예제 #1
0
    protected void btnSave_ServerClick(object sender, EventArgs e)
    {
        try
        {
            decimal tempPercentage = 0;
            foreach (DataGridItem dgItem in dgList.Items)
            {
                tempPercentage += System.Convert.ToDecimal(((TextBox)dgItem.FindControl("TxtPercentage")).Text.Trim());
            }
            if (tempPercentage != 100)
            {
                Response.Write(Rms.Web.JavaScript.Alert(true, "权重总和为 " + tempPercentage.ToString() + "%  不为100%!"));
                return;
            }
            //System.Web.UI.WebControls.DataGridItem
            foreach (DataGridItem dgItem in dgList.Items)
            {
                RmsPM.BLL.GradeDepartment cgradeDepartment = new RmsPM.BLL.GradeDepartment();
                string departmentCode = ((Label)dgItem.FindControl("lblDepartmentCode")).Text.Trim();
                string percentage     = System.Convert.ToString(System.Convert.ToDecimal(((TextBox)dgItem.FindControl("TxtPercentage")).Text.Trim()) / 100);

                cgradeDepartment.DepartmentDefineCode = departmentCode;
                cgradeDepartment.Percentage           = percentage;
                cgradeDepartment.GradeDepartmentSubmit();
            }
            Response.Write(Rms.Web.JavaScript.Alert(true, "保存成功"));
        }
        catch (Exception ex)
        {
            RmsPM.Web.ApplicationLog.WriteLog(this.ToString(), ex, "");
            Response.Write(Rms.Web.JavaScript.Alert(true, "改变业务权重报错:" + ex.Message));
            throw ex;
        }
    }
예제 #2
0
    public void LoadDate()
    {
        if (!this.user.HasRight("271001"))
        {
            Response.Redirect("../RejectAccess.aspx");
            Response.End();
        }

        if (!this.user.HasRight("271002"))
        {
            this.btnSave.Visible = false;
        }
        string MainDefineCode = this.ddlWorkFlowTypeView.SelectedValue;

        RmsPM.BLL.GradeDepartment cgradedepartment = new RmsPM.BLL.GradeDepartment();
        if (MainDefineCode != "")
        {
            cgradedepartment.MainDefineCode = MainDefineCode;
        }
        else
        {
            cgradedepartment.MainDefineCode = "100001";
        }
        switch (MainDefineCode)
        {
        case "100001":
            this.lblTitlename.Text = "承包商部门权重管理";
            break;

        case "100002":
            this.lblTitlename.Text = "供应商部门权重管理";
            break;

        default:
            this.lblTitlename.Text = "部门权重管理";
            break;
        }

        DataTable dtGradeDep = cgradedepartment.GetGradeDepartments();

        foreach (DataRow drGradeDep in dtGradeDep.Select())
        {
            drGradeDep["Percentage"] = System.Convert.ToDecimal(drGradeDep["Percentage"]) * 100;
        }

        this.dgList.DataSource = dtGradeDep;
        this.dgList.DataBind();
    }
