Exemple #1
0
        /// <summary>
        /// 获奖成果:根据(Type/Source/Grade)返回对应的级别(JiBie)及级别分系数(LevelFactor)     ——By Jianguo Fung
        /// </summary>
        /// <param name="AchievementModel"></param>
        /// <returns></returns>
        public ZQUSR.Model.sr_Evaluate GetHuoJiangJiBie(ZQUSR.Model.sr_Achievement AchievementModel)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 JiBie,LevelFactor from sr_Evaluate ");
            strSql.Append(" where Type=@Type and Grade=@Source and AwardGrade=@Grade ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Type",   SqlDbType.NVarChar, 10),
                new SqlParameter("@Source", SqlDbType.NVarChar, 30),
                new SqlParameter("@Grade",  SqlDbType.NVarChar, 20)
            };
            parameters[0].Value = AchievementModel.Type;
            parameters[1].Value = AchievementModel.Source;
            parameters[2].Value = AchievementModel.Grade;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                model.JiBie = ds.Tables[0].Rows[0]["JiBie"].ToString();
                if (ds.Tables[0].Rows[0]["LevelFactor"].ToString() != "")
                {
                    model.LevelFactor = decimal.Parse(ds.Tables[0].Rows[0]["LevelFactor"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         BindDdlType();    //绑定专利类型
         string cmd = Request.QueryString["cmd"].ToString();
         if (cmd == "add") //若为添加则自动生成编号
         {
             TabContainer1.Tabs[0].HeaderText = "专利成果添加";
             txtAID.Text = "ZL" + CreateNumber.GetNumber();
         }
         if (cmd == "modify")    //若为修改则绑定数据到文本框
         {
             TabContainer1.Tabs[0].HeaderText = "专利成果修改";
             string srid = Request.QueryString["srid"].ToString();
             if (srid != "")
             {
                 AchievementModel = AchievementBll.GetModel(srid);
                 if (AchievementModel != null)
                 {
                     txtAID.Text     = AchievementModel.PK_AID;
                     txtTitle.Text   = AchievementModel.Title;
                     txtUnit.Text    = AchievementModel.Unit;
                     txtTime.Text    = string.Format("{0:yyyy-MM-dd}", AchievementModel.PublishTime);
                     txtNumber.Value = AchievementModel.Number;
                     //ddlRank.SelectedValue = AchievementModel.Rank;
                     //ddlSchoolSign.SelectedItem.Text = AchievementModel.SchoolSign;
                     //ddlGrade.SelectedItem.Text = AchievementModel.Grade;
                     txtRemark.Text = AchievementModel.Remark;
                 }
             }
         }
     }
 }
        private void BindData(string srid)
        {
            //得到对象实体
            AchievementModel = AchievementBll.GetModel(srid);
            UserModel        = UserBll.GetModel(AchievementModel.FK_UserID);

            //绑定数据到Label
            lblUserName.Text = UserModel.UserName;
            lblUserUnit.Text = UserModel.Unit;
            lblSex.Text      = UserModel.Sex;
            lblZhiCheng.Text = UserModel.ZhiCheng;

            lblBigSort.Text    = AchievementModel.BigSort;
            lblSchoolSign.Text = AchievementModel.SchoolSign;
            lblRank.Text       = (AchievementModel.Rank).ToString();
            lblPopulation.Text = (AchievementModel.Population).ToString();
            lblAllAuthor.Text  = AchievementModel.AllAuthor;
            lblRemark.Text     = AchievementModel.Remark;
            lblJiBie.Text      = (AchievementModel.LevelFactor).ToString() + AchievementModel.JiBie;
            lblPerScore.Text   = (AchievementModel.PerScore).ToString();
            string state = (AchievementModel.AuditState).ToString();

            lblAuditState.Text = StateInfo.GetAuditState(state);
            lblReason.Text     = AchievementModel.Extra1;

            if (state == "2" || state == "4" || state == "6")
            {
                PanelReasonVisible.Visible = true;
            }

            lblSRID.Text   = AchievementModel.PK_AID;
            lblType.Text   = AchievementModel.Type;
            lblTitle.Text  = AchievementModel.Title;
            lblSource.Text = AchievementModel.Source;
            lblTime.Text   = string.Format("{0:yyyy-MM-dd}", AchievementModel.PublishTime);
            lblGrade.Text  = AchievementModel.Grade;


            //if (state == "1" || state == "3" || state == "5" || state == "7")
            //{
            //    Button1.Enabled = false;
            //    Button2.Enabled = false;
            //}
            //if (state == "3" || state == "5" || state == "7")
            //{
            //    Button3.Enabled = false;
            //    Button4.Enabled = false;
            //}
            //if (state == "5" || state == "7")
            //{
            //    Button5.Enabled = false;
            //    Button6.Enabled = false;
            //}
            //if (state == "7")
            //{
            //    Button7.Enabled = false;
            //    Button8.Enabled = false;
            //}
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["Role"] != null)
                {
                    string srid = Request.QueryString["srid"].ToString();  //获得成果编号

                    if (srid != "")
                    {
                        BindData(srid);

                        AchievementModel = AchievementBll.GetModel(srid);
                        string state = (AchievementModel.AuditState).ToString();

                        string cmd = Request.QueryString["cmd"].ToString();
                        if ((cmd == "preview") && (state == "0" || state == "2" || state == "4" || state == "6"))
                        {
                            Panel1.Visible = true;  //显示提交、修改按钮(公用)
                        }

                        string role = Session["Role"].ToString(); //角色
                        switch (role)                             //根据角色不同显示不同的操作按钮
                        {
                        //case "教师":
                        //    if (state == "0" || state == "2" || state == "4" || state == "6")
                        //    {
                        //        Panel1.Visible = true;
                        //    }
                        //    break;
                        case "管理员":
                            if (state == "1")
                            {
                                Panel2.Visible = true;
                            }
                            break;

                        case "系统管理员":
                            if (state == "3")
                            {
                                Panel3.Visible          = true;
                                lbtnUpdateJiBie.Visible = true;
                            }
                            break;

                        case "超级管理员":
                            if (state == "3")
                            {
                                Panel3.Visible          = true;
                                lbtnUpdateJiBie.Visible = true;
                            }
                            if (state == "5" || state == "6" || state == "7")
                            {
                                CheckBox1.Visible = true;
                            }
                            break;

                        default:
                            break;
                        }
                    }
                }
                else
                {
                    Response.Write("<script language=javascript>alert('您已经与服务器断开连接,请重新登录!');window.location.href='~/../../login.aspx';</script>");
                    //Response.Redirect("~/login.aspx");
                }
            }
        }
        private void BindData(string srid)
        {
            //得到对象实体
            AchievementModel = AchievementBll.GetModel(srid);
            UserModel = UserBll.GetModel(AchievementModel.FK_UserID);

            //绑定数据到Label
            lblUserName.Text = UserModel.UserName;
            lblUserUnit.Text = UserModel.Unit;
            lblSex.Text = UserModel.Sex;
            lblZhiCheng.Text = UserModel.ZhiCheng;

            lblBigSort.Text = AchievementModel.BigSort;
            lblSchoolSign.Text = AchievementModel.SchoolSign;
            lblRank.Text = (AchievementModel.Rank).ToString();
            lblPopulation.Text = (AchievementModel.Population).ToString();
            lblAllAuthor.Text = AchievementModel.AllAuthor;
            lblRemark.Text = AchievementModel.Remark;
            lblJiBie.Text = (AchievementModel.LevelFactor).ToString() + AchievementModel.JiBie;
            lblPerScore.Text = (AchievementModel.PerScore).ToString();
            string state = (AchievementModel.AuditState).ToString();
            lblAuditState.Text = StateInfo.GetAuditState(state);

            lblSRID.Text = AchievementModel.PK_AID;
            lblTitle.Text = AchievementModel.Title;
            lblTime.Text = string.Format("{0:yyyy-MM-dd}", AchievementModel.PublishTime);
            lblType.Text = AchievementModel.Type;
            lblUnit.Text = AchievementModel.Unit;
            lblReason.Text = AchievementModel.Extra1;

            if (state == "2" || state == "4" || state == "6")
            {
                PanelReasonVisible.Visible = true;
            }

            //if (state == "1" || state == "3" || state == "5" || state == "7")
            //{
            //    Button1.Enabled = false;
            //    Button2.Enabled = false;
            //}
            //if (state == "3" || state == "5" || state == "7")
            //{
            //    Button3.Enabled = false;
            //    Button4.Enabled = false;
            //}
            //if (state == "5" || state == "7")
            //{
            //    Button5.Enabled = false;
            //    Button6.Enabled = false;
            //}
            //if (state == "7")
            //{
            //    Button7.Enabled = false;
            //    Button8.Enabled = false;
            //}
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["Role"] != null)
                {
                    string srid = Request.QueryString["srid"].ToString();  //获得成果编号

                    if (srid != "")
                    {
                        BindData(srid);

                        AchievementModel = AchievementBll.GetModel(srid);
                        string state = (AchievementModel.AuditState).ToString();

                        string cmd = Request.QueryString["cmd"].ToString();
                        if ((cmd == "preview") && (state == "0" || state == "2" || state == "4" || state == "6"))
                        {
                            Panel1.Visible = true;  //显示提交、修改按钮(公用)
                        }

                        string role = Session["Role"].ToString();   //角色
                        switch (role)   //根据角色不同显示不同的操作按钮
                        {
                            //case "教师":
                                //if (state == "0" || state == "2" || state == "4" || state == "6")
                                //{
                                //    Panel1.Visible = true;
                                //}
                                //break;
                            case "管理员":
                                if (state == "1")
                                {
                                    Panel2.Visible = true;
                                }
                                break;
                            case "系统管理员":
                                if (state == "3")
                                {
                                    Panel3.Visible = true;
                                    lbtnUpdateJiBie.Visible = true;
                                }
                                break;
                            case "超级管理员":
                                if (state == "3")
                                {
                                    Panel3.Visible = true;
                                    lbtnUpdateJiBie.Visible = true;
                                }
                                if (state == "5" || state == "6" || state == "7")
                                {
                                    CheckBox1.Visible = true;
                                }
                                break;
                            default:
                                break;
                        }
                    }
                }
                else
                {
                    Response.Write("<script language=javascript>alert('您已经与服务器断开连接,请重新登录!');window.location.href='~/../../login.aspx';</script>");
                    //Response.Redirect("~/login.aspx");
                }
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         BindDdlType();  //绑定专利类型
         string cmd = Request.QueryString["cmd"].ToString();
         if (cmd == "add")   //若为添加则自动生成编号
         {
             TabContainer1.Tabs[0].HeaderText = "专利成果添加";
             txtAID.Text = "ZL" + CreateNumber.GetNumber();
         }
         if (cmd == "modify")    //若为修改则绑定数据到文本框
         {
             TabContainer1.Tabs[0].HeaderText = "专利成果修改";
             string srid = Request.QueryString["srid"].ToString();
             if (srid != "")
             {
                 AchievementModel = AchievementBll.GetModel(srid);
                 if (AchievementModel != null)
                 {
                     txtAID.Text = AchievementModel.PK_AID;
                     txtTitle.Text = AchievementModel.Title;
                     txtUnit.Text = AchievementModel.Unit;
                     txtTime.Text = string.Format("{0:yyyy-MM-dd}", AchievementModel.PublishTime);
                     txtNumber.Value = AchievementModel.Number;
                     //ddlRank.SelectedValue = AchievementModel.Rank;
                     //ddlSchoolSign.SelectedItem.Text = AchievementModel.SchoolSign;
                     //ddlGrade.SelectedItem.Text = AchievementModel.Grade;
                     txtRemark.Text = AchievementModel.Remark;
                 }
             }
         }
     }
 }
        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>");
        }
        /// <summary>
        /// �õ�һ������ʵ��
        /// </summary>
        public ZQUSR.Model.sr_Achievement GetModel(string PK_AID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 PK_AID,FK_UserID,BigSort,SmallSort,Type,Title,AddTime,Unit,Source,PublishTime,Number,Rank,Population,AllAuthor,SchoolSign,Grade,Remark,AuditState,JiBie,LevelFactor,PerScore,Rewards,Bounty,ShiFa,Extra1,Extra2,Extra3,Extra4,Extra5 from sr_Achievement ");
            strSql.Append(" where PK_AID=@PK_AID ");
            SqlParameter[] parameters = {
                    new SqlParameter("@PK_AID", SqlDbType.NVarChar,50)};
            parameters[0].Value = PK_AID;

            ZQUSR.Model.sr_Achievement model=new ZQUSR.Model.sr_Achievement();
            DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                model.PK_AID=ds.Tables[0].Rows[0]["PK_AID"].ToString();
                model.FK_UserID=ds.Tables[0].Rows[0]["FK_UserID"].ToString();
                model.BigSort=ds.Tables[0].Rows[0]["BigSort"].ToString();
                model.SmallSort=ds.Tables[0].Rows[0]["SmallSort"].ToString();
                model.Type=ds.Tables[0].Rows[0]["Type"].ToString();
                model.Title=ds.Tables[0].Rows[0]["Title"].ToString();
                if(ds.Tables[0].Rows[0]["AddTime"].ToString()!="")
                {
                    model.AddTime=DateTime.Parse(ds.Tables[0].Rows[0]["AddTime"].ToString());
                }
                model.Unit=ds.Tables[0].Rows[0]["Unit"].ToString();
                model.Source=ds.Tables[0].Rows[0]["Source"].ToString();
                if(ds.Tables[0].Rows[0]["PublishTime"].ToString()!="")
                {
                    model.PublishTime=DateTime.Parse(ds.Tables[0].Rows[0]["PublishTime"].ToString());
                }
                model.Number=ds.Tables[0].Rows[0]["Number"].ToString();
                if(ds.Tables[0].Rows[0]["Rank"].ToString()!="")
                {
                    model.Rank=int.Parse(ds.Tables[0].Rows[0]["Rank"].ToString());
                }
                if(ds.Tables[0].Rows[0]["Population"].ToString()!="")
                {
                    model.Population=int.Parse(ds.Tables[0].Rows[0]["Population"].ToString());
                }
                model.AllAuthor=ds.Tables[0].Rows[0]["AllAuthor"].ToString();
                model.SchoolSign=ds.Tables[0].Rows[0]["SchoolSign"].ToString();
                model.Grade=ds.Tables[0].Rows[0]["Grade"].ToString();
                model.Remark=ds.Tables[0].Rows[0]["Remark"].ToString();
                model.AuditState=ds.Tables[0].Rows[0]["AuditState"].ToString();
                model.JiBie=ds.Tables[0].Rows[0]["JiBie"].ToString();
                if(ds.Tables[0].Rows[0]["LevelFactor"].ToString()!="")
                {
                    model.LevelFactor=decimal.Parse(ds.Tables[0].Rows[0]["LevelFactor"].ToString());
                }
                if(ds.Tables[0].Rows[0]["PerScore"].ToString()!="")
                {
                    model.PerScore=decimal.Parse(ds.Tables[0].Rows[0]["PerScore"].ToString());
                }
                if(ds.Tables[0].Rows[0]["Rewards"].ToString()!="")
                {
                    model.Rewards=decimal.Parse(ds.Tables[0].Rows[0]["Rewards"].ToString());
                }
                if(ds.Tables[0].Rows[0]["Bounty"].ToString()!="")
                {
                    model.Bounty=decimal.Parse(ds.Tables[0].Rows[0]["Bounty"].ToString());
                }
                if(ds.Tables[0].Rows[0]["ShiFa"].ToString()!="")
                {
                    model.ShiFa=decimal.Parse(ds.Tables[0].Rows[0]["ShiFa"].ToString());
                }
                model.Extra1=ds.Tables[0].Rows[0]["Extra1"].ToString();
                model.Extra2=ds.Tables[0].Rows[0]["Extra2"].ToString();
                model.Extra3=ds.Tables[0].Rows[0]["Extra3"].ToString();
                model.Extra4=ds.Tables[0].Rows[0]["Extra4"].ToString();
                model.Extra5=ds.Tables[0].Rows[0]["Extra5"].ToString();
                return model;
            }
            else
            {
                return null;
            }
        }
        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>");
        }