private bool DealReq(int n, int rn) { string s = ""; switch (n) { case 0: string cardtime = ReqDataView.Rows[rn].Cells[10].Text; string tmp = Convert.ToDateTime(cardtime).ToString("yyyy-MM-dd"); s = "INSERT INTO OriginalCheckData VALUES(" + Mgr.QuoteStr(ReqDataView.DataKeys[rn].Values[1].ToString()) + ","; s += Mgr.QuoteStr(cardtime) + "," + Mgr.QuoteStr(tmp) + ",'00:00:00',0," + ReqDataView.DataKeys[rn].Values[2].ToString( ); s += ",0,0,0, '手工补卡')"; break; case 1: string btime = ReqDataView.Rows[rn].Cells[11].Text; string etime = ReqDataView.Rows[rn].Cells[12].Text; string lr = ReqDataView.Rows[rn].Cells[6].Text; s = " INSERT INTO AskLeaveRegister VALUES(" + ReqDataView.DataKeys[rn].Values[2].ToString( ) + "," + ReqDataView.DataKeys[rn].Values[3].ToString( ) + ","; s += Mgr.QuoteStr(btime) + "," + Mgr.QuoteStr(btime) + "," + Mgr.QuoteStr(etime) + "," + Mgr.QuoteStr(etime) + "," + Session["RKey"].ToString( ) + ","; s += Mgr.QuoteStr(lr) + ", '手工请假' , getdate(),1)"; break; case 2: string rwt = ReqDataView.Rows[rn].Cells[13].Text; string rot = ReqDataView.Rows[rn].Cells[14].Text; string cd = ReqDataView.Rows[rn].Cells[10].Text; s = "UPDATE Onoffdutydata SET locked=1,SumCN = 0,SumCT=0,SumZN=0,SumZT=0,SumKN=0,SumKT=0 ,YTNote='修改工时', RWT = " + rwt.ToString( ) + ", ROT=" + rot.ToString( ); s += " WHERE checkdate=" + Mgr.QuoteStr(cd) + " AND employeeid=" + Mgr.QuoteStr(ReqDataView.DataKeys[rn].Values[2].ToString( )); break; default: return(false); break; } DBBase db = new DBBase( ); if (db.SqlExec(s) <= 0) { //errstr += "第 " + rn.ToString( ) + " 条 处理失败!!\\n"; return(false); } else { //errstr += "第 " + rn.ToString( ) + " 条 处理成功!!\\n"; s = "UPDATE Req SET Reqstate = 2, Dealtime=getdate(), dealPerson=" + Mgr.QuoteStr(Session["USER_FULL_NAME"].ToString( )) + " WHERE RKey = " + ReqDataView.DataKeys[rn].Values[0].ToString( ); db.SqlExec(s); return(true); } }
private void Reqsub(int n) { if (!checkuser(tbx_EmpName.Text, tbx_EmpID.Text)) { Mgr.ShowAlert(this, "姓名工号不匹配"); return; } string s = " "; switch (cbx_ReqType.SelectedIndex) { //补卡 case 0: if (!Mgr.CheckDate(tbx_time1.Text)) { Mgr.ShowAlert(this, "时间格式错误"); return; } s = "INSERT INTO Req VALUES(" + rkey.ToString( ) + ", " + Mgr.QuoteStr(Cardno.ToString( )) + ", getdate(), " + Mgr.QuoteStr(Session["USER_FULL_NAME"].ToString( )) + "," + Mgr.QuoteStr(tbx_ReqNote.Text) + "," + n.ToString() + "," + cbx_ReqType.SelectedValue.ToString( ) + ",null,null,null,null," + Mgr.QuoteStr(tbx_time1.Text) + ",null,null,null)"; break; //请假 case 1: if (!Mgr.CheckDate(tbx_time1.Text) || !Mgr.CheckDate(tbx_time2.Text)) { Mgr.ShowAlert(this, "时间格式错误"); return; } s = "INSERT INTO Req VALUES(" + rkey.ToString( ) + ", " + Mgr.QuoteStr(Cardno.ToString( )) + ", getdate(), " + Mgr.QuoteStr(Session["USER_FULL_NAME"].ToString( )) + "," + Mgr.QuoteStr(tbx_ReqNote.Text) + "," + n.ToString( ) + "," + cbx_ReqType.SelectedValue.ToString( ) + ",null,null," + Mgr.QuoteStr(tbx_time1.Text) + "," + Mgr.QuoteStr(tbx_time2.Text) + ",null,null,null," + cbx_RestType.SelectedValue.ToString( ) + ")"; break; //手动修改工时 case 2: if (!Mgr.CheckDate(tbx_date.Text)) { Mgr.ShowAlert(this, "日期格式不正确"); return; } if (!Mgr.CheckDoule(tbx_ZB.Text) || !Mgr.CheckDoule(tbx_JB.Text)) { Mgr.ShowAlert(this, "工时不正确"); return; } s = "INSERT INTO Req VALUES(" + rkey.ToString( ) + ", " + Mgr.QuoteStr(Cardno.ToString( )) + ", getdate(), " + Mgr.QuoteStr(Session["USER_FULL_NAME"].ToString( )) + "," + Mgr.QuoteStr(tbx_ReqNote.Text) + "," + n.ToString( ) + "," + cbx_ReqType.SelectedValue.ToString( ) + ",null,null,null,null," + Mgr.QuoteStr(tbx_date.Text) + "," + tbx_ZB.Text.ToString( ) + "," + tbx_JB.Text.ToString( ) + ",null)"; break; } DBBase db = new DBBase( ); if (db.SqlExec(s) == 1) { Mgr.ShowAlert(this, "添加成功"); Response.Write("<script>window.location.href='ReqSubmit.aspx'</script>"); } else { Mgr.ShowAlert(this, "添加失败"); } }
protected void Btn_PostBack_Click(object sender, EventArgs e) { if (!Mgr.CheckLogin(this, 2)) { return; } bool b = false; string errstr = "", s; int nSucc = 0; int ntotal = 0; for (int nn = 0; nn < ReqDataView.Rows.Count; nn++) { GridViewRow row = ReqDataView.Rows[nn]; Control ctrl = row.FindControl("CheckBox1"); if ((ctrl as CheckBox).Checked) { ntotal++; int n = row.RowIndex; //TableCellCollection cell = row.Cells; int ReqRkey = Convert.ToInt32(ReqDataView.DataKeys[n].Values[0].ToString( )); int nState = Mgr.GetReqState(ReqRkey); string estr = ""; if (!Mgr.CheckState(nState, new int[] { 1 }, ref estr)) { errstr += "第 " + ntotal.ToString( ) + " 条 " + estr + "\\n"; } else { s = "UPDATE Req SET reqstate = 3 WHERE RKey= " + ReqRkey.ToString( ); DBBase db = new DBBase( ); if (db.SqlExec(s) <= 0) { errstr += "第 " + ntotal.ToString( ) + "条 返回0,操作失败 \\n"; } else { nSucc++; errstr += "第 " + ntotal.ToString( ) + "条 操作成功 \\n"; } } b = true; } } if (!b) { errstr = "数据为空"; } else { errstr += "总共: " + ntotal.ToString( ) + "条 成功:" + nSucc.ToString( ) + "条"; } Mgr.ShowAlert(this, errstr); GetData( ); }