SysFName.aspx.cs
上传用户:tiancihang
上传日期:2014-03-12
资源大小:21387k
文件大小:8k
- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- using com.etong.DAL.FC;
- using System.IO;
- using System.Net;
- public partial class SysManage_SysFName : System.Web.UI.Page
- {
- //protected System.Web.UI.WebControls.TextBox FDirName;
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- EtongWord EWord = new EtongWord();
- DataView dv = new DataView();
- try
- {
- dv = EWord.GetAllFName();
- GridView1.DataSource = dv;
- GridView1.DataBind();
- TB_Condition.Attributes.Add("onkeypress", "javascript:return EnterTextBox();");
- }
- catch (Exception ex)
- {
- ClientScript.RegisterStartupScript(this.GetType(), "errMessage", "<script>alert('" + ex.Message.Replace("'", "").Replace("rn", "") + "');</script>");
- return;
- }
-
- }
- }
- protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
- {
- int currentpageindex;
- currentpageindex = Convert.ToInt32(e.NewPageIndex);
- if (currentpageindex == -2)
- {
- TextBox txtNewPageIndex;
- txtNewPageIndex = GridView1.BottomPagerRow.FindControl("LinkTextBoxNewPage") as TextBox;
- if (txtNewPageIndex != null)
- {
- try
- {
- currentpageindex = Convert.ToInt32(txtNewPageIndex.Text) - 1;
- }
- catch
- {
- currentpageindex = 0;
- }
- }
- }
- currentpageindex = currentpageindex < 0 ? 0 : currentpageindex;
- currentpageindex = currentpageindex >= GridView1.PageCount ? GridView1.PageCount - 1 : currentpageindex;
- GridView1.PageIndex = currentpageindex;
- EtongWord EWord = new EtongWord();
- DataView dv = EWord.GetAllFName();
- GridView1.DataSource = dv;
- GridView1.DataBind();
- }
- protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
- {
- int iOpID = Convert.ToInt32(GridView1.DataKeys[e.NewEditIndex].Value);
- string sURL = "SysFNameModify.aspx?strN=M&strOp=" + iOpID;
- //Response.Redirect(sURL);
- this.ClientScript.RegisterStartupScript(this.GetType(), "0", "<script> window.showModalDialog('" + sURL + "','系统文件修改','help:0;dialogWidth:600px;dialogHeight:400px,location=no,status=no;');</script>");
- }
- protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
- {
- try
- {
- int serialid = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value.ToString());
- EtongWord EWord = new EtongWord();
- EWord.FID = serialid;
- DataView dv = new DataView();
- dv = EWord.GetRoleFNameByCondition();
- if (dv.Table.Rows.Count > 0)
- {
- ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:此文档其它业务角色正在使用,无法删除!');</script>");
- return;
- }
- EWord.Delete();
- GridView1.DataSource = EWord.GetAllFName();
- GridView1.DataBind();
- ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:删除记录成功!');</script>");
- }
- catch (Exception ex)
- {
- ClientScript.RegisterStartupScript(this.GetType(), "errorMessage", "<script>alert('" + ex.Message.Replace("'", "").Replace("rn", "") + "');</script>");
- }
- }
- protected void IB_Search_Click(object sender, ImageClickEventArgs e)
- {
- EtongWord EWord = new EtongWord();
- if (DDL_Condition.SelectedValue == "1")
- {
- if (TB_Condition.Text == null || TB_Condition.Text.Trim() == "") ;
- else
- {
- try
- {
- EWord.FID = Convert.ToInt32(TB_Condition.Text);
- }
- catch
- {
- this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:编号查询指允许输入数据,请输入数字!');", true);
- return;
- }
- }
- }
- else if (DDL_Condition.SelectedValue == "2")
- {
- EWord.FName = TB_Condition.Text.Trim();
- }
- else
- {
- this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:请输入系统查询条件!');", true);
- return;
- }
- DataView dv = new DataView();
- dv = EWord.GetFNameByCondition();
- GridView1.DataSource = dv;
- GridView1.DataBind();
- }
- protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
- {
- if (e.Row.RowType == DataControlRowType.DataRow)
- {
- int iRow;
- iRow = e.Row.DataItemIndex;
- iRow = iRow % 2;
- if (iRow > 0)
- e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor='#f0f0f0';");
- else
- e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor='White';");
- e.Row.Attributes.Add("OnMouseOver", "this.style.backgroundColor='#E8F2FA';");
- }
- }
- protected void IMG2_Click(object sender, ImageClickEventArgs e)
- {
- string[] al;
- string FName = FDirName.Value;
- if (FName.Trim() != "")
- {
- al = FName.Split('.');
- if (al.Length == 2)
- {
- string FExName = al[1].ToString();
- if (FExName != "doc" && FExName != "xls")
- {
- this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:系统只接受 “doc” 和 “xls”文档!');", true);
- return;
- }
- else
- {
- try
- {
- int starti = FName.Length - (FName.Split('\').GetValue(FName.Split('\').Length - 1)).ToString().Length;
- FName = FName.Substring(starti, FName.Length - starti);
- string FDir = Server.MapPath(Request.ServerVariables["PATH_INFO"]);
- al = FDir.Split('\');
- FDir = FDir.Substring(0, FDir.Length - al[al.Length - 1].Length - al[al.Length - 2].Length - 1);
- FDirName.PostedFile.SaveAs(FDir + "workflow\doc\" + FName);
- ClientScript.RegisterStartupScript(this.GetType(), "Message", "<script>alert('系统提示:“" + FName + "”模版上传成功!');</script>");
- }
- catch (Exception ex)
- {
- ClientScript.RegisterStartupScript(this.GetType(), "errMessage", "<script>alert('" + ex.Message.Replace("'", "").Replace("rn", "") + "');</script>");
- }
- }
- }
- else
- {
- this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:输入的文件格式不正确!');", true);
- }
- }
- else
- {
- this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:请选择要上传的模版文件!');", true);
- }
- //FDirName
- //FDirName.
- }
- }