Exemple #1
0
 /// <summary>
 /// 获取实体数据
 /// </summary>
 /// <param name="strCondition"></param>
 /// <returns></returns>
 public Bse_Department GetDeptModel(string strCondition)
 {
     List<Bse_Department> list = instance.GetListByWhere(strCondition);
     Bse_Department model = new Bse_Department();
     if (list != null && list.Count > 0)
     {
         model = list[0];
     }
     return model;
 }
Exemple #2
0
        public Dept(string pCode, string pName, Bll_Dept _instance, Bll_Bse_Employee _employeeInstance, Bse_Department _model)
        {
            this.Refresh();
            InitializeComponent();
            instance = _instance;
            employeeInstance = _employeeInstance;
            GModel = _model;

            this.Load+=new EventHandler(Dept_Load);
        }
Exemple #3
0
 /// <summary>
 /// 新增或更新对象
 /// </summary>
 /// <param name="Mn"></param>
 /// <returns></returns>
 public bool AddUpdatePlanObject(Bse_Department dep)
 {
     if (dep.Dept_ID.Equals(0))
     {
         return instance.Add(dep).Equals(1);
     }
     else
     {
         return instance.Update(dep).Equals(1);
     }
 }
Exemple #4
0
 //
 // GET: /HR/
 public ActionResult HR_Department()
 {
     string id = Request.QueryString["id"];
     ViewData["DeptList"] = deptInstance.GetChildListDept();
     Bse_Department depmodel = new Bse_Department();
     if (string.IsNullOrEmpty(id))
     {
         depmodel = new BLL.Bll_Bse_Department().GetModel(" and Dept_Code='root'");
         return View(depmodel);
     }
     else
     {
         depmodel = new BLL.Bll_Bse_Department().GetModel(" and Dept_Code='" + id + "'");
         var result = JsonConvert.SerializeObject(depmodel, new JsonDateConverter("yyyy-MM-dd"));
         return JavaScript(result);
     }
 }
Exemple #5
0
        /// <summary>
        /// 插入数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int InsertDept(Bse_Department model)
        {
            int _result = 0;
            try
            {

                _result = TypeConverter.ObjectToInt(instance.AddWithReturn(model));

                if (_result > 0)
                {
                    //result = true;
                }
            }
            catch (Exception)
            {

            }

            return _result;
        }
Exemple #6
0
 /// <summary>
 /// 获取指定的部门信息维护 Bse_Department对象集合
 /// </summary>
 public List<Bse_Department> GetListByWhere(string strCondition)
 {
     List<Bse_Department> ret = new List<Bse_Department>();
      string sql = "SELECT  Dept_ID,Dept_Code,Dept_Name,Dept_PCode,Dept_PName,Dept_Owner,Dept_OwnerName,Dept_OTel,Dept_OMob,Dept_Num,Dept_IsLeaf,Dept_Level,Dept_SimpleCode,Dept_SimpleName,Stat,Dept_Stat,Dept_Desp,Dept_Bak,Dept_Date FROM Bse_Department WHERE 1=1 AND ((Stat is null) or (Stat=0) ) ";
      if(!string.IsNullOrEmpty(strCondition))
      {
     strCondition.Replace('\'','"'); //防sql注入
     sql += strCondition ;
      }
       sql += " ORDER BY Dept_ID DESC ";
       SqlDataReader dr=null;
        try {
       dr=(SqlDataReader)idb.ReturnReader(sql);
      while(dr.Read())
      {
     Bse_Department bse_Department = new Bse_Department();
     if (dr["Dept_ID"] != DBNull.Value) bse_Department.Dept_ID = Convert.ToInt64(dr["Dept_ID"]);
     if (dr["Dept_Code"] != DBNull.Value) bse_Department.Dept_Code = Convert.ToString(dr["Dept_Code"]);
     if (dr["Dept_Name"] != DBNull.Value) bse_Department.Dept_Name = Convert.ToString(dr["Dept_Name"]);
     if (dr["Dept_PCode"] != DBNull.Value) bse_Department.Dept_PCode = Convert.ToString(dr["Dept_PCode"]);
     if (dr["Dept_PName"] != DBNull.Value) bse_Department.Dept_PName = Convert.ToString(dr["Dept_PName"]);
     if (dr["Dept_Owner"] != DBNull.Value) bse_Department.Dept_Owner = Convert.ToString(dr["Dept_Owner"]);
     if (dr["Dept_OwnerName"] != DBNull.Value) bse_Department.Dept_OwnerName = Convert.ToString(dr["Dept_OwnerName"]);
     if (dr["Dept_OTel"] != DBNull.Value) bse_Department.Dept_OTel = Convert.ToString(dr["Dept_OTel"]);
     if (dr["Dept_OMob"] != DBNull.Value) bse_Department.Dept_OMob = Convert.ToString(dr["Dept_OMob"]);
     if (dr["Dept_Num"] != DBNull.Value) bse_Department.Dept_Num = Convert.ToString(dr["Dept_Num"]);
     if (dr["Dept_IsLeaf"] != DBNull.Value) bse_Department.Dept_IsLeaf = Convert.ToInt32(dr["Dept_IsLeaf"]);
     if (dr["Dept_Level"] != DBNull.Value) bse_Department.Dept_Level = Convert.ToInt32(dr["Dept_Level"]);
     if (dr["Dept_SimpleCode"] != DBNull.Value) bse_Department.Dept_SimpleCode = Convert.ToString(dr["Dept_SimpleCode"]);
     if (dr["Dept_SimpleName"] != DBNull.Value) bse_Department.Dept_SimpleName = Convert.ToString(dr["Dept_SimpleName"]);
     if (dr["Stat"] != DBNull.Value) bse_Department.Stat = Convert.ToInt32(dr["Stat"]);
     if (dr["Dept_Stat"] != DBNull.Value) bse_Department.Dept_Stat = Convert.ToInt32(dr["Dept_Stat"]);
     if (dr["Dept_Desp"] != DBNull.Value) bse_Department.Dept_Desp = Convert.ToString(dr["Dept_Desp"]);
     if (dr["Dept_Bak"] != DBNull.Value) bse_Department.Dept_Bak = Convert.ToString(dr["Dept_Bak"]);
     if (dr["Dept_Date"] != DBNull.Value) bse_Department.Dept_Date = Convert.ToDateTime(dr["Dept_Date"]);
     ret.Add(bse_Department);
      }
       }catch (System.Exception ex){ throw ex; }  finally { if (dr != null) { dr.Close(); } if (idb.GetConnection() != null && idb.GetConnection().State == ConnectionState.Open) { idb.GetConnection().Close(); }   }
      return ret;
 }
Exemple #7
0
        /// <summary>
        /// 获取指定的部门信息维护 Bse_Department对象(即:一条记录
        /// </summary>
        public Bse_Department GetByKey(Int64 dept_ID)
        {
            Bse_Department bse_Department = new Bse_Department();
             string sql = "SELECT  Dept_ID,Dept_Code,Dept_Name,Dept_PCode,Dept_PName,Dept_Owner,Dept_OwnerName,Dept_OTel,Dept_OMob,Dept_Num,Dept_IsLeaf,Dept_Level,Dept_SimpleCode,Dept_SimpleName,Stat,Dept_Stat,Dept_Desp,Dept_Bak,Dept_Date FROM Bse_Department WHERE 1=1 AND ((Stat is null) or (Stat=0) )  AND Dept_ID=@Dept_ID ";
             idb.AddParameter("@Dept_ID", dept_ID);

              SqlDataReader dr=null;
               try {
              dr=(SqlDataReader)idb.ReturnReader(sql);
             while(dr.Read())
             {
            if (dr["Dept_ID"] != DBNull.Value) bse_Department.Dept_ID = Convert.ToInt64(dr["Dept_ID"]);
            if (dr["Dept_Code"] != DBNull.Value) bse_Department.Dept_Code = Convert.ToString(dr["Dept_Code"]);
            if (dr["Dept_Name"] != DBNull.Value) bse_Department.Dept_Name = Convert.ToString(dr["Dept_Name"]);
            if (dr["Dept_PCode"] != DBNull.Value) bse_Department.Dept_PCode = Convert.ToString(dr["Dept_PCode"]);
            if (dr["Dept_PName"] != DBNull.Value) bse_Department.Dept_PName = Convert.ToString(dr["Dept_PName"]);
            if (dr["Dept_Owner"] != DBNull.Value) bse_Department.Dept_Owner = Convert.ToString(dr["Dept_Owner"]);
            if (dr["Dept_OwnerName"] != DBNull.Value) bse_Department.Dept_OwnerName = Convert.ToString(dr["Dept_OwnerName"]);
            if (dr["Dept_OTel"] != DBNull.Value) bse_Department.Dept_OTel = Convert.ToString(dr["Dept_OTel"]);
            if (dr["Dept_OMob"] != DBNull.Value) bse_Department.Dept_OMob = Convert.ToString(dr["Dept_OMob"]);
            if (dr["Dept_Num"] != DBNull.Value) bse_Department.Dept_Num = Convert.ToString(dr["Dept_Num"]);
            if (dr["Dept_IsLeaf"] != DBNull.Value) bse_Department.Dept_IsLeaf = Convert.ToInt32(dr["Dept_IsLeaf"]);
            if (dr["Dept_Level"] != DBNull.Value) bse_Department.Dept_Level = Convert.ToInt32(dr["Dept_Level"]);
            if (dr["Dept_SimpleCode"] != DBNull.Value) bse_Department.Dept_SimpleCode = Convert.ToString(dr["Dept_SimpleCode"]);
            if (dr["Dept_SimpleName"] != DBNull.Value) bse_Department.Dept_SimpleName = Convert.ToString(dr["Dept_SimpleName"]);
            if (dr["Stat"] != DBNull.Value) bse_Department.Stat = Convert.ToInt32(dr["Stat"]);
            if (dr["Dept_Stat"] != DBNull.Value) bse_Department.Dept_Stat = Convert.ToInt32(dr["Dept_Stat"]);
            if (dr["Dept_Desp"] != DBNull.Value) bse_Department.Dept_Desp = Convert.ToString(dr["Dept_Desp"]);
            if (dr["Dept_Bak"] != DBNull.Value) bse_Department.Dept_Bak = Convert.ToString(dr["Dept_Bak"]);
            if (dr["Dept_Date"] != DBNull.Value) bse_Department.Dept_Date = Convert.ToDateTime(dr["Dept_Date"]);
             }
              }catch (System.Exception ex){ throw ex; }  finally { if (dr != null) { dr.Close(); } if (idb.GetConnection() != null && idb.GetConnection().State == ConnectionState.Open) { idb.GetConnection().Close(); }   }
             return bse_Department;
        }
Exemple #8
0
 /// <summary>
 /// 获取所有的部门信息维护 Bse_Department对象(即:一条记录
 /// </summary>
 public List<Bse_Department> GetAll()
 {
     List<Bse_Department> ret = new List<Bse_Department>();
      string sql = "SELECT  Dept_ID,Dept_Code,Dept_Name,Dept_PCode,Dept_PName,Dept_Owner,Dept_OwnerName,Dept_OTel,Dept_OMob,Dept_Num,Dept_IsLeaf,Dept_Level,Dept_SimpleCode,Dept_SimpleName,Stat,Dept_Stat,Dept_Desp,Dept_Bak,Dept_Date FROM Bse_Department where 1=1 AND ((Stat is null) or (Stat=0) ) order by Dept_ID desc ";
       SqlDataReader dr=null;
        try {
       dr=(SqlDataReader)idb.ReturnReader(sql);
      while(dr.Read())
      {
     Bse_Department bse_Department = new Bse_Department();
     if (dr["Dept_ID"] != DBNull.Value) bse_Department.Dept_ID = Convert.ToInt64(dr["Dept_ID"]);
     if (dr["Dept_Code"] != DBNull.Value) bse_Department.Dept_Code = Convert.ToString(dr["Dept_Code"]);
     if (dr["Dept_Name"] != DBNull.Value) bse_Department.Dept_Name = Convert.ToString(dr["Dept_Name"]);
     if (dr["Dept_PCode"] != DBNull.Value) bse_Department.Dept_PCode = Convert.ToString(dr["Dept_PCode"]);
     if (dr["Dept_PName"] != DBNull.Value) bse_Department.Dept_PName = Convert.ToString(dr["Dept_PName"]);
     if (dr["Dept_Owner"] != DBNull.Value) bse_Department.Dept_Owner = Convert.ToString(dr["Dept_Owner"]);
     if (dr["Dept_OwnerName"] != DBNull.Value) bse_Department.Dept_OwnerName = Convert.ToString(dr["Dept_OwnerName"]);
     if (dr["Dept_OTel"] != DBNull.Value) bse_Department.Dept_OTel = Convert.ToString(dr["Dept_OTel"]);
     if (dr["Dept_OMob"] != DBNull.Value) bse_Department.Dept_OMob = Convert.ToString(dr["Dept_OMob"]);
     if (dr["Dept_Num"] != DBNull.Value) bse_Department.Dept_Num = Convert.ToString(dr["Dept_Num"]);
     if (dr["Dept_IsLeaf"] != DBNull.Value) bse_Department.Dept_IsLeaf = Convert.ToInt32(dr["Dept_IsLeaf"]);
     if (dr["Dept_Level"] != DBNull.Value) bse_Department.Dept_Level = Convert.ToInt32(dr["Dept_Level"]);
     if (dr["Dept_SimpleCode"] != DBNull.Value) bse_Department.Dept_SimpleCode = Convert.ToString(dr["Dept_SimpleCode"]);
     if (dr["Dept_SimpleName"] != DBNull.Value) bse_Department.Dept_SimpleName = Convert.ToString(dr["Dept_SimpleName"]);
     if (dr["Stat"] != DBNull.Value) bse_Department.Stat = Convert.ToInt32(dr["Stat"]);
     if (dr["Dept_Stat"] != DBNull.Value) bse_Department.Dept_Stat = Convert.ToInt32(dr["Dept_Stat"]);
     if (dr["Dept_Desp"] != DBNull.Value) bse_Department.Dept_Desp = Convert.ToString(dr["Dept_Desp"]);
     if (dr["Dept_Bak"] != DBNull.Value) bse_Department.Dept_Bak = Convert.ToString(dr["Dept_Bak"]);
     if (dr["Dept_Date"] != DBNull.Value) bse_Department.Dept_Date = Convert.ToDateTime(dr["Dept_Date"]);
     ret.Add(bse_Department);
      }
       }catch (System.Exception ex){ throw ex; }  finally {  if (dr != null) { dr.Close(); } if (idb.GetConnection() != null && idb.GetConnection().State == ConnectionState.Open) { idb.GetConnection().Close(); }   }
      return ret;
 }
Exemple #9
0
        /// <summary>
        /// 添加部门信息维护 Bse_Department对象(即:一条记录)
        /// </summary>
        public int Add(Bse_Department bse_Department)
        {
            string sql = "INSERT INTO Bse_Department (Dept_Code,Dept_Name,Dept_PCode,Dept_PName,Dept_Owner,Dept_OwnerName,Dept_OTel,Dept_OMob,Dept_Num,Dept_IsLeaf,Dept_Level,Dept_SimpleCode,Dept_SimpleName,Stat,Dept_Stat,Dept_Desp,Dept_Bak,Dept_Date) VALUES (@Dept_Code,@Dept_Name,@Dept_PCode,@Dept_PName,@Dept_Owner,@Dept_OwnerName,@Dept_OTel,@Dept_OMob,@Dept_Num,@Dept_IsLeaf,@Dept_Level,@Dept_SimpleCode,@Dept_SimpleName,@Stat,@Dept_Stat,@Dept_Desp,@Dept_Bak,@Dept_Date)";
             if (string.IsNullOrEmpty(bse_Department.Dept_Code))
             {
            idb.AddParameter("@Dept_Code", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_Code", bse_Department.Dept_Code);
             }
             if (string.IsNullOrEmpty(bse_Department.Dept_Name))
             {
            idb.AddParameter("@Dept_Name", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_Name", bse_Department.Dept_Name);
             }
             if (string.IsNullOrEmpty(bse_Department.Dept_PCode))
             {
            idb.AddParameter("@Dept_PCode", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_PCode", bse_Department.Dept_PCode);
             }
             if (string.IsNullOrEmpty(bse_Department.Dept_PName))
             {
            idb.AddParameter("@Dept_PName", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_PName", bse_Department.Dept_PName);
             }
             if (string.IsNullOrEmpty(bse_Department.Dept_Owner))
             {
            idb.AddParameter("@Dept_Owner", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_Owner", bse_Department.Dept_Owner);
             }
             if (string.IsNullOrEmpty(bse_Department.Dept_OwnerName))
             {
            idb.AddParameter("@Dept_OwnerName", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_OwnerName", bse_Department.Dept_OwnerName);
             }
             if (string.IsNullOrEmpty(bse_Department.Dept_OTel))
             {
            idb.AddParameter("@Dept_OTel", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_OTel", bse_Department.Dept_OTel);
             }
             if (string.IsNullOrEmpty(bse_Department.Dept_OMob))
             {
            idb.AddParameter("@Dept_OMob", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_OMob", bse_Department.Dept_OMob);
             }
             if (string.IsNullOrEmpty(bse_Department.Dept_Num))
             {
            idb.AddParameter("@Dept_Num", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_Num", bse_Department.Dept_Num);
             }
             if (bse_Department.Dept_IsLeaf == 0)
             {
            idb.AddParameter("@Dept_IsLeaf", 0);
             }
             else
             {
            idb.AddParameter("@Dept_IsLeaf", bse_Department.Dept_IsLeaf);
             }
             if (bse_Department.Dept_Level == 0)
             {
            idb.AddParameter("@Dept_Level", 0);
             }
             else
             {
            idb.AddParameter("@Dept_Level", bse_Department.Dept_Level);
             }
             if (string.IsNullOrEmpty(bse_Department.Dept_SimpleCode))
             {
            idb.AddParameter("@Dept_SimpleCode", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_SimpleCode", bse_Department.Dept_SimpleCode);
             }
             if (string.IsNullOrEmpty(bse_Department.Dept_SimpleName))
             {
            idb.AddParameter("@Dept_SimpleName", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_SimpleName", bse_Department.Dept_SimpleName);
             }
             if (bse_Department.Stat == 0)
             {
            idb.AddParameter("@Stat", 0);
             }
             else
             {
            idb.AddParameter("@Stat", bse_Department.Stat);
             }
             if (bse_Department.Dept_Stat == 0)
             {
            idb.AddParameter("@Dept_Stat", 0);
             }
             else
             {
            idb.AddParameter("@Dept_Stat", bse_Department.Dept_Stat);
             }
             if (string.IsNullOrEmpty(bse_Department.Dept_Desp))
             {
            idb.AddParameter("@Dept_Desp", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_Desp", bse_Department.Dept_Desp);
             }
             if (string.IsNullOrEmpty(bse_Department.Dept_Bak))
             {
            idb.AddParameter("@Dept_Bak", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_Bak", bse_Department.Dept_Bak);
             }
             if (bse_Department.Dept_Date == DateTime.MinValue)
             {
            idb.AddParameter("@Dept_Date", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_Date", bse_Department.Dept_Date);
             }

             return idb.ExeCmd(sql);
        }
Exemple #10
0
 /// <summary>
 /// 更新数据
 /// </summary>
 /// <param name='model'>实体</param>
 /// <returns>bool</returns>
 public bool Update(Bse_Department model,bool IsValid)
 {
     bool result = false;
     var e = new ModelExceptions();
     if(e.IsValid && IsValid){
         int _rseult = instance.Update(model);
         if (_rseult > 0)
         {
             result = true;
         }
     }
     return result;
 }
Exemple #11
0
        //登陆
        public ActionResult LoginBtn()
        {
            //TODO:corporation
            string result = "fail";
            string msg = string.Empty;
            string company = Request["company"];
            string userName = Request["userName"];
            string userPwd = Request["pwd"];
            //string userRole = Request["role"];
            //string result = "";
            if (!Net.CheckConn())
            {
                return Json(new { result = result, msg = "无法连接到服务器!请检查网络情况。" });
            }

            try
            {

                if (userName == null || userPwd == null)
                {
                    result = "fail";
                    msg = "用户名或密码不能为空";
                    //return Content("Null");
                }
                else
                {
                    Session.RemoveAll();
                    Session.Clear();
                    //TODO:1.4
                    //得到公司
                   // string pwd = Md5.MD5(userPwd.Replace('\'', '"'));
                    string pwd = userPwd;
                    //角色Stuff_LoginType and Stuff_LoginType='" + userRole + "'
                    HR_Stuff = instanceHR_Stuff.GetModel(" and Emp_LoginID='" + userName.Replace('\'', '"') + "' and Emp_LoginPwd='" + pwd + "'");

                    if (HR_Stuff == null)
                    {
                        result = "fail";
                        msg = "用户名或密码不正确 ";
                    }
                    else
                    {
                        //用户名
                        this.SetSession<string>("UserName", HR_Stuff.Emp_Name);
                        //员工编码
                        this.SetSession<string>("UserId", HR_Stuff.Emp_Code);
                        //员工登录名
                        this.SetSession<string>("LoginName", HR_Stuff.Emp_LoginID);
                        //登录IP
                        this.SetSession<string>("IP", HttpContext.Request.UserHostAddress);

                        //部门信息
                        Bse_Department =instanceDepartment.GetModel(" and Dept_Code='" + HR_Stuff.Emp_Dept_Code + "'");
                        if (Bse_Department != null)
                        {

                            //部门id
                            this.SetSession<string>("DeptId", Bse_Department.Dept_Code.ToString());
                            //部门名称
                            this.SetSession<string>("DeptName", Bse_Department.Dept_Name);
                            //用户角色//hack
                            this.SetSession<string>("UserRole", "");
                            //DODO:hao

                            //Bse_Department fagTemp = instanceBse_Department.GetModel(" and Dept_Code='" + Bse_Department.Dept_PCode.ToString() + "'");
                            //while (!string.IsNullOrEmpty(fagTemp.Dept_PCode))
                            //{
                            //    fagTemp = instanceBse_Department.GetModel(" and Dept_Code='" + fagTemp.Dept_PCode + "'");
                            //}
                            //string companyUser = fagTemp.Dept_Name.ToString();
                            ////公司编码
                            //string companyCode = fagTemp.Dept_Code.ToString();
                            ////this.SetSession<string>("Company", company);
                            //this.SetSession<string>("CompanyCode", companyCode);
                            //部门编码
                           // this.SetSession<string>("DeptCode", Bse_Department.Dept_Code);

                            //TODO:得到公司问题
                            //companyCode=new BLL.Bll_Bse_Department().GetCompanyName("" + Bse_Department.Dept_Code + "");

                            //this.SetSession<string>("Company", companyUser);

                            result ="success";

                            msg = "";

                        }
                        else
                        {
                            result ="fail";
                            msg = "用户信息配置错误";
                        }
                    }
                }

            }
            catch (System.Exception ex)
            {
                result = "fail";
                // msg = "网络连接不通,请重试";
                msg = ex.Message;
               // PlateLog.Write("连接异常:", PlateLog.LogMessageType.Error,ex);
            }
            //QX.Log.PlateLog.WriteOp
            //写入登录日志
            Bll_Comm.LoginLog(userName,msg);

            return Json(new { result = result, msg = msg });
        }
Exemple #12
0
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Dept_Load(object sender, EventArgs e)
        {
            FormHelper gen = new FormHelper();

            gen.GenerateForm("FDept", this.groupBox1, new Point(6, 20));
            gen.GenerateForm("FODept", this.panel1, new Point(6, 20));
            gen.GenerateForm("FBDept", this.panel2, new Point(6, 20));
            //保存按钮:保存并关闭
            btnSave.Click += new EventHandler(btnSave_Click);
            btnOk.Click += new EventHandler(btnOk_Click);
            //btnDel.Click += new EventHandler(btnDel_Click);
            //弹出部门选择
            //Dept_PCode.Click+=new EventHandler(Dept_PCode_Click);
            //Dept_PName.Click += new EventHandler(Dept_PCode_Click);

            //弹出人员选择窗口
            //Dept_Owner.Click += new EventHandler(Dept_Owner_Click);
            //Dept_OwnerName.Click += new EventHandler(Dept_Owner_Click);
            //Dept_OMob.Click += new EventHandler(Dept_Owner_Click);
            //Dept_OTel.Click += new EventHandler(Dept_Owner_Click);
            BindModelHelper modelHepler = new BindModelHelper();
            //操作类型
            switch (operationType)
            {
                case OperationTypeEnum.Look:
                    break;
                case OperationTypeEnum.Edit:

                    //modelHepler.BindModelToControl<Bse_Department>(GModel, AllControls());
                    modelHepler.BindModelToControl<Bse_Department>(GModel, this.groupBox1.Controls, "");
                    modelHepler.BindModelToControl<Bse_Department>(GModel, this.panel1.Controls, "");
                    modelHepler.BindModelToControl<Bse_Department>(GModel, this.panel2.Controls, "");

                    break;
                case OperationTypeEnum.Add:
                    GModel = new Bse_Department();
                    GModel.Dept_Code = instance.GenerateDeptCode();
                    modelHepler.BindModelToControl<Bse_Department>(GModel, this.groupBox1.Controls, "");
                    modelHepler.BindModelToControl<Bse_Department>(GModel, this.panel1.Controls, "");
                    modelHepler.BindModelToControl<Bse_Department>(GModel, this.panel2.Controls, "");
                    break;
                default:
                    break;
            }
        }
        /// <summary>
        /// 更新部门信息维护 Bse_Department对象(即:一条记录
        /// </summary>
        public int Update(Bse_Department bse_Department)
        {
            StringBuilder sbParameter=new StringBuilder();
              StringBuilder sb=new StringBuilder();
              sb.Append(@"UPDATE       Bse_Department       SET ");
            if(bse_Department.Dept_Code_IsChanged){sbParameter.Append("Dept_Code=@Dept_Code, ");}
              if(bse_Department.Dept_Name_IsChanged){sbParameter.Append("Dept_Name=@Dept_Name, ");}
              if(bse_Department.Dept_PCode_IsChanged){sbParameter.Append("Dept_PCode=@Dept_PCode, ");}
              if(bse_Department.Dept_PName_IsChanged){sbParameter.Append("Dept_PName=@Dept_PName, ");}
              if(bse_Department.Dept_Owner_IsChanged){sbParameter.Append("Dept_Owner=@Dept_Owner, ");}
              if(bse_Department.Dept_OwnerName_IsChanged){sbParameter.Append("Dept_OwnerName=@Dept_OwnerName, ");}
              if(bse_Department.Dept_OTel_IsChanged){sbParameter.Append("Dept_OTel=@Dept_OTel, ");}
              if(bse_Department.Dept_OMob_IsChanged){sbParameter.Append("Dept_OMob=@Dept_OMob, ");}
              if(bse_Department.Dept_Num_IsChanged){sbParameter.Append("Dept_Num=@Dept_Num, ");}
              if(bse_Department.Dept_IsLeaf_IsChanged){sbParameter.Append("Dept_IsLeaf=@Dept_IsLeaf, ");}
              if(bse_Department.Dept_Level_IsChanged){sbParameter.Append("Dept_Level=@Dept_Level, ");}
              if(bse_Department.Dept_SimpleCode_IsChanged){sbParameter.Append("Dept_SimpleCode=@Dept_SimpleCode, ");}
              if(bse_Department.Dept_SimpleName_IsChanged){sbParameter.Append("Dept_SimpleName=@Dept_SimpleName, ");}
              if(bse_Department.Stat_IsChanged){sbParameter.Append("Stat=@Stat, ");}
              if(bse_Department.Dept_Stat_IsChanged){sbParameter.Append("Dept_Stat=@Dept_Stat, ");}
              if(bse_Department.Dept_Desp_IsChanged){sbParameter.Append("Dept_Desp=@Dept_Desp, ");}
              if(bse_Department.Dept_Bak_IsChanged){sbParameter.Append("Dept_Bak=@Dept_Bak, ");}
              if(bse_Department.Dept_Date_IsChanged){sbParameter.Append("Dept_Date=@Dept_Date ");}
          sb.Append(sbParameter.ToString().Trim().TrimEnd(','));
              sb.Append(      " WHERE 1=1 AND ((Stat is null) or (Stat=0))   and Dept_ID=@Dept_ID; " );
              string sql=sb.ToString();
             if(bse_Department.Dept_Code_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Department.Dept_Code))
             {
            idb.AddParameter("@Dept_Code", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_Code", bse_Department.Dept_Code);
             }
              }
             if(bse_Department.Dept_Name_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Department.Dept_Name))
             {
            idb.AddParameter("@Dept_Name", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_Name", bse_Department.Dept_Name);
             }
              }
             if(bse_Department.Dept_PCode_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Department.Dept_PCode))
             {
            idb.AddParameter("@Dept_PCode", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_PCode", bse_Department.Dept_PCode);
             }
              }
             if(bse_Department.Dept_PName_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Department.Dept_PName))
             {
            idb.AddParameter("@Dept_PName", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_PName", bse_Department.Dept_PName);
             }
              }
             if(bse_Department.Dept_Owner_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Department.Dept_Owner))
             {
            idb.AddParameter("@Dept_Owner", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_Owner", bse_Department.Dept_Owner);
             }
              }
             if(bse_Department.Dept_OwnerName_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Department.Dept_OwnerName))
             {
            idb.AddParameter("@Dept_OwnerName", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_OwnerName", bse_Department.Dept_OwnerName);
             }
              }
             if(bse_Department.Dept_OTel_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Department.Dept_OTel))
             {
            idb.AddParameter("@Dept_OTel", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_OTel", bse_Department.Dept_OTel);
             }
              }
             if(bse_Department.Dept_OMob_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Department.Dept_OMob))
             {
            idb.AddParameter("@Dept_OMob", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_OMob", bse_Department.Dept_OMob);
             }
              }
             if(bse_Department.Dept_Num_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Department.Dept_Num))
             {
            idb.AddParameter("@Dept_Num", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_Num", bse_Department.Dept_Num);
             }
              }
             if(bse_Department.Dept_IsLeaf_IsChanged)
             {
             if (bse_Department.Dept_IsLeaf == 0)
             {
            idb.AddParameter("@Dept_IsLeaf", 0);
             }
             else
             {
            idb.AddParameter("@Dept_IsLeaf", bse_Department.Dept_IsLeaf);
             }
              }
             if(bse_Department.Dept_Level_IsChanged)
             {
             if (bse_Department.Dept_Level == 0)
             {
            idb.AddParameter("@Dept_Level", 0);
             }
             else
             {
            idb.AddParameter("@Dept_Level", bse_Department.Dept_Level);
             }
              }
             if(bse_Department.Dept_SimpleCode_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Department.Dept_SimpleCode))
             {
            idb.AddParameter("@Dept_SimpleCode", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_SimpleCode", bse_Department.Dept_SimpleCode);
             }
              }
             if(bse_Department.Dept_SimpleName_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Department.Dept_SimpleName))
             {
            idb.AddParameter("@Dept_SimpleName", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_SimpleName", bse_Department.Dept_SimpleName);
             }
              }
             if(bse_Department.Stat_IsChanged)
             {
             if (bse_Department.Stat == 0)
             {
            idb.AddParameter("@Stat", 0);
             }
             else
             {
            idb.AddParameter("@Stat", bse_Department.Stat);
             }
              }
             if(bse_Department.Dept_Stat_IsChanged)
             {
             if (bse_Department.Dept_Stat == 0)
             {
            idb.AddParameter("@Dept_Stat", 0);
             }
             else
             {
            idb.AddParameter("@Dept_Stat", bse_Department.Dept_Stat);
             }
              }
             if(bse_Department.Dept_Desp_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Department.Dept_Desp))
             {
            idb.AddParameter("@Dept_Desp", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_Desp", bse_Department.Dept_Desp);
             }
              }
             if(bse_Department.Dept_Bak_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Department.Dept_Bak))
             {
            idb.AddParameter("@Dept_Bak", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_Bak", bse_Department.Dept_Bak);
             }
              }
             if(bse_Department.Dept_Date_IsChanged)
             {
             if (bse_Department.Dept_Date == DateTime.MinValue)
             {
            idb.AddParameter("@Dept_Date", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_Date", bse_Department.Dept_Date);
             }
              }

             idb.AddParameter("@Dept_ID", bse_Department.Dept_ID);

            int Re = 0;
            //SQL日志记录
            var RunMethod = System.Reflection.MethodBase.GetCurrentMethod();
            System.Collections.Hashtable param = new System.Collections.Hashtable();
            string Ex = string.Empty;
            foreach (System.Collections.DictionaryEntry item in idb.GetParameters())
            {
                  param.Add(item.Key, item.Value);
            }

            try
            {
                Re = idb.ExeCmd(sql);
                Ex = Re.ToString();
            }
            catch (Exception ex)
            {
                Ex = ex.Message;
            }
            finally
            {
                SysRunLog.InsertRunSql(sql, param, RunMethod.DeclaringType +"." + RunMethod.Name,Ex);
            }            return Re;
        /// <summary>
        /// 添加部门信息维护 Bse_Department对象(即:一条记录)
        /// </summary>
        public int Add(Bse_Department bse_Department)
        {
            string sql = "INSERT INTO Bse_Department (Dept_Code,Dept_Name,Dept_PCode,Dept_PName,Dept_Owner,Dept_OwnerName,Dept_OTel,Dept_OMob,Dept_Num,Dept_IsLeaf,Dept_Level,Dept_SimpleCode,Dept_SimpleName,Stat,Dept_Stat,Dept_Desp,Dept_Bak,Dept_Date) VALUES (@Dept_Code,@Dept_Name,@Dept_PCode,@Dept_PName,@Dept_Owner,@Dept_OwnerName,@Dept_OTel,@Dept_OMob,@Dept_Num,@Dept_IsLeaf,@Dept_Level,@Dept_SimpleCode,@Dept_SimpleName,@Stat,@Dept_Stat,@Dept_Desp,@Dept_Bak,@Dept_Date)";
             if (string.IsNullOrEmpty(bse_Department.Dept_Code))
             {
            idb.AddParameter("@Dept_Code", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_Code", bse_Department.Dept_Code);
             }
             if (string.IsNullOrEmpty(bse_Department.Dept_Name))
             {
            idb.AddParameter("@Dept_Name", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_Name", bse_Department.Dept_Name);
             }
             if (string.IsNullOrEmpty(bse_Department.Dept_PCode))
             {
            idb.AddParameter("@Dept_PCode", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_PCode", bse_Department.Dept_PCode);
             }
             if (string.IsNullOrEmpty(bse_Department.Dept_PName))
             {
            idb.AddParameter("@Dept_PName", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_PName", bse_Department.Dept_PName);
             }
             if (string.IsNullOrEmpty(bse_Department.Dept_Owner))
             {
            idb.AddParameter("@Dept_Owner", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_Owner", bse_Department.Dept_Owner);
             }
             if (string.IsNullOrEmpty(bse_Department.Dept_OwnerName))
             {
            idb.AddParameter("@Dept_OwnerName", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_OwnerName", bse_Department.Dept_OwnerName);
             }
             if (string.IsNullOrEmpty(bse_Department.Dept_OTel))
             {
            idb.AddParameter("@Dept_OTel", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_OTel", bse_Department.Dept_OTel);
             }
             if (string.IsNullOrEmpty(bse_Department.Dept_OMob))
             {
            idb.AddParameter("@Dept_OMob", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_OMob", bse_Department.Dept_OMob);
             }
             if (string.IsNullOrEmpty(bse_Department.Dept_Num))
             {
            idb.AddParameter("@Dept_Num", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_Num", bse_Department.Dept_Num);
             }
             if (bse_Department.Dept_IsLeaf == 0)
             {
            idb.AddParameter("@Dept_IsLeaf", 0);
             }
             else
             {
            idb.AddParameter("@Dept_IsLeaf", bse_Department.Dept_IsLeaf);
             }
             if (bse_Department.Dept_Level == 0)
             {
            idb.AddParameter("@Dept_Level", 0);
             }
             else
             {
            idb.AddParameter("@Dept_Level", bse_Department.Dept_Level);
             }
             if (string.IsNullOrEmpty(bse_Department.Dept_SimpleCode))
             {
            idb.AddParameter("@Dept_SimpleCode", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_SimpleCode", bse_Department.Dept_SimpleCode);
             }
             if (string.IsNullOrEmpty(bse_Department.Dept_SimpleName))
             {
            idb.AddParameter("@Dept_SimpleName", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_SimpleName", bse_Department.Dept_SimpleName);
             }
             if (bse_Department.Stat == 0)
             {
            idb.AddParameter("@Stat", 0);
             }
             else
             {
            idb.AddParameter("@Stat", bse_Department.Stat);
             }
             if (bse_Department.Dept_Stat == 0)
             {
            idb.AddParameter("@Dept_Stat", 0);
             }
             else
             {
            idb.AddParameter("@Dept_Stat", bse_Department.Dept_Stat);
             }
             if (string.IsNullOrEmpty(bse_Department.Dept_Desp))
             {
            idb.AddParameter("@Dept_Desp", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_Desp", bse_Department.Dept_Desp);
             }
             if (string.IsNullOrEmpty(bse_Department.Dept_Bak))
             {
            idb.AddParameter("@Dept_Bak", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_Bak", bse_Department.Dept_Bak);
             }
             if (bse_Department.Dept_Date == DateTime.MinValue)
             {
            idb.AddParameter("@Dept_Date", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_Date", bse_Department.Dept_Date);
             }

            int Re = 0;
            //SQL日志记录
            var RunMethod = System.Reflection.MethodBase.GetCurrentMethod();
            System.Collections.Hashtable param = new System.Collections.Hashtable();
            string Ex = string.Empty;
            foreach (System.Collections.DictionaryEntry item in idb.GetParameters())
            {
                  param.Add(item.Key, item.Value);
            }

            try
            {
                Re = idb.ExeCmd(sql);
                Ex = Re.ToString();
            }
            catch (Exception ex)
            {
                Ex = ex.Message;
            }
            finally
            {
                SysRunLog.InsertRunSql(sql, param, RunMethod.DeclaringType +"." + RunMethod.Name,Ex);
             }            return Re;
        }
Exemple #15
0
        /// <summary>
        /// 更新部门信息维护 Bse_Department对象(即:一条记录
        /// </summary>
        public int Update(Bse_Department bse_Department)
        {
            StringBuilder sbParameter=new StringBuilder();
              StringBuilder sb=new StringBuilder();
              sb.Append(@"UPDATE       Bse_Department       SET ");
            if(bse_Department.Dept_Code_IsChanged){sbParameter.Append("Dept_Code=@Dept_Code, ");}
              if(bse_Department.Dept_Name_IsChanged){sbParameter.Append("Dept_Name=@Dept_Name, ");}
              if(bse_Department.Dept_PCode_IsChanged){sbParameter.Append("Dept_PCode=@Dept_PCode, ");}
              if(bse_Department.Dept_PName_IsChanged){sbParameter.Append("Dept_PName=@Dept_PName, ");}
              if(bse_Department.Dept_Owner_IsChanged){sbParameter.Append("Dept_Owner=@Dept_Owner, ");}
              if(bse_Department.Dept_OwnerName_IsChanged){sbParameter.Append("Dept_OwnerName=@Dept_OwnerName, ");}
              if(bse_Department.Dept_OTel_IsChanged){sbParameter.Append("Dept_OTel=@Dept_OTel, ");}
              if(bse_Department.Dept_OMob_IsChanged){sbParameter.Append("Dept_OMob=@Dept_OMob, ");}
              if(bse_Department.Dept_Num_IsChanged){sbParameter.Append("Dept_Num=@Dept_Num, ");}
              if(bse_Department.Dept_IsLeaf_IsChanged){sbParameter.Append("Dept_IsLeaf=@Dept_IsLeaf, ");}
              if(bse_Department.Dept_Level_IsChanged){sbParameter.Append("Dept_Level=@Dept_Level, ");}
              if(bse_Department.Dept_SimpleCode_IsChanged){sbParameter.Append("Dept_SimpleCode=@Dept_SimpleCode, ");}
              if(bse_Department.Dept_SimpleName_IsChanged){sbParameter.Append("Dept_SimpleName=@Dept_SimpleName, ");}
              if(bse_Department.Stat_IsChanged){sbParameter.Append("Stat=@Stat, ");}
              if(bse_Department.Dept_Stat_IsChanged){sbParameter.Append("Dept_Stat=@Dept_Stat, ");}
              if(bse_Department.Dept_Desp_IsChanged){sbParameter.Append("Dept_Desp=@Dept_Desp, ");}
              if(bse_Department.Dept_Bak_IsChanged){sbParameter.Append("Dept_Bak=@Dept_Bak, ");}
              if(bse_Department.Dept_Date_IsChanged){sbParameter.Append("Dept_Date=@Dept_Date ");}
          sb.Append(sbParameter.ToString().Trim().TrimEnd(','));
              sb.Append(      " WHERE 1=1 AND ((Stat is null) or (Stat=0))   and Dept_ID=@Dept_ID; " );
              string sql=sb.ToString();
             if(bse_Department.Dept_Code_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Department.Dept_Code))
             {
            idb.AddParameter("@Dept_Code", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_Code", bse_Department.Dept_Code);
             }
              }
             if(bse_Department.Dept_Name_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Department.Dept_Name))
             {
            idb.AddParameter("@Dept_Name", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_Name", bse_Department.Dept_Name);
             }
              }
             if(bse_Department.Dept_PCode_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Department.Dept_PCode))
             {
            idb.AddParameter("@Dept_PCode", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_PCode", bse_Department.Dept_PCode);
             }
              }
             if(bse_Department.Dept_PName_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Department.Dept_PName))
             {
            idb.AddParameter("@Dept_PName", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_PName", bse_Department.Dept_PName);
             }
              }
             if(bse_Department.Dept_Owner_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Department.Dept_Owner))
             {
            idb.AddParameter("@Dept_Owner", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_Owner", bse_Department.Dept_Owner);
             }
              }
             if(bse_Department.Dept_OwnerName_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Department.Dept_OwnerName))
             {
            idb.AddParameter("@Dept_OwnerName", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_OwnerName", bse_Department.Dept_OwnerName);
             }
              }
             if(bse_Department.Dept_OTel_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Department.Dept_OTel))
             {
            idb.AddParameter("@Dept_OTel", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_OTel", bse_Department.Dept_OTel);
             }
              }
             if(bse_Department.Dept_OMob_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Department.Dept_OMob))
             {
            idb.AddParameter("@Dept_OMob", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_OMob", bse_Department.Dept_OMob);
             }
              }
             if(bse_Department.Dept_Num_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Department.Dept_Num))
             {
            idb.AddParameter("@Dept_Num", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_Num", bse_Department.Dept_Num);
             }
              }
             if(bse_Department.Dept_IsLeaf_IsChanged)
             {
             if (bse_Department.Dept_IsLeaf == 0)
             {
            idb.AddParameter("@Dept_IsLeaf", 0);
             }
             else
             {
            idb.AddParameter("@Dept_IsLeaf", bse_Department.Dept_IsLeaf);
             }
              }
             if(bse_Department.Dept_Level_IsChanged)
             {
             if (bse_Department.Dept_Level == 0)
             {
            idb.AddParameter("@Dept_Level", 0);
             }
             else
             {
            idb.AddParameter("@Dept_Level", bse_Department.Dept_Level);
             }
              }
             if(bse_Department.Dept_SimpleCode_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Department.Dept_SimpleCode))
             {
            idb.AddParameter("@Dept_SimpleCode", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_SimpleCode", bse_Department.Dept_SimpleCode);
             }
              }
             if(bse_Department.Dept_SimpleName_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Department.Dept_SimpleName))
             {
            idb.AddParameter("@Dept_SimpleName", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_SimpleName", bse_Department.Dept_SimpleName);
             }
              }
             if(bse_Department.Stat_IsChanged)
             {
             if (bse_Department.Stat == 0)
             {
            idb.AddParameter("@Stat", 0);
             }
             else
             {
            idb.AddParameter("@Stat", bse_Department.Stat);
             }
              }
             if(bse_Department.Dept_Stat_IsChanged)
             {
             if (bse_Department.Dept_Stat == 0)
             {
            idb.AddParameter("@Dept_Stat", 0);
             }
             else
             {
            idb.AddParameter("@Dept_Stat", bse_Department.Dept_Stat);
             }
              }
             if(bse_Department.Dept_Desp_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Department.Dept_Desp))
             {
            idb.AddParameter("@Dept_Desp", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_Desp", bse_Department.Dept_Desp);
             }
              }
             if(bse_Department.Dept_Bak_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Department.Dept_Bak))
             {
            idb.AddParameter("@Dept_Bak", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_Bak", bse_Department.Dept_Bak);
             }
              }
             if(bse_Department.Dept_Date_IsChanged)
             {
             if (bse_Department.Dept_Date == DateTime.MinValue)
             {
            idb.AddParameter("@Dept_Date", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Dept_Date", bse_Department.Dept_Date);
             }
              }

             idb.AddParameter("@Dept_ID", bse_Department.Dept_ID);

             return idb.ExeCmd(sql);
Exemple #16
0
        /// <summary>
        /// 插入数据
        /// </summary>
        /// <param name='model'>实体</param>
        /// <returns>bool</returns>
        public bool Insert(Bse_Department model)
        {
            bool result = false;
            try
            {
                int _result = instance.Add(model);
                if (_result > 0)
                {
                    result = true;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return result;
        }
Exemple #17
0
 /// <summary>
 /// 插入数据
 /// </summary>
 /// <param name='model'>实体</param>
 /// <param name='model'>是否完成验证</param>
 /// <returns>bool</returns>
 public bool Insert(Bse_Department model,bool IsValid)
 {
     var e = new ModelExceptions();
     bool result = false;
     if (e.IsValid && IsValid)
     {
         //完成了验证,开始更新数据库了
         int _result = instance.Add(model);
         if (_result > 0)
         {
             result = true;
         }
     }
     return result;
 }
Exemple #18
0
        private void GenerateChildNon(Bse_Department dept, List<Bse_Department> allDept)
        {
            dept.ChildrenDept = allDept.Where(o => o.Dept_PCode == dept.Dept_Code);

            if (dept.ChildrenDept.Count() == 0)
            {
                return;
            }
            foreach (var d in dept.ChildrenDept)
            {
                staticDeptList.Add(d);
                GenerateChildNon(d, allDept);
            }
        }
Exemple #19
0
 /// <summary>
 /// 更新数据
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool UpdateDept(Bse_Department model)
 {
     bool result = false;
     int _rseult = instance.Update(model);
     if (_rseult > 0)
     {
         result = true;
     }
     return result;
 }