/// <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); } }
private void BindData(string srid) { //得到对象实体 LZJModel = LZJBll.GetModel(srid); UserModel = UserBll.GetModel(LZJModel.FK_UserID); //绑定数据到Label lblUserName.Text = UserModel.UserName; lblUserUnit.Text = UserModel.Unit; lblSex.Text = UserModel.Sex; lblZhiCheng.Text = UserModel.ZhiCheng; lblBigSort.Text = LZJModel.BigSort; lblSchoolSign.Text = LZJModel.SchoolSign; lblRank.Text = (LZJModel.Rank).ToString(); lblPopulation.Text = (LZJModel.Population).ToString(); lblAllAuthor.Text = LZJModel.AllAuthor; lblRemark.Text = LZJModel.Remark; lblJiBie.Text = (LZJModel.LevelFactor).ToString() + LZJModel.JiBie; lblPerScore.Text = (LZJModel.PerScore).ToString(); string state = (LZJModel.AuditState).ToString(); lblAuditState.Text = StateInfo.GetAuditState(state); lblReason.Text = LZJModel.Extra1; if (state == "2" || state == "4" || state == "6") { PanelReasonVisible.Visible = true; } lblSRID.Text = LZJModel.PK_LZID; lblTitle.Text = LZJModel.Title; lblTime.Text = string.Format("{0:yyyy-MM-dd}", LZJModel.PublishTime); lblType.Text = LZJModel.Type; lblUnit.Text = LZJModel.Unit; lblSource.Text = LZJModel.Source; lblWord.Text = LZJModel.Word + "万字"; //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; //} }
/* * /// <summary> * /// 分页获取数据列表 * /// </summary> * public DataSet GetList(int PageSize,int PageIndex,string strWhere) * { * SqlParameter[] parameters = { * new SqlParameter("@tblName", SqlDbType.VarChar, 255), * new SqlParameter("@fldName", SqlDbType.VarChar, 255), * new SqlParameter("@PageSize", SqlDbType.Int), * new SqlParameter("@PageIndex", SqlDbType.Int), * new SqlParameter("@IsReCount", SqlDbType.Bit), * new SqlParameter("@OrderType", SqlDbType.Bit), * new SqlParameter("@strWhere", SqlDbType.VarChar,1000), * }; * parameters[0].Value = "sr_LwZzJc"; * parameters[1].Value = "ID"; * parameters[2].Value = PageSize; * parameters[3].Value = PageIndex; * parameters[4].Value = 0; * parameters[5].Value = 0; * parameters[6].Value = strWhere; * return DbHelperSQL.RunProcedure("UP_GetRecordByPage",parameters,"ds"); * }*/ #endregion 成员方法 #region 返回学术论文/学术著作/教材数据列表(教师角色) /// <summary> /// 返回学术论文/学术著作/教材数据列表(教师角色) ——By Jianguo Fung /// </summary> /// <returns></returns> public DataSet GetLwZzJcByJs(ZQUSR.Model.sr_LwZzJc model) { string userID = model.FK_UserID; string smallSort = model.SmallSort; string strSql = "select * from sr_LwZzJc where FK_UserID='" + userID + "' and SmallSort='" + smallSort + "' order by PK_LZID desc"; return(DbHelperSQL.Query(strSql.ToString())); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BindDdlType(); //绑定著作类型下拉列表 BindDdlSource(); //绑定著作来源下拉列表 //BindDdlSchoolSign(); //绑定学校署名排名下拉列表 string cmd = Request.QueryString["cmd"].ToString(); if (cmd == "add") //若为添加则自动生成编号 { TabContainer1.Tabs[0].HeaderText = "学术著作添加"; txtLZID.Text = "ZZ" + CreateNumber.GetNumber(); } if (cmd == "modify") //若为修改则绑定数据到文本框 { TabContainer1.Tabs[0].HeaderText = "学术著作修改"; string srid = Request.QueryString["srid"].ToString(); if (srid != "") { LZJModel = LZJBll.GetModel(srid); if (LZJModel != null) { txtLZID.Text = LZJModel.PK_LZID; ddlType.Text = LZJModel.Type; txtTitle.Text = LZJModel.Title; txtUnit.Text = LZJModel.Unit; txtTime.Text = string.Format("{0:yyyy-MM-dd}", LZJModel.PublishTime); ddlSource.Text = LZJModel.Source; //txtISBN.Text = LZJModel.Number1; txtWord.Text = LZJModel.Word.ToString(); ddlSchoolSign.Text = LZJModel.SchoolSign; ddlRank.Text = StateInfo.GetRank((LZJModel.Rank).ToString()); txtPopulation.Text = LZJModel.Population.ToString(); txtAllAuthor.Text = LZJModel.AllAuthor; txtRemark.Text = LZJModel.Remark; } } } } }
protected void Page_Load(object sender, EventArgs e) { //txtNumber1、txtNumber2 失去焦点时触发事件 //this.txtNumber1.Attributes["onblur"] = ClientScript.GetPostBackEventReference(txtNumber1, null); //this.txtNumber2.Attributes["onblur"] = ClientScript.GetPostBackEventReference(txtNumber2, null); if (!IsPostBack) { BindDdlState(); // 绑定收录/转载情况下拉列表 string cmd = Request.QueryString["cmd"].ToString(); if (cmd == "add") //若为添加则自动生成编号 { TabContainer1.Tabs[0].HeaderText = "学术论文添加"; txtLZID.Text = "LW" + CreateNumber.GetNumber(); } if (cmd == "modify") //若为修改则绑定数据到文本框 { TabContainer1.Tabs[0].HeaderText = "学术论文修改"; string srid = Request.QueryString["srid"].ToString(); if (srid != "") { LZJModel = LZJBll.GetModel(srid); if (LZJModel != null) { txtLZID.Text = LZJModel.PK_LZID; ddlType.Text = LZJModel.Type; txtTitle.Text = LZJModel.Title; txtUnit.Text = LZJModel.Unit; txtTime.Text = string.Format("{0:yyyy-MM-dd}", LZJModel.PublishTime); ddlSchoolSign.Text = LZJModel.SchoolSign; ddlRank.Text = StateInfo.GetRank((LZJModel.Rank).ToString()); txtPopulation.Text = LZJModel.Population.ToString(); txtAllAuthor.Text = LZJModel.AllAuthor; txtRemark.Text = LZJModel.Remark; } } } } }
/// <summary> /// 更新级别分系数、级别、个人得分 /// </summary> /// <param name="model"></param> public void UpdateJiBie(ZQUSR.Model.sr_LwZzJc model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update sr_LwZzJc set "); strSql.Append("JiBie=@JiBie,"); strSql.Append("LevelFactor=@LevelFactor,"); strSql.Append("PerScore=@PerScore "); strSql.Append(" where PK_LZID=@PK_LZID "); SqlParameter[] parameters = { new SqlParameter("@PK_LZID", SqlDbType.NVarChar, 16), new SqlParameter("@JiBie", SqlDbType.Char, 1), new SqlParameter("@LevelFactor", SqlDbType.Float, 8), new SqlParameter("@PerScore", SqlDbType.Float, 8) }; parameters[0].Value = model.PK_LZID; parameters[1].Value = model.JiBie; parameters[2].Value = model.LevelFactor; parameters[3].Value = model.PerScore; DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["Role"] != null) { string srid = Request.QueryString["srid"].ToString(); //获得成果编号 if (srid != "") { BindData(srid); LZJModel = LZJBll.GetModel(srid); string state = (LZJModel.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 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_LwZzJc GetModel(string PK_LZID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 PK_LZID,FK_UserID,BigSort,SmallSort,Type,Title,AddTime,Unit,Source,PublishTime,Number1,Number2,Rank,Population,AllAuthor,SchoolSign,State,StateUnit,Word,Remark,AuditState,JiBie,LevelFactor,PerScore,Rewards,Bounty,ShiFa,Extra1,Extra2,Extra3,Extra4,Extra5 from sr_LwZzJc "); strSql.Append(" where PK_LZID=@PK_LZID "); SqlParameter[] parameters = { new SqlParameter("@PK_LZID", SqlDbType.NVarChar, 50) }; parameters[0].Value = PK_LZID; ZQUSR.Model.sr_LwZzJc model = new ZQUSR.Model.sr_LwZzJc(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { model.PK_LZID = ds.Tables[0].Rows[0]["PK_LZID"].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.Number1 = ds.Tables[0].Rows[0]["Number1"].ToString(); model.Number2 = ds.Tables[0].Rows[0]["Number2"].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.State = ds.Tables[0].Rows[0]["State"].ToString(); model.StateUnit = ds.Tables[0].Rows[0]["StateUnit"].ToString(); if (ds.Tables[0].Rows[0]["Word"].ToString() != "") { model.Word = decimal.Parse(ds.Tables[0].Rows[0]["Word"].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); } }
/// <summary> /// 增加一条数据 /// </summary> public void Add(ZQUSR.Model.sr_LwZzJc model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into sr_LwZzJc("); strSql.Append("PK_LZID,FK_UserID,BigSort,SmallSort,Type,Title,AddTime,Unit,Source,PublishTime,Number1,Number2,Rank,Population,AllAuthor,SchoolSign,State,StateUnit,Word,Remark,AuditState,JiBie,LevelFactor,PerScore,Rewards,Bounty,ShiFa,Extra1,Extra2,Extra3,Extra4,Extra5)"); strSql.Append(" values ("); strSql.Append("@PK_LZID,@FK_UserID,@BigSort,@SmallSort,@Type,@Title,@AddTime,@Unit,@Source,@PublishTime,@Number1,@Number2,@Rank,@Population,@AllAuthor,@SchoolSign,@State,@StateUnit,@Word,@Remark,@AuditState,@JiBie,@LevelFactor,@PerScore,@Rewards,@Bounty,@ShiFa,@Extra1,@Extra2,@Extra3,@Extra4,@Extra5)"); SqlParameter[] parameters = { new SqlParameter("@PK_LZID", SqlDbType.NVarChar, 16), new SqlParameter("@FK_UserID", SqlDbType.NVarChar, 10), new SqlParameter("@BigSort", SqlDbType.NVarChar, 10), new SqlParameter("@SmallSort", SqlDbType.NVarChar, 10), new SqlParameter("@Type", SqlDbType.NVarChar, 10), new SqlParameter("@Title", SqlDbType.NVarChar, 100), new SqlParameter("@AddTime", SqlDbType.DateTime), new SqlParameter("@Unit", SqlDbType.NVarChar, 100), new SqlParameter("@Source", SqlDbType.NVarChar, 30), new SqlParameter("@PublishTime", SqlDbType.DateTime), new SqlParameter("@Number1", SqlDbType.NVarChar, 20), new SqlParameter("@Number2", SqlDbType.NVarChar, 20), new SqlParameter("@Rank", SqlDbType.Int, 4), new SqlParameter("@Population", SqlDbType.Int, 4), new SqlParameter("@AllAuthor", SqlDbType.NVarChar, 60), new SqlParameter("@SchoolSign", SqlDbType.NVarChar, 10), new SqlParameter("@State", SqlDbType.NVarChar, 100), new SqlParameter("@StateUnit", SqlDbType.NVarChar, 100), new SqlParameter("@Word", SqlDbType.Float, 8), new SqlParameter("@Remark", SqlDbType.NVarChar, 200), new SqlParameter("@AuditState", SqlDbType.NVarChar, 10), new SqlParameter("@JiBie", SqlDbType.Char, 1), new SqlParameter("@LevelFactor", SqlDbType.Float, 8), new SqlParameter("@PerScore", SqlDbType.Float, 8), new SqlParameter("@Rewards", SqlDbType.Float, 8), new SqlParameter("@Bounty", SqlDbType.Float, 8), new SqlParameter("@ShiFa", SqlDbType.Float, 8), new SqlParameter("@Extra1", SqlDbType.NVarChar, 10), new SqlParameter("@Extra2", SqlDbType.NVarChar, 10), new SqlParameter("@Extra3", SqlDbType.NVarChar, 10), new SqlParameter("@Extra4", SqlDbType.NVarChar, 10), new SqlParameter("@Extra5", SqlDbType.NVarChar, 10) }; parameters[0].Value = model.PK_LZID; parameters[1].Value = model.FK_UserID; parameters[2].Value = model.BigSort; parameters[3].Value = model.SmallSort; parameters[4].Value = model.Type; parameters[5].Value = model.Title; parameters[6].Value = model.AddTime; parameters[7].Value = model.Unit; parameters[8].Value = model.Source; parameters[9].Value = model.PublishTime; parameters[10].Value = model.Number1; parameters[11].Value = model.Number2; parameters[12].Value = model.Rank; parameters[13].Value = model.Population; parameters[14].Value = model.AllAuthor; parameters[15].Value = model.SchoolSign; parameters[16].Value = model.State; parameters[17].Value = model.StateUnit; parameters[18].Value = model.Word; parameters[19].Value = model.Remark; parameters[20].Value = model.AuditState; parameters[21].Value = model.JiBie; parameters[22].Value = model.LevelFactor; parameters[23].Value = model.PerScore; parameters[24].Value = model.Rewards; parameters[25].Value = model.Bounty; parameters[26].Value = model.ShiFa; parameters[27].Value = model.Extra1; parameters[28].Value = model.Extra2; parameters[29].Value = model.Extra3; parameters[30].Value = model.Extra4; parameters[31].Value = model.Extra5; DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); }
private void BindData(string srid) { //得到对象实体 LZJModel = LZJBll.GetModel(srid); UserModel = UserBll.GetModel(LZJModel.FK_UserID); //绑定数据到Label lblUserName.Text = UserModel.UserName; lblUserUnit.Text = UserModel.Unit; lblSex.Text = UserModel.Sex; lblZhiCheng.Text = UserModel.ZhiCheng; lblBigSort.Text = LZJModel.BigSort; lblSchoolSign.Text = LZJModel.SchoolSign; lblRank.Text = (LZJModel.Rank).ToString(); lblPopulation.Text = (LZJModel.Population).ToString(); lblAllAuthor.Text = LZJModel.AllAuthor; lblRemark.Text = LZJModel.Remark; lblJiBie.Text = (LZJModel.LevelFactor).ToString() + LZJModel.JiBie; lblPerScore.Text = (LZJModel.PerScore).ToString(); string state = (LZJModel.AuditState).ToString(); lblAuditState.Text = StateInfo.GetAuditState(state); lblReason.Text = LZJModel.Extra1; if (state == "2" || state == "4" || state == "6") { PanelReasonVisible.Visible = true; } lblSRID.Text = LZJModel.PK_LZID; lblTitle.Text = LZJModel.Title; lblTime.Text = string.Format("{0:yyyy-MM-dd}", LZJModel.PublishTime); lblType.Text = LZJModel.Type; lblUnit.Text = LZJModel.Unit; lblState.Text = LZJModel.State; //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; //} }
/// <summary> /// 更新一条数据 /// </summary> public void Update(ZQUSR.Model.sr_LwZzJc model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update sr_LwZzJc set "); strSql.Append("FK_UserID=@FK_UserID,"); strSql.Append("BigSort=@BigSort,"); strSql.Append("SmallSort=@SmallSort,"); strSql.Append("Type=@Type,"); strSql.Append("Title=@Title,"); strSql.Append("AddTime=@AddTime,"); strSql.Append("Unit=@Unit,"); strSql.Append("Source=@Source,"); strSql.Append("PublishTime=@PublishTime,"); strSql.Append("Number1=@Number1,"); strSql.Append("Number2=@Number2,"); strSql.Append("Rank=@Rank,"); strSql.Append("Population=@Population,"); strSql.Append("AllAuthor=@AllAuthor,"); strSql.Append("SchoolSign=@SchoolSign,"); strSql.Append("State=@State,"); strSql.Append("StateUnit=@StateUnit,"); strSql.Append("Word=@Word,"); strSql.Append("Remark=@Remark,"); strSql.Append("AuditState=@AuditState,"); strSql.Append("JiBie=@JiBie,"); strSql.Append("LevelFactor=@LevelFactor,"); strSql.Append("PerScore=@PerScore,"); strSql.Append("Rewards=@Rewards,"); strSql.Append("Bounty=@Bounty,"); strSql.Append("ShiFa=@ShiFa,"); strSql.Append("Extra1=@Extra1,"); strSql.Append("Extra2=@Extra2,"); strSql.Append("Extra3=@Extra3,"); strSql.Append("Extra4=@Extra4,"); strSql.Append("Extra5=@Extra5"); strSql.Append(" where PK_LZID=@PK_LZID "); SqlParameter[] parameters = { new SqlParameter("@PK_LZID", SqlDbType.NVarChar, 16), new SqlParameter("@FK_UserID", SqlDbType.NVarChar, 10), new SqlParameter("@BigSort", SqlDbType.NVarChar, 10), new SqlParameter("@SmallSort", SqlDbType.NVarChar, 10), new SqlParameter("@Type", SqlDbType.NVarChar, 10), new SqlParameter("@Title", SqlDbType.NVarChar, 100), new SqlParameter("@AddTime", SqlDbType.DateTime), new SqlParameter("@Unit", SqlDbType.NVarChar, 100), new SqlParameter("@Source", SqlDbType.NVarChar, 30), new SqlParameter("@PublishTime", SqlDbType.DateTime), new SqlParameter("@Number1", SqlDbType.NVarChar, 20), new SqlParameter("@Number2", SqlDbType.NVarChar, 20), new SqlParameter("@Rank", SqlDbType.Int, 4), new SqlParameter("@Population", SqlDbType.Int, 4), new SqlParameter("@AllAuthor", SqlDbType.NVarChar, 60), new SqlParameter("@SchoolSign", SqlDbType.NVarChar, 10), new SqlParameter("@State", SqlDbType.NVarChar, 100), new SqlParameter("@StateUnit", SqlDbType.NVarChar, 100), new SqlParameter("@Word", SqlDbType.Float, 8), new SqlParameter("@Remark", SqlDbType.NVarChar, 200), new SqlParameter("@AuditState", SqlDbType.NVarChar, 10), new SqlParameter("@JiBie", SqlDbType.Char, 1), new SqlParameter("@LevelFactor", SqlDbType.Float, 8), new SqlParameter("@PerScore", SqlDbType.Float, 8), new SqlParameter("@Rewards", SqlDbType.Float, 8), new SqlParameter("@Bounty", SqlDbType.Float, 8), new SqlParameter("@ShiFa", SqlDbType.Float, 8), new SqlParameter("@Extra1", SqlDbType.NVarChar, 10), new SqlParameter("@Extra2", SqlDbType.NVarChar, 10), new SqlParameter("@Extra3", SqlDbType.NVarChar, 10), new SqlParameter("@Extra4", SqlDbType.NVarChar, 10), new SqlParameter("@Extra5", SqlDbType.NVarChar, 10) }; parameters[0].Value = model.PK_LZID; parameters[1].Value = model.FK_UserID; parameters[2].Value = model.BigSort; parameters[3].Value = model.SmallSort; parameters[4].Value = model.Type; parameters[5].Value = model.Title; parameters[6].Value = model.AddTime; parameters[7].Value = model.Unit; parameters[8].Value = model.Source; parameters[9].Value = model.PublishTime; parameters[10].Value = model.Number1; parameters[11].Value = model.Number2; parameters[12].Value = model.Rank; parameters[13].Value = model.Population; parameters[14].Value = model.AllAuthor; parameters[15].Value = model.SchoolSign; parameters[16].Value = model.State; parameters[17].Value = model.StateUnit; parameters[18].Value = model.Word; parameters[19].Value = model.Remark; parameters[20].Value = model.AuditState; parameters[21].Value = model.JiBie; parameters[22].Value = model.LevelFactor; parameters[23].Value = model.PerScore; parameters[24].Value = model.Rewards; parameters[25].Value = model.Bounty; parameters[26].Value = model.ShiFa; parameters[27].Value = model.Extra1; parameters[28].Value = model.Extra2; parameters[29].Value = model.Extra3; parameters[30].Value = model.Extra4; parameters[31].Value = model.Extra5; DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); }
/// <summary> /// �õ�һ������ʵ�� /// </summary> public ZQUSR.Model.sr_LwZzJc GetModel(string PK_LZID) { StringBuilder strSql=new StringBuilder(); strSql.Append("select top 1 PK_LZID,FK_UserID,BigSort,SmallSort,Type,Title,AddTime,Unit,Source,PublishTime,Number1,Number2,Rank,Population,AllAuthor,SchoolSign,State,StateUnit,Word,Remark,AuditState,JiBie,LevelFactor,PerScore,Rewards,Bounty,ShiFa,Extra1,Extra2,Extra3,Extra4,Extra5 from sr_LwZzJc "); strSql.Append(" where PK_LZID=@PK_LZID "); SqlParameter[] parameters = { new SqlParameter("@PK_LZID", SqlDbType.NVarChar,50)}; parameters[0].Value = PK_LZID; ZQUSR.Model.sr_LwZzJc model=new ZQUSR.Model.sr_LwZzJc(); DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters); if(ds.Tables[0].Rows.Count>0) { model.PK_LZID=ds.Tables[0].Rows[0]["PK_LZID"].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.Number1=ds.Tables[0].Rows[0]["Number1"].ToString(); model.Number2=ds.Tables[0].Rows[0]["Number2"].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.State=ds.Tables[0].Rows[0]["State"].ToString(); model.StateUnit=ds.Tables[0].Rows[0]["StateUnit"].ToString(); if(ds.Tables[0].Rows[0]["Word"].ToString()!="") { model.Word=decimal.Parse(ds.Tables[0].Rows[0]["Word"].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>"); }