/// <summary> /// 获得数据列表 /// </summary> public List <ZQUSR.Model.sr_Evaluate> DataTableToList(DataTable dt) { List <ZQUSR.Model.sr_Evaluate> modelList = new List <ZQUSR.Model.sr_Evaluate>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { ZQUSR.Model.sr_Evaluate model; for (int n = 0; n < rowsCount; n++) { model = new ZQUSR.Model.sr_Evaluate(); if (dt.Rows[n]["PK_EID"].ToString() != "") { model.PK_EID = int.Parse(dt.Rows[n]["PK_EID"].ToString()); } model.Sort = dt.Rows[n]["Sort"].ToString(); model.Type = dt.Rows[n]["Type"].ToString(); model.Source = dt.Rows[n]["Source"].ToString(); model.Grade = dt.Rows[n]["Grade"].ToString(); model.AwardGrade = dt.Rows[n]["AwardGrade"].ToString(); if (dt.Rows[n]["Funds1"].ToString() != "") { model.Funds1 = decimal.Parse(dt.Rows[n]["Funds1"].ToString()); } if (dt.Rows[n]["Funds2"].ToString() != "") { model.Funds2 = decimal.Parse(dt.Rows[n]["Funds2"].ToString()); } model.JiBie = dt.Rows[n]["JiBie"].ToString(); if (dt.Rows[n]["LevelFactor"].ToString() != "") { model.LevelFactor = decimal.Parse(dt.Rows[n]["LevelFactor"].ToString()); //model.LevelFactor = dt.Rows[n]["LevelFactor"].ToString(); //--by caiyuying } model.Extra1 = dt.Rows[n]["Extra1"].ToString(); model.Extra2 = dt.Rows[n]["Extra2"].ToString(); modelList.Add(model); } } return(modelList); }
/// <summary> /// ��������б� /// </summary> public List<ZQUSR.Model.sr_Evaluate> DataTableToList(DataTable dt) { List<ZQUSR.Model.sr_Evaluate> modelList = new List<ZQUSR.Model.sr_Evaluate>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { ZQUSR.Model.sr_Evaluate model; for (int n = 0; n < rowsCount; n++) { model = new ZQUSR.Model.sr_Evaluate(); if(dt.Rows[n]["PK_EID"].ToString()!="") { model.PK_EID=int.Parse(dt.Rows[n]["PK_EID"].ToString()); } model.Sort=dt.Rows[n]["Sort"].ToString(); model.Type=dt.Rows[n]["Type"].ToString(); model.Source=dt.Rows[n]["Source"].ToString(); model.Grade=dt.Rows[n]["Grade"].ToString(); model.AwardGrade=dt.Rows[n]["AwardGrade"].ToString(); if(dt.Rows[n]["Funds1"].ToString()!="") { model.Funds1=decimal.Parse(dt.Rows[n]["Funds1"].ToString()); } if(dt.Rows[n]["Funds2"].ToString()!="") { model.Funds2=decimal.Parse(dt.Rows[n]["Funds2"].ToString()); } model.JiBie=dt.Rows[n]["JiBie"].ToString(); if(dt.Rows[n]["LevelFactor"].ToString()!="") { model.LevelFactor=decimal.Parse(dt.Rows[n]["LevelFactor"].ToString()); //model.LevelFactor = dt.Rows[n]["LevelFactor"].ToString(); //--by caiyuying } model.Extra1=dt.Rows[n]["Extra1"].ToString(); model.Extra2=dt.Rows[n]["Extra2"].ToString(); modelList.Add(model); } } return modelList; }
private void Save(string strAuditState) { if (Session["UserID"] != null) { string cmd = Request.QueryString["cmd"].ToString(); try { if (txtTime.Text == "") { MessageBox.Show(this, "鉴定日期不能为空!"); txtTime.Focus(); } else if (!PageValidateBll.IsDateTime(txtTime.Text)) { MessageBox.Show(this, "鉴定日期格式不正确!"); txtTime.Focus(); } else if (txtTitle.Text == "") { MessageBox.Show(this, "成果名称不能为空!"); txtTitle.Focus(); } else if (ddlSource.SelectedValue == "-1") { MessageBox.Show(this, "请选择成果来源!"); ddlSource.Focus(); } else if (ddlGrade.SelectedValue == "-1") { MessageBox.Show(this, "请选择鉴定等级!"); ddlGrade.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 = "科研业绩"; //大类别 string strSmallSort = "社科鉴定成果"; //小类别 string strTitle = txtTitle.Text; //成果名称 DateTime dtAddTime = DateTime.Now; //提交时间 string strSource = ddlSource.SelectedItem.Text; //成果来源 DateTime dtPublishTime = Convert.ToDateTime(txtTime.Text); //鉴定日期 int intRank = Convert.ToInt32(ddlRank.SelectedValue); //完成成果排名 string strSchoolSign = ddlSchoolSign.SelectedItem.Text; //学校署名排名 string strGrade = ddlGrade.SelectedItem.Text; //鉴定等级(优秀/良好) string strRemark = txtRemark.Text; //备注 AchievementModel.PK_AID = strAID; //成果编号 AchievementModel.FK_UserID = strUserID; //用户编号 AchievementModel.BigSort = strBigSort; //大类别 AchievementModel.SmallSort = strSmallSort; //小类别 AchievementModel.Title = strTitle; //成果名称 AchievementModel.AddTime = dtAddTime; //提交时间 AchievementModel.Unit = strSource; //成果来源 AchievementModel.PublishTime = dtPublishTime; //鉴定日期 AchievementModel.Rank = intRank; //完成成果排名 AchievementModel.SchoolSign = strSchoolSign; //学校署名排名 AchievementModel.Grade = strGrade; //鉴定等级(优秀/良好) AchievementModel.Remark = strRemark; //备注 AchievementModel.AuditState = strAuditState; //审核状态 //计算成果总得分 EvaluateModel = EvaluateBll.GetSKJDJiBie(AchievementModel); string strJiBie = ""; //级别 decimal decLevelFactor = 0; //级别分系数 decimal decScore = 0; //成果总得分 if (EvaluateModel != null) { strJiBie = EvaluateModel.JiBie; decLevelFactor = Convert.ToDecimal(EvaluateModel.LevelFactor); AchievementModel.JiBie = strJiBie; //级别 AchievementModel.LevelFactor = decLevelFactor; //级别分系数 int intScore = LevelScoresBll.GetScoreByJiBie(strJiBie); //根据级别得到对应的级别分数 decScore = intScore * 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("SKJD_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("SKJD_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 (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 (ddlGrade.SelectedValue == "-1") { MessageBox.Show(this, "请选择获奖等级!"); ddlGrade.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 = "科研业绩"; //大类别 string strSmallSort = "获奖成果"; //小类别 string strType = ddlType.SelectedItem.Text; //获奖成果类别(教学成果类/理工类/社科类) string strTitle = txtTitle.Text; //成果名称 DateTime dtAddTime = DateTime.Now; //提交时间 string strSource = ddlSource.SelectedItem.Text; //获奖级别 DateTime dtPublishTime = Convert.ToDateTime(txtTime.Text); //获奖日期 int intRank = Convert.ToInt32(ddlRank.SelectedValue); //完成成果排名 string strSchoolSign = ddlSchoolSign.SelectedItem.Text; //学校署名排名 string strGrade = ddlGrade.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.Source = strSource; //奖项名称 AchievementModel.PublishTime = dtPublishTime; //获奖日期 AchievementModel.Rank = intRank; //完成成果排名 AchievementModel.SchoolSign = strSchoolSign; //学校署名排名 AchievementModel.Grade = strGrade; //获奖等级(特等奖/一等奖/二等奖/三等奖/四等奖) AchievementModel.Remark = strRemark; //备注 AchievementModel.AuditState = strAuditState; //审核状态 //计算成果总得分 EvaluateModel = EvaluateBll.GetHuoJiangJiBie(AchievementModel); string strJiBie = ""; //级别 decimal decLevelFactor = 0; //级别分系数 decimal decScore = 0; //成果总得分 if (EvaluateModel != null) { strJiBie = EvaluateModel.JiBie; decLevelFactor = Convert.ToDecimal(EvaluateModel.LevelFactor); AchievementModel.JiBie = strJiBie; //级别 AchievementModel.LevelFactor = decLevelFactor; //级别分系数 int intScore = LevelScoresBll.GetScoreByJiBie(strJiBie); //根据级别得到对应的级别分数 decScore = intScore * 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("HuoJiang_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("HuoJiang_List.aspx"); } } } catch (Exception ex) { throw ex; } } else { Response.Write("<script language=javascript>alert('您已经与服务器断开连接,请重新登录!');window.location.href='~/../../login.aspx';</script>"); } }
/// <summary> /// 是否存在该记录(Sort/Type/Source/Source)(项目申报) ——By Jianguo Fung /// </summary> /// <param name="model"></param> /// <returns></returns> public bool ExistsTypeSourceGrade(ZQUSR.Model.sr_Evaluate model) { return(dal.ExistsTypeSourceGrade(model)); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(ZQUSR.Model.sr_Evaluate model) { dal.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(ZQUSR.Model.sr_Evaluate model) { return(dal.Add(model)); }