//提交打分 protected void Button3_Click(object sender, EventArgs e) { Opposes = com.COM_Proc_Sel3("PC_CheckOpposes", ddlUname.SelectedValue.ToString(), intime, "1"); //1验证是否存在打分记录 if (ddlUname.SelectedValue != "0") { if (Opposes.Rows.Count != 0)//判读同周期下是否存在某角色已打分 { string statuis = Opposes.Rows[0]["statuis"].ToString(); #region 更新角色打分,统计 Opposes = com.COM_Proc_Sel3("PC_CheckOpposes", ddlUname.SelectedValue.ToString(), pids.ToString(), intime); if (Opposes.Rows.Count == 0) { //更新打分 int c = 0; for (int i = 0; i < gvlist.Rows.Count; i++) { GridView gvlist2 = (GridView)gvlist.Rows[i].FindControl("GridView2"); string sid = gvlist.DataKeys[i].Value.ToString();//考核大栏目编号 DataTable table = com.COM_Proc_Sel3("PC_GetOpposes", ddlUname.SelectedValue.ToString(), sid, intime); for (int j = 0; j < table.Rows.Count; j++) { #region up Opposes data RadioButtonList rbl = (RadioButtonList)gvlist2.Rows[j].FindControl("Radio"); string ords = ((TextBox)(gvlist2.Rows[j].Cells[4].Controls[1])).Text.Trim(); if (rbl.SelectedValue.ToString() == "") { com.COM_Proc_DelorUp_3("PC_Upall0pposes", ddlUname.SelectedValue.ToString(), intime, statuis); Tools.Common.JavaScript.MessageBox(this, "第 " + (i + 1) + " 模块下的第" + (j + 1) + "行的具体考核因素未选择,请重新选择!"); return; } if (rbl.SelectedValue.ToString() == "20" || rbl.SelectedValue.ToString() == "0") { if (ords == "") { com.COM_Proc_DelorUp_3("PC_Upall0pposes", ddlUname.SelectedValue.ToString(), intime, statuis); Tools.Common.JavaScript.MessageBox(this, "第 " + (i + 1) + " 模块下的第" + (j + 1) + "行的备注不能为空,请重新填写!"); return; } } string id = table.Rows[j]["Id"].ToString();//考核编号 string stsuid = table.Rows[j]["statuis"].ToString(); string rem = table.Rows[j]["remrk"].ToString(); string column = ""; DataRow dr = table.Rows[0]; if (ords.Trim() != "") { dr["remrk"] = rem + "|" + ords; } else { dr["remrk"] = rem; } switch (pids) { case 1: dr["threescore"] = rbl.SelectedValue.ToString(); column = "threescore=@threescore"; c += Convert.ToInt32(rbl.SelectedValue); break; case 2: dr["twoscore"] = rbl.SelectedValue.ToString(); column = "twoscore=@twoscore"; c += Convert.ToInt32(rbl.SelectedValue); break; case 3: dr["onescore"] = rbl.SelectedValue.ToString(); column = "onescore=@onescore"; c += Convert.ToInt32(rbl.SelectedValue); break; case 4: dr["custom"] = rbl.SelectedValue.ToString(); column = "custom=@custom"; c += Convert.ToInt32(rbl.SelectedValue); break; } dr["statuis"] = stsuid + pids.ToString() + ","; com.COM_Up(table, "OA_Opposes", "remrk=@remrk," + column + ",statuis=@statuis", id); #endregion // com.pkUpdate(Opposes, "OA_Opposes", "orderby=@orderby", gvlsit.DataKeys[jj].Value.ToString());//书卷编号); } } Stats(c); FinalMessage("打分成功!", "Scorelist.aspx", 0); } else { Tools.Common.JavaScript.Redirect(this, "您的角色已经打过分了,系统禁用重复打分,谢谢操作!", "Scorelist.aspx"); } #endregion } else { #region 插入打分,统计 int c = 0; for (int i = 0; i < gvlist.Rows.Count; i++) { GridView gvlist2 = (GridView)gvlist.Rows[i].FindControl("GridView2"); string sid = gvlist.DataKeys[i].Value.ToString();//考核大栏目编号 for (int j = 0; j < gvlist2.Rows.Count; j++) { #region add Opposes data RadioButtonList rbl = (RadioButtonList)gvlist2.Rows[j].FindControl("Radio"); string ords = ((TextBox)(gvlist2.Rows[j].Cells[4].Controls[1])).Text.Trim(); if (rbl.SelectedValue.ToString() == "") { com.COM_Proc_DelorUp_2("PC_DelAll0pposes", ddlUname.SelectedValue.ToString(), intime); Tools.Common.JavaScript.MessageBox(this, "第 " + (i + 1) + " 模块下的第" + (j + 1) + "行的具体考核因素未选择,请重新选择!"); return; } if (rbl.SelectedValue.ToString() == "20" || rbl.SelectedValue.ToString() == "0") { if (ords == "") { com.COM_Proc_DelorUp_2("PC_DelAll0pposes", ddlUname.SelectedValue.ToString(), intime); Tools.Common.JavaScript.MessageBox(this, "第 " + (i + 1) + " 模块下的第" + (j + 1) + "行的备注不能为空,请重新填写!"); return; } } string id = gvlist2.DataKeys[j].Value.ToString();//考核栏目编号 string column = ""; Opposes.Rows.Clear(); DataRow dr = Opposes.NewRow(); dr["Itemid"] = id; dr["parentid"] = sid; dr["uid"] = getvalue(1); dr["intimes"] = intime; dr["remrk"] = ords; switch (pids) { case 1: dr["threescore"] = rbl.SelectedValue.ToString(); column = "@threescore"; c += Convert.ToInt32(rbl.SelectedValue); break; case 2: dr["twoscore"] = rbl.SelectedValue.ToString(); column = "@twoscore"; c += Convert.ToInt32(rbl.SelectedValue); break; case 3: dr["onescore"] = rbl.SelectedValue.ToString(); column = "@onescore"; c += Convert.ToInt32(rbl.SelectedValue); break; case 4: dr["custom"] = rbl.SelectedValue.ToString(); column = "@custom"; c += Convert.ToInt32(rbl.SelectedValue); break; } dr["touser"] = ddlUname.SelectedValue.ToString(); dr["statuis"] = "," + pids.ToString() + ","; Opposes.Rows.Add(dr); com.COM_Add(Opposes, "OA_Opposes", "@Itemid,@parentid,@uid,@intimes,@remrk," + column + ",@touser,@statuis"); #endregion // com.pkUpdate(Opposes, "OA_Opposes", "orderby=@orderby", gvlsit.DataKeys[jj].Value.ToString());//书卷编号); } } Stats(c); // Tools.Common.JavaScript.Redirect(this, "打分成功!", "Scorelist.aspx"); FinalMessage("打分成功!", "Scorelist.aspx", 0); #endregion } } else { Tools.Common.JavaScript.MessageBox(this, "禁用同时给所有用户打分!请重新选择用户,谢谢操作!"); } }