private void DoSubmit() { if (Session["FlowVerifyInfo"] != null) { Dictionary <string, string> oVerifyInfo = (Dictionary <string, string>)Session["FlowVerifyInfo"]; Dictionary <string, string> dic = (Dictionary <string, string>)Session["PunchAppdOperation_GridView"]; Dictionary <string, string> toUserData = (Dictionary <string, string>)Session["PunchAppdOperation_toUserData"]; Util.setJSContent(oVerifyInfo["FlowVerifyJS"]); Session["FlowVerifyInfo"] = null; Punch_Confirm_Remedy_Bean model = new Punch_Confirm_Remedy_Bean() { //跟共用條件 CompID = dic["CompID"], EmpID = dic["EmpID"], EmpName = dic["EmpName"], LastChgComp = UserInfo.getUserInfo().CompID.Trim(), LastChgID = UserInfo.getUserInfo().UserID.Trim(), LastChgDate = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"), //預存所需資料 PunchTime = dic["PunchTime"], ConfirmPunchFlag = dic["ConfirmPunchFlag"], DutyTime = dic["DutyTime"], RestBeginTime = dic["RestBeginTime"], RestEndTime = dic["RestEndTime"], //Remedy所需資料 PunchDate = dic["PunchDate"], PunchRemedySeq = dic["PunchRemedySeq"], FlowCaseID = dic["FlowCaseID"], ValidDateTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"), ValidCompID = UserInfo.getUserInfo().CompID.Trim(), ValidID = UserInfo.getUserInfo().UserID.Trim(), ValidName = UserInfo.getUserInfo().UserName.Trim(), //Confirm所需資料 DutyDate = dic["DutyDate"], PunchConfirmSeq = dic["PunchConfirmSeq"], RemedyReasonID = dic["RemedyReasonID"], RemedyReasonCN = dic["RemedyReasonCN"], RemedyPunchTime = dic["RemedyPunchTime"], Remedy_MAFT10_FLAG = dic["Remedy_MAFT10_FLAG"], Remedy_AbnormalFlag = dic["Remedy_AbnormalFlag"], Remedy_AbnormalReasonID = dic["Remedy_AbnormalReasonID"], Remedy_AbnormalReasonCN = dic["Remedy_AbnormalReasonCN"], Remedy_AbnormalDesc = dic["Remedy_AbnormalDesc"] }; switch (oVerifyInfo["FlowStepBtnID"].ToString()) { //PORemedyStatus。0:未處理,1:未送簽,2:送簽中,3:核准,4:駁回 //ConfirmStatus。0:正常,1:異常,2:送簽中,3:異常不控管 case "btnClose": model.PORemedyStatus = "3"; string strConfirmStatus = "", strAbnormalType = ""; if (!PunchUpdate.PunchAppdOperation_EXEC_PunchCheckData(model, out strConfirmStatus, out strAbnormalType)) { Util.MsgBox("打卡異常檢核失敗!!"); return; } model.ConfirmStatus = strConfirmStatus; //0 or 1記得用John的TSQL model.AbnormalType = strAbnormalType; break; case "btnApprove": case "btnReApprove": model.PORemedyStatus = "2"; model.ConfirmStatus = "2"; break; case "btnReject": model.PORemedyStatus = "4"; model.ConfirmStatus = "1"; break; } Dictionary <string, string> oAssDic = CustVerify.getEmpID_Name_Dictionary(toUserData["SignID"], toUserData["SignIDComp"]); DataTable LastHROtherFlowLog = PunchUpdate.HROtherFlowLog(model.FlowCaseID, true); long seccessCount = 0; string msg = ""; bool result = false; result = PunchUpdate.PunchAppdOperation_SaveData(model, oAssDic, oVerifyInfo["FlowStepBtnID"].ToString(), oVerifyInfo["FlowStepOpinion"].ToString().Replace("'", "''"), out seccessCount, out msg, LastHROtherFlowLog.Rows[0]["FlowCode"].ToString(), LastHROtherFlowLog.Rows[0]["FlowSN"].ToString(), LastHROtherFlowLog.Rows[0]["FlowSeq"].ToString(), LastHROtherFlowLog.Rows[0]["FlowLogBatNo"].ToString(), LastHROtherFlowLog.Rows[0]["FlowLogID"].ToString(), toUserData); if (result) { labMsg.Text = Util.getHtmlMessage(Util.HtmlMessageKind.Succeed, "審核成功!"); } else { labMsg.Text = Util.getHtmlMessage(Util.HtmlMessageKind.Error, "審核失敗"); txtErrMsg.Text = msg; txtErrMsg.Visible = true; } } }
private void SaveData() { string ErrorIndex = ""; for (int index = 0; index < gvMain.Rows.Count; index++) { CheckBox objchk = (CheckBox)gvMain.Rows[index].FindControl("chkChoiced"); if (objchk.Checked == true) { bool result = false; long seccessCount = 0; string msg = "", flowCode = "", flowSN = ""; string btnName = ""; RadioButton rdoApp = (RadioButton)gvMain.Rows[index].FindControl("rbnApproved"); RadioButton rdoRej = (RadioButton)gvMain.Rows[index].FindControl("rbnReject"); TextBox txtReason = (TextBox)gvMain.Rows[index].FindControl("txtReason"); Dictionary <string, string> dic = new Dictionary <string, string>(); Dictionary <string, string> toUserData = new Dictionary <string, string>(); PunchUpdate.GridViewToDictionary(gvMain, out dic, index, strDataKeyNames); Punch_Confirm_Remedy_Bean model = new Punch_Confirm_Remedy_Bean() { //跟共用條件 CompID = dic["CompID"], EmpID = dic["EmpID"], EmpName = dic["EmpName"], LastChgComp = UserInfo.getUserInfo().CompID.Trim(), LastChgID = UserInfo.getUserInfo().UserID.Trim(), LastChgDate = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"), //預存所需資料 PunchTime = dic["PunchTime"], ConfirmPunchFlag = dic["ConfirmPunchFlag"], DutyTime = dic["DutyTime"], RestBeginTime = dic["RestBeginTime"], RestEndTime = dic["RestEndTime"], //Remedy所需資料 PunchDate = dic["PunchDate"], PunchRemedySeq = dic["PunchRemedySeq"], FlowCaseID = dic["FlowCaseID"], ValidDateTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"), ValidCompID = UserInfo.getUserInfo().CompID.Trim(), ValidID = UserInfo.getUserInfo().UserID.Trim(), ValidName = UserInfo.getUserInfo().UserName.Trim(), //Confirm所需資料 DutyDate = dic["DutyDate"], PunchConfirmSeq = dic["PunchConfirmSeq"], RemedyReasonID = dic["RemedyReasonID"], RemedyReasonCN = dic["RemedyReasonCN"], RemedyPunchTime = dic["RemedyPunchTime"], Remedy_MAFT10_FLAG = dic["Remedy_MAFT10_FLAG"], Remedy_AbnormalFlag = dic["Remedy_AbnormalFlag"], Remedy_AbnormalReasonID = dic["Remedy_AbnormalReasonID"], Remedy_AbnormalReasonCN = dic["Remedy_AbnormalReasonCN"], Remedy_AbnormalDesc = dic["Remedy_AbnormalDesc"] }; if (rdoApp.Checked == true) //核准 { if (!nextFlowBtn(model, out flowCode, out flowSN, ref btnName, out toUserData, out msg)) //判斷審核按鈕 { Util.MsgBox(msg); return; } switch (btnName) { //PORemedyStatus。0:未處理,1:未送簽,2:送簽中,3:核准,4:駁回 //ConfirmStatus。0:正常,1:異常,2:送簽中,3:異常不控管 case "btnClose": model.PORemedyStatus = "3"; string strConfirmStatus = "", strAbnormalType = ""; if (!PunchUpdate.PunchAppdOperation_EXEC_PunchCheckData(model, out strConfirmStatus, out strAbnormalType)) { Util.MsgBox("打卡異常檢核失敗!!"); return; } model.ConfirmStatus = strConfirmStatus; //0 or 1記得用John的TSQL model.AbnormalType = strAbnormalType; break; case "btnApprove": case "btnReApprove": model.PORemedyStatus = "2"; model.ConfirmStatus = "2"; break; } } else if (rdoRej.Checked == true)//駁回 { btnName = "btnReject"; model.PORemedyStatus = "4"; model.ConfirmStatus = "1"; } DataTable LastHROtherFlowLog = PunchUpdate.HROtherFlowLog(model.FlowCaseID, true); Dictionary <string, string> oAssDic = CustVerify.getEmpID_Name_Dictionary(toUserData["SignID"], toUserData["SignIDComp"]); if (!string.IsNullOrEmpty(btnName)) { //審核動作 result = PunchUpdate.PunchAppdOperation_SaveData(model, oAssDic, btnName, txtReason.Text, out seccessCount, out msg, flowCode, flowSN, LastHROtherFlowLog.Rows[0]["FlowSeq"].ToString(), LastHROtherFlowLog.Rows[0]["FlowLogBatNo"].ToString(), LastHROtherFlowLog.Rows[0]["FlowLogID"].ToString(), toUserData); } else { result = false; } if (!result) { //Util.MsgBox(msg); ErrorIndex += (index + 1).ToString() + ","; continue; } if (seccessCount == 0) { ErrorIndex += (index + 1).ToString() + ","; continue; } } } if (ErrorIndex.Length > 0) { ErrorIndex = ErrorIndex.Substring(0, ErrorIndex.Length - 1); Util.MsgBox("第" + ErrorIndex + "筆審核失敗"); } else { Util.MsgBox("審核成功"); } }