Example #1
0
        public static string GetGradePoint(string DepartmentCode, string GradeMessageCode, string MainDefineCode)
        {
            GradeList list = new GradeList();

            if ((GradeMessageCode != "") && (GradeMessageCode != null))
            {
                list.GradeMessageCode = GradeMessageCode;
            }
            if ((DepartmentCode != "") && (DepartmentCode != null))
            {
                list.DepartmentDefineCode = DepartmentCode;
            }
            DataTable grades = list.GetGrades();
            DataTable lastConsiderPercentage = new GradeConsiderPercentage().GetLastConsiderPercentage(GradeMessageCode, MainDefineCode);
            decimal   num = 0M;

            if (list != null)
            {
                for (int i = 0; i < grades.Rows.Count; i++)
                {
                    if ((lastConsiderPercentage != null) && (lastConsiderPercentage.Rows.Count != 0))
                    {
                        num += (Convert.ToDecimal(grades.Rows[i]["GradeValue"]) * Convert.ToDecimal(lastConsiderPercentage.Select("ConsiderDiathesisCode='" + grades.Rows[i]["ConsiderDiathesisCode"].ToString() + "'")[0]["Percentage"])) * 10M;
                    }
                    else
                    {
                        num += Convert.ToDecimal(grades.Rows[i]["GradeValue"]);
                    }
                }
            }
            return(num.ToString("N0"));
        }
Example #2
0
        public DataTable GetLastConsiderPercentage(string supplierCode, string GradeMessageCode, string MainDefineCode)
        {
            GradeConsiderPercentage percentage;
            DataTable table = new DataTable();

            if (GradeMessageCode != "")
            {
                percentage = new GradeConsiderPercentage();
                percentage.GradeMessageCode = "'" + GradeMessageCode + "'";
                percentage.MainDefineCode   = MainDefineCode;
                percentage.dao = this.dao;
                return(percentage.GetGradeConsiderPercentages());
            }
            GradeMessage message = new GradeMessage();

            message.dao            = this.dao;
            message.SupplierCode   = supplierCode;
            message.MainDefineCode = MainDefineCode;
            DataTable gradeMessages = new DataTable();

            gradeMessages = message.GetGradeMessages();
            string text = "";
            int    num  = 0;

            if (gradeMessages != null)
            {
                foreach (DataRow row in gradeMessages.Select())
                {
                    if (num != (gradeMessages.Rows.Count - 1))
                    {
                        text = text + "'" + row["GradeMessageCode"].ToString() + "',";
                    }
                    else
                    {
                        text = text + "'" + row["GradeMessageCode"].ToString() + "'";
                    }
                    num++;
                }
            }
            percentage = new GradeConsiderPercentage();
            percentage.GradeMessageCode = text;
            percentage.MainDefineCode   = MainDefineCode;
            percentage.dao = this.dao;
            return(percentage.GetGradeConsiderPercentages());
        }
Example #3
0
        public string GetAdjustCoefficient(string DepartmentCode, string GradeMessageCode, string MainDefineCode)
        {
            DataTable localConsiderDepartments = this.GetLocalConsiderDepartments();
            decimal   num = 0M;
            GradeConsiderPercentage percentage = new GradeConsiderPercentage();

            percentage.dao = this.dao;
            DataTable lastConsiderPercentage = percentage.GetLastConsiderPercentage(GradeMessageCode, MainDefineCode);

            foreach (DataRow row in localConsiderDepartments.Select("DepartmentDefineCode='" + DepartmentCode + "' and flag='0'"))
            {
                if (lastConsiderPercentage.Select("ConsiderDiathesisCode='" + row["ConsiderDiathesisCode"] + "'").Length != 0)
                {
                    num += Convert.ToDecimal(lastConsiderPercentage.Select("ConsiderDiathesisCode='" + row["ConsiderDiathesisCode"] + "'")[0]["Percentage"]);
                }
            }
            decimal num2 = 0M;

            if (Convert.ToDecimal((decimal)(1M - num)) != 0M)
            {
                num2 = 1M / (1M - num);
            }
            return(num2.ToString());
        }