/EQT_V1/EQTWebApp/EquipKeptReg.aspx.cs
http://sgsoft-las.googlecode.com/ · C# · 143 lines · 109 code · 20 blank · 14 comment · 12 complexity · eb55b18237e9baa97f1bb91e44052c87 MD5 · raw file
- /*----------------------------------------------------------------
- // Copyright (C) 2009
- // ?????
- //
- // ????
- // ???????????????
- //
- //
- // ?????
- // ????????
- // ?????
- // ?????
- //----------------------------------------------------------------*/
- 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 EQT.Dal;
- using System.Threading;
- using EQT.Model;
- using Wuqi.Webdiyer;
-
-
- public partial class EquipKeptReg : System.Web.UI.Page
- {
- private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
- private DaKeptLog dalKept = new DaKeptLog();
- private DaDept dalDept = new DaDept();
- private DaEmployee dalEmp = new DaEmployee();
- private UserContext context;
-
- protected void Page_Load(object sender, EventArgs e)
- {
- context = Session["USER_CONTEXT"] as UserContext;
- OperationResult.Text = "";
- divResult.Visible = false;
- if (!IsPostBack)
- {
- DataSet dsDept = dalDept.Query(string.Empty);
-
- Utility.BindDataSet2Combox(dsDept, CreateDdlDeptID1, "Dept_Name", "Dept_ID");
- Utility.BindDataSet2Combox(dsDept, CreateDdlDeptID2, "Dept_Name", "Dept_ID");
-
- CreateDdlDeptID1.Items.Insert(0, new ListItem("", ""));
- CreateDdlDeptID2.Items.Insert(0, new ListItem("", ""));
-
-
- if (!string.IsNullOrEmpty(Request.QueryString["EquipID"]))
- {
- CreateEquip_ID.Text = Request.QueryString["EquipID"].ToString();
-
- MoKeptLog mod = dalKept.GetEquipLastKept(Request.QueryString["EquipID"].ToString());
-
- if (mod != null)
- {
- MoDept moddept = dalEmp.GetEmpDepartment(mod.User_Code2);
- CreateDdlDeptID1.SelectedValue = moddept == null ? "" : moddept.Dept_Id;
-
- this.CreateDdlDeptID1_SelectedIndexChanged(null, null);
-
- if (CreateUser_Code1.Items.FindByValue(mod.User_Code2) != null)
- {
- CreateUser_Code1.SelectedValue = mod.User_Code2;
- }
- CreateDdlDeptID1.Enabled = false;
- CreateUser_Code1.Enabled = false;
- LastKeptID.Value = mod.Kpt_Log_Id.ToString();
- }
- CreateEquip_ID.Enabled = false;
- }
- }
-
- }
-
- protected void CreateDdlDeptID1_SelectedIndexChanged(object sender, EventArgs e)
- {
- CreateUser_Code1.Items.Clear();
-
- string deptid = CreateDdlDeptID1.SelectedValue;
- if (!string.IsNullOrEmpty(deptid))
- {
- Utility.BindDataSet2Combox(dalEmp.GetEmploreeByDeptID(deptid), CreateUser_Code1, "FullName", "Emp_Id");
- CreateUser_Code1.Items.Insert(0, new ListItem("", ""));
- }
- }
-
- protected void CreateDdlDeptID2_SelectedIndexChanged(object sender, EventArgs e)
- {
- CreateUser_Code2.Items.Clear();
-
- string deptid = CreateDdlDeptID2.SelectedValue;
- if (!string.IsNullOrEmpty(deptid))
- {
- Utility.BindDataSet2Combox(dalEmp.GetEmploreeByDeptID(deptid), CreateUser_Code2, "FullName", "Emp_Id");
- }
- }
-
- protected void CreateGo_Click(object sender, EventArgs e)
- {
- MoKeptLog mod = new MoKeptLog();
-
- try
- {
- //mod.Kpt_Log_Id = SequenceKeys.GenerateSampleKeptID();
- mod.Equip_Id = CreateEquip_ID.Text.Trim();
- mod.Kpt_Addr = CreateKpt_Addr.Text.Trim();
- mod.Kpt_Begin = DateTime.Now;
- mod.Kpt_Status = 1;
- mod.Rem = CreateRem.Text.Trim();
-
- if (!string.IsNullOrEmpty(CreateUser_Code1.SelectedValue))
- {
- mod.User_Code1 = CreateUser_Code1.SelectedValue;
- }
- mod.User_Code2 = CreateUser_Code2.SelectedValue;
-
- int rtn = dalKept.CreateKeptLog(mod, LastKeptID.Value);
- if (rtn == 1)
- {
- OperationResult.Text = "?????????"; divResult.Visible = true;
- }
- else
- {
- OperationResult.Text = "?????????"; divResult.Visible = true;
- }
- }
- catch (Exception ex)
- {
- log.Error("????????", ex);
- OperationResult.Text = "???????????"; divResult.Visible = true;
- }
- }
- protected void BtnBack_Click(object sender, EventArgs e)
- {
- Response.Redirect("Equipment.aspx");
- }
- }