/// <summary> /// 学术著作:根据来源(Source)和著作类型(Type)返回对应的级别(JiBie)及级别分系数(LevelFactor) ——By Jianguo Fung /// </summary> /// <param name="AchievementModel"></param> /// <returns></returns> public ZQUSR.Model.sr_Evaluate GetZhuZuoJiBie(ZQUSR.Model.sr_LwZzJc LZJModel) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 JiBie,LevelFactor from sr_Evaluate "); strSql.Append(" where Type=@Type and Source=@Source "); SqlParameter[] parameters = { new SqlParameter("@Type", SqlDbType.NVarChar, 10), new SqlParameter("@Source", SqlDbType.NVarChar, 30) }; parameters[0].Value = LZJModel.Type; parameters[1].Value = LZJModel.Source; 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); } }
/// <summary> /// 科研项目:根据申报项目类型(Type)、项目来源(Source)和申报情况(Grade)返回对应的级别(JiBie)及级别分系数(LevelFactor) ——By Jianguo Fung /// </summary> /// <param name="ProjectModel"></param> /// <returns></returns> public ZQUSR.Model.sr_Evaluate GetShenBaoJiBie(ZQUSR.Model.sr_Project ProjectModel) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 JiBie,LevelFactor from sr_Evaluate "); strSql.Append(" where Sort=@Sort and Type=@Type and Source=@Source and Grade=@Grade "); SqlParameter[] parameters = { new SqlParameter("@Sort", SqlDbType.NVarChar, 10), new SqlParameter("@Type", SqlDbType.NVarChar, 10), new SqlParameter("@Source", SqlDbType.NVarChar, 30), new SqlParameter("@Grade", SqlDbType.NVarChar, 20) }; parameters[0].Value = ProjectModel.SmallSort; parameters[1].Value = ProjectModel.Type; parameters[2].Value = ProjectModel.Source; parameters[3].Value = ProjectModel.ReviewState; 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); } }
/// <summary> /// 软科学成果:根据采纳部门(Unit)返回对应的级别(JiBie)和级别分系数(LevelFactor) ——By Jianguo Fung /// </summary> /// <param name="AchievementModel"></param> /// <returns></returns> public ZQUSR.Model.sr_Evaluate GetRuanKeXueJiBie(ZQUSR.Model.sr_Achievement AchievementModel) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 JiBie,LevelFactor from sr_Evaluate "); strSql.Append(" where Source=@Source "); SqlParameter[] parameters = { new SqlParameter("@Source", SqlDbType.NVarChar, 30) }; parameters[0].Value = AchievementModel.Unit; 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); } }
/// <summary> /// 得到一个对象实体 /// </summary> public ZQUSR.Model.sr_Evaluate GetModel(int PK_EID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 PK_EID,Sort,Type,Source,Grade,AwardGrade,Funds1,Funds2,JiBie,LevelFactor,Extra1,Extra2 from sr_Evaluate "); strSql.Append(" where PK_EID=@PK_EID "); SqlParameter[] parameters = { new SqlParameter("@PK_EID", SqlDbType.Int, 4) }; parameters[0].Value = PK_EID; ZQUSR.Model.sr_Evaluate model = new ZQUSR.Model.sr_Evaluate(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["PK_EID"].ToString() != "") { model.PK_EID = int.Parse(ds.Tables[0].Rows[0]["PK_EID"].ToString()); } model.Sort = ds.Tables[0].Rows[0]["Sort"].ToString(); model.Type = ds.Tables[0].Rows[0]["Type"].ToString(); model.Source = ds.Tables[0].Rows[0]["Source"].ToString(); model.Grade = ds.Tables[0].Rows[0]["Grade"].ToString(); model.AwardGrade = ds.Tables[0].Rows[0]["AwardGrade"].ToString(); if (ds.Tables[0].Rows[0]["Funds1"].ToString() != "") { model.Funds1 = decimal.Parse(ds.Tables[0].Rows[0]["Funds1"].ToString()); } if (ds.Tables[0].Rows[0]["Funds2"].ToString() != "") { model.Funds2 = decimal.Parse(ds.Tables[0].Rows[0]["Funds2"].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()); //model.LevelFactor = ds.Tables[0].Rows[0]["LevelFactor"].ToString(); //--by caiyuying } model.Extra1 = ds.Tables[0].Rows[0]["Extra1"].ToString(); model.Extra2 = ds.Tables[0].Rows[0]["Extra2"].ToString(); return(model); } else { return(null); } }
/// <summary> /// 更新一条数据 //--modify by caiyuying 2011--1-20 /// </summary> public void Update(ZQUSR.Model.sr_Evaluate model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update sr_Evaluate set "); //strSql.Append("Sort=@Sort,"); strSql.Append("Type=@Type,"); strSql.Append("Source=@Source,"); strSql.Append("Grade=@Grade,"); strSql.Append("AwardGrade=@AwardGrade,"); strSql.Append("Funds1=@Funds1,"); strSql.Append("Funds2=@Funds2,"); strSql.Append("JiBie=@JiBie,"); strSql.Append("LevelFactor=@LevelFactor,"); strSql.Append("Extra1=@Extra1,"); strSql.Append("Extra2=@Extra2"); strSql.Append(" where PK_EID=@PK_EID "); SqlParameter[] parameters = { new SqlParameter("@PK_EID", SqlDbType.Int, 4), //new SqlParameter("@Sort", SqlDbType.NVarChar,10), new SqlParameter("@Type", SqlDbType.NVarChar, 10), new SqlParameter("@Source", SqlDbType.NVarChar, 30), new SqlParameter("@Grade", SqlDbType.NVarChar, 20), new SqlParameter("@AwardGrade", SqlDbType.NVarChar, 5), new SqlParameter("@Funds1", SqlDbType.Float, 8), new SqlParameter("@Funds2", SqlDbType.Float, 8), new SqlParameter("@JiBie", SqlDbType.Char, 1), new SqlParameter("@LevelFactor", SqlDbType.Float, 8), new SqlParameter("@Extra1", SqlDbType.NVarChar, 10), new SqlParameter("@Extra2", SqlDbType.NVarChar, 10) }; parameters[0].Value = model.PK_EID; //parameters[1].Value = model.Sort; parameters[1].Value = model.Type; parameters[2].Value = model.Source; parameters[3].Value = model.Grade; parameters[4].Value = model.AwardGrade; parameters[5].Value = model.Funds1; parameters[6].Value = model.Funds2; parameters[7].Value = model.JiBie; parameters[8].Value = model.LevelFactor; parameters[9].Value = model.Extra1; parameters[10].Value = model.Extra2; DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(ZQUSR.Model.sr_Evaluate model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into sr_Evaluate("); strSql.Append("Sort,Type,Source,Grade,AwardGrade,Funds1,Funds2,JiBie,LevelFactor,Extra1,Extra2)"); strSql.Append(" values ("); strSql.Append("@Sort,@Type,@Source,@Grade,@AwardGrade,@Funds1,@Funds2,@JiBie,@LevelFactor,@Extra1,@Extra2)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@Sort", SqlDbType.NVarChar, 10), new SqlParameter("@Type", SqlDbType.NVarChar, 10), new SqlParameter("@Source", SqlDbType.NVarChar, 30), new SqlParameter("@Grade", SqlDbType.NVarChar, 20), new SqlParameter("@AwardGrade", SqlDbType.NVarChar, 5), new SqlParameter("@Funds1", SqlDbType.Float, 8), new SqlParameter("@Funds2", SqlDbType.Float, 8), new SqlParameter("@JiBie", SqlDbType.Char, 1), new SqlParameter("@LevelFactor", SqlDbType.Float, 8), new SqlParameter("@Extra1", SqlDbType.NVarChar, 10), new SqlParameter("@Extra2", SqlDbType.NVarChar, 10) }; parameters[0].Value = model.Sort; parameters[1].Value = model.Type; parameters[2].Value = model.Source; parameters[3].Value = model.Grade; parameters[4].Value = model.AwardGrade; parameters[5].Value = model.Funds1; parameters[6].Value = model.Funds2; parameters[7].Value = model.JiBie; parameters[8].Value = model.LevelFactor; parameters[9].Value = model.Extra1; parameters[10].Value = model.Extra2; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(1); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 是否存在该记录(Sort/Source)(科技应用成果/软科学成果) ——By Jianguo Fung /// </summary> public bool ExistsSource(ZQUSR.Model.sr_Evaluate model) { StringBuilder strSql = new StringBuilder(); strSql.Append("select count(1) from sr_Evaluate"); strSql.Append(" where Sort=@Sort and "); strSql.Append(" Source=@Source "); SqlParameter[] parameters = { new SqlParameter("@Sort", SqlDbType.NVarChar, 10), new SqlParameter("@Source", SqlDbType.NVarChar, 30) }; parameters[0].Value = model.Sort; parameters[1].Value = model.Source; return(DbHelperSQL.Exists(strSql.ToString(), parameters)); }
/// <summary> /// 更新级别和级别分系数(评定标准)-By Jianguo Fung /// </summary> public void UpdateJiBie(ZQUSR.Model.sr_Evaluate model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update sr_Evaluate set "); strSql.Append("JiBie=@JiBie,"); strSql.Append("LevelFactor=@LevelFactor "); strSql.Append(" where PK_EID=@PK_EID "); SqlParameter[] parameters = { new SqlParameter("@PK_EID", SqlDbType.Int, 4), new SqlParameter("@JiBie", SqlDbType.Char, 1), new SqlParameter("@LevelFactor", SqlDbType.Float, 8) }; parameters[0].Value = model.PK_EID; parameters[1].Value = model.JiBie; parameters[2].Value = model.LevelFactor; DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); }
/// <summary> /// 是否存在该记录(Sort/Type/Grade/AwardGrade)(获奖成果) ——By Jianguo Fung /// </summary> public bool ExistsTypeGradeAwardGrade(ZQUSR.Model.sr_Evaluate model) { StringBuilder strSql = new StringBuilder(); strSql.Append("select count(1) from sr_Evaluate"); strSql.Append(" where Sort=@Sort and "); strSql.Append(" Type=@Type and "); strSql.Append(" Grade=@Grade and "); strSql.Append(" AwardGrade=@AwardGrade "); SqlParameter[] parameters = { new SqlParameter("@Sort", SqlDbType.NVarChar, 10), new SqlParameter("@Type", SqlDbType.NVarChar, 10), new SqlParameter("@Grade", SqlDbType.NVarChar, 20), new SqlParameter("@AwardGrade", SqlDbType.NVarChar, 10) }; parameters[0].Value = model.Sort; parameters[1].Value = model.Type; parameters[2].Value = model.Grade; parameters[3].Value = model.AwardGrade; return(DbHelperSQL.Exists(strSql.ToString(), parameters)); }
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 (txtTime.Text == "") { MessageBox.Show(this, "项目完成日期不能为空!"); txtTime.Focus(); } else if (!PageValidateBll.IsDateTime(txtTime.Text)) { MessageBox.Show(this, "项目完成日期格式不正确!"); txtTime.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(txtTime.Text); //项目完成日期 string strReviewState = ddlReviewState.SelectedValue; //申报情况 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.ReviewState = strReviewState; ProModel.Anchorperson = intAnchorPerson; ProModel.Population = intPopulation; ProModel.AllAuthor = strAllAuthor; ProModel.SchoolSign = strSchoolSign; ProModel.Remark = strRemark; ProModel.AuditState = strAuditState; //计算级别分 EvaluateModel = EvaluateBll.GetShenBaoJiBie(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 * decScale; } else { decPerScore = decJiBieScore * (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("ShenBao_List.aspx"); } else { decPerScore = decJiBieScore; 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("ShenBao_List.aspx"); } } } catch (Exception ex) { throw ex; } } else { Response.Write("<script language=javascript>alert('您已经与服务器断开连接,请重新登录!');window.location.href='~/../../login.aspx';</script>"); } }
/// <summary> /// ���ѧ�ɹ������ݲ��ɲ��ţ�Unit�����ض�Ӧ�ļ���JiBie���ͼ����ϵ����LevelFactor�� ����By Jianguo Fung /// </summary> /// <param name="AchievementModel"></param> /// <returns></returns> public ZQUSR.Model.sr_Evaluate GetRuanKeXueJiBie(ZQUSR.Model.sr_Achievement AchievementModel) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 JiBie,LevelFactor from sr_Evaluate "); strSql.Append(" where Source=@Source "); SqlParameter[] parameters = { new SqlParameter("@Source", SqlDbType.NVarChar,30)}; parameters[0].Value = AchievementModel.Unit; 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; } }
/// <summary> /// ������Ŀ�������걨��Ŀ����(Type)����Ŀ��Դ(Source)���걨���(Grade)���ض�Ӧ�ļ���(JiBie)�������ϵ��(LevelFactor) ����By Jianguo Fung /// </summary> /// <param name="ProjectModel"></param> /// <returns></returns> public ZQUSR.Model.sr_Evaluate GetShenBaoJiBie(ZQUSR.Model.sr_Project ProjectModel) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 JiBie,LevelFactor from sr_Evaluate "); strSql.Append(" where Sort=@Sort and Type=@Type and Source=@Source and Grade=@Grade "); SqlParameter[] parameters = { new SqlParameter("@Sort",SqlDbType.NVarChar,10), new SqlParameter("@Type", SqlDbType.NVarChar,10), new SqlParameter("@Source", SqlDbType.NVarChar,30), new SqlParameter("@Grade", SqlDbType.NVarChar,20)}; parameters[0].Value = ProjectModel.SmallSort; parameters[1].Value = ProjectModel.Type; parameters[2].Value = ProjectModel.Source; parameters[3].Value = ProjectModel.ReviewState; 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; } }
/// <summary> /// ѧ��������������Դ(Source)����������(Type)���ض�Ӧ�ļ���(JiBie)�������ϵ��(LevelFactor) ����By Jianguo Fung /// </summary> /// <param name="AchievementModel"></param> /// <returns></returns> public ZQUSR.Model.sr_Evaluate GetZhuZuoJiBie(ZQUSR.Model.sr_LwZzJc LZJModel) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 JiBie,LevelFactor from sr_Evaluate "); strSql.Append(" where Type=@Type and Source=@Source "); SqlParameter[] parameters = { new SqlParameter("@Type", SqlDbType.NVarChar,10), new SqlParameter("@Source", SqlDbType.NVarChar,30)}; parameters[0].Value = LZJModel.Type; parameters[1].Value = LZJModel.Source; 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; } }
/// <summary> /// �õ�һ������ʵ�� /// </summary> public ZQUSR.Model.sr_Evaluate GetModel(int PK_EID) { StringBuilder strSql=new StringBuilder(); strSql.Append("select top 1 PK_EID,Sort,Type,Source,Grade,AwardGrade,Funds1,Funds2,JiBie,LevelFactor,Extra1,Extra2 from sr_Evaluate "); strSql.Append(" where PK_EID=@PK_EID "); SqlParameter[] parameters = { new SqlParameter("@PK_EID", SqlDbType.Int,4)}; parameters[0].Value = PK_EID; ZQUSR.Model.sr_Evaluate model=new ZQUSR.Model.sr_Evaluate(); DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters); if(ds.Tables[0].Rows.Count>0) { if(ds.Tables[0].Rows[0]["PK_EID"].ToString()!="") { model.PK_EID=int.Parse(ds.Tables[0].Rows[0]["PK_EID"].ToString()); } model.Sort=ds.Tables[0].Rows[0]["Sort"].ToString(); model.Type=ds.Tables[0].Rows[0]["Type"].ToString(); model.Source=ds.Tables[0].Rows[0]["Source"].ToString(); model.Grade=ds.Tables[0].Rows[0]["Grade"].ToString(); model.AwardGrade=ds.Tables[0].Rows[0]["AwardGrade"].ToString(); if(ds.Tables[0].Rows[0]["Funds1"].ToString()!="") { model.Funds1=decimal.Parse(ds.Tables[0].Rows[0]["Funds1"].ToString()); } if(ds.Tables[0].Rows[0]["Funds2"].ToString()!="") { model.Funds2=decimal.Parse(ds.Tables[0].Rows[0]["Funds2"].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()); //model.LevelFactor = ds.Tables[0].Rows[0]["LevelFactor"].ToString(); //--by caiyuying } model.Extra1=ds.Tables[0].Rows[0]["Extra1"].ToString(); model.Extra2=ds.Tables[0].Rows[0]["Extra2"].ToString(); return model; } else { return null; } }
private void Save(string strAuditState) { if (Session["UserID"] != null) { string cmd = Request.QueryString["cmd"].ToString(); try { if (txtNumber.Value == "") { MessageBox.Show(this, "专利号不能为空!"); //MessageBll.Show(this, "专利号不能为空!"); txtNumber.Focus(); } else 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 (ddlSchoolSign.SelectedValue == "-1") { MessageBox.Show(this, "请选择学校署名排名!"); ddlSchoolSign.Focus(); } else if (ddlRank.SelectedValue == "-1") { MessageBox.Show(this, "请选择完成成果排名!"); ddlRank.Focus(); } else { string strAID = txtAID.Text; //成果编号 string strUserID = Session["UserID"].ToString(); //用户编号 //string strBigSort = lblBigSort.Text; //大类别 //string strSmallSort = lblSmallSort.Text; //小类别 string strBigSort = "科研成果"; //大类别 string strSmallSort = "专利成果"; //小类别 string strType = ddlType.SelectedItem.Text; //专利类型 string strTitle = txtTitle.Text; //成果名称 DateTime dtAddTime = DateTime.Now; //提交时间 string strUnit = txtUnit.Text; //授权单位 DateTime dtPublishTime = Convert.ToDateTime(txtTime.Text); //授权日期 string strNumber = txtNumber.Value; //专利号 int intRank = Convert.ToInt32(ddlRank.SelectedValue); //完成成果排名 string strSchoolSign = ddlSchoolSign.SelectedItem.Text; //学校署名排名 string strRemark = txtRemark.Text; //备注 AchievementModel.PK_AID = strAID; //成果编号 AchievementModel.FK_UserID = strUserID; //用户编号 AchievementModel.BigSort = strBigSort; //大类别 AchievementModel.SmallSort = strSmallSort; //小类别 AchievementModel.Type = strType; //专利类型 AchievementModel.Title = strTitle; //成果名称 AchievementModel.AddTime = dtAddTime; //提交时间 AchievementModel.Unit = strUnit; //授权单位 AchievementModel.PublishTime = dtPublishTime; //授权日期 AchievementModel.Number = strNumber; //专利号 AchievementModel.Rank = intRank; //完成成果排名 AchievementModel.SchoolSign = strSchoolSign; //学校署名排名 AchievementModel.Remark = strRemark; //备注 AchievementModel.AuditState = strAuditState; //审核状态 //计算专利成果总得分 EvaluateModel = EvaluateBll.GetZhuanLiJiBie(AchievementModel); string strJiBie = ""; //级别 decimal decLevelFactor = 0; //级别分系数 decimal decScore = 0; //成果总得分 if (EvaluateModel != null) { strJiBie = EvaluateModel.JiBie; decLevelFactor = Convert.ToDecimal(EvaluateModel.LevelFactor); int intScore = LevelScoresBll.GetScoreByJiBie(strJiBie); //根据级别得到对应的级别分数 decScore = intScore * decLevelFactor; } AchievementModel.JiBie = strJiBie; //级别 AchievementModel.LevelFactor = decLevelFactor; //级别分系数 //计算专利成果个人得分 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 = decScore * int1 / int2; AchievementModel.Population = intPopulation; //完成人数 AchievementModel.AllAuthor = strAllAuthor; //参与作者 AchievementModel.PerScore = decPerScore; //个人得分 if (cmd == "add") //新增 { if (!AchievementBll.Exists(strAID)) { AchievementBll.Add(AchievementModel); } else { MessageBox.Show(this, "已经存在该记录"); } } if (cmd == "modify") //修改 { AchievementBll.Update(AchievementModel); } Response.Redirect("ZhuanLi_List.aspx"); } } } else { decPerScore = decScore; AchievementModel.Population = intPopulation; //完成人数 AchievementModel.AllAuthor = strAllAuthor; //参与作者 AchievementModel.PerScore = decPerScore; //个人得分 if (cmd == "add") //新增 { if (!AchievementBll.Exists(strAID)) { AchievementBll.Add(AchievementModel); } else { MessageBox.Show(this, "已经存在该记录"); } } if (cmd == "modify") //修改 { AchievementBll.Update(AchievementModel); } Response.Redirect("ZhuanLi_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 (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>"); } }
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>"); } }