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

.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 AddNewOrg : System.Web.UI.Page
  13. {
  14.     protected void Page_Load(object sender, EventArgs e)
  15.     {
  16.         Response.Buffer = true;
  17.         Response.ExpiresAbsolute = System.DateTime.Now;
  18.         Response.Expires = 0;
  19.         Response.CacheControl = "no-cache";
  20.         if (!IsPostBack)
  21.         {
  22.             string StrAddressName;
  23.             string SOrgID,SParentID;
  24.             EtongFlyChou EFly = new EtongFlyChou();
  25.             SOrgID = Request.QueryString["StrValue"].ToString();
  26.             SParentID = Request.QueryString["StrParent"];
  27.             if (Request.QueryString["StrM"] == "M")
  28.             {
  29.                 StrAddressName = EFly.GetOrgzationName(SParentID);
  30.             }
  31.             else
  32.             {
  33.                 StrAddressName = EFly.GetOrgzationName(SOrgID);
  34.             }
  35.             TxtOrgName.Text = StrAddressName;
  36.             ImgButCancel.Attributes.Add("onclick", "javascript:if(confirm('确定要退出吗?')) {window.close();return;} else {return;}");
  37.             Page.Title = "新增组织机构";
  38.             LabOrg.Text = "新增组织机构";
  39.             ///修改组织机构
  40.             if (Request.QueryString["StrM"] == "M")
  41.             {
  42.                 Page.Title = "组织机构修改";
  43.                 LabOrg.Text = "组织机构修改";
  44.                 DataView dv = new DataView();
  45.                 dv =EFly.GetOrganzation(SOrgID);
  46.                 TxtName.Text = dv.Table.Rows[0][2].ToString();
  47.                 TxtEmail.Text = dv.Table.Rows[0][3].ToString();
  48.                 DListType.Items.FindByValue(DListType.SelectedValue).Selected = false;
  49.                 DListType.Items.FindByValue(dv.Table.Rows[0]["OrgcID"].ToString()).Selected = true;
  50.             }
  51.         }
  52.     }
  53.     protected void ImButOk_Click(object sender, ImageClickEventArgs e)
  54.     {
  55.         string StrOrgID, StrLevel, StrPath, StrName, StrDesc;
  56.         StrOrgID = Request.QueryString["StrValue"].ToString();
  57.         StrLevel = Request.QueryString["StrLevel"].ToString();
  58.         StrPath = Request.QueryString["StrPath"].ToString();
  59.         StrName = TxtName.Text.Trim();
  60.         StrDesc = TxtEmail.Text.Trim();
  61.         string strCID = DListType.SelectedValue.ToString();
  62.         EtongFlyChou EFly = new EtongFlyChou();
  63.         if (Request.QueryString["StrM"] == "M")
  64.         {
  65.             int iOrgID = Convert.ToInt32(StrOrgID);
  66.             try
  67.             {
  68.                 EFly.UpOrg(iOrgID, StrName, StrDesc, strCID);
  69.             }
  70.             catch (Exception ex)
  71.             {
  72.                 this.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + ex.Message.Replace("'", "").Replace("rn", "").Replace("n", "") + "');</script>");
  73.                 return;
  74.             }
  75.             this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:组织机构修改成功!');", true);
  76.         }
  77.         else 
  78.         {
  79.             try 
  80.             {
  81.                 EFly.AddOrgzation(StrOrgID, StrName, StrDesc, StrLevel, StrPath, strCID);
  82.             }
  83.             catch (Exception ex)
  84.             {
  85.                 this.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + ex.Message.Replace("'", "").Replace("rn", "").Replace("n", "") + "');</script>");
  86.                 return;
  87.             }
  88.             this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:组织机构保存成功!');", true);
  89.         }
  90.     }
  91.     //protected void ImButCancel_Click(object sender, ImageClickEventArgs e)
  92.     //{
  93.     //    this.ClientScript.RegisterStartupScript(this.GetType(), "", "window.close();", true);
  94.     //    //Response.Write("<script>window.close();</script>");
  95.     //    //this.Unload();
  96.     //    //Page.Unload();
  97.     //}
  98. }