SysFNameModify.aspx.cs
上传用户:tiancihang
上传日期:2014-03-12
资源大小:21387k
文件大小:3k
源码类别:

.net编程

开发平台:

C#

  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Collections;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.WebControls;
  9. using System.Web.UI.WebControls.WebParts;
  10. using System.Web.UI.HtmlControls;
  11. using com.etong.DAL.FC;
  12. public partial class SysManage_SysFNameModify : System.Web.UI.Page
  13. {
  14.     protected string sN;
  15.     protected int iN;
  16.     EtongWord EWord = new EtongWord();
  17.     protected void Page_Load(object sender, EventArgs e)
  18.     {
  19.         Response.Buffer = true;
  20.         Response.ExpiresAbsolute = System.DateTime.Now;
  21.         Response.Expires = 0;
  22.         Response.CacheControl = "no-cache";
  23.         sN = Convert.ToString(Request.QueryString["strN"]);
  24.         if (sN == "M")
  25.         {
  26.             iN = Convert.ToInt32(Request.QueryString["strOp"]);
  27.         }
  28.         if (!IsPostBack)
  29.         {
  30.             if (sN == "M")
  31.             {
  32.                 EWord.FID = iN;
  33.                 try
  34.                 {
  35.                     DataView dv = new DataView();
  36.                     dv = EWord.GetFNameByCondition();
  37.                     TID.Text = dv.Table.Rows.Count > 0 ? dv.Table.Rows[0][1].ToString() : "";
  38.                     tname.Value = dv.Table.Rows.Count > 0 ? dv.Table.Rows[0][1].ToString() : "";
  39.                     TDesc.Text = dv.Table.Rows.Count > 0 ? dv.Table.Rows[0][2].ToString() : "";
  40.                 }
  41.                 catch (Exception ex)
  42.                 {
  43.                     ClientScript.RegisterStartupScript(this.GetType(), "errorMessage", "<script>alert('" + ex.Message.Replace("'", "").Replace("rn", "") + "');</script>");
  44.                 }
  45.             }
  46.         }
  47.     }
  48.     protected void ImgSave_Click(object sender, ImageClickEventArgs e)
  49.     {
  50.         if (sN == "N")
  51.         {
  52.             try
  53.             {
  54.                 EWord.FName = tname.Value ;
  55.                 EWord.FDesc = TDesc.Text;
  56.                 EWord.Insert();
  57.                 ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:添加记录成功!');</script>");
  58.             }
  59.             catch (Exception ex)
  60.             {
  61.                 ClientScript.RegisterStartupScript(this.GetType(), "errorMessage", "<script>alert('" + ex.Message.Replace("'", "").Replace("rn", "") + "');</script>");
  62.             }
  63.         }
  64.         else if (sN == "M")
  65.         {
  66.             try
  67.             {
  68.                 EWord.FID = iN;
  69.                 EWord.FName = tname.Value;
  70.                 EWord.FDesc = TDesc.Text;
  71.                 EWord.Update();
  72.                 ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:修改记录成功!');</script>");
  73.             }
  74.             catch (Exception ex)
  75.             {
  76.                 ClientScript.RegisterStartupScript(this.GetType(), "errorMessage", "<script>alert('" + ex.Message.Replace("'", "").Replace("rn", "") + "');</script>");
  77.             }
  78.         }
  79.     }
  80. }