예제 #3
0
파일: GradeList.cs 프로젝트: riyuexing/rms
        public static string GetSumGradePoint(string GradeMessageCode)
        {
            try
            {
                string gradePoint = "0";
                string text2      = "0";
                string text3      = "0";
                string text4      = "0";
                string text5      = "0";
                string text6      = "0";
                string text7      = "0";
                string decimalNoPointShowString = "0";
                string text9  = "0";
                string text10 = "0";
                string text11 = "0";
                string text12 = "0";
                string text13 = "0";
                string text14 = "0";
                gradePoint = GetGradePoint("100001", GradeMessageCode);
                text2      = GetGradePoint("100002", GradeMessageCode);
                text3      = GetGradePoint("100003", GradeMessageCode);
                text4      = GetGradePoint("100004", GradeMessageCode);
                text5      = GetGradePoint("100005", GradeMessageCode);
                text6      = GetGradePoint("100006", GradeMessageCode);
                text7      = GetGradePoint("100007", GradeMessageCode);
                DataTable gradeDepartments         = new GradeDepartment().GetGradeDepartments();
                DataTable lastDepartmentPercentage = new GradeDepartmentPercentage().GetLastDepartmentPercentage(GradeMessageCode, "100001");
                decimal   num = 0M;
                foreach (DataRow row in lastDepartmentPercentage.Select())
                {
                    num += (decimal)row["Percentage"];
                }
                if (gradeDepartments != null)
                {
                    foreach (DataRow row2 in gradeDepartments.Select("MainDefineCode='100001'"))
                    {
                        switch (row2["DepartmentDefineCode"].ToString())
                        {
                        case "100001":
                            if (lastDepartmentPercentage.Select("DepartmentDefineCode='100001'").Length != 0)
                            {
                                row2["Percentage"] = (decimal)lastDepartmentPercentage.Select("DepartmentDefineCode='100001'")[0]["Percentage"];
                            }
                            decimalNoPointShowString = MathRule.GetDecimalNoPointShowString(((Convert.ToDecimal(gradePoint) * ((decimal)row2["AdjustCoefficient"])) * ((decimal)row2["Percentage"])) / num);
                            if (decimalNoPointShowString == "")
                            {
                                decimalNoPointShowString = "0";
                            }
                            break;

                        case "100002":
                            if (lastDepartmentPercentage.Select("DepartmentDefineCode='100002'").Length != 0)
                            {
                                row2["Percentage"] = (decimal)lastDepartmentPercentage.Select("DepartmentDefineCode='100002'")[0]["Percentage"];
                            }
                            text9 = MathRule.GetDecimalNoPointShowString(((Convert.ToDecimal(text2) * ((decimal)row2["AdjustCoefficient"])) * ((decimal)row2["Percentage"])) / num);
                            if (text9 == "")
                            {
                                text9 = "0";
                            }
                            break;

                        case "100003":
                            if (lastDepartmentPercentage.Select("DepartmentDefineCode='100003'").Length != 0)
                            {
                                row2["Percentage"] = (decimal)lastDepartmentPercentage.Select("DepartmentDefineCode='100003'")[0]["Percentage"];
                            }
                            text10 = MathRule.GetDecimalNoPointShowString(((Convert.ToDecimal(text3) * ((decimal)row2["AdjustCoefficient"])) * ((decimal)row2["Percentage"])) / num);
                            if (text10 == "")
                            {
                                text10 = "0";
                            }
                            break;

                        case "100004":
                            if (lastDepartmentPercentage.Select("DepartmentDefineCode='100004'").Length != 0)
                            {
                                row2["Percentage"] = (decimal)lastDepartmentPercentage.Select("DepartmentDefineCode='100004'")[0]["Percentage"];
                            }
                            text11 = MathRule.GetDecimalNoPointShowString(((Convert.ToDecimal(text4) * ((decimal)row2["AdjustCoefficient"])) * ((decimal)row2["Percentage"])) / num);
                            if (text11 == "")
                            {
                                text11 = "0";
                            }
                            break;

                        case "100005":
                            if (lastDepartmentPercentage.Select("DepartmentDefineCode='100005'").Length != 0)
                            {
                                row2["Percentage"] = (decimal)lastDepartmentPercentage.Select("DepartmentDefineCode='100005'")[0]["Percentage"];
                            }
                            text12 = MathRule.GetDecimalNoPointShowString(((Convert.ToDecimal(text5) * ((decimal)row2["AdjustCoefficient"])) * ((decimal)row2["Percentage"])) / num);
                            if (text12 == "")
                            {
                                text12 = "0";
                            }
                            break;

                        case "100006":
                            if (lastDepartmentPercentage.Select("DepartmentDefineCode='100006'").Length != 0)
                            {
                                row2["Percentage"] = (decimal)lastDepartmentPercentage.Select("DepartmentDefineCode='100006'")[0]["Percentage"];
                            }
                            text13 = MathRule.GetDecimalNoPointShowString(((Convert.ToDecimal(text6) * ((decimal)row2["AdjustCoefficient"])) * ((decimal)row2["Percentage"])) / num);
                            if (text13 == "")
                            {
                                text13 = "0";
                            }
                            break;

                        case "100007":
                            if (lastDepartmentPercentage.Select("DepartmentDefineCode='100007'").Length != 0)
                            {
                                row2["Percentage"] = (decimal)lastDepartmentPercentage.Select("DepartmentDefineCode='100007'")[0]["Percentage"];
                            }
                            text14 = MathRule.GetDecimalNoPointShowString(((Convert.ToDecimal(text7) * ((decimal)row2["AdjustCoefficient"])) * ((decimal)row2["Percentage"])) / num);
                            if (text14 == "")
                            {
                                text14 = "0";
                            }
                            break;
                        }
                    }
                }
                return(MathRule.GetDecimalNoPointShowString((((((Convert.ToDecimal(decimalNoPointShowString) + Convert.ToDecimal(text9)) + Convert.ToDecimal(text10)) + Convert.ToDecimal(text11)) + Convert.ToDecimal(text12)) + Convert.ToDecimal(text13)) + Convert.ToDecimal(text14)));
            }
            catch
            {
                return("");
            }
        }