private void BindZhuZuoData()
 {
     WFModel        = WFBll.GetModel("学术著作");
     txtDigit2.Text = WFModel.Digit2.ToString();
     txtDigit1.Text = WFModel.Digit1.ToString();
     txtDigit3.Text = WFModel.Digit3.ToString();
     lblDigit2.Text = WFModel.Digit2.ToString();
 }
Example #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public ZQUSR.Model.sr_WordsFunds GetModel(int PK_WFID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 PK_WFID,Sort,Type,Digit1,Digit2,Digit3,Digit4,Digit5,Digit6,Digit7 from sr_WordsFunds ");
            strSql.Append(" where PK_WFID=@PK_WFID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@PK_WFID", SqlDbType.Int, 4)
            };
            parameters[0].Value = PK_WFID;

            ZQUSR.Model.sr_WordsFunds model = new ZQUSR.Model.sr_WordsFunds();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["PK_WFID"].ToString() != "")
                {
                    model.PK_WFID = int.Parse(ds.Tables[0].Rows[0]["PK_WFID"].ToString());
                }
                model.Sort = ds.Tables[0].Rows[0]["Sort"].ToString();
                model.Type = ds.Tables[0].Rows[0]["Type"].ToString();
                if (ds.Tables[0].Rows[0]["Digit1"].ToString() != "")
                {
                    model.Digit1 = decimal.Parse(ds.Tables[0].Rows[0]["Digit1"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Digit2"].ToString() != "")
                {
                    model.Digit2 = decimal.Parse(ds.Tables[0].Rows[0]["Digit2"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Digit3"].ToString() != "")
                {
                    model.Digit3 = decimal.Parse(ds.Tables[0].Rows[0]["Digit3"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Digit4"].ToString() != "")
                {
                    model.Digit4 = decimal.Parse(ds.Tables[0].Rows[0]["Digit4"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Digit5"].ToString() != "")
                {
                    model.Digit5 = decimal.Parse(ds.Tables[0].Rows[0]["Digit5"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Digit6"].ToString() != "")
                {
                    model.Digit6 = decimal.Parse(ds.Tables[0].Rows[0]["Digit6"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Digit7"].ToString() != "")
                {
                    model.Digit7 = decimal.Parse(ds.Tables[0].Rows[0]["Digit7"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Example #3
0
        /// <summary>
        ///  科研项目:计算经费分用  ——By Jianguo Fung
        /// </summary>
        /// <returns></returns>
        public ZQUSR.Model.sr_WordsFunds GetModel(string Sort, string Type)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 Digit1,Digit2,Digit3,Digit4,Digit5,Digit6,Digit7 from sr_WordsFunds ");
            strSql.Append(" where Sort=@Sort ");
            strSql.Append(" and Type=@Type ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Sort", SqlDbType.NVarChar, 10),
                new SqlParameter("@Type", SqlDbType.NVarChar, 10)
            };
            parameters[0].Value = Sort;
            parameters[1].Value = Type;

            ZQUSR.Model.sr_WordsFunds model = new ZQUSR.Model.sr_WordsFunds();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["Digit1"].ToString() != "")
                {
                    model.Digit1 = decimal.Parse(ds.Tables[0].Rows[0]["Digit1"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Digit2"].ToString() != "")
                {
                    model.Digit2 = decimal.Parse(ds.Tables[0].Rows[0]["Digit2"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Digit3"].ToString() != "")
                {
                    model.Digit3 = decimal.Parse(ds.Tables[0].Rows[0]["Digit3"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Digit4"].ToString() != "")
                {
                    model.Digit4 = decimal.Parse(ds.Tables[0].Rows[0]["Digit4"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Digit5"].ToString() != "")
                {
                    model.Digit5 = decimal.Parse(ds.Tables[0].Rows[0]["Digit5"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Digit6"].ToString() != "")
                {
                    model.Digit6 = decimal.Parse(ds.Tables[0].Rows[0]["Digit6"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Digit7"].ToString() != "")
                {
                    model.Digit7 = decimal.Parse(ds.Tables[0].Rows[0]["Digit7"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Example #4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(ZQUSR.Model.sr_WordsFunds model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into sr_WordsFunds(");
            strSql.Append("Sort,Type,Digit1,Digit2,Digit3,Digit4,Digit5,Digit6,Digit7)");
            strSql.Append(" values (");
            strSql.Append("@Sort,@Type,@Digit1,@Digit2,@Digit3,@Digit4,@Digit5,@Digit6,@Digit7)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Sort",   SqlDbType.NVarChar, 10),
                new SqlParameter("@Type",   SqlDbType.NVarChar, 10),
                new SqlParameter("@Digit1", SqlDbType.Float,     8),
                new SqlParameter("@Digit2", SqlDbType.Float,     8),
                new SqlParameter("@Digit3", SqlDbType.Float,     8),
                new SqlParameter("@Digit4", SqlDbType.Float,     8),
                new SqlParameter("@Digit5", SqlDbType.Float,     8),
                new SqlParameter("@Digit6", SqlDbType.Float,     8),
                new SqlParameter("@Digit7", SqlDbType.Float, 8)
            };
            parameters[0].Value = model.Sort;
            parameters[1].Value = model.Type;
            parameters[2].Value = model.Digit1;
            parameters[3].Value = model.Digit2;
            parameters[4].Value = model.Digit3;
            parameters[5].Value = model.Digit4;
            parameters[6].Value = model.Digit5;
            parameters[7].Value = model.Digit6;
            parameters[8].Value = model.Digit7;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(1);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Example #5
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(ZQUSR.Model.sr_WordsFunds model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update sr_WordsFunds set ");
            strSql.Append("Sort=@Sort,");
            strSql.Append("Type=@Type,");
            strSql.Append("Digit1=@Digit1,");
            strSql.Append("Digit2=@Digit2,");
            strSql.Append("Digit3=@Digit3,");
            strSql.Append("Digit4=@Digit4,");
            strSql.Append("Digit5=@Digit5,");
            strSql.Append("Digit6=@Digit6,");
            strSql.Append("Digit7=@Digit7");
            strSql.Append(" where PK_WFID=@PK_WFID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@PK_WFID", SqlDbType.Int,       4),
                new SqlParameter("@Sort",    SqlDbType.NVarChar, 10),
                new SqlParameter("@Type",    SqlDbType.NVarChar, 10),
                new SqlParameter("@Digit1",  SqlDbType.Float,     8),
                new SqlParameter("@Digit2",  SqlDbType.Float,     8),
                new SqlParameter("@Digit3",  SqlDbType.Float,     8),
                new SqlParameter("@Digit4",  SqlDbType.Float,     8),
                new SqlParameter("@Digit5",  SqlDbType.Float,     8),
                new SqlParameter("@Digit6",  SqlDbType.Float,     8),
                new SqlParameter("@Digit7",  SqlDbType.Float, 8)
            };
            parameters[0].Value = model.PK_WFID;
            parameters[1].Value = model.Sort;
            parameters[2].Value = model.Type;
            parameters[3].Value = model.Digit1;
            parameters[4].Value = model.Digit2;
            parameters[5].Value = model.Digit3;
            parameters[6].Value = model.Digit4;
            parameters[7].Value = model.Digit5;
            parameters[8].Value = model.Digit6;
            parameters[9].Value = model.Digit7;

            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
Example #6
0
        /// <summary>
        /// 更新学术著作的字数分设置 -By Jianguo Fung
        /// </summary>
        /// <param name="model"></param>
        public void UpdateZhuZuo(ZQUSR.Model.sr_WordsFunds model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update sr_WordsFunds set ");
            strSql.Append("Digit1=@Digit1,");
            strSql.Append("Digit2=@Digit2,");
            strSql.Append("Digit3=@Digit3 ");
            strSql.Append(" where Sort=@Sort ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Digit1", SqlDbType.Float,    8),
                new SqlParameter("@Digit2", SqlDbType.Float,    8),
                new SqlParameter("@Digit3", SqlDbType.Float,    8),
                new SqlParameter("@Sort",   SqlDbType.NVarChar, 10)
            };
            parameters[0].Value = model.Digit1;
            parameters[1].Value = model.Digit2;
            parameters[2].Value = model.Digit3;
            parameters[3].Value = model.Sort;

            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
        private void BindKeJiData()
        {
            WFModel        = WFBll.GetModel("科研项目", "纵向科技项目");
            TextBox2.Text  = WFModel.Digit1.ToString();
            TextBox1.Text  = WFModel.Digit2.ToString();
            TextBox4.Text  = WFModel.Digit2.ToString();
            Label1.Text    = WFModel.Digit2.ToString();
            TextBox6.Text  = WFModel.Digit3.ToString();
            TextBox5.Text  = WFModel.Digit4.ToString();
            TextBox8.Text  = WFModel.Digit4.ToString();
            Label2.Text    = WFModel.Digit4.ToString();
            TextBox10.Text = WFModel.Digit5.ToString();
            TextBox9.Text  = WFModel.Digit6.ToString();
            TextBox12.Text = WFModel.Digit6.ToString();
            Label3.Text    = WFModel.Digit6.ToString();
            TextBox13.Text = WFModel.Digit7.ToString();

            WFModel        = WFBll.GetModel("科研项目", "横向科技项目");
            TextBox3.Text  = WFModel.Digit1.ToString();
            TextBox7.Text  = WFModel.Digit3.ToString();
            TextBox11.Text = WFModel.Digit5.ToString();
            TextBox14.Text = WFModel.Digit7.ToString();
        }
        private void BindSheKeData()
        {
            WFModel        = WFBll.GetModel("科研项目", "纵向社科项目");
            TextBox16.Text = WFModel.Digit1.ToString();
            TextBox15.Text = WFModel.Digit2.ToString();
            TextBox18.Text = WFModel.Digit2.ToString();
            Label4.Text    = WFModel.Digit2.ToString();
            TextBox20.Text = WFModel.Digit3.ToString();
            TextBox19.Text = WFModel.Digit4.ToString();
            TextBox22.Text = WFModel.Digit4.ToString();
            Label5.Text    = WFModel.Digit4.ToString();
            TextBox24.Text = WFModel.Digit5.ToString();
            TextBox23.Text = WFModel.Digit6.ToString();
            TextBox26.Text = WFModel.Digit6.ToString();
            Label6.Text    = WFModel.Digit6.ToString();
            TextBox27.Text = WFModel.Digit7.ToString();

            WFModel        = WFBll.GetModel("科研项目", "横向社科项目");
            TextBox17.Text = WFModel.Digit1.ToString();
            TextBox21.Text = WFModel.Digit3.ToString();
            TextBox25.Text = WFModel.Digit5.ToString();
            TextBox28.Text = WFModel.Digit7.ToString();
        }
Example #9
0
        /// <summary>
        /// �õ�һ������ʵ��
        /// </summary>
        public ZQUSR.Model.sr_WordsFunds GetModel(int PK_WFID)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 PK_WFID,Sort,Type,Digit1,Digit2,Digit3,Digit4,Digit5,Digit6,Digit7 from sr_WordsFunds ");
            strSql.Append(" where PK_WFID=@PK_WFID ");
            SqlParameter[] parameters = {
                    new SqlParameter("@PK_WFID", SqlDbType.Int,4)};
            parameters[0].Value = PK_WFID;

            ZQUSR.Model.sr_WordsFunds model = new ZQUSR.Model.sr_WordsFunds();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["PK_WFID"].ToString() != "")
                {
                    model.PK_WFID = int.Parse(ds.Tables[0].Rows[0]["PK_WFID"].ToString());
                }
                model.Sort = ds.Tables[0].Rows[0]["Sort"].ToString();
                model.Type = ds.Tables[0].Rows[0]["Type"].ToString();
                if (ds.Tables[0].Rows[0]["Digit1"].ToString() != "")
                {
                    model.Digit1 = decimal.Parse(ds.Tables[0].Rows[0]["Digit1"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Digit2"].ToString() != "")
                {
                    model.Digit2 = decimal.Parse(ds.Tables[0].Rows[0]["Digit2"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Digit3"].ToString() != "")
                {
                    model.Digit3 = decimal.Parse(ds.Tables[0].Rows[0]["Digit3"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Digit4"].ToString() != "")
                {
                    model.Digit4 = decimal.Parse(ds.Tables[0].Rows[0]["Digit4"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Digit5"].ToString() != "")
                {
                    model.Digit5 = decimal.Parse(ds.Tables[0].Rows[0]["Digit5"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Digit6"].ToString() != "")
                {
                    model.Digit6 = decimal.Parse(ds.Tables[0].Rows[0]["Digit6"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Digit7"].ToString() != "")
                {
                    model.Digit7 = decimal.Parse(ds.Tables[0].Rows[0]["Digit7"].ToString());
                }
                return model;
            }
            else
            {
                return null;
            }
        }
Example #10
0
 private void BindZhuZuoData()
 {
     WFModel = WFBll.GetModel("学术著作");
     txtDigit2.Text = WFModel.Digit2.ToString();
     txtDigit1.Text = WFModel.Digit1.ToString();
     txtDigit3.Text = WFModel.Digit3.ToString();
     lblDigit2.Text = WFModel.Digit2.ToString();
 }
        protected void btnOK_Click(object sender, EventArgs e)
        {
            decimal decLevelFactor = Convert.ToDecimal(txtLevelFactor.Text);  //级别分系数
            string  strJiBie       = ddlJiBie.SelectedValue;                  //级别

            int     intScore      = LevelScoresBll.GetScoreByJiBie(strJiBie); //根据级别得到对应的级别分数
            decimal decJiBieScore = intScore * decLevelFactor;                //级别分

            string strID     = lblSRID.Text.Trim();
            string strResult = strID.Substring(0, 2);

            if (strResult == "LW")  //学术论文
            {
                decimal decPerScore = 0;
                LZJModel = LZJBll.GetModel(strID);
                int intRank       = Convert.ToInt32(LZJModel.Rank);
                int intPopulation = Convert.ToInt32(LZJModel.Population);

                //根据完成人数和完成成果排名返回对应的得分比例
                Cal2Model = Cal2Bll.GetScoreScale(intPopulation, intRank);
                if (Cal2Model != null)
                {
                    string   strScale = Cal2Model.ScoreScale;
                    string[] str      = strScale.Split('/');
                    int      int1     = int.Parse(str[0]);
                    int      int2     = int.Parse(str[1]);
                    decPerScore = decJiBieScore * int1 / int2;
                }

                //更新级别分系数、级别、个人得分
                LZJModel.PK_LZID     = strID;
                LZJModel.LevelFactor = decLevelFactor;
                LZJModel.JiBie       = strJiBie;
                LZJModel.PerScore    = decPerScore;
            }
            else if (strResult == "ZZ") //学术著作
            {
                decimal decPerScore = 0;
                LZJModel = LZJBll.GetModel(strID);
                int intRank       = Convert.ToInt32(LZJModel.Rank);
                int intPopulation = Convert.ToInt32(LZJModel.Population);

                //计算字数分
                decimal decWord = Convert.ToDecimal(LZJModel.Word);
                WordsFundsModel = WordsFundsBll.GetModel("学术著作");
                decimal decWordScore = 0;   //字数分
                if (decWord <= WordsFundsModel.Digit2)
                {
                    decWordScore = decWord * Convert.ToDecimal(WordsFundsModel.Digit1);
                }
                else if (decWord > WordsFundsModel.Digit2)
                {
                    decWordScore = Convert.ToDecimal(WordsFundsModel.Digit2) * Convert.ToDecimal(WordsFundsModel.Digit1) + Convert.ToDecimal(decWord - WordsFundsModel.Digit2) * Convert.ToDecimal(WordsFundsModel.Digit3);
                }

                //根据完成人数和完成成果排名返回对应的得分比例
                Cal2Model = Cal2Bll.GetScoreScale(intPopulation, intRank);
                if (Cal2Model != null)
                {
                    string   strScale = Cal2Model.ScoreScale;
                    string[] str      = strScale.Split('/');
                    int      int1     = int.Parse(str[0]);
                    int      int2     = int.Parse(str[1]);
                    decPerScore = (decJiBieScore + decWordScore) * int1 / int2;
                }

                //更新级别分系数、级别、个人得分
                LZJModel.PK_LZID     = strID;
                LZJModel.LevelFactor = decLevelFactor;
                LZJModel.JiBie       = strJiBie;
                LZJModel.PerScore    = decPerScore;
            }
            else if (strResult == "KY") //科研项目
            {
                decimal decPerScore = 0;
                ProModel = ProBll.GetModel(strID);
                int intRank       = Convert.ToInt32(ProModel.Anchorperson);
                int intPopulation = Convert.ToInt32(ProModel.Population);

                //计算经费分
                decimal decFundScore = 0;
                string  strSmallSort = ProModel.SmallSort;
                string  strType      = ProModel.Type;
                decimal decFunds1    = Convert.ToDecimal(ProModel.Funds1);
                WordsFundsModel = WordsFundsBll.GetModel(strSmallSort, strType);;
                if (decFunds1 <= WordsFundsModel.Digit2)
                {
                    decFundScore = decFunds1 * Convert.ToDecimal(WordsFundsModel.Digit1);
                }
                else if (decFunds1 > WordsFundsModel.Digit2 && decFunds1 <= WordsFundsModel.Digit4)
                {
                    decFundScore = Convert.ToDecimal(WordsFundsModel.Digit2) * Convert.ToDecimal(WordsFundsModel.Digit1) + (decFunds1 - Convert.ToDecimal(WordsFundsModel.Digit2)) * Convert.ToDecimal(WordsFundsModel.Digit3);
                }
                else if (decFunds1 > WordsFundsModel.Digit4 && decFunds1 <= WordsFundsModel.Digit6)
                {
                    decFundScore = Convert.ToDecimal(WordsFundsModel.Digit2) * Convert.ToDecimal(WordsFundsModel.Digit1) + (Convert.ToDecimal(WordsFundsModel.Digit4) - Convert.ToDecimal(WordsFundsModel.Digit2)) * Convert.ToDecimal(WordsFundsModel.Digit3) + (decFunds1 - Convert.ToDecimal(WordsFundsModel.Digit4)) * Convert.ToDecimal(WordsFundsModel.Digit5);
                }
                else if (decFunds1 > 100)
                {
                    decFundScore = Convert.ToDecimal(WordsFundsModel.Digit2) * Convert.ToDecimal(WordsFundsModel.Digit1) + (Convert.ToDecimal(WordsFundsModel.Digit4) - Convert.ToDecimal(WordsFundsModel.Digit2)) * Convert.ToDecimal(WordsFundsModel.Digit3) + (Convert.ToDecimal(WordsFundsModel.Digit6) - Convert.ToDecimal(WordsFundsModel.Digit4)) * Convert.ToDecimal(WordsFundsModel.Digit5) + (decFunds1 - Convert.ToDecimal(WordsFundsModel.Digit6)) * Convert.ToDecimal(WordsFundsModel.Digit7);
                }

                //计算个人得分
                decimal decScale        = Cal3Bll.GetProjectScale("是");
                int     intAnchorperson = Convert.ToInt32(ProModel.Anchorperson);
                if (intAnchorperson == 0)   //是否项目主持人
                {
                    decPerScore = (decJiBieScore + decFundScore) * decScale;
                }
                else
                {
                    decPerScore = (decJiBieScore + decFundScore) * (1 - decScale) / (intPopulation - 1);
                }

                //更新级别分系数、级别、个人得分
                ProModel.PK_PID      = strID;
                ProModel.LevelFactor = decLevelFactor;
                ProModel.JiBie       = strJiBie;
                ProModel.PerScore    = decPerScore;
            }
            else if (strResult == "SB") //项目申报
            {
                decimal decPerScore = 0;
                ProModel = ProBll.GetModel(strID);
                int intRank       = Convert.ToInt32(ProModel.Anchorperson);
                int intPopulation = Convert.ToInt32(ProModel.Population);

                //计算个人得分
                decimal decScale        = Cal3Bll.GetProjectScale("是");
                int     intAnchorperson = Convert.ToInt32(ProModel.Anchorperson);
                if (intAnchorperson == 0)   //是否项目主持人
                {
                    decPerScore = decJiBieScore * decScale;
                }
                else
                {
                    decPerScore = decJiBieScore * (1 - decScale) / (intPopulation - 1);
                }

                //更新级别分系数、级别、个人得分
                ProModel.PK_PID      = strID;
                ProModel.LevelFactor = decLevelFactor;
                ProModel.JiBie       = strJiBie;
                ProModel.PerScore    = decPerScore;
            }
            else  //其他类别
            {
                decimal decPerScore = 0;
                AchievementModel = AchievementBll.GetModel(strID);
                int intRank       = Convert.ToInt32(AchievementModel.Rank);
                int intPopulation = Convert.ToInt32(AchievementModel.Population);

                //根据完成人数和完成成果排名返回对应的得分比例
                Cal2Model = Cal2Bll.GetScoreScale(intPopulation, intRank);
                if (Cal2Model != null)
                {
                    string   strScale = Cal2Model.ScoreScale;
                    string[] str      = strScale.Split('/');
                    int      int1     = int.Parse(str[0]);
                    int      int2     = int.Parse(str[1]);
                    decPerScore = decJiBieScore * int1 / int2;
                }

                //更新级别分系数、级别、个人得分
                AchievementModel.PK_AID      = strID;
                AchievementModel.LevelFactor = decLevelFactor;
                AchievementModel.JiBie       = strJiBie;
                AchievementModel.PerScore    = decPerScore;

                AchievementBll.UpdateJiBie(AchievementModel);
            }

            Response.Write("<script language=javascript>opener.location.reload();window.close();</script>");
        }
Example #12
0
        private void Save(string strAuditState)
        {
            if (Session["UserID"] != null)
            {
                string cmd = Request.QueryString["cmd"].ToString();
                try
                {
                    if (ddlType.SelectedValue == "-1")
                    {
                        MessageBox.Show(this, "请选择著作类型!");
                        ddlType.Focus();
                    }
                    else if (txtTitle.Text == "")
                    {
                        MessageBox.Show(this, "著作名称不能为空!");
                        txtTitle.Focus();
                    }
                    else if (txtUnit.Text == "")
                    {
                        MessageBox.Show(this, "出版单位不能为空!");
                        txtUnit.Focus();
                    }
                    else if (txtTime.Text == "")
                    {
                        MessageBox.Show(this, "出版日期不能为空!");
                        txtTime.Focus();
                    }
                    else if (!PageValidateBll.IsDateTime(txtTime.Text))
                    {
                        MessageBox.Show(this, "出版日期格式不正确!");
                        txtTime.Focus();
                    }
                    else if (ddlSource.SelectedValue == "-1")
                    {
                        MessageBox.Show(this, "请选择来源!");
                        ddlSource.Focus();
                    }
                    //else if (txtISBN.Text == "")
                    //{
                    //    MessageBox.Show(this, "ISBN号不能为空!");
                    //    txtISBN.Focus();
                    //}
                    else if (txtWord.Text == "")
                    {
                        MessageBox.Show(this, "字数不能为空!");
                        txtWord.Focus();
                    }
                    else if (ddlSchoolSign.SelectedValue == "-1")
                    {
                        MessageBox.Show(this, "请选择学校署名排名!");
                        ddlSchoolSign.Focus();
                    }
                    else if (ddlRank.SelectedValue == "-1")
                    {
                        MessageBox.Show(this, "请选择完成成果排名!");
                        ddlRank.Focus();
                    }
                    else
                    {
                        string strLZID = txtLZID.Text;    //著作编号
                        string strUserID = Session["UserID"].ToString();     //用户编号
                        string strBigSort = "科研成果";    //大类别
                        string strSmallSort = "学术著作";    //小类别
                        string strType = ddlType.SelectedItem.Text;     //著作类型
                        string strTitle = txtTitle.Text;    //著作名称
                        DateTime dtAddTime = DateTime.Now;  //提交时间
                        string strUnit = txtUnit.Text;  //出版单位
                        string strSource = ddlSource.SelectedItem.Text;  //来源
                        DateTime dtPublishTime = Convert.ToDateTime(txtTime.Text);  //出版日期
                        //string strNumber = txtISBN.Text;   //ISBN号
                        int intRank = Convert.ToInt32(ddlRank.SelectedValue);   //完成成果排名
                        string strSchoolSign = ddlSchoolSign.SelectedItem.Text;     //学校署名排名
                        decimal decWord = decimal.Parse(txtWord.Text);  //字数
                        string strRemark = txtRemark.Text;  //备注

                        LZJModel.PK_LZID = strLZID;     //著作编号
                        LZJModel.FK_UserID = strUserID;     //用户编号
                        LZJModel.BigSort = strBigSort;      //大类别
                        LZJModel.SmallSort = strSmallSort;    //小类别
                        LZJModel.Type = strType;     //著作类型
                        LZJModel.Title = strTitle;    //著作名称
                        LZJModel.Unit = strUnit;  //出版单位
                        LZJModel.Source = strSource;  //来源
                        LZJModel.PublishTime = dtPublishTime;  //出版日期
                        //LZJModel.Number1 = strNumber;   //ISBN号
                        LZJModel.Rank = intRank;   //完成成果排名
                        LZJModel.SchoolSign = strSchoolSign;     //学校署名排名
                        LZJModel.Word = decWord;  //字数
                        LZJModel.Remark = strRemark;  //备注
                        LZJModel.AddTime = dtAddTime;  //提交时间
                        LZJModel.AuditState = strAuditState;  //审核状态

                        //计算级别分
                        EvaluateModel = EvaluateBll.GetZhuZuoJiBie(LZJModel);
                        string strJiBie = "";   //级别
                        decimal decLevelFactor = 0;     //级别分系数
                        decimal decJiBieScore = 0;      //级别分

                        if (EvaluateModel != null)
                        {
                            strJiBie = EvaluateModel.JiBie;
                            decLevelFactor = Convert.ToDecimal(EvaluateModel.LevelFactor);
                            LZJModel.JiBie = strJiBie;  //级别
                            LZJModel.LevelFactor = decLevelFactor;  //级别分系数

                            int intScore = LevelScoresBll.GetScoreByJiBie(strJiBie);    //根据级别得到对应的级别分数
                            decJiBieScore = intScore * decLevelFactor;  //级别分
                        }

                        //计算字数分
                        WordsFundsModel = WordsFundsBll.GetModel("学术著作");
                        decimal decWordScore = 0;
                        if (decWord <= WordsFundsModel.Digit2)
                        {
                            decWordScore = decWord * Convert.ToDecimal(WordsFundsModel.Digit1);
                        }
                        else if (decWord > WordsFundsModel.Digit2)
                        {
                            decWordScore = Convert.ToDecimal(WordsFundsModel.Digit2) * Convert.ToDecimal(WordsFundsModel.Digit1) + Convert.ToDecimal(decWord - WordsFundsModel.Digit2) * Convert.ToDecimal(WordsFundsModel.Digit3);
                        }

                        //计算成果个人得分
                        int intPopulation = 1;      //完成人数
                        string strAllAuthor = "";   //参与作者
                        decimal decPerScore = 0;    //个人得分
                        //根据完成成果排名判断是否为多人合作,若是则按多人合作个人所占比例规则计算得分
                        //若否则成果总得分即为个人得分
                        if (!(intRank == -1 || intRank == 0))
                        {
                            if (txtPopulation.Text == "")
                            {
                                MessageBox.Show(this, "完成人数不能为空!");
                                txtPopulation.Focus();
                            }
                            else if (!PageValidateBll.IsNumber(txtPopulation.Text))
                            {
                                MessageBox.Show(this, "完成人数只能填写数字!");
                                txtPopulation.Focus();
                            }
                            else if (txtAllAuthor.Text == "")
                            {
                                MessageBox.Show(this, "参与作者不能为空!");
                                txtAllAuthor.Focus();
                            }
                            else
                            {
                                intPopulation = Convert.ToInt32(txtPopulation.Text);
                                strAllAuthor = txtAllAuthor.Text;
                                //根据完成人数和完成成果排名返回对应的得分比例
                                Cal2Model = Cal2Bll.GetScoreScale(intPopulation, intRank);
                                if (Cal2Model != null)
                                {
                                    string strScale = Cal2Model.ScoreScale;
                                    string[] str = strScale.Split('/');
                                    int int1 = int.Parse(str[0]);
                                    int int2 = int.Parse(str[1]);
                                    decPerScore = (decJiBieScore + decWordScore) * int1 / int2;   //个人得分=(级别分+字数分) * 比例

                                    LZJModel.Population = intPopulation;    //完成人数
                                    LZJModel.AllAuthor = strAllAuthor;  //参与作者
                                    LZJModel.PerScore = decPerScore;    //个人得分

                                    if (cmd == "add")   //新增
                                    {
                                        if (!LZJBll.Exists(strLZID))
                                        {
                                            LZJBll.Add(LZJModel);
                                        }
                                        else
                                        {
                                            MessageBox.Show(this, "已经存在该记录产!");
                                        }
                                    }
                                    if (cmd == "modify")  //修改
                                    {
                                        LZJBll.Update(LZJModel);
                                    }
                                    Response.Redirect("ZhuZuo_List.aspx");
                                }
                            }
                        }
                        else
                        {
                            decPerScore = decJiBieScore + decWordScore;
                            LZJModel.Population = intPopulation;    //完成人数
                            LZJModel.AllAuthor = strAllAuthor;  //参与作者
                            LZJModel.PerScore = decPerScore;    //个人得分

                            if (cmd == "add")   //新增
                            {
                                if (!LZJBll.Exists(strLZID))
                                {
                                    LZJBll.Add(LZJModel);
                                }
                                else
                                {
                                    MessageBox.Show(this, "已经存在该记录产!");
                                }
                            }
                            if (cmd == "modify")  //修改
                            {
                                LZJBll.Update(LZJModel);
                            }
                            Response.Redirect("ZhuZuo_List.aspx");
                        }
                    }
                }
                catch (Exception ex)
                {

                    throw ex;
                }
            }
            else
            {
                Response.Write("<script language=javascript>alert('您已经与服务器断开连接,请重新登录!');window.location.href='~/../../login.aspx';</script>");
            }
        }
Example #13
0
        private void Save(string strAuditState)
        {
            if (Session["UserID"] != null)
            {
                string cmd = Request.QueryString["cmd"].ToString();
                try
                {
                    if (ddlType.SelectedValue == "-1")
                    {
                        MessageBox.Show(this, "请选择著作类型!");
                        ddlType.Focus();
                    }
                    else if (txtTitle.Text == "")
                    {
                        MessageBox.Show(this, "著作名称不能为空!");
                        txtTitle.Focus();
                    }
                    else if (txtUnit.Text == "")
                    {
                        MessageBox.Show(this, "出版单位不能为空!");
                        txtUnit.Focus();
                    }
                    else if (txtTime.Text == "")
                    {
                        MessageBox.Show(this, "出版日期不能为空!");
                        txtTime.Focus();
                    }
                    else if (!PageValidateBll.IsDateTime(txtTime.Text))
                    {
                        MessageBox.Show(this, "出版日期格式不正确!");
                        txtTime.Focus();
                    }
                    else if (ddlSource.SelectedValue == "-1")
                    {
                        MessageBox.Show(this, "请选择来源!");
                        ddlSource.Focus();
                    }
                    //else if (txtISBN.Text == "")
                    //{
                    //    MessageBox.Show(this, "ISBN号不能为空!");
                    //    txtISBN.Focus();
                    //}
                    else if (txtWord.Text == "")
                    {
                        MessageBox.Show(this, "字数不能为空!");
                        txtWord.Focus();
                    }
                    else if (ddlSchoolSign.SelectedValue == "-1")
                    {
                        MessageBox.Show(this, "请选择学校署名排名!");
                        ddlSchoolSign.Focus();
                    }
                    else if (ddlRank.SelectedValue == "-1")
                    {
                        MessageBox.Show(this, "请选择完成成果排名!");
                        ddlRank.Focus();
                    }
                    else
                    {
                        string   strLZID       = txtLZID.Text;                          //著作编号
                        string   strUserID     = Session["UserID"].ToString();          //用户编号
                        string   strBigSort    = "科研成果";                                //大类别
                        string   strSmallSort  = "学术著作";                                //小类别
                        string   strType       = ddlType.SelectedItem.Text;             //著作类型
                        string   strTitle      = txtTitle.Text;                         //著作名称
                        DateTime dtAddTime     = DateTime.Now;                          //提交时间
                        string   strUnit       = txtUnit.Text;                          //出版单位
                        string   strSource     = ddlSource.SelectedItem.Text;           //来源
                        DateTime dtPublishTime = Convert.ToDateTime(txtTime.Text);      //出版日期
                        //string strNumber = txtISBN.Text;   //ISBN号
                        int     intRank       = Convert.ToInt32(ddlRank.SelectedValue); //完成成果排名
                        string  strSchoolSign = ddlSchoolSign.SelectedItem.Text;        //学校署名排名
                        decimal decWord       = decimal.Parse(txtWord.Text);            //字数
                        string  strRemark     = txtRemark.Text;                         //备注

                        LZJModel.PK_LZID     = strLZID;                                 //著作编号
                        LZJModel.FK_UserID   = strUserID;                               //用户编号
                        LZJModel.BigSort     = strBigSort;                              //大类别
                        LZJModel.SmallSort   = strSmallSort;                            //小类别
                        LZJModel.Type        = strType;                                 //著作类型
                        LZJModel.Title       = strTitle;                                //著作名称
                        LZJModel.Unit        = strUnit;                                 //出版单位
                        LZJModel.Source      = strSource;                               //来源
                        LZJModel.PublishTime = dtPublishTime;                           //出版日期
                        //LZJModel.Number1 = strNumber;   //ISBN号
                        LZJModel.Rank       = intRank;                                  //完成成果排名
                        LZJModel.SchoolSign = strSchoolSign;                            //学校署名排名
                        LZJModel.Word       = decWord;                                  //字数
                        LZJModel.Remark     = strRemark;                                //备注
                        LZJModel.AddTime    = dtAddTime;                                //提交时间
                        LZJModel.AuditState = strAuditState;                            //审核状态

                        //计算级别分
                        EvaluateModel = EvaluateBll.GetZhuZuoJiBie(LZJModel);
                        string  strJiBie       = ""; //级别
                        decimal decLevelFactor = 0;  //级别分系数
                        decimal decJiBieScore  = 0;  //级别分

                        if (EvaluateModel != null)
                        {
                            strJiBie             = EvaluateModel.JiBie;
                            decLevelFactor       = Convert.ToDecimal(EvaluateModel.LevelFactor);
                            LZJModel.JiBie       = strJiBie;                         //级别
                            LZJModel.LevelFactor = decLevelFactor;                   //级别分系数

                            int intScore = LevelScoresBll.GetScoreByJiBie(strJiBie); //根据级别得到对应的级别分数
                            decJiBieScore = intScore * decLevelFactor;               //级别分
                        }

                        //计算字数分
                        WordsFundsModel = WordsFundsBll.GetModel("学术著作");
                        decimal decWordScore = 0;
                        if (decWord <= WordsFundsModel.Digit2)
                        {
                            decWordScore = decWord * Convert.ToDecimal(WordsFundsModel.Digit1);
                        }
                        else if (decWord > WordsFundsModel.Digit2)
                        {
                            decWordScore = Convert.ToDecimal(WordsFundsModel.Digit2) * Convert.ToDecimal(WordsFundsModel.Digit1) + Convert.ToDecimal(decWord - WordsFundsModel.Digit2) * Convert.ToDecimal(WordsFundsModel.Digit3);
                        }


                        //计算成果个人得分
                        int     intPopulation = 1;  //完成人数
                        string  strAllAuthor  = ""; //参与作者
                        decimal decPerScore   = 0;  //个人得分
                        //根据完成成果排名判断是否为多人合作,若是则按多人合作个人所占比例规则计算得分
                        //若否则成果总得分即为个人得分
                        if (!(intRank == -1 || intRank == 0))
                        {
                            if (txtPopulation.Text == "")
                            {
                                MessageBox.Show(this, "完成人数不能为空!");
                                txtPopulation.Focus();
                            }
                            else if (!PageValidateBll.IsNumber(txtPopulation.Text))
                            {
                                MessageBox.Show(this, "完成人数只能填写数字!");
                                txtPopulation.Focus();
                            }
                            else if (txtAllAuthor.Text == "")
                            {
                                MessageBox.Show(this, "参与作者不能为空!");
                                txtAllAuthor.Focus();
                            }
                            else
                            {
                                intPopulation = Convert.ToInt32(txtPopulation.Text);
                                strAllAuthor  = txtAllAuthor.Text;
                                //根据完成人数和完成成果排名返回对应的得分比例
                                Cal2Model = Cal2Bll.GetScoreScale(intPopulation, intRank);
                                if (Cal2Model != null)
                                {
                                    string   strScale = Cal2Model.ScoreScale;
                                    string[] str      = strScale.Split('/');
                                    int      int1     = int.Parse(str[0]);
                                    int      int2     = int.Parse(str[1]);
                                    decPerScore = (decJiBieScore + decWordScore) * int1 / int2; //个人得分=(级别分+字数分) * 比例

                                    LZJModel.Population = intPopulation;                        //完成人数
                                    LZJModel.AllAuthor  = strAllAuthor;                         //参与作者
                                    LZJModel.PerScore   = decPerScore;                          //个人得分

                                    if (cmd == "add")                                           //新增
                                    {
                                        if (!LZJBll.Exists(strLZID))
                                        {
                                            LZJBll.Add(LZJModel);
                                        }
                                        else
                                        {
                                            MessageBox.Show(this, "已经存在该记录产!");
                                        }
                                    }
                                    if (cmd == "modify")  //修改
                                    {
                                        LZJBll.Update(LZJModel);
                                    }
                                    Response.Redirect("ZhuZuo_List.aspx");
                                }
                            }
                        }
                        else
                        {
                            decPerScore         = decJiBieScore + decWordScore;
                            LZJModel.Population = intPopulation; //完成人数
                            LZJModel.AllAuthor  = strAllAuthor;  //参与作者
                            LZJModel.PerScore   = decPerScore;   //个人得分

                            if (cmd == "add")                    //新增
                            {
                                if (!LZJBll.Exists(strLZID))
                                {
                                    LZJBll.Add(LZJModel);
                                }
                                else
                                {
                                    MessageBox.Show(this, "已经存在该记录产!");
                                }
                            }
                            if (cmd == "modify")  //修改
                            {
                                LZJBll.Update(LZJModel);
                            }
                            Response.Redirect("ZhuZuo_List.aspx");
                        }
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            else
            {
                Response.Write("<script language=javascript>alert('您已经与服务器断开连接,请重新登录!');window.location.href='~/../../login.aspx';</script>");
            }
        }
Example #14
0
        /// <summary>
        ///  ������Ŀ�����㾭�ѷ���  ����By Jianguo Fung
        /// </summary>
        /// <returns></returns>
        public ZQUSR.Model.sr_WordsFunds GetModel(string Sort, string Type)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 Digit1,Digit2,Digit3,Digit4,Digit5,Digit6,Digit7 from sr_WordsFunds ");
            strSql.Append(" where Sort=@Sort ");
            strSql.Append(" and Type=@Type ");
            SqlParameter[] parameters = {
                    new SqlParameter("@Sort", SqlDbType.NVarChar,10),
                    new SqlParameter("@Type", SqlDbType.NVarChar,10)};
            parameters[0].Value = Sort;
            parameters[1].Value = Type;

            ZQUSR.Model.sr_WordsFunds model = new ZQUSR.Model.sr_WordsFunds();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["Digit1"].ToString() != "")
                {
                    model.Digit1 = decimal.Parse(ds.Tables[0].Rows[0]["Digit1"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Digit2"].ToString() != "")
                {
                    model.Digit2 = decimal.Parse(ds.Tables[0].Rows[0]["Digit2"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Digit3"].ToString() != "")
                {
                    model.Digit3 = decimal.Parse(ds.Tables[0].Rows[0]["Digit3"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Digit4"].ToString() != "")
                {
                    model.Digit4 = decimal.Parse(ds.Tables[0].Rows[0]["Digit4"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Digit5"].ToString() != "")
                {
                    model.Digit5 = decimal.Parse(ds.Tables[0].Rows[0]["Digit5"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Digit6"].ToString() != "")
                {
                    model.Digit6 = decimal.Parse(ds.Tables[0].Rows[0]["Digit6"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Digit7"].ToString() != "")
                {
                    model.Digit7 = decimal.Parse(ds.Tables[0].Rows[0]["Digit7"].ToString());
                }
                return model;
            }
            else
            {
                return null;
            }
        }
Example #15
0
        private void BindKeJiData()
        {
            WFModel = WFBll.GetModel("科研项目", "纵向科技项目");
            TextBox2.Text = WFModel.Digit1.ToString();
            TextBox1.Text = WFModel.Digit2.ToString();
            TextBox4.Text = WFModel.Digit2.ToString();
            Label1.Text = WFModel.Digit2.ToString();
            TextBox6.Text = WFModel.Digit3.ToString();
            TextBox5.Text = WFModel.Digit4.ToString();
            TextBox8.Text = WFModel.Digit4.ToString();
            Label2.Text = WFModel.Digit4.ToString();
            TextBox10.Text = WFModel.Digit5.ToString();
            TextBox9.Text = WFModel.Digit6.ToString();
            TextBox12.Text = WFModel.Digit6.ToString();
            Label3.Text = WFModel.Digit6.ToString();
            TextBox13.Text = WFModel.Digit7.ToString();

            WFModel = WFBll.GetModel("科研项目", "横向科技项目");
            TextBox3.Text = WFModel.Digit1.ToString();
            TextBox7.Text = WFModel.Digit3.ToString();
            TextBox11.Text = WFModel.Digit5.ToString();
            TextBox14.Text = WFModel.Digit7.ToString();
        }
Example #16
0
        private void BindSheKeData()
        {
            WFModel = WFBll.GetModel("科研项目", "纵向社科项目");
            TextBox16.Text = WFModel.Digit1.ToString();
            TextBox15.Text = WFModel.Digit2.ToString();
            TextBox18.Text = WFModel.Digit2.ToString();
            Label4.Text = WFModel.Digit2.ToString();
            TextBox20.Text = WFModel.Digit3.ToString();
            TextBox19.Text = WFModel.Digit4.ToString();
            TextBox22.Text = WFModel.Digit4.ToString();
            Label5.Text = WFModel.Digit4.ToString();
            TextBox24.Text = WFModel.Digit5.ToString();
            TextBox23.Text = WFModel.Digit6.ToString();
            TextBox26.Text = WFModel.Digit6.ToString();
            Label6.Text = WFModel.Digit6.ToString();
            TextBox27.Text = WFModel.Digit7.ToString();

            WFModel = WFBll.GetModel("科研项目", "横向社科项目");
            TextBox17.Text = WFModel.Digit1.ToString();
            TextBox21.Text = WFModel.Digit3.ToString();
            TextBox25.Text = WFModel.Digit5.ToString();
            TextBox28.Text = WFModel.Digit7.ToString();
        }
Example #17
0
        private void Save(string strAuditState)
        {
            if (Session["UserID"] != null)
            {
                string cmd = Request.QueryString["cmd"].ToString();
                try
                {
                    if (ddlType.SelectedValue == "-1")
                    {
                        MessageBox.Show(this, "请选择项目类型!");
                        ddlType.Focus();
                    }
                    else if (txtTitle.Text == "")
                    {
                        MessageBox.Show(this, "项目名称不能为空!");
                        txtTitle.Focus();
                    }
                    else if (ddlSource.SelectedValue == "-1")
                    {
                        MessageBox.Show(this, "请选择项目来源!");
                        ddlSource.Focus();
                    }
                    else if (txtFinishTime.Text == "")
                    {
                        MessageBox.Show(this, "项目完成日期不能为空!");
                        txtFinishTime.Focus();
                    }
                    else if (!PageValidateBll.IsDateTime(txtFinishTime.Text))
                    {
                        MessageBox.Show(this, "项目完成日期格式不正确!");
                        txtFinishTime.Focus();
                    }
                    else if (txtFund1.Text == "")
                    {
                        MessageBox.Show(this, "实到经费不能为空!");
                        txtFund1.Focus();
                    }
                    else if (ddlSchoolSign.SelectedValue == "-1")
                    {
                        MessageBox.Show(this, "请选择学校署名排名!");
                        ddlSchoolSign.Focus();
                    }
                    else if (ddlAnchorperson.SelectedValue == "-1")
                    {
                        MessageBox.Show(this, "请选择是否项目主持人!");
                        ddlAnchorperson.Focus();
                    }
                    else if (txtPopulation.Text == "")
                    {
                        MessageBox.Show(this, "完成人数不能为空!");
                        txtPopulation.Focus();
                    }
                    else if (!PageValidateBll.IsNumber(txtPopulation.Text))
                    {
                        MessageBox.Show(this, "完成人数只能填写数字!");
                        txtPopulation.Focus();
                    }
                    else if (txtAllAuthor.Text == "")
                    {
                        MessageBox.Show(this, "参与作者不能为空!");
                        txtAllAuthor.Focus();
                    }
                    else
                    {
                        string   strPID          = txtPID.Text;                                    //项目编号
                        string   strUserID       = Session["UserID"].ToString();                   //用户编号
                        string   strBigSort      = "科研业绩";                                         //大类别
                        string   strSmallSort    = "科研项目";                                         //小类别
                        string   strType         = ddlType.SelectedValue;                          //项目类型
                        string   strTitle        = txtTitle.Text;                                  //项目名称
                        DateTime dtAddTime       = DateTime.Now;                                   //提交时间
                        string   strSource       = ddlSource.SelectedItem.Text;                    //项目来源
                        DateTime dtPublishTime   = Convert.ToDateTime(txtFinishTime.Text);         //项目完成日期
                        decimal  decFunds1       = decimal.Parse(txtFund1.Text);                   //实到经费
                        string   strSchoolSign   = ddlSchoolSign.SelectedItem.Text;                //学校署名排名
                        int      intAnchorPerson = Convert.ToInt32(ddlAnchorperson.SelectedValue); //是否项目主持人
                        int      intPopulation   = Convert.ToInt32(txtPopulation.Text);            //完成人数
                        string   strAllAuthor    = txtAllAuthor.Text;                              //参与作者
                        string   strRemark       = txtRemark.Text;                                 //备注

                        ProModel.PK_PID       = strPID;
                        ProModel.FK_UserID    = strUserID;
                        ProModel.BigSort      = strBigSort;
                        ProModel.SmallSort    = strSmallSort;
                        ProModel.Type         = strType;
                        ProModel.Title        = strTitle;
                        ProModel.AddTime      = dtAddTime;
                        ProModel.Source       = strSource;
                        ProModel.PublishTime1 = dtPublishTime;
                        ProModel.Funds1       = decFunds1;
                        ProModel.Anchorperson = intAnchorPerson;
                        ProModel.Population   = intPopulation;
                        ProModel.AllAuthor    = strAllAuthor;
                        ProModel.SchoolSign   = strSchoolSign;
                        ProModel.Remark       = strRemark;
                        ProModel.AuditState   = strAuditState;

                        //计算级别分
                        EvaluateModel = EvaluateBll.GetXiangMuJiBie(ProModel);
                        string  strJiBie       = ""; //级别
                        decimal decLevelFactor = 0;  //级别分系数
                        decimal decJiBieScore  = 0;  //级别分

                        if (EvaluateModel != null)
                        {
                            strJiBie             = EvaluateModel.JiBie;
                            decLevelFactor       = Convert.ToDecimal(EvaluateModel.LevelFactor);
                            ProModel.JiBie       = strJiBie;                         //级别
                            ProModel.LevelFactor = decLevelFactor;                   //级别分系数

                            int intScore = LevelScoresBll.GetScoreByJiBie(strJiBie); //根据级别得到对应的级别分数
                            decJiBieScore = intScore * decLevelFactor;               //级别分
                        }

                        //计算经费分
                        decimal decFundScore = 0;
                        WordsFundsModel = WordsFundsBll.GetModel(strSmallSort, strType);;
                        if (decFunds1 <= WordsFundsModel.Digit2)
                        {
                            decFundScore = decFunds1 * Convert.ToDecimal(WordsFundsModel.Digit1);
                        }
                        else if (decFunds1 > WordsFundsModel.Digit2 && decFunds1 <= WordsFundsModel.Digit4)
                        {
                            decFundScore = Convert.ToDecimal(WordsFundsModel.Digit2) * Convert.ToDecimal(WordsFundsModel.Digit1) + (decFunds1 - Convert.ToDecimal(WordsFundsModel.Digit2)) * Convert.ToDecimal(WordsFundsModel.Digit3);
                        }
                        else if (decFunds1 > WordsFundsModel.Digit4 && decFunds1 <= WordsFundsModel.Digit6)
                        {
                            decFundScore = Convert.ToDecimal(WordsFundsModel.Digit2) * Convert.ToDecimal(WordsFundsModel.Digit1) + (Convert.ToDecimal(WordsFundsModel.Digit4) - Convert.ToDecimal(WordsFundsModel.Digit2)) * Convert.ToDecimal(WordsFundsModel.Digit3) + (decFunds1 - Convert.ToDecimal(WordsFundsModel.Digit4)) * Convert.ToDecimal(WordsFundsModel.Digit5);
                        }
                        else if (decFunds1 > 100)
                        {
                            decFundScore = Convert.ToDecimal(WordsFundsModel.Digit2) * Convert.ToDecimal(WordsFundsModel.Digit1) + (Convert.ToDecimal(WordsFundsModel.Digit4) - Convert.ToDecimal(WordsFundsModel.Digit2)) * Convert.ToDecimal(WordsFundsModel.Digit3) + (Convert.ToDecimal(WordsFundsModel.Digit6) - Convert.ToDecimal(WordsFundsModel.Digit4)) * Convert.ToDecimal(WordsFundsModel.Digit5) + (decFunds1 - Convert.ToDecimal(WordsFundsModel.Digit6)) * Convert.ToDecimal(WordsFundsModel.Digit7);
                        }

                        //计算个人得分
                        decimal decPerScore = 0;    //个人得分
                        //判断是否多人合作
                        if (intPopulation > 1)
                        {
                            decimal decScale = Cal3Bll.GetProjectScale("是");
                            //是否项目主持人
                            if (ddlAnchorperson.SelectedValue == "0")
                            {
                                decPerScore = (decJiBieScore + decFundScore) * decScale;
                            }
                            else
                            {
                                decPerScore = (decJiBieScore + decFundScore) * (1 - decScale) / (intPopulation - 1);
                            }

                            ProModel.PerScore = decPerScore; //个人得分

                            if (cmd == "add")                //新增
                            {
                                if (!ProBll.Exists(strPID))
                                {
                                    ProBll.Add(ProModel);
                                }
                                else
                                {
                                    MessageBox.Show(this, "已经存在该记录!");
                                }
                            }
                            if (cmd == "modify")  //修改
                            {
                                ProBll.Update(ProModel);
                            }
                            Response.Redirect("Project_List.aspx");
                        }
                        else
                        {
                            decPerScore       = decJiBieScore + decFundScore;
                            ProModel.PerScore = decPerScore; //个人得分

                            if (cmd == "add")                //新增
                            {
                                if (!ProBll.Exists(strPID))
                                {
                                    ProBll.Add(ProModel);
                                }
                                else
                                {
                                    MessageBox.Show(this, "已经存在该记录!");
                                }
                            }
                            if (cmd == "modify")  //修改
                            {
                                ProBll.Update(ProModel);
                            }
                            Response.Redirect("Project_List.aspx");
                        }
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            else
            {
                Response.Write("<script language=javascript>alert('您已经与服务器断开连接,请重新登录!');window.location.href='~/../../login.aspx';</script>");
            }
        }
        private void Save(string strAuditState)
        {
            if (Session["UserID"] != null)
            {
                string cmd = Request.QueryString["cmd"].ToString();
                try
                {
                    if (ddlType.SelectedValue == "-1")
                    {
                        MessageBox.Show(this, "请选择项目类型!");
                        ddlType.Focus();
                    }
                    else if (txtTitle.Text == "")
                    {
                        MessageBox.Show(this, "项目名称不能为空!");
                        txtTitle.Focus();
                    }
                    else if (ddlSource.SelectedValue == "-1")
                    {
                        MessageBox.Show(this, "请选择项目来源!");
                        ddlSource.Focus();
                    }
                    else if (txtFinishTime.Text == "")
                    {
                        MessageBox.Show(this, "项目完成日期不能为空!");
                        txtFinishTime.Focus();
                    }
                    else if (!PageValidateBll.IsDateTime(txtFinishTime.Text))
                    {
                        MessageBox.Show(this, "项目完成日期格式不正确!");
                        txtFinishTime.Focus();
                    }
                    else if (txtFund1.Text == "")
                    {
                        MessageBox.Show(this, "实到经费不能为空!");
                        txtFund1.Focus();
                    }
                    else if (ddlSchoolSign.SelectedValue == "-1")
                    {
                        MessageBox.Show(this, "请选择学校署名排名!");
                        ddlSchoolSign.Focus();
                    }
                    else if (ddlAnchorperson.SelectedValue == "-1")
                    {
                        MessageBox.Show(this, "请选择是否项目主持人!");
                        ddlAnchorperson.Focus();
                    }
                    else if (txtPopulation.Text == "")
                    {
                        MessageBox.Show(this, "完成人数不能为空!");
                        txtPopulation.Focus();
                    }
                    else if (!PageValidateBll.IsNumber(txtPopulation.Text))
                    {
                        MessageBox.Show(this, "完成人数只能填写数字!");
                        txtPopulation.Focus();
                    }
                    else if (txtAllAuthor.Text == "")
                    {
                        MessageBox.Show(this, "参与作者不能为空!");
                        txtAllAuthor.Focus();
                    }
                    else
                    {
                        string strPID = txtPID.Text;    //项目编号
                        string strUserID = Session["UserID"].ToString();     //用户编号
                        string strBigSort = "科研业绩";    //大类别
                        string strSmallSort = "科研项目";    //小类别
                        string strType = ddlType.SelectedValue;     //项目类型
                        string strTitle = txtTitle.Text;    //项目名称
                        DateTime dtAddTime = DateTime.Now;  //提交时间
                        string strSource = ddlSource.SelectedItem.Text;  //项目来源
                        DateTime dtPublishTime = Convert.ToDateTime(txtFinishTime.Text);  //项目完成日期
                        decimal decFunds1 = decimal.Parse(txtFund1.Text);   //实到经费
                        string strSchoolSign = ddlSchoolSign.SelectedItem.Text;     //学校署名排名
                        int intAnchorPerson = Convert.ToInt32(ddlAnchorperson.SelectedValue);   //是否项目主持人
                        int intPopulation = Convert.ToInt32(txtPopulation.Text);    //完成人数
                        string strAllAuthor = txtAllAuthor.Text;    //参与作者
                        string strRemark = txtRemark.Text;  //备注

                        ProModel.PK_PID = strPID;
                        ProModel.FK_UserID = strUserID;
                        ProModel.BigSort = strBigSort;
                        ProModel.SmallSort = strSmallSort;
                        ProModel.Type = strType;
                        ProModel.Title = strTitle;
                        ProModel.AddTime = dtAddTime;
                        ProModel.Source = strSource;
                        ProModel.PublishTime1 = dtPublishTime;
                        ProModel.Funds1 = decFunds1;
                        ProModel.Anchorperson = intAnchorPerson;
                        ProModel.Population = intPopulation;
                        ProModel.AllAuthor = strAllAuthor;
                        ProModel.SchoolSign = strSchoolSign;
                        ProModel.Remark = strRemark;
                        ProModel.AuditState = strAuditState;

                        //计算级别分
                        EvaluateModel = EvaluateBll.GetXiangMuJiBie(ProModel);
                        string strJiBie = "";   //级别
                        decimal decLevelFactor = 0;     //级别分系数
                        decimal decJiBieScore = 0;      //级别分

                        if (EvaluateModel != null)
                        {
                            strJiBie = EvaluateModel.JiBie;
                            decLevelFactor = Convert.ToDecimal(EvaluateModel.LevelFactor);
                            ProModel.JiBie = strJiBie;  //级别
                            ProModel.LevelFactor = decLevelFactor;  //级别分系数

                            int intScore = LevelScoresBll.GetScoreByJiBie(strJiBie);    //根据级别得到对应的级别分数
                            decJiBieScore = intScore * decLevelFactor;  //级别分
                        }

                        //计算经费分
                        decimal decFundScore = 0;
                        WordsFundsModel = WordsFundsBll.GetModel(strSmallSort, strType); ;
                        if (decFunds1 <= WordsFundsModel.Digit2)
                        {
                            decFundScore = decFunds1 * Convert.ToDecimal(WordsFundsModel.Digit1);
                        }
                        else if (decFunds1 > WordsFundsModel.Digit2 && decFunds1 <= WordsFundsModel.Digit4)
                        {
                            decFundScore = Convert.ToDecimal(WordsFundsModel.Digit2) * Convert.ToDecimal(WordsFundsModel.Digit1) + (decFunds1 - Convert.ToDecimal(WordsFundsModel.Digit2)) * Convert.ToDecimal(WordsFundsModel.Digit3);
                        }
                        else if (decFunds1 > WordsFundsModel.Digit4 && decFunds1 <= WordsFundsModel.Digit6)
                        {
                            decFundScore = Convert.ToDecimal(WordsFundsModel.Digit2) * Convert.ToDecimal(WordsFundsModel.Digit1) + (Convert.ToDecimal(WordsFundsModel.Digit4) - Convert.ToDecimal(WordsFundsModel.Digit2)) * Convert.ToDecimal(WordsFundsModel.Digit3) + (decFunds1 - Convert.ToDecimal(WordsFundsModel.Digit4)) * Convert.ToDecimal(WordsFundsModel.Digit5);
                        }
                        else if (decFunds1 > 100)
                        {
                            decFundScore = Convert.ToDecimal(WordsFundsModel.Digit2) * Convert.ToDecimal(WordsFundsModel.Digit1) + (Convert.ToDecimal(WordsFundsModel.Digit4) - Convert.ToDecimal(WordsFundsModel.Digit2)) * Convert.ToDecimal(WordsFundsModel.Digit3) + (Convert.ToDecimal(WordsFundsModel.Digit6) - Convert.ToDecimal(WordsFundsModel.Digit4)) * Convert.ToDecimal(WordsFundsModel.Digit5) + (decFunds1 - Convert.ToDecimal(WordsFundsModel.Digit6)) * Convert.ToDecimal(WordsFundsModel.Digit7);
                        }

                        //计算个人得分
                        decimal decPerScore = 0;    //个人得分
                        //判断是否多人合作
                        if (intPopulation > 1)
                        {
                            decimal decScale = Cal3Bll.GetProjectScale("是");
                            //是否项目主持人
                            if (ddlAnchorperson.SelectedValue == "0")
                            {
                                decPerScore = (decJiBieScore + decFundScore) * decScale;
                            }
                            else
                            {
                                decPerScore = (decJiBieScore + decFundScore) * (1 - decScale) / (intPopulation - 1);
                            }

                            ProModel.PerScore = decPerScore;    //个人得分

                            if (cmd == "add")   //新增
                            {
                                if (!ProBll.Exists(strPID))
                                {
                                    ProBll.Add(ProModel);
                                }
                                else
                                {
                                    MessageBox.Show(this, "已经存在该记录!");
                                }
                            }
                            if (cmd == "modify")  //修改
                            {
                                ProBll.Update(ProModel);
                            }
                            Response.Redirect("Project_List.aspx");
                        }
                        else
                        {
                            decPerScore = decJiBieScore + decFundScore;
                            ProModel.PerScore = decPerScore;    //个人得分

                            if (cmd == "add")   //新增
                            {
                                if (!ProBll.Exists(strPID))
                                {
                                    ProBll.Add(ProModel);
                                }
                                else
                                {
                                    MessageBox.Show(this, "已经存在该记录!");
                                }
                            }
                            if (cmd == "modify")  //修改
                            {
                                ProBll.Update(ProModel);
                            }
                            Response.Redirect("Project_List.aspx");
                        }
                    }
                }
                catch (Exception ex)
                {

                    throw ex;
                }
            }
            else
            {
                Response.Write("<script language=javascript>alert('您已经与服务器断开连接,请重新登录!');window.location.href='~/../../login.aspx';</script>");
            }
        }
        protected void btnOK_Click(object sender, EventArgs e)
        {
            decimal decLevelFactor = Convert.ToDecimal(txtLevelFactor.Text);     //级别分系数
            string strJiBie = ddlJiBie.SelectedValue;   //级别

            int intScore = LevelScoresBll.GetScoreByJiBie(strJiBie);    //根据级别得到对应的级别分数
            decimal decJiBieScore = intScore * decLevelFactor;   //级别分

            string strID = lblSRID.Text.Trim();
            string strResult = strID.Substring(0, 2);

            if (strResult == "LW")  //学术论文
            {
                decimal decPerScore = 0;
                LZJModel = LZJBll.GetModel(strID);
                int intRank = Convert.ToInt32(LZJModel.Rank);
                int intPopulation = Convert.ToInt32(LZJModel.Population);

                //根据完成人数和完成成果排名返回对应的得分比例
                Cal2Model = Cal2Bll.GetScoreScale(intPopulation, intRank);
                if (Cal2Model != null)
                {
                    string strScale = Cal2Model.ScoreScale;
                    string[] str = strScale.Split('/');
                    int int1 = int.Parse(str[0]);
                    int int2 = int.Parse(str[1]);
                    decPerScore = decJiBieScore * int1 / int2;
                }

                //更新级别分系数、级别、个人得分
                LZJModel.PK_LZID = strID;
                LZJModel.LevelFactor = decLevelFactor;
                LZJModel.JiBie = strJiBie;
                LZJModel.PerScore = decPerScore;

            }
            else if (strResult == "ZZ") //学术著作
            {
                decimal decPerScore = 0;
                LZJModel = LZJBll.GetModel(strID);
                int intRank = Convert.ToInt32(LZJModel.Rank);
                int intPopulation = Convert.ToInt32(LZJModel.Population);

                //计算字数分
                decimal decWord = Convert.ToDecimal(LZJModel.Word);
                WordsFundsModel = WordsFundsBll.GetModel("学术著作");
                decimal decWordScore = 0;   //字数分
                if (decWord <= WordsFundsModel.Digit2)
                {
                    decWordScore = decWord * Convert.ToDecimal(WordsFundsModel.Digit1);
                }
                else if (decWord > WordsFundsModel.Digit2)
                {
                    decWordScore = Convert.ToDecimal(WordsFundsModel.Digit2) * Convert.ToDecimal(WordsFundsModel.Digit1) + Convert.ToDecimal(decWord - WordsFundsModel.Digit2) * Convert.ToDecimal(WordsFundsModel.Digit3);
                }

                //根据完成人数和完成成果排名返回对应的得分比例
                Cal2Model = Cal2Bll.GetScoreScale(intPopulation, intRank);
                if (Cal2Model != null)
                {
                    string strScale = Cal2Model.ScoreScale;
                    string[] str = strScale.Split('/');
                    int int1 = int.Parse(str[0]);
                    int int2 = int.Parse(str[1]);
                    decPerScore = (decJiBieScore+decWordScore) * int1 / int2;
                }

                //更新级别分系数、级别、个人得分
                LZJModel.PK_LZID = strID;
                LZJModel.LevelFactor = decLevelFactor;
                LZJModel.JiBie = strJiBie;
                LZJModel.PerScore = decPerScore;
            }
            else if (strResult == "KY") //科研项目
            {
                decimal decPerScore = 0;
                ProModel = ProBll.GetModel(strID);
                int intRank = Convert.ToInt32(ProModel.Anchorperson);
                int intPopulation = Convert.ToInt32(ProModel.Population);

                //计算经费分
                decimal decFundScore = 0;
                string strSmallSort = ProModel.SmallSort;
                string strType = ProModel.Type;
                decimal decFunds1 = Convert.ToDecimal(ProModel.Funds1);
                WordsFundsModel = WordsFundsBll.GetModel(strSmallSort, strType); ;
                if (decFunds1 <= WordsFundsModel.Digit2)
                {
                    decFundScore = decFunds1 * Convert.ToDecimal(WordsFundsModel.Digit1);
                }
                else if (decFunds1 > WordsFundsModel.Digit2 && decFunds1 <= WordsFundsModel.Digit4)
                {
                    decFundScore = Convert.ToDecimal(WordsFundsModel.Digit2) * Convert.ToDecimal(WordsFundsModel.Digit1) + (decFunds1 - Convert.ToDecimal(WordsFundsModel.Digit2)) * Convert.ToDecimal(WordsFundsModel.Digit3);
                }
                else if (decFunds1 > WordsFundsModel.Digit4 && decFunds1 <= WordsFundsModel.Digit6)
                {
                    decFundScore = Convert.ToDecimal(WordsFundsModel.Digit2) * Convert.ToDecimal(WordsFundsModel.Digit1) + (Convert.ToDecimal(WordsFundsModel.Digit4) - Convert.ToDecimal(WordsFundsModel.Digit2)) * Convert.ToDecimal(WordsFundsModel.Digit3) + (decFunds1 - Convert.ToDecimal(WordsFundsModel.Digit4)) * Convert.ToDecimal(WordsFundsModel.Digit5);
                }
                else if (decFunds1 > 100)
                {
                    decFundScore = Convert.ToDecimal(WordsFundsModel.Digit2) * Convert.ToDecimal(WordsFundsModel.Digit1) + (Convert.ToDecimal(WordsFundsModel.Digit4) - Convert.ToDecimal(WordsFundsModel.Digit2)) * Convert.ToDecimal(WordsFundsModel.Digit3) + (Convert.ToDecimal(WordsFundsModel.Digit6) - Convert.ToDecimal(WordsFundsModel.Digit4)) * Convert.ToDecimal(WordsFundsModel.Digit5) + (decFunds1 - Convert.ToDecimal(WordsFundsModel.Digit6)) * Convert.ToDecimal(WordsFundsModel.Digit7);
                }

                //计算个人得分
                decimal decScale = Cal3Bll.GetProjectScale("是");
                int intAnchorperson = Convert.ToInt32(ProModel.Anchorperson);
                if (intAnchorperson == 0)   //是否项目主持人
                {
                    decPerScore = (decJiBieScore + decFundScore) * decScale;
                }
                else
                {
                    decPerScore = (decJiBieScore + decFundScore) * (1 - decScale) / (intPopulation - 1);
                }

                //更新级别分系数、级别、个人得分
                ProModel.PK_PID = strID;
                ProModel.LevelFactor = decLevelFactor;
                ProModel.JiBie = strJiBie;
                ProModel.PerScore = decPerScore;
            }
            else if (strResult == "SB") //项目申报
            {
                decimal decPerScore = 0;
                ProModel = ProBll.GetModel(strID);
                int intRank = Convert.ToInt32(ProModel.Anchorperson);
                int intPopulation = Convert.ToInt32(ProModel.Population);

                //计算个人得分
                decimal decScale = Cal3Bll.GetProjectScale("是");
                int intAnchorperson = Convert.ToInt32(ProModel.Anchorperson);
                if (intAnchorperson == 0)   //是否项目主持人
                {
                    decPerScore = decJiBieScore * decScale;
                }
                else
                {
                    decPerScore = decJiBieScore * (1 - decScale) / (intPopulation - 1);
                }

                //更新级别分系数、级别、个人得分
                ProModel.PK_PID = strID;
                ProModel.LevelFactor = decLevelFactor;
                ProModel.JiBie = strJiBie;
                ProModel.PerScore = decPerScore;
            }
            else  //其他类别
            {
                decimal decPerScore = 0;
                AchievementModel = AchievementBll.GetModel(strID);
                int intRank = Convert.ToInt32(AchievementModel.Rank);
                int intPopulation = Convert.ToInt32(AchievementModel.Population);

                //根据完成人数和完成成果排名返回对应的得分比例
                Cal2Model = Cal2Bll.GetScoreScale(intPopulation, intRank);
                if (Cal2Model != null)
                {
                    string strScale = Cal2Model.ScoreScale;
                    string[] str = strScale.Split('/');
                    int int1 = int.Parse(str[0]);
                    int int2 = int.Parse(str[1]);
                    decPerScore = decJiBieScore * int1 / int2;
                }

                //更新级别分系数、级别、个人得分
                AchievementModel.PK_AID = strID;
                AchievementModel.LevelFactor = decLevelFactor;
                AchievementModel.JiBie = strJiBie;
                AchievementModel.PerScore = decPerScore;

                AchievementBll.UpdateJiBie(AchievementModel);
            }

            Response.Write("<script language=javascript>opener.location.reload();window.close();</script>");
        }