/// <summary> /// ��������б� /// </summary> public List<ZQUSR.Model.sr_Produce> DataTableToList(DataTable dt) { List<ZQUSR.Model.sr_Produce> modelList = new List<ZQUSR.Model.sr_Produce>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { ZQUSR.Model.sr_Produce model; for (int n = 0; n < rowsCount; n++) { model = new ZQUSR.Model.sr_Produce(); if(dt.Rows[n]["PK_PID"].ToString()!="") { model.PK_PID=int.Parse(dt.Rows[n]["PK_PID"].ToString()); } model.XueKe=dt.Rows[n]["XueKe"].ToString(); model.Source=dt.Rows[n]["Source"].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(); } modelList.Add(model); } } return modelList; }
/// <summary> /// 获得数据列表 /// </summary> public List <ZQUSR.Model.sr_Produce> DataTableToList(DataTable dt) { List <ZQUSR.Model.sr_Produce> modelList = new List <ZQUSR.Model.sr_Produce>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { ZQUSR.Model.sr_Produce model; for (int n = 0; n < rowsCount; n++) { model = new ZQUSR.Model.sr_Produce(); if (dt.Rows[n]["PK_PID"].ToString() != "") { model.PK_PID = int.Parse(dt.Rows[n]["PK_PID"].ToString()); } model.XueKe = dt.Rows[n]["XueKe"].ToString(); model.Source = dt.Rows[n]["Source"].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(); } 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 (ddlType.SelectedValue == "-1") { MessageBox.Show(this, "请选择学科!"); ddlType.Focus(); } else if (ddlUnit.SelectedValue == "-1") { MessageBox.Show(this, "请选择发表刊物名称/来源!"); ddlUnit.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 strUnit = ddlUnit.SelectedItem.Text; //发表刊物来源 DateTime dtPublishTime = Convert.ToDateTime(txtTime.Text); //发表日期 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.Rank = intRank; //完成成果排名 AchievementModel.SchoolSign = strSchoolSign; //学校署名排名 AchievementModel.Remark = strRemark; //备注 AchievementModel.AuditState = strAuditState; //审核状态 //计算成果总得分 ProduceModel = ProduceBll.GetJiBieBySource(strUnit); string strJiBie = ""; //级别 decimal decLevelFactor = 0; //级别分系数 decimal decScore = 0; //成果总得分 if (ProduceModel != null) { strJiBie = ProduceModel.JiBie; decLevelFactor = Convert.ToDecimal(ProduceModel.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("ChuangZuo_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("ChuangZuo_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 (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 (ddlType.SelectedValue == "-1") { MessageBox.Show(this, "请选择学科!"); ddlType.Focus(); } else if (ddlUnit.SelectedValue == "-1") { MessageBox.Show(this, "请选择发表刊物名称/来源!"); ddlUnit.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 strUnit = ddlUnit.SelectedItem.Text; //发表刊物来源 DateTime dtPublishTime = Convert.ToDateTime(txtTime.Text); //发表日期 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.Rank = intRank; //完成成果排名 AchievementModel.SchoolSign = strSchoolSign; //学校署名排名 AchievementModel.Remark = strRemark; //备注 AchievementModel.AuditState = strAuditState; //审核状态 //计算成果总得分 ProduceModel = ProduceBll.GetJiBieBySource(strUnit); string strJiBie = ""; //级别 decimal decLevelFactor = 0; //级别分系数 decimal decScore = 0; //成果总得分 if (ProduceModel != null) { strJiBie = ProduceModel.JiBie; decLevelFactor = Convert.ToDecimal(ProduceModel.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("ChuangZuo_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("ChuangZuo_List.aspx"); } } } catch (Exception ex) { throw ex; } } else { Response.Write("<script language=javascript>alert('您已经与服务器断开连接,请重新登录!');window.location.href='~/../../login.aspx';</script>"); } }
/// <summary> /// 更新一条数据 /// </summary> public void Update(ZQUSR.Model.sr_Produce model) { dal.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(ZQUSR.Model.sr_Produce model) { return(dal.Add(model)); }
/// <summary> /// 是否存在该记录(XueKe/Source)-By Jianguo Fung /// </summary> public bool Exists(ZQUSR.Model.sr_Produce model) { return(dal.Exists(model)); }