AddNewOrg.aspx.cs
上传用户:tiancihang
上传日期:2014-03-12
资源大小:21387k
文件大小:4k
- 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;
- public partial class AddNewOrg : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- Response.Buffer = true;
- Response.ExpiresAbsolute = System.DateTime.Now;
- Response.Expires = 0;
- Response.CacheControl = "no-cache";
- if (!IsPostBack)
- {
- string StrAddressName;
- string SOrgID,SParentID;
- EtongFlyChou EFly = new EtongFlyChou();
- SOrgID = Request.QueryString["StrValue"].ToString();
- SParentID = Request.QueryString["StrParent"];
- if (Request.QueryString["StrM"] == "M")
- {
- StrAddressName = EFly.GetOrgzationName(SParentID);
- }
- else
- {
- StrAddressName = EFly.GetOrgzationName(SOrgID);
- }
- TxtOrgName.Text = StrAddressName;
- ImgButCancel.Attributes.Add("onclick", "javascript:if(confirm('确定要退出吗?')) {window.close();return;} else {return;}");
- Page.Title = "新增组织机构";
- LabOrg.Text = "新增组织机构";
- ///修改组织机构
- if (Request.QueryString["StrM"] == "M")
- {
- Page.Title = "组织机构修改";
- LabOrg.Text = "组织机构修改";
- DataView dv = new DataView();
- dv =EFly.GetOrganzation(SOrgID);
- TxtName.Text = dv.Table.Rows[0][2].ToString();
- TxtEmail.Text = dv.Table.Rows[0][3].ToString();
- DListType.Items.FindByValue(DListType.SelectedValue).Selected = false;
- DListType.Items.FindByValue(dv.Table.Rows[0]["OrgcID"].ToString()).Selected = true;
- }
- }
- }
- protected void ImButOk_Click(object sender, ImageClickEventArgs e)
- {
- string StrOrgID, StrLevel, StrPath, StrName, StrDesc;
- StrOrgID = Request.QueryString["StrValue"].ToString();
- StrLevel = Request.QueryString["StrLevel"].ToString();
- StrPath = Request.QueryString["StrPath"].ToString();
- StrName = TxtName.Text.Trim();
- StrDesc = TxtEmail.Text.Trim();
- string strCID = DListType.SelectedValue.ToString();
- EtongFlyChou EFly = new EtongFlyChou();
- if (Request.QueryString["StrM"] == "M")
- {
- int iOrgID = Convert.ToInt32(StrOrgID);
- try
- {
- EFly.UpOrg(iOrgID, StrName, StrDesc, strCID);
- }
- catch (Exception ex)
- {
- this.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + ex.Message.Replace("'", "").Replace("rn", "").Replace("n", "") + "');</script>");
- return;
- }
- this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:组织机构修改成功!');", true);
- }
- else
- {
- try
- {
- EFly.AddOrgzation(StrOrgID, StrName, StrDesc, StrLevel, StrPath, strCID);
- }
- catch (Exception ex)
- {
- this.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + ex.Message.Replace("'", "").Replace("rn", "").Replace("n", "") + "');</script>");
- return;
- }
- this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:组织机构保存成功!');", true);
- }
- }
- //protected void ImButCancel_Click(object sender, ImageClickEventArgs e)
- //{
- // this.ClientScript.RegisterStartupScript(this.GetType(), "", "window.close();", true);
- // //Response.Write("<script>window.close();</script>");
- // //this.Unload();
- // //Page.Unload();
- //}
- }