//*****************************表單自訂Fuction**************************************** #region WfConfirm 確認 private void WfConfirm() { vw_stpi100 masterModel = null; try { if (DrMaster == null) { return; } if (WfRetrieveMaster() == false) { return; } if (WfLockMasterRow() == false) //這裡會LOCK資料 { return; } WfSetBllTransaction(); masterModel = DrMaster.ToItem <vw_stpi100>(); if (masterModel.scavali == "N") { WfShowErrorMsg("客戶已失效!"); WfRollback(); return; } if (GlobalFn.isNullRet(masterModel.scaconf, "N") != "N") { WfShowErrorMsg("客戶非未確認狀態!"); WfRollback(); return; } DrMaster["scaconf"] = "Y"; DrMaster["scavali"] = "Y"; DrMaster["scamodu"] = LoginInfo.UserNo; DrMaster["scamodg"] = LoginInfo.DeptNo; DrMaster["scamodd"] = Now; BoMaster.OfUpdate(DrMaster.Table); WfCommit(); DrMaster.AcceptChanges(); WfShowBottomStatusMsg("作業成功!"); masterModel = DrMaster.ToItem <vw_stpi100>(); WfSetDocPicture(masterModel.scavali, masterModel.scaconf, "", pbxDoc); } catch (Exception ex) { WfRollback(); DrMaster.RejectChanges(); throw ex; } }
private bool WfReCalculate(string ipa01) { icc_tb iccModel; string selectSql; try { //lock master row 並取得transaction物件 if (WfLockMasterRow() == false) { WfShowErrorMsg("Lock ipa_file 失敗!"); return(false); } WfRetrieveMaster(); //更新主檔資料 WfRetrieveDetail(); //更新明細資料 WfSetBllTransaction(); //相關bll 註冊transaction TabDetailList[0].BoBasic.TRAN = BoMaster.TRAN; foreach (DataRow drDetail in TabDetailList[0].DtSource.Rows) { var ipbModel = drDetail.ToItem <ipb_tb>(); iccModel = BoInv.OfGetIccModel(ipbModel.ipb03, ipbModel.ipb04); drDetail["ipb06"] = iccModel.icc05; drDetail["ipbmodu"] = LoginInfo.UserNo; drDetail["ipbmodg"] = LoginInfo.DeptNo; drDetail["ipbmodd"] = Now; } DrMaster["ipa05"] = "Y"; DrMaster["ipa06"] = Today; DrMaster["ipamodu"] = LoginInfo.UserNo; DrMaster["ipamodg"] = LoginInfo.DeptNo; DrMaster["ipamodd"] = Now; BoMaster.OfUpdate(TabMaster.DtSource); TabDetailList[0].BoBasic.OfUpdate(TabDetailList[0].DtSource); if (WfCommit() == false) { DrMaster.RejectChanges(); TabDetailList[0].DtSource.RejectChanges(); WfRollback(); WfShowErrorMsg("執行commit失敗!"); return(false); } return(false); } catch (Exception ex) { DrMaster.RejectChanges(); TabDetailList[0].DtSource.RejectChanges(); WfRollback(); throw ex; } }
private bool WfCancelPosting(string ipa01) { icc_tb iccModel; string selectSql; try { //lock master row 並取得transaction物件 if (WfLockMasterRow() == false) { WfShowErrorMsg("Lock ipa_file 失敗!"); return(false); } WfSetBllTransaction(); //相關bll 註冊transaction TabDetailList[0].BoBasic.TRAN = BoMaster.TRAN; DrMaster["ipa07"] = "N"; DrMaster["ipa08"] = DBNull.Value; DrMaster["ipamodu"] = LoginInfo.UserNo; DrMaster["ipamodg"] = LoginInfo.DeptNo; DrMaster["ipamodd"] = Now; BoMaster.OfUpdate(TabMaster.DtSource); if (WfCommit() == false) { DrMaster.RejectChanges(); TabDetailList[0].DtSource.RejectChanges(); WfRollback(); WfShowErrorMsg("執行commit失敗!"); return(false); } return(false); } catch (Exception ex) { DrMaster.RejectChanges(); WfRollback(); throw ex; } }
protected override void WfActionClick(string pActionName) { vw_admi600 masterModel; StringBuilder sbSql; YR.ERP.Base.Forms.FrmBase frmActive = null; try { switch (pActionName.ToLower()) { case "admi601": if (FormEditMode != YREditType.NA) { return; } if (DrMaster == null) { return; } masterModel = DrMaster.ToItem <vw_admi600>(); sbSql = new StringBuilder(); sbSql.AppendLine(string.Format(" AND ado01='{0}'", masterModel.ado01)); WfShowForm("admi601", false, new object[] { "admi600", this.LoginInfo, sbSql.ToString() }); break; case "admi602": if (FormEditMode != YREditType.NA) { return; } if (DrMaster == null) { return; } masterModel = DrMaster.ToItem <vw_admi600>(); sbSql = new StringBuilder(); sbSql.AppendLine(string.Format(" AND ado01='{0}'", masterModel.ado01)); WfShowForm("admi602", false, new object[] { "admi600", this.LoginInfo, sbSql.ToString() }); break; #region genaction case "genaction": if (DrMaster == null) { return; } if (FormEditMode != YREditType.NA) { return; } masterModel = DrMaster.ToItem <vw_admi600>(); var adoModle = BoAdm.OfGetAdoModel(masterModel.ado01); if (AdoModel == null) { WfShowErrorMsg("無此程式代號"); return; } //先檢查是否有transction if (BoMaster.TRAN != null) { WfCommit(); } if (TabMaster.CanUseRowLock == true) { WfLockMasterRow(); //Lock row 並且產生transaction } else { WfBeginTran(); } try { var assembly = System.Reflection.Assembly.LoadFile(Path.Combine(Application.StartupPath, adoModle.ado03)); var type = assembly.GetType(adoModle.ado04); frmActive = Activator.CreateInstance(type) as YR.ERP.Base.Forms.FrmBase; frmActive.LoginInfo = this.LoginInfo; frmActive.WindowState = FormWindowState.Minimized; frmActive.Show(); Dictionary <string, string> dic = new Dictionary <string, string>(); var actionDic = frmActive.ActionDic; var reportDic = frmActive.ReportDic; if (actionDic != null) { foreach (KeyValuePair <string, string> keyValue in actionDic) { dic.Add(keyValue.Key, keyValue.Value); } } if (reportDic != null) { foreach (KeyValuePair <string, string> keyValue in reportDic) { dic.Add(keyValue.Key, keyValue.Value); } } StringBuilder sb = new StringBuilder(); if (dic != null) { var i = 0; foreach (KeyValuePair <string, string> keyValue in dic) { i++; sb.Append(keyValue.Key); if (i < dic.Count) { sb.Append(","); } } DrMaster["ado15"] = sb.ToString(); //WfShowMsg(sb.ToString()); } frmActive.Close(); BoMaster.OfUpdate(DrMaster.Table); WfCommit(); DrMaster.Table.AcceptChanges(); } catch (Exception ex) { WfRollback(); DrMaster.Table.RejectChanges(); throw ex; } finally { if (frmActive != null) { frmActive.Close(); } } break; #endregion } } catch (Exception ex) { throw ex; } }
private void WfInvalid() { vw_stpi100 masterModel = null; string msg; try { if (DrMaster == null) { return; } if (WfRetrieveMaster() == false) //這裡會LOCK資料 { return; } WfSetBllTransaction(); masterModel = DrMaster.ToItem <vw_stpi100>(); if (masterModel.scavali == "Y") { msg = "是否要作廢客戶?"; } else { msg = "是否要作廢還原客戶?"; } var result = WfShowConfirmMsg(msg); //if (WfShowConfirmMsg(msg) != 1) if (result != DialogResult.Yes) { return; } if (masterModel.scavali == "Y" || masterModel.scavali == "W")//走作廢 { DrMaster["scavali"] = "N"; } else { DrMaster["scavali"] = "Y"; } DrMaster["scamodu"] = LoginInfo.UserNo; DrMaster["scamodg"] = LoginInfo.DeptNo; DrMaster["scamodd"] = Now; BoMaster.OfUpdate(DrMaster.Table); WfCommit(); DrMaster.AcceptChanges(); WfShowBottomStatusMsg("作業成功!"); masterModel = DrMaster.ToItem <vw_stpi100>(); WfSetDocPicture(masterModel.scavali, masterModel.scaconf, "", pbxDoc); } catch (Exception ex) { WfRollback(); DrMaster.RejectChanges(); throw ex; } }