예제 #1
0
    /// <summary>
    /// 获取编码
    /// </summary>
    private string GetCodeValue()
    {
        //获取选择的编码规则
        string selectCodeRule = ddlCodeRule.SelectedValue;

        //如果是手工输入的时候,返回输入的内容
        if (string.IsNullOrEmpty(selectCodeRule))
        {
            return(txtCode.Text);
        }
        //根据编码规则生成编码
        else
        {
            return(ItemCodingRuleBus.GetCodeValue(selectCodeRule));
        }
    }
예제 #2
0
    /// <summary>
    /// 根据编码类型以及单据代码或基础数据代码获取编码规则信息
    /// </summary>
    public void BindCodingRule()
    {
        //分类标识未设置时,不进行绑定
        if (string.IsNullOrEmpty(this.CodingType) || string.IsNullOrEmpty(this.ItemTypeID))
        {
            return;
        }
        //查询分类标识信息
        DataTable dt = ItemCodingRuleBus.GetCodingRuleInfoForDrp(this.CodingType, this.ItemTypeID);

        //分类标识存在时绑定数据
        if (dt != null && dt.Rows.Count > 0)
        {
            //设置列表项的文本内容的数据源字段
            ddlCodeRule.DataTextField = "RuleName";
            //设置列表项的提供值的数据源字段。
            ddlCodeRule.DataValueField = "ID";
            //设置列表项的数据源
            ddlCodeRule.DataSource = dt;
            //绑定列表的数据源
            ddlCodeRule.DataBind();
            //获取默认编码规则
            DataRow[] drDefault = dt.Select("IsDefault = '" + ConstUtil.CODING_RULE_DEFAULT_TRUE + "'");
            //存在默认编码规则时,设定默认编码规则为选中项
            if (drDefault.Length > 0)
            {
                //获取默认编码规则的ID
                string selectID = GetSafeData.ValidateDataRow_Int(drDefault[0], "ID").ToString();
                //设置为选中项
                ddlCodeRule.SelectedValue = selectID;
                //设置提示信息
                txtCode.Text = ConstUtil.CODING_RULE_DISPLAY_TEXT;
                //设置为不可编辑
                txtCode.Enabled = false;
            }
        }
        //添加一请选择选项
        ListItem Item = new ListItem(ConstUtil.CODING_RULE_INSERT_TEXT, ConstUtil.CODING_RULE_INSERT_VALUE);

        ddlCodeRule.Items.Insert(0, Item);
    }
예제 #3
0
    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    = "保存失败!";
        }
    }