/// <summary> /// 結案後HROverTimeLog的Flag解除 /// </summary> /// <param name="FlowCaseID">FlowCaseID</param> /// <param name="AD">A事先/D事後</param> /// <param name="sb">回傳SQL語法,統一給TryCatchIsFlowVerify執行</param> public static void CloseHROverTimeLog(string FlowCaseID, string AD, ref CommandHelper sb) { //AD = ADTable(AD); //HROverTimeLogAD不要加 DataTable dt = HROverTimeLogAD(FlowCaseID, AD); FlowUtility.ChangeFlowFlag(FlowCaseID, dt.Rows[0]["FlowCode"].ToString(), dt.Rows[0]["FlowSN"].ToString(), dt.Rows[0]["SignIDComp"].ToString(), dt.Rows[0]["SignID"].ToString(), "0", ref sb); }
/// <summary> /// 1.當共用檔使用有問題時,須額外撈取現在是否最後一關時使用。 /// 2.只有最基本的流程走法不會用到,其他情況幾乎看這。 /// </summary> /// <param name="OTCompID">加班人公司</param> /// <param name="flowCaseID">FlowCaseID</param> /// <param name="otModel">A/D</param> /// <returns>現在是否為最後一關</returns> private bool isLastFlowNow(string OTCompID, string flowCaseID, string otModel) { DataRow retrunRow; string message = ""; try { if (!FlowUtility.QueryHRFlowEngineDatas_Now(OTCompID, flowCaseID, otModel, out retrunRow, out message)) { return(false); } else if (retrunRow.Table.Rows.Count > 0) { string FlowEndFlag = retrunRow["FlowEndFlag"].ToString(); return(FlowEndFlag == "1" ? true : false); } else { return(false); } } catch (Exception ex) { return(true); } }
public string Translate(string sourceText, string sourceTextLang, string targetTextLanguage) { if (_initialized == false) { throw new Exception("No connection to server"); } _client = new UdpClient(); try { var serverEndPoint = new IPEndPoint(RemoteHostIpAddress, Port); _client.Connect(serverEndPoint); // From "English" to "en", from "Romanian" to "ro", etc. FlowUtility.ConvertToFlowProtocolLanguageNotations(ref sourceTextLang); FlowUtility.ConvertToFlowProtocolLanguageNotations(ref targetTextLanguage); string textToBeSent = string.Format(Template.TranslateTemplate, sourceText, sourceTextLang, targetTextLanguage); byte[] buffer = textToBeSent.ToFlowProtocolAsciiEncodedBytesArray(); _client.Send(buffer, buffer.Length); buffer = _client.Receive(ref serverEndPoint); string response = string.Empty; if (buffer.Length > 0) { response = buffer.ToFlowProtocolAsciiDecodedString(); } var responseComponents = _parser.ParseResponse(response); if (responseComponents.TryGetValue(Cmd, out string cmd)) { if (cmd == Commands.Translate) { if (responseComponents.TryGetValue(ResultValue, out string resultValue)) { return(resultValue); } } } } catch (Exception exception) { Debug.WriteLine(exception); } finally { _client.Close(); } return(string.Empty); }
public static void Main() { var isSuccess = false; var compID = ""; var flowCaseID = ""; var otModel = ""; DataTable dt = new DataTable("Test"); DataRow row = dt.NewRow(); var message = ""; isSuccess = FlowUtility.QueryHRFlowEngineDatas_Now(compID, flowCaseID, otModel, out row, out message); }
private void DoRelease() { if (Session["FlowVerifyInfo"] != null) { DbHelper db = new DbHelper(Aattendant._AattendantDBName); CommandHelper sb = db.CreateCommandHelper(); DbConnection cn = db.OpenConnection(); DbTransaction tx = cn.BeginTransaction(); try { //永豐流程相關資料 FlowExpress oFlow = new FlowExpress("OnBizReqAppd_ITRD", Request["FlowLogID"], true); //預設下關審核人,因為只有一關所以是結案人,即為本關審核人 Dictionary <string, string> oVerifyInfo = (Dictionary <string, string>)Session["FlowVerifyInfo"]; Session["FlowVerifyInfo"] = null; Util.setJSContent(oVerifyInfo["FlowVerifyJS"]); Dictionary <string, string> oAssDic = Util.getDictionary(oVerifyInfo["FlowStepAssignToList"]); //審核資料 string strFlowCustDB = oFlow.FlowID; string strReason = oFlow.FlowDefOpinion; string [] FlowList = oFlow.FlowKeyValueList; string rowCompID = FlowList[0]; string rowEmpID = FlowList[1]; string rowWriteDate = FlowList[2]; string rowFormSeq = FlowList[3]; string rowFlowCaseID = oFlow.getFlowCaseID(oFlow.FlowLogID); string rowFlowLogID = oFlow.FlowLogID; string btnAct = ""; string strOBFormStatus = ""; string HRLogStatus = ""; if (oVerifyInfo["FlowStepBtnID"].ToString() == "btnClose") //核准 { btnAct = "btnClose"; strOBFormStatus = "3"; HRLogStatus = "2"; } else if (oVerifyInfo["FlowStepBtnID"].ToString() == "btnReject") //駁回 { btnAct = "btnReject"; strOBFormStatus = "4"; HRLogStatus = "3"; } else //有問題 { ShowError("永豐流程按鈕錯誤"); return; } //審核SQL字串 OnBizReqAppdOperationSql.UpdateVisitForm(rowCompID, rowEmpID, rowWriteDate, rowFormSeq, strOBFormStatus, strReason, ref sb); OnBizReqAppdOperationSql.UpdateHROverTimeLog(rowFlowCaseID, HRLogStatus, ref sb); FlowUtility.ChangeFlowFlag(rowFlowCaseID, "OB01", "0001", UserInfo.getUserInfo().CompID, UserInfo.getUserInfo().UserID, "0", ref sb); /*******************************/ //sb.Append("我是來製造錯誤的~☆"); //測試用 //labMsg.Text = Util.getHtmlMessage(Util.HtmlMessageKind.Succeed); //return; /*******************************/ //先執行SQL,if(永豐流程成功)則Commit,else則RollBack。 db.ExecuteNonQuery(sb.BuildCommand(), tx); if (FlowExpress.IsFlowVerify(strFlowCustDB, rowFlowLogID, btnAct, oAssDic, strReason)) { tx.Commit(); labMsg.Text = Util.getHtmlMessage(Util.HtmlMessageKind.Succeed); } else { ShowError("永豐流程執行失敗"); } } catch (Exception ex) { tx.Rollback(); ShowError("SQL語法出現錯誤,\n" + ex.Message); } } else { //參數錯誤 labMsg.Text = Util.getHtmlMessage(Util.HtmlMessageKind.ParaError); } }
/// <summary> /// 原本不允許送審重複主管,現在又改成可以,所以把這方法註解,改成不檢核直接查詢 /// </summary> /// <param name="SignID">下一關主管ID</param> /// <param name="SignIDComp">下一關主管公司</param> /// <param name="oAssDic">回傳Dictionary格式給永豐流程使用</param> // private void oAssDicCheck(string SignID, string SignIDComp, ref Dictionary<string, string> oAssDic) //{ // if (SignID.Trim().Equals(UserInfo.getUserInfo().UserID.Trim())) // { // oAssDic.Clear(); // } // else // { // oAssDic = CustVerify.getEmpID_Name_Dictionary(SignID, SignIDComp); // } //} protected void Page_Load(object sender, EventArgs e) { //代辦畫面傳來的多筆審核資料 DataTable dtOverTimeAdvance = (DataTable)Session["dtOverTimeAdvance"]; DataTable dtOverTimeDeclaration = (DataTable)Session["dtOverTimeDeclaration"]; //永豐流程相關資料 FlowExpress oFlow = new FlowExpress(Aattendant._AattendantFlowID, Request["FlowLogID"], true); //錯誤訊息儲存 string ErrMsg = ""; CustVerify CV = new CustVerify(); Dictionary <string, string> toUserData = (Dictionary <string, string>)Session["toUserData"]; //EmpInfo.QueryOrganData || EmpInfo.QueryFlowOrganData 使用 //string SignOrganID = "", SignID = "", SignIDComp = ""; if (!IsPostBack) { if (Session["FlowVerifyInfo"] != null) { #region "變數" //TrtCatchIsFlowVerify()使用 DbHelper db = new DbHelper(Aattendant._AattendantDBName); CommandHelper sb = db.CreateCommandHelper(); DbConnection cn = db.OpenConnection(); DbTransaction tx = cn.BeginTransaction(); //撈取該筆加班單相關資料 DataTable dtOverTime; //預設下關待辦人(會變,沒變代表沒找到相關資料) Dictionary <string, string> oVerifyInfo = (Dictionary <string, string>)Session["FlowVerifyInfo"]; Util.setJSContent(oVerifyInfo["FlowVerifyJS"]); Session["FlowVerifyInfo"] = null; Dictionary <string, string> oAssDic = Util.getDictionary(oVerifyInfo["FlowStepAssignToList"]); //共用檔 Aattendant _Aattendant = new Aattendant(); //Para撈取參數設定 DataTable dtOverTimePara_All = db.ExecuteDataSet(CommandType.Text, string.Format("SELECT DISTINCT CompID,Para FROM OverTimePara ")).Tables[0]; string AD = ""; #endregion "變數" switch (oVerifyInfo["FlowStepBtnID"].ToString()) { case "btnClose": case "btnReApprove": case "FlowReassign": case "btnApprove": //審核 //單筆審核(使用oFlow.FlowCaseID判斷) if (dtOverTimeAdvance == null && dtOverTimeDeclaration == null) { #region "單筆審核" //給IsFlowVerify的下一關簽核主管 //oAssDicCheck(toUserData["SignID"], toUserData["SignIDComp"], ref oAssDic); //原本要檢核主管是否重複,後來說不要了 oAssDic = CustVerify.getEmpID_Name_Dictionary(toUserData["SignID"], toUserData["SignIDComp"]); switch (oFlow.FlowCurrStepID) { //事先 case "A10": case "A20": AD = "A"; break; //事後 case "A30": case "A40": AD = "D"; break; } dtOverTime = CustVerify.OverTime_find_by_FlowCaseID(oFlow.FlowCaseID, AD); if (oVerifyInfo["FlowStepBtnID"].ToString() == "btnClose") //結案 { sb.Reset(); CustVerify.UpdateOverTime(AD, "3", oFlow.FlowCaseID, ref sb); CustVerify.UpdateHROrverTimeLog(oFlow.FlowCaseID, "2", ref sb); CustVerify.CloseHROverTimeLog(oFlow.FlowCaseID, AD, ref sb); if (AD == "A") { CustVerify.insertFromAdvanceToData(oFlow.FlowCaseID, ref sb); } if (TryCatchIsFlowVerify(Request["FlowLogID"], oVerifyInfo["FlowStepBtnID"], oAssDic, oVerifyInfo["FlowStepOpinion"].ToString().Replace("'", "''"), sb, out ErrMsg, dtOverTime.Rows[0], true)) { CV.MailLogContent(oFlow.FlowCaseID, "3", AD, "", "", true); labMsg.Text = Util.getHtmlMessage(Util.HtmlMessageKind.Succeed, "審核成功!"); } else { labMsg.Text = Util.getHtmlMessage(Util.HtmlMessageKind.Error, "審核失敗"); } } else //沒結案 { sb.Reset(); DataTable dtHROverTimeLog = CustVerify.HROverTimeLog(oFlow.FlowCaseID, false); CustVerify.UpdateOverTime(AD, "2", oFlow.FlowCaseID, ref sb); CustVerify.UpdateHROrverTimeLog(oFlow.FlowCaseID, "2", ref sb); FlowUtility.InsertHROverTimeLogCommand( oFlow.FlowCaseID, CustVerify.addone(dtHROverTimeLog.Rows[0]["FlowLogBatNo"].ToString()), CustVerify.FlowLogIDadd(dtHROverTimeLog.Rows[0]["FlowLogID"].ToString()), AD, dtHROverTimeLog.Rows[0]["OTEmpID"].ToString(), dtHROverTimeLog.Rows[0]["EmpOrganID"].ToString(), dtHROverTimeLog.Rows[0]["EmpFlowOrganID"].ToString(), UserInfo.getUserInfo().UserID, dtHROverTimeLog.Rows[0]["FlowCode"].ToString(), dtHROverTimeLog.Rows[0]["FlowSN"].ToString(), CustVerify.addone(dtHROverTimeLog.Rows[0]["FlowSeq"].ToString()), toUserData["SignLine"], toUserData["SignIDComp"], toUserData["SignID"], toUserData["SignOrganID"], toUserData["SignFlowOrganID"], "1", false, ref sb, int.Parse(dtHROverTimeLog.Rows[0]["Seq"].ToString()) + 1 ); if (TryCatchIsFlowVerify(Request["FlowLogID"], oVerifyInfo["FlowStepBtnID"], oAssDic, oVerifyInfo["FlowStepOpinion"].ToString().Replace("'", "''"), sb, out ErrMsg, dtOverTime.Rows[0], true)) { CV.MailLogContent(oFlow.FlowCaseID, "2", AD, "", "", false); labMsg.Text = Util.getHtmlMessage(Util.HtmlMessageKind.Succeed, "審核成功!"); } else { labMsg.Text = Util.getHtmlMessage(Util.HtmlMessageKind.Error, "審核失敗"); } } #endregion "單筆審核" } /*================================================*/ //多筆審核有四個迴圈,事先兩個是後兩個 //UpdateAD、HROverTimeLog、MailLog在第一迴圈 //其他在第二迴圈 //多筆審核按鈕(非印章) else { #region "事先多筆" if (dtOverTimeAdvance.Rows.Count > 0) { AD = "A"; for (int i = 0; i < dtOverTimeAdvance.Rows.Count; i++) { if (dtOverTimeAdvance.Rows[i]["OTSeqNo"].ToString() == "1") { oFlow = new FlowExpress(Aattendant._AattendantFlowID, CustVerify.getFlowLogID(dtOverTimeAdvance.Rows[i]["FlowCaseID"].ToString(), "A"), true); string btnName = dtOverTimeAdvance.Rows[i]["btnName"].ToString(); //oAssDicCheck(dtOverTimeAdvance.Rows[i]["SignID"].ToString(), dtOverTimeAdvance.Rows[i]["SignIDComp"].ToString(), ref oAssDic); oAssDic = CustVerify.getEmpID_Name_Dictionary(dtOverTimeAdvance.Rows[i]["SignID"].ToString(), dtOverTimeAdvance.Rows[i]["SignIDComp"].ToString()); if (btnName == "btnClose") //結案 { sb.Reset(); CustVerify.UpdateOverTime(AD, "3", dtOverTimeAdvance.Rows[i]["FlowCaseID"].ToString(), ref sb); CustVerify.UpdateHROrverTimeLog(dtOverTimeAdvance.Rows[i]["FlowCaseID"].ToString(), "2", ref sb); CustVerify.CloseHROverTimeLog(dtOverTimeAdvance.Rows[i]["FlowCaseID"].ToString(), AD, ref sb); CustVerify.insertFromAdvanceToData(dtOverTimeAdvance.Rows[i]["FlowCaseID"].ToString(), ref sb); if (TryCatchIsFlowVerify(oFlow.FlowCurrLastLogID, btnName, oAssDic, oVerifyInfo["FlowStepOpinion"].ToString().Replace("'", "''"), sb, out ErrMsg, dtOverTimeAdvance.Rows[i], false)) { CV.MailLogContent(dtOverTimeAdvance.Rows[i]["FlowCaseID"].ToString(), "3", AD, "", "", true); labMsg.Text = Util.getHtmlMessage(Util.HtmlMessageKind.Succeed, "審核成功!"); } else { labMsg.Text = Util.getHtmlMessage(Util.HtmlMessageKind.Error, "審核失敗"); } } else //沒結案 { sb.Reset(); DataTable dtHROverTimeLog = CustVerify.HROverTimeLog(dtOverTimeAdvance.Rows[i]["FlowCaseID"].ToString(), false); CustVerify.UpdateOverTime(AD, "2", dtOverTimeAdvance.Rows[i]["FlowCaseID"].ToString(), ref sb); CustVerify.UpdateHROrverTimeLog(dtOverTimeAdvance.Rows[i]["FlowCaseID"].ToString(), "2", ref sb); FlowUtility.InsertHROverTimeLogCommand( dtOverTimeAdvance.Rows[i]["FlowCaseID"].ToString(), CustVerify.addone(dtHROverTimeLog.Rows[0]["FlowLogBatNo"].ToString()), CustVerify.FlowLogIDadd(dtHROverTimeLog.Rows[0]["FlowLogID"].ToString()), AD, dtHROverTimeLog.Rows[0]["OTEmpID"].ToString(), dtHROverTimeLog.Rows[0]["EmpOrganID"].ToString(), dtHROverTimeLog.Rows[0]["EmpFlowOrganID"].ToString(), UserInfo.getUserInfo().UserID, dtHROverTimeLog.Rows[0]["FlowCode"].ToString(), dtHROverTimeLog.Rows[0]["FlowSN"].ToString(), CustVerify.addone(dtHROverTimeLog.Rows[0]["FlowSeq"].ToString()), //toUserData start dtOverTimeAdvance.Rows[i]["SignLine"].ToString(), dtOverTimeAdvance.Rows[i]["SignIDComp"].ToString(), dtOverTimeAdvance.Rows[i]["SignID"].ToString(), dtOverTimeAdvance.Rows[i]["SignOrganID"].ToString(), dtOverTimeAdvance.Rows[i]["SignFlowOrganID"].ToString(), //toUserData end "1", false, ref sb, int.Parse(dtHROverTimeLog.Rows[0]["Seq"].ToString()) + 1 ); if (TryCatchIsFlowVerify(oFlow.FlowCurrLastLogID, btnName, oAssDic, oVerifyInfo["FlowStepOpinion"].ToString().Replace("'", "''"), sb, out ErrMsg, dtOverTimeAdvance.Rows[i], false)) { CV.MailLogContent(dtOverTimeAdvance.Rows[i]["FlowCaseID"].ToString(), "2", AD, "", "", false); labMsg.Text = Util.getHtmlMessage(Util.HtmlMessageKind.Succeed, "審核成功!"); } else { labMsg.Text = Util.getHtmlMessage(Util.HtmlMessageKind.Error, "審核失敗"); } } } } } #endregion "事先多筆" /*------------------*/ #region "事後多筆" if (dtOverTimeDeclaration.Rows.Count > 0) { AD = "D"; for (int i = 0; i < dtOverTimeDeclaration.Rows.Count; i++) { if (dtOverTimeDeclaration.Rows[i]["OTSeqNo"].ToString() == "1") { oFlow = new FlowExpress(Aattendant._AattendantFlowID, CustVerify.getFlowLogID(dtOverTimeDeclaration.Rows[i]["FlowCaseID"].ToString(), "D"), true); string btnName = dtOverTimeDeclaration.Rows[i]["btnName"].ToString(); //oAssDicCheck(dtOverTimeDeclaration.Rows[i]["SignID"].ToString(), dtOverTimeDeclaration.Rows[i]["SignIDComp"].ToString(), ref oAssDic); oAssDic = CustVerify.getEmpID_Name_Dictionary(dtOverTimeDeclaration.Rows[i]["SignID"].ToString(), dtOverTimeDeclaration.Rows[i]["SignIDComp"].ToString()); if (btnName == "btnClose") //結案 { sb.Reset(); CustVerify.UpdateOverTime(AD, "3", dtOverTimeDeclaration.Rows[i]["FlowCaseID"].ToString(), ref sb); CustVerify.UpdateHROrverTimeLog(dtOverTimeDeclaration.Rows[i]["FlowCaseID"].ToString(), "2", ref sb); CustVerify.CloseHROverTimeLog(dtOverTimeDeclaration.Rows[i]["FlowCaseID"].ToString(), AD, ref sb); if (TryCatchIsFlowVerify(oFlow.FlowCurrLastLogID, btnName, oAssDic, oVerifyInfo["FlowStepOpinion"].ToString().Replace("'", "''"), sb, out ErrMsg, dtOverTimeDeclaration.Rows[i], false)) { CV.MailLogContent(dtOverTimeDeclaration.Rows[i]["FlowCaseID"].ToString(), "3", AD, "", "", true); labMsg.Text = Util.getHtmlMessage(Util.HtmlMessageKind.Succeed, "審核成功!"); } else { labMsg.Text = Util.getHtmlMessage(Util.HtmlMessageKind.Error, "審核失敗"); } } else //沒結案 { sb.Reset(); DataTable dtHROverTimeLog = CustVerify.HROverTimeLog(dtOverTimeDeclaration.Rows[i]["FlowCaseID"].ToString(), false); CustVerify.UpdateOverTime(AD, "2", dtOverTimeDeclaration.Rows[i]["FlowCaseID"].ToString(), ref sb); CustVerify.UpdateHROrverTimeLog(dtOverTimeDeclaration.Rows[i]["FlowCaseID"].ToString(), "2", ref sb); FlowUtility.InsertHROverTimeLogCommand( dtOverTimeDeclaration.Rows[i]["FlowCaseID"].ToString(), CustVerify.addone(dtHROverTimeLog.Rows[0]["FlowLogBatNo"].ToString()), CustVerify.FlowLogIDadd(dtHROverTimeLog.Rows[0]["FlowLogID"].ToString()), AD, dtHROverTimeLog.Rows[0]["OTEmpID"].ToString(), dtHROverTimeLog.Rows[0]["EmpOrganID"].ToString(), dtHROverTimeLog.Rows[0]["EmpFlowOrganID"].ToString(), UserInfo.getUserInfo().UserID, dtHROverTimeLog.Rows[0]["FlowCode"].ToString(), dtHROverTimeLog.Rows[0]["FlowSN"].ToString(), CustVerify.addone(dtHROverTimeLog.Rows[0]["FlowSeq"].ToString()), //toUserData start dtOverTimeDeclaration.Rows[i]["SignLine"].ToString(), dtOverTimeDeclaration.Rows[i]["SignIDComp"].ToString(), dtOverTimeDeclaration.Rows[i]["SignID"].ToString(), dtOverTimeDeclaration.Rows[i]["SignOrganID"].ToString(), dtOverTimeDeclaration.Rows[i]["SignFlowOrganID"].ToString(), //toUserData end "1", false, ref sb, int.Parse(dtHROverTimeLog.Rows[0]["Seq"].ToString()) + 1 ); if (TryCatchIsFlowVerify(oFlow.FlowCurrLastLogID, btnName, oAssDic, oVerifyInfo["FlowStepOpinion"].ToString().Replace("'", "''"), sb, out ErrMsg, dtOverTimeDeclaration.Rows[i], false)) { CV.MailLogContent(dtOverTimeDeclaration.Rows[i]["FlowCaseID"].ToString(), "2", AD, "", "", false); labMsg.Text = Util.getHtmlMessage(Util.HtmlMessageKind.Succeed, "審核成功!"); } else { labMsg.Text = Util.getHtmlMessage(Util.HtmlMessageKind.Error, "審核失敗"); } } } } } #endregion "事後多筆" } break; /*=================================================*/ case "btnReject": //駁回 if (dtOverTimeAdvance == null && dtOverTimeDeclaration == null) //true 印章 false 多筆審核按鈕 { #region "單筆駁回" switch (oFlow.FlowCurrStepID) { //事先 case "A10": case "A20": AD = "A"; break; //事後 case "A30": case "A40": AD = "D"; break; } dtOverTime = CustVerify.OverTime_find_by_FlowCaseID(oFlow.FlowCaseID, AD); sb.Reset(); CustVerify.UpdateOverTime(AD, "4", oFlow.FlowCaseID, ref sb); CustVerify.UpdateHROrverTimeLog(oFlow.FlowCaseID, "3", ref sb); CustVerify.CloseHROverTimeLog(oFlow.FlowCaseID, AD, ref sb); if (AD == "D") { CustVerify.AfterReject_CheckAndInsert(oFlow.FlowCaseID, ref sb); } //ClearBtn(oFlow.FlowCurrLogAssignTo); if (TryCatchIsFlowVerify(Request["FlowLogID"], "btnReject", oAssDic, oVerifyInfo["FlowStepOpinion"].ToString().Replace("'", "''"), sb, out ErrMsg, dtOverTime.Rows[0], true)) { CV.MailLogContent(oFlow.FlowCaseID, "4", AD, "", "", true); labMsg.Text = Util.getHtmlMessage(Util.HtmlMessageKind.Succeed, "審核成功!"); } else { labMsg.Text = Util.getHtmlMessage(Util.HtmlMessageKind.Error, "審核失敗"); } #endregion "單筆駁回" } else //多筆審核按鈕 { #region "多筆駁回" if (dtOverTimeAdvance.Rows.Count > 0) { AD = "A"; for (int i = 0; i < dtOverTimeAdvance.Rows.Count; i++) { if (dtOverTimeAdvance.Rows[i]["OTSeqNo"].ToString() == "1") { oFlow = new FlowExpress(Aattendant._AattendantFlowID, CustVerify.getFlowLogID(dtOverTimeAdvance.Rows[i]["FlowCaseID"].ToString(), "A"), true); sb.Reset(); CustVerify.UpdateOverTime(AD, "4", dtOverTimeAdvance.Rows[i]["FlowCaseID"].ToString(), ref sb); CustVerify.UpdateHROrverTimeLog(dtOverTimeAdvance.Rows[i]["FlowCaseID"].ToString(), "3", ref sb); CustVerify.CloseHROverTimeLog(dtOverTimeAdvance.Rows[i]["FlowCaseID"].ToString(), AD, ref sb); //ClearBtn(oFlow.FlowCurrLogAssignTo); if (TryCatchIsFlowVerify(oFlow.FlowCurrLastLogID, "btnReject", oAssDic, oVerifyInfo["FlowStepOpinion"].ToString().Replace("'", "''"), sb, out ErrMsg, dtOverTimeAdvance.Rows[i], false)) { CV.MailLogContent(dtOverTimeAdvance.Rows[i]["FlowCaseID"].ToString(), "4", AD, "", "", true); labMsg.Text = Util.getHtmlMessage(Util.HtmlMessageKind.Succeed, "審核成功!"); } else { labMsg.Text = Util.getHtmlMessage(Util.HtmlMessageKind.Error, "審核失敗"); } } } } if (dtOverTimeDeclaration.Rows.Count > 0) { AD = "D"; for (int i = 0; i < dtOverTimeDeclaration.Rows.Count; i++) { if (dtOverTimeDeclaration.Rows[i]["OTSeqNo"].ToString() == "1") { oFlow = new FlowExpress(Aattendant._AattendantFlowID, CustVerify.getFlowLogID(dtOverTimeDeclaration.Rows[i]["FlowCaseID"].ToString(), "D"), true); sb.Reset(); CustVerify.UpdateOverTime(AD, "4", oFlow.FlowCaseID, ref sb); CustVerify.UpdateHROrverTimeLog(oFlow.FlowCaseID, "3", ref sb); CustVerify.CloseHROverTimeLog(oFlow.FlowCaseID, AD, ref sb); CustVerify.AfterReject_CheckAndInsert(oFlow.FlowCaseID, ref sb); //ClearBtn(oFlow.FlowCurrLogAssignTo); if (TryCatchIsFlowVerify(oFlow.FlowCurrLastLogID, "btnReject", oAssDic, oVerifyInfo["FlowStepOpinion"].ToString().Replace("'", "''"), sb, out ErrMsg, dtOverTimeDeclaration.Rows[i], false)) { CV.MailLogContent(oFlow.FlowCaseID, "4", AD, "", "", true); labMsg.Text = Util.getHtmlMessage(Util.HtmlMessageKind.Succeed, "審核成功!"); } else { labMsg.Text = Util.getHtmlMessage(Util.HtmlMessageKind.Error, "審核失敗"); } } } } #endregion "多筆駁回" } break; /*==============================*/ } if (txtErrMsg.Text != "") { txtErrMsg.Text = "審核失敗清單:" + txtErrMsg.Text; txtErrMsg.Visible = true; } } else { //參數錯誤 labMsg.Text = Util.getHtmlMessage(Util.HtmlMessageKind.ParaError); } } }
/// <summary> /// 審核 /// </summary> private void DoRelease() { DbHelper db = new DbHelper(_attendantDBName); CommandHelper sb = db.CreateCommandHelper(); DbConnection cn = db.OpenConnection(); DbTransaction tx = cn.BeginTransaction(); FlowExpress oFlow = new FlowExpress("OnBizReqAppd_ITRD"); string FlowCustDB = oFlow.FlowID; Dictionary <string, string> oAssDic = CustVerify.getEmpID_Name_Dictionary(UserInfo.getUserInfo().UserID, UserInfo.getUserInfo().CompID); try { for (int introw = 0; introw < gvCheckVisitForm.Rows.Count; introw++) { CheckBox objchk = (CheckBox)gvCheckVisitForm.Rows[introw].FindControl("chkChoiced"); if (objchk.Checked == true) { RadioButton rdoApp = (RadioButton)gvCheckVisitForm.Rows[introw].FindControl("rbnApproved"); RadioButton rdoRej = (RadioButton)gvCheckVisitForm.Rows[introw].FindControl("rbnReject"); TextBox txtReson = (TextBox)gvCheckVisitForm.Rows[introw].FindControl("txtReson"); string rowCompID = gvCheckVisitForm.DataKeys[introw].Values["CompID"].ToString(); string rowEmpID = gvCheckVisitForm.DataKeys[introw].Values["EmpID"].ToString(); string rowWriteDate = gvCheckVisitForm.DataKeys[introw].Values["WriteDate"].ToString(); string rowFormSeq = gvCheckVisitForm.DataKeys[introw].Values["FormSeq"].ToString(); string rowFlowCaseID = gvCheckVisitForm.DataKeys[introw].Values["FlowCaseID"].ToString(); string rowFlowLogID = gvCheckVisitForm.DataKeys[introw].Values["FlowLogID"].ToString(); string btnAct = ""; string OBFormStatus = ""; string HRLogStatus = ""; if (rdoApp.Checked == true) { btnAct = "btnClose"; OBFormStatus = "3"; HRLogStatus = "2"; } else if (rdoRej.Checked == true) { btnAct = "btnReject"; OBFormStatus = "4"; HRLogStatus = "3"; } OnBizReqAppdOperationSql.UpdateVisitForm(rowCompID, rowEmpID, rowWriteDate, rowFormSeq, OBFormStatus, txtReson.Text.ToString(), ref sb); OnBizReqAppdOperationSql.UpdateHROverTimeLog(rowFlowCaseID, HRLogStatus, ref sb); FlowUtility.ChangeFlowFlag(rowFlowCaseID, "OB01", "0001", UserInfo.getUserInfo().CompID, UserInfo.getUserInfo().UserID, "0", ref sb); //先執行SQL,if(永豐流程成功)則Commit,else則RollBack。 //20170613 leo modify db.ExecuteNonQuery(sb.BuildCommand(), tx); if (FlowExpress.IsFlowVerify(FlowCustDB, rowFlowLogID, btnAct, oAssDic, txtReson.Text.ToString())) { tx.Commit(); Util.MsgBox("審核成功!"); } else { throw new Exception("審核失敗!"); } } } } catch (Exception ex) { tx.Rollback(); Util.MsgBox(ex.Message); } }
public IPromise FlowPromise() { return(FlowUtility.GetFlowSequence(FlowInterstitial.FlowPoints, false)); }
public GetMessageResult GetMessage(string translationMode) { if (_initialized == false) { throw new Exception("No connection to server"); } if (_sessionToken == Guid.Empty) { throw new Exception("Not authorized. You have to sign in first."); } _client = new UdpClient(); try { var serverEndPoint = new IPEndPoint(RemoteHostIpAddress, Port); _client.Connect(serverEndPoint); byte[] buffer; if (translationMode == Template.Convention.ClientSaysDoNotTranslate) { string textToBeSent = string.Format(Template.GetMessageUnmodifiedTemplate, _sessionToken); buffer = textToBeSent.ToFlowProtocolAsciiEncodedBytesArray(); _client.Send(buffer, buffer.Length); } else { // From "English" to "en", from "Romanian" to "ro", etc. FlowUtility.ConvertToFlowProtocolLanguageNotations(ref translationMode); string textToBeSent = string.Format(Template.GetMessageTranslatedTemplate, _sessionToken, translationMode); buffer = textToBeSent.ToFlowProtocolAsciiEncodedBytesArray(); _client.Send(buffer, buffer.Length); } buffer = _client.Receive(ref serverEndPoint); string response = string.Empty; if (buffer.Length > 0) { response = buffer.ToFlowProtocolAsciiDecodedString(); } var responseComponents = _parser.ParseResponse(response); if (responseComponents.TryGetValue(Cmd, out string cmd)) { if (cmd == Commands.GetMessage) { if (responseComponents.TryGetValue(StatusDescription, out string statusDesc)) { if (statusDesc == Error) { responseComponents.TryGetValue(ResultValue, out string resultValue); return(new GetMessageResult { Success = false, ErrorExplained = resultValue }); } if (statusDesc == Ok) { responseComponents.TryGetValue(SenderId, out string senderId); responseComponents.TryGetValue(SenderName, out string senderName); responseComponents.TryGetValue(Message, out string message); return(new GetMessageResult { Success = true, SenderId = senderId, SenderName = senderName, MessageBody = message }); } } } } } catch (Exception exception) { Debug.WriteLine(exception); } finally { _client.Close(); } return(new GetMessageResult { Success = false }); }
public SendMessageResult SendMessage(string recipient, string messageText, string messageTextLang) { if (_initialized == false) { throw new Exception("No connection to server"); } if (_sessionToken == Guid.Empty) { throw new Exception("Not authorized. You have to sign in first."); } _client = new UdpClient(); try { var serverEndPoint = new IPEndPoint(RemoteHostIpAddress, Port); _client.Connect(serverEndPoint); // From "English" to "en", from "Romanian" to "ro", etc. FlowUtility.ConvertToFlowProtocolLanguageNotations(ref messageTextLang); string textToBeSent = string.Format(Template.SendMessageTemplate, recipient, messageText, messageTextLang, _sessionToken); byte[] buffer = textToBeSent.ToFlowProtocolAsciiEncodedBytesArray(); _client.Send(buffer, buffer.Length); buffer = _client.Receive(ref serverEndPoint); string response = string.Empty; if (buffer.Length > 0) { response = buffer.ToFlowProtocolAsciiDecodedString(); } var responseComponents = _parser.ParseResponse(response); if (responseComponents.TryGetValue(Cmd, out string cmd)) { if (cmd == Commands.SendMessage) { if (responseComponents.TryGetValue(StatusDescription, out string statusDesc)) { if (statusDesc == Error) { return(new SendMessageResult { Success = false }); } if (statusDesc == Ok) { if (responseComponents.TryGetValue(ResultValue, out string resultValue)) { return(new SendMessageResult { Success = true, ResponseMessage = resultValue }); } } } } } } catch (Exception exception) { Debug.WriteLine(exception); } finally { _client.Close(); } return(new SendMessageResult { Success = false }); }
public SendMessageResult SendMessage(string recipient, string messageText, string messageTextLang) { if (_initialized == false) { throw new Exception("No connection to server"); } if (_sessionToken == Guid.Empty) { throw new Exception("Not authorized. You have to sign in first."); } _client = new TcpClient(); try { _client.Connect(RemoteHostIpAddress, Port); NetworkStream networkStream = _client.GetStream(); // From "English" to "en", from "Romanian" to "ro", etc. FlowUtility.ConvertToFlowProtocolLanguageNotations(ref messageTextLang); string textToBeSent = string.Format(Template.SendMessageTemplate, recipient, messageText, messageTextLang, _sessionToken); byte[] buffer = textToBeSent.ToFlowProtocolAsciiEncodedBytesArray(); if (networkStream.CanWrite) { networkStream.Write(buffer, FromBeginning, buffer.Length); networkStream.Flush(); } string response = string.Empty; if (networkStream.CanRead) { buffer = new byte[EthernetTcpUdpPacketSize]; int bytesRead = networkStream.Read(buffer, FromBeginning, EthernetTcpUdpPacketSize); response = buffer.Take(bytesRead).ToArray().ToFlowProtocolAsciiDecodedString(); } var responseComponents = _parser.ParseResponse(response); if (responseComponents.TryGetValue(Cmd, out string cmd)) { if (cmd == Commands.SendMessage) { if (responseComponents.TryGetValue(StatusDescription, out string statusDesc)) { if (statusDesc == Error) { return(new SendMessageResult { Success = false }); } if (statusDesc == Ok) { if (responseComponents.TryGetValue(ResultValue, out string resultValue)) { return(new SendMessageResult { Success = true, ResponseMessage = resultValue }); } } } } } } catch (Exception exception) { Debug.WriteLine(exception); } finally { _client.Close(); } return(new SendMessageResult { Success = false }); }
public string Translate(string sourceText, string sourceTextLang, string targetTextLanguage) { if (_initialized == false) { throw new Exception("No connection to server"); } _client = new TcpClient(); try { _client.Connect(RemoteHostIpAddress, Port); NetworkStream networkStream = _client.GetStream(); // From "English" to "en", from "Romanian" to "ro", etc. FlowUtility.ConvertToFlowProtocolLanguageNotations(ref sourceTextLang); FlowUtility.ConvertToFlowProtocolLanguageNotations(ref targetTextLanguage); string textToBeSent = string.Format(Template.TranslateTemplate, sourceText, sourceTextLang, targetTextLanguage); byte[] buffer = textToBeSent.ToFlowProtocolAsciiEncodedBytesArray(); if (networkStream.CanWrite) { networkStream.Write(buffer, FromBeginning, buffer.Length); networkStream.Flush(); } string response = string.Empty; if (networkStream.CanRead) { buffer = new byte[EthernetTcpUdpPacketSize]; int bytesRead = networkStream.Read(buffer, FromBeginning, EthernetTcpUdpPacketSize); response = buffer.Take(bytesRead).ToArray().ToFlowProtocolAsciiDecodedString(); } var responseComponents = _parser.ParseResponse(response); if (responseComponents.TryGetValue(Cmd, out string cmd)) { if (cmd == Commands.Translate) { if (responseComponents.TryGetValue(ResultValue, out string resultValue)) { return(resultValue); } } } } catch (Exception exception) { Debug.WriteLine(exception); } finally { _client.Close(); } return(string.Empty); }
public static bool PunchAppdOperation_SaveData(Punch_Confirm_Remedy_Bean model, Dictionary <string, string> oAssDic, string btnName, string FlowStepOpinion, out long seccessCount, out string msg, string flowCode = "", string flowSN = "", string flowSeq = "", string FlowLogBatNo = "", string FlowLogID = "", Dictionary <string, string> toUserData = null) { seccessCount = 0; msg = ""; Punch_Confirm_Remedy_Bean datas = new Punch_Confirm_Remedy_Bean(); try { FlowExpress flow = new FlowExpress(Util.getAppSetting("app://AattendantDB_PunchUpdate/"), model.FlowCaseID, false); string strFlowLogID = flow.FlowCurrLastLogID; //string strFlowLogID=PunchUpdate.getFlowLogID(Util.getAppSetting("app://AattendantDB_PunchUpdate/"), model.FlowCaseID); //FlowExpress flow = new FlowExpress(Util.getAppSetting("app://AattendantDB_PunchUpdate/"), model.FlowCaseID); //FlowExpress flow = new FlowExpress(Util.getAppSetting("app://AattendantDB_PunchUpdate/"), strFlowLogID); DbHelper db = new DbHelper(Aattendant._AattendantDBName); CommandHelper sb = db.CreateCommandHelper(); DbConnection cn = db.OpenConnection(); DbTransaction tx = cn.BeginTransaction(); Punch_Confirm_Remedy_Bean dataBean = new Punch_Confirm_Remedy_Bean() { FlowCaseID = model.FlowCaseID, CompID = model.CompID, EmpID = model.EmpID, EmpName = model.EmpName, DutyDate = model.DutyDate, DutyTime = model.DutyTime, PunchDate = model.PunchDate, PunchTime = model.PunchTime, PunchConfirmSeq = model.PunchConfirmSeq, DeptID = model.DeptID, DeptName = model.DeptName, OrganID = model.OrganID, OrganName = model.OrganName, FlowOrganID = model.FlowOrganID, FlowOrganName = model.FlowOrganName, ConfirmStatus = model.ConfirmStatus, PunchRemedySeq = model.PunchRemedySeq, RemedyReasonID = model.RemedyReasonID, RemedyReasonCN = model.RemedyReasonCN, RemedyPunchTime = model.RemedyPunchTime, AbnormalFlag = model.AbnormalFlag, AbnormalReasonID = model.AbnormalReasonID, AbnormalReasonCN = model.AbnormalReasonCN, AbnormalDesc = model.AbnormalDesc, Remedy_MAFT10_FLAG = model.Remedy_MAFT10_FLAG, Remedy_AbnormalFlag = model.Remedy_AbnormalFlag, Remedy_AbnormalReasonID = model.Remedy_AbnormalReasonID, Remedy_AbnormalReasonCN = model.Remedy_AbnormalReasonCN, Remedy_AbnormalDesc = model.Remedy_AbnormalDesc, LastChgComp = model.LastChgComp, LastChgID = model.LastChgID, LastChgDate = model.LastChgDate, //Remedy RemedyPunchFlag = model.RemedyPunchFlag, BatchFlag = model.BatchFlag, PORemedyStatus = model.PORemedyStatus, RejectReason = model.RejectReason, RejectReasonCN = model.RejectReasonCN, ValidDateTime = model.ValidDateTime, ValidCompID = model.ValidCompID, ValidID = model.ValidID, ValidName = model.ValidName }; try { SqlCommand.PunchAppdOperation_UpdatePunchRemedyLog(dataBean, ref sb); SqlCommand.PunchAppdOperation_UpdatePunchConfirm(dataBean, ref sb); //內部判定結案or駁回 SqlCommand.PunchAppdOperation_UpdateHROtherFlowLog(dataBean.FlowCaseID, dataBean.ConfirmStatus == "4" ? "3" : "2", ref sb); if (dataBean.PORemedyStatus == "2")//沒結案(送簽中) { OBFlowUtility.InsertHROtherFlowLogCommand(dataBean.FlowCaseID, CustVerify.addone(FlowLogBatNo), CustVerify.FlowLogIDadd(FlowLogID), "P", dataBean.EmpID, dataBean.OrganID, dataBean.FlowOrganID, UserInfo.getUserInfo().UserID, flowCode, flowSN, CustVerify.addone(flowSeq), toUserData["SignLine"], toUserData["SignIDComp"], toUserData["SignID"], toUserData["SignOrganID"], toUserData["SignFlowOrganID"], "1", false, ref sb); } else if (dataBean.PORemedyStatus == "3" || dataBean.PORemedyStatus == "4")//結案 { FlowUtility.ChangeFlowFlag(dataBean.FlowCaseID, flowCode, flowSN, UserInfo.getUserInfo().CompID, UserInfo.getUserInfo().UserID, "0", ref sb); } //======(test錯誤的存在)======= //sb.Append("test錯誤的存在"); msg = "注定失敗"; return(false); //======(test錯誤的存在)======= seccessCount = db.ExecuteNonQuery(sb.BuildCommand(), tx); //執行新增,成功筆數回傳,並做Transaction機制 if (seccessCount > 0) { if (FlowExpress.IsFlowVerify(flow.FlowID, flow.FlowCurrLastLogID, btnName, oAssDic, FlowStepOpinion)) { tx.Commit(); //成功Transaction直接Commit } else { tx.Rollback(); //失敗Transaction Rollback msg = "永豐流程寫入失敗"; } } else { tx.Rollback(); //失敗Transaction Rollback msg = "審核失敗,更新0筆資料"; } } catch (Exception ex) { tx.Rollback(); //失敗Transaction Rollback msg = ex.Message; throw ex; } } catch (Exception ex) { //tx.Rollback(); //失敗Transaction Rollback msg = ex.Message; return(false); } return(true); }