Ejemplo n.º 1
0
        /// <summary>
        /// 编辑机构岗位信息
        /// </summary>
        /// <param name="model">保存信息</param>
        /// <returns></returns>
        public static bool SaveDeptQuarterInfo(DeptQuarterModel model)
        {
            //获取登陆用户信息
            UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];
            //设置公司代码
            model.CompanyCD = userInfo.CompanyCD;
            model.ModifiedUserID = userInfo.UserID;
            //定义返回变量
            bool isSucc = false;
            //操作日志
            LogInfoModel logModel = InitLogInfo(model.QuarterNo);

            //更新
            if (ConstUtil.EDIT_FLAG_UPDATE.Equals(model.EditFlag))
            {
                try
                {
                    logModel.Element = ConstUtil.LOG_PROCESS_UPDATE;
                    //执行更新操作
                    isSucc = DeptQuarterDBHelper.UpdateDeptQuarterInfo(model);
                }
                catch (Exception ex)
                {
                    //输出系统日志
                    WriteSystemLog(userInfo, ex);
                }
            }
            //插入
            else
            {
                try
                {
                    logModel.Element = ConstUtil.LOG_PROCESS_INSERT;
                    //执行插入操作
                    isSucc = DeptQuarterDBHelper.InsertDeptQuarterInfo(model);
                }
                catch (Exception ex)
                {
                    //输出系统日志
                    WriteSystemLog(userInfo, ex);
                }
            }
            //更新成功时
            if (isSucc)
            {
                //设置操作成功标识
                logModel.Remark = ConstUtil.LOG_PROCESS_SUCCESS;
            }
            //更新不成功
            else
            {
                //设置操作成功标识 
                logModel.Remark = ConstUtil.LOG_PROCESS_FAILED;
            }

            //登陆日志
            LogDBHelper.InsertLog(logModel);

            return isSucc;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 保存时基本信息参数设置
        /// </summary>
        /// <param name="comm">命令</param>
        /// <param name="model">保存信息</param>
        private static void SetSaveParameter(SqlCommand comm, DeptQuarterModel model)
        {
            //设置参数
            comm.Parameters.Add(SqlHelper.GetParameterFromString("@CompanyCD", model.CompanyCD));//公司代码
            comm.Parameters.Add(SqlHelper.GetParameterFromString("@QuarterNo", model.QuarterNo));//岗位编号
            if (ConstUtil.EDIT_FLAG_INSERT.Equals(model.EditFlag))
            {
                comm.Parameters.Add(SqlHelper.GetParameterFromString("@DeptID", model.DeptID));//部门ID(对应部门表ID)
                comm.Parameters.Add(SqlHelper.GetParameterFromString("@SuperQuarterID", model.SuperQuarterID));//上级岗位ID
            }


            comm.Parameters.Add(SqlHelper.GetParameterFromString("@QuterContent", model.QuterContent));//岗位拼音代码
            comm.Parameters.Add(SqlHelper.GetParameterFromString("@PYShort", model.PYShort));//岗位拼音代码
            comm.Parameters.Add(SqlHelper.GetParameterFromString("@QuarterName", model.QuarterName));//岗位名称
            comm.Parameters.Add(SqlHelper.GetParameterFromString("@TypeID", model.TypeID));//岗位类型ID(对应分类代码表ID)
            comm.Parameters.Add(SqlHelper.GetParameterFromString("@LevelID", model.LevelID));//岗位级别ID(对应分类代码表ID)
            comm.Parameters.Add(SqlHelper.GetParameterFromString("@KeyFlag", model.KeyFlag));//是否关键岗位(0否,1是)
            comm.Parameters.Add(SqlHelper.GetParameterFromString("@Duty", model.Duty));//岗位职责
            comm.Parameters.Add(SqlHelper.GetParameterFromString("@DutyRequire", model.DutyRequire));//任职资格
            comm.Parameters.Add(SqlHelper.GetParameterFromString("@Attachment", model.PageAttachment));//附件
            comm.Parameters.Add(SqlHelper.GetParameterFromString("@UsedStatus", model.UsedStatus));//启用状态(0停用,1启用)
            comm.Parameters.Add(SqlHelper.GetParameterFromString("@Description", model.Description));//描述
            comm.Parameters.Add(SqlHelper.GetParameterFromString("@ModifiedUserID", model.ModifiedUserID));//最后更新用户ID
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 更新组织机构信息
        /// </summary>
        /// <param name="model">保存信息</param>
        /// <returns></returns>
        public static bool UpdateDeptQuarterInfo(DeptQuarterModel model)
        {

            #region 更新SQL拼写
            StringBuilder updateSql = new StringBuilder();
            updateSql.AppendLine(" UPDATE officedba.DeptQuarter            ");
            updateSql.AppendLine("    SET                                  ");
            updateSql.AppendLine("        PYShort = @PYShort               ");
            updateSql.AppendLine("       ,QuarterName = @QuarterName       ");
            updateSql.AppendLine("       ,TypeID = @TypeID                 ");
            updateSql.AppendLine("       ,LevelID = @LevelID               ");
            updateSql.AppendLine("       ,KeyFlag = @KeyFlag               ");
            updateSql.AppendLine("       ,Duty = @Duty                     ");
            updateSql.AppendLine("       ,DutyRequire = @DutyRequire       ");
            updateSql.AppendLine("       ,Attachment = @Attachment         ");
            updateSql.AppendLine("       ,UsedStatus = @UsedStatus         ");
            updateSql.AppendLine("       ,Description = @Description       ");

            updateSql.AppendLine("       ,QuterContent = @QuterContent       ");
            
            updateSql.AppendLine("       ,ModifiedDate = getdate()         ");
            updateSql.AppendLine("       ,ModifiedUserID = @ModifiedUserID ");
            updateSql.AppendLine("  WHERE                                  ");
            updateSql.AppendLine(" 	  CompanyCD = @CompanyCD               ");
            updateSql.AppendLine(" 	  AND QuarterNo = @QuarterNo          ");
            #endregion

            //定义更新基本信息的命令
            SqlCommand comm = new SqlCommand();
            comm.CommandText = updateSql.ToString();
            //设置保存的参数
            SetSaveParameter(comm, model);

            //执行插入操作并返回更新结果
            return SqlHelper.ExecuteTransWithCommand(comm);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 添加机构岗位信息
        /// </summary>
        /// <param name="model">机构岗位信息</param>
        /// <returns></returns>
        public static bool InsertDeptQuarterInfo(DeptQuarterModel model)
        {

            #region 插入SQL拼写
            StringBuilder insertSql = new StringBuilder();
            insertSql.AppendLine(" INSERT INTO officedba.DeptQuarter ");
            insertSql.AppendLine("            (CompanyCD             ");
            insertSql.AppendLine("            ,DeptID                ");
            insertSql.AppendLine("            ,QuarterNo             ");
            insertSql.AppendLine("            ,SuperQuarterID        ");
            insertSql.AppendLine("            ,PYShort               ");
            insertSql.AppendLine("            ,QuarterName           ");
            insertSql.AppendLine("            ,TypeID                ");
            insertSql.AppendLine("            ,LevelID               ");
            insertSql.AppendLine("            ,KeyFlag               ");
            insertSql.AppendLine("            ,Duty                  ");
            insertSql.AppendLine("            ,DutyRequire           ");
            insertSql.AppendLine("            ,Attachment            ");
            insertSql.AppendLine("            ,UsedStatus            ");
            insertSql.AppendLine("            ,Description           ");
            insertSql.AppendLine("            ,ModifiedDate          ");
            insertSql.AppendLine("            ,QuterContent          ");
            
            insertSql.AppendLine("            ,ModifiedUserID)       ");
            insertSql.AppendLine("      VALUES                       ");
            insertSql.AppendLine("            (@CompanyCD            ");
            insertSql.AppendLine("            ,@DeptID               ");
            insertSql.AppendLine("            ,@QuarterNo            ");
            insertSql.AppendLine("            ,@SuperQuarterID       ");
            insertSql.AppendLine("            ,@PYShort              ");
            insertSql.AppendLine("            ,@QuarterName          ");
            insertSql.AppendLine("            ,@TypeID               ");
            insertSql.AppendLine("            ,@LevelID              ");
            insertSql.AppendLine("            ,@KeyFlag              ");
            insertSql.AppendLine("            ,@Duty                 ");
            insertSql.AppendLine("            ,@DutyRequire          ");
            insertSql.AppendLine("            ,@Attachment           ");
            insertSql.AppendLine("            ,@UsedStatus           ");
            insertSql.AppendLine("            ,@Description          ");
            insertSql.AppendLine("            ,getdate()             ");
            insertSql.AppendLine("            ,@QuterContent          ");
            insertSql.AppendLine("            ,@ModifiedUserID)      ");
            #endregion

            //定义插入基本信息的命令
            SqlCommand comm = new SqlCommand();
            comm.CommandText = insertSql.ToString();
            //设置保存的参数
            SetSaveParameter(comm, model);

            //执行插入操作并返回更新结果
            return SqlHelper.ExecuteTransWithCommand(comm);

        }
    protected void imbSave_Click(object sender, System.Web.UI.ImageClickEventArgs e)
    {

        string EditFlag = hidEditFlag.Value.Trim();

   
        //定义Model变量
        DeptQuarterModel model = new DeptQuarterModel();
        //编辑标识
        model.EditFlag = EditFlag;
        string codeRules = string.Empty;
        //获取编号
         string quarterNo=string .Empty ;
         if (!EditFlag.Equals("INSERT"))
         {
             //quarterNo = txtDisplayCode.Value.Trim();
             quarterNo = hfdNo.Value;
         }
         else
         {
             
             //获取编码规则ID
             codeRules = codeRule.GetCodeRuleID();
             //手工输入的时候
             if (codeRules == string.Empty)
             {
                 


                 quarterNo = codeRule.GetDisplaycode();
             }
            
         
         
         
         
         }

        //新建时
        if (ConstUtil.EDIT_FLAG_INSERT.Equals(model.EditFlag))
        {
            //编号为空时,通过编码规则编号获取编号
            if (string.IsNullOrEmpty(quarterNo))
            {
                //获取编码规则编号
              string   codeRuleID = codeRule.GetCodeRuleID();
                //通过编码规则代码获取编号
                quarterNo = ItemCodingRuleBus.GetCodeValue(codeRuleID, ConstUtil.CODING_RULE_TABLE_DEPTQUARTER
                                , ConstUtil.CODING_RULE_COLUMN_DEPTQUARTER_NO);
            }
            //判断是否存在
            bool isAlready = PrimekeyVerifyBus.CheckCodeUniq(ConstUtil.CODING_RULE_TABLE_DEPTQUARTER
                                , ConstUtil.CODING_RULE_COLUMN_DEPTQUARTER_NO, quarterNo);
            //存在的场合
            if (!isAlready)
            {
                lblErrorMes.Visible = true;
                lblErrorMes.Text = "该编号已被使用,请输入未使用的编号!";
             
                return;
            }
            else
            {
                lblErrorMes.Visible = false ;
                lblErrorMes.Text = " ";
            
            }
        }
        //设置岗位编号
        model.QuarterNo = quarterNo;


        //所属机构
        model.DeptID = txtDeptID.Value .Trim ();
        //上级岗位
        model.SuperQuarterID = hidSuperQuarter.Value.Trim();
        //岗位名称
        model.QuarterName = txtQuarterName.Text .Trim ();
        //拼音代码
        model.PYShort = txtPYShort.Text .Trim ();
        //是否关键岗位
        model.KeyFlag = ddlKeyFlag.SelectedValue ;
        //岗位分类
        model.TypeID = ddlQuarterType.SelectedValue ;
        //岗位级别
        model.LevelID = ddlQuarterLevel.SelectedValue ;
        //描述信息
        model.Description = txtDescription.Text.Trim(); ;
        //启用状态
        model.UsedStatus = ddlUsedStatus.SelectedValue ;
        //附件
        model.Attachment = hfAttachment.Value.Trim() ;
        model.PageAttachment = hfPageAttachment.Value .Trim ();
        //岗位职责
        model.Duty = txtDuty.Text .Trim ();
        //任职资格
        model.DutyRequire = txtDutyRequire.Text .Trim ();

    //
        model.QuterContent = FCKeditor1.Value;




      
   



        bool isSucce = DeptQuarterBus.SaveDeptQuarterInfo(model);
        //保存成功时
        if (isSucce)
        {


            UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];
            //设置公司代码

            IList<QuterModuleSetModel> QuterModuleSetList = new List<QuterModuleSetModel>();
            
            if (chMMubiao.Checked)
            {
             
                if (chMRi.Checked)
                {
                    QuterModuleSetModel dchMRi = new QuterModuleSetModel();
                    dchMRi.CompanyCD = userInfo.CompanyCD;
                    dchMRi.Sign = "2";
                    dchMRi.ModuleID = "1001";
                    dchMRi.QuarterNo = model.QuarterNo;
                    dchMRi.DeptID = model.DeptID;
                    dchMRi.TypeID = "1";

                    QuterModuleSetList.Add(dchMRi);
                }
                if (this.chMZhou.Checked)
                {
                    QuterModuleSetModel dMZhou = new QuterModuleSetModel();
                    dMZhou.CompanyCD = userInfo.CompanyCD;
                    dMZhou.Sign = "2";
                    dMZhou.ModuleID = "1001";
                    dMZhou.QuarterNo = model.QuarterNo;
                    dMZhou.DeptID = model.DeptID;
                    dMZhou.TypeID = "2";

                    QuterModuleSetList.Add(dMZhou);
                }
                if (this.chMYue.Checked)
                {
                    QuterModuleSetModel dMYue = new QuterModuleSetModel();
                    dMYue.CompanyCD = userInfo.CompanyCD;
                    dMYue.Sign = "2";
                    dMYue.ModuleID = "1001";
                    dMYue.QuarterNo = model.QuarterNo;
                    dMYue.DeptID = model.DeptID;
                    dMYue.TypeID = "3";

                    QuterModuleSetList.Add(dMYue);
                }
                if (this.chMJi.Checked)
                {
                    QuterModuleSetModel dMJi = new QuterModuleSetModel();
                    dMJi.CompanyCD = userInfo.CompanyCD;
                    dMJi.Sign = "2";
                    dMJi.ModuleID = "1001";
                    dMJi.QuarterNo = model.QuarterNo;
                    dMJi.DeptID = model.DeptID;
                    dMJi.TypeID = "4";

                    QuterModuleSetList.Add(dMJi);
                }
                if (this.chMNian.Checked)
                {
                    QuterModuleSetModel dMNian = new QuterModuleSetModel();
                    dMNian.CompanyCD = userInfo.CompanyCD;
                    dMNian.Sign = "2";
                    dMNian.ModuleID = "1001";
                    dMNian.QuarterNo = model.QuarterNo;
                    dMNian.DeptID = model.DeptID;
                    dMNian.TypeID = "5";

                    QuterModuleSetList.Add(dMNian);
                }



            }
      


           
            if (chRRenWu.Checked)
            {
               
                if (chRGEren.Checked)
                {
                    QuterModuleSetModel dchGEren = new QuterModuleSetModel();
                    dchGEren.CompanyCD = userInfo.CompanyCD;
                    dchGEren.Sign = "2";
                    dchGEren.ModuleID = "1011";
                    dchGEren.QuarterNo = model.QuarterNo;
                    dchGEren.DeptID = model.DeptID;
                    dchGEren.TypeID = "1";

                    QuterModuleSetList.Add(dchGEren);
                }
                if (this.chRZhipai.Checked)
                {
                    QuterModuleSetModel dMZhipai = new QuterModuleSetModel();
                    dMZhipai.CompanyCD = userInfo.CompanyCD;
                    dMZhipai.Sign = "2";
                    dMZhipai.ModuleID = "1011";
                    dMZhipai.QuarterNo = model.QuarterNo;
                    dMZhipai.DeptID = model.DeptID;
                    dMZhipai.TypeID = "2";

                    QuterModuleSetList.Add(dMZhipai);
                }


            }
           



            QuterModuleSetModel ModelchGgongzuo = new QuterModuleSetModel();
            ModelchGgongzuo.CompanyCD = userInfo.CompanyCD;
            ModelchGgongzuo.Sign = "2";
            if (chGgongzuo.Checked)
            {
                ModelchGgongzuo.ModuleID = "1021";
                ModelchGgongzuo.QuarterNo = model.QuarterNo;
                ModelchGgongzuo.DeptID = model.DeptID;
            }
            QuterModuleSetList.Add(ModelchGgongzuo);



            QuterModuleSetModel ModelchCricheng = new QuterModuleSetModel();
            ModelchCricheng.CompanyCD = userInfo.CompanyCD;
            ModelchCricheng.Sign = "2";
            if (chCricheng.Checked)
            {
                ModelchCricheng.ModuleID = "10411";
                ModelchCricheng.QuarterNo = model.QuarterNo;
                ModelchCricheng.DeptID = model.DeptID;
            }
            QuterModuleSetList.Add(ModelchCricheng);






            if (DeptQuarterBus.SaveQuarterSet(QuterModuleSetList))
            {
                lblErrorMes.Visible = true;
                lblErrorMes.Text = "保存成功!";
                hidEditFlag.Value = ConstUtil.EDIT_FLAG_UPDATE;
                txtDisplayCode.Value = model.QuarterNo;
                txtDisplayCode.Disabled = true;
                hidDeptInfo.Value = model.DeptID;
                this.Page.ClientScript.RegisterStartupScript(this.GetType(), " ", " <script> SaveAfter(); </script> ");
            }
            else
            {
                lblErrorMes.Visible = true;
                lblErrorMes.Text = "保存失败!";
            
            }






































          


        }
        //保存未成功时
        else
        {
            lblErrorMes.Visible = true;
            lblErrorMes.Text = "保存失败!";
        }
        

               
             
                      
              

    


    }