public DataTable QueryDetailByID(ArrayList ParameterList) { DBO.VDS_CGR03_DBO CGRM = new VDS_CGR03_DBO(ref USEDB); DataTable Dt; try { Dt = CGRM.QueryDetailByID(ParameterList); return Dt; } catch (Exception ex) { throw ex; } }
public DataTable CheckFullBarCode(ArrayList ParameterList) { DBO.VDS_CGR03_DBO CGRM = new VDS_CGR03_DBO(ref USEDB); DataTable Dt; try { Dt = CGRM.CheckFullBarCode(ParameterList); return Dt; } catch (Exception ex) { throw ex; } }
public void UpdateMainDetail(DataTable Dt_Main, DataTable Dt_Detail, string UID, DbTransaction RootDBT,out int M_ID) { bool IsRootTranscation = false; M_ID = 0; if (Dt_Main.Rows.Count > 0) { M_ID = int.Parse(Dt_Main.Rows[0]["ID"].ToString()); } try { DBO.VDS_CGR03_DBO dbo = new VDS_CGR03_DBO(ref USEDB); //判斷是否有傳入Root Transcation IsRootTranscation = (RootDBT == null) ? true : false; #region 啟動交易或指定RootTranscation if (IsRootTranscation) { //獨立呼叫啟動Transcation Conn = USEDB.CreateConnection(); Conn.Open(); DBT = Conn.BeginTransaction(); } else { DBT = RootDBT; } #endregion DataTable DtM_A = Dt_Main.GetChanges(DataRowState.Added); DataTable DtM_M = Dt_Main.GetChanges(DataRowState.Modified); DataTable DtD_A = Dt_Detail.GetChanges(DataRowState.Added); DataTable DtD_M = Dt_Detail.GetChanges(DataRowState.Modified); DataTable DtD_D = Dt_Detail.GetChanges(DataRowState.Deleted); ArrayList arrayList = new ArrayList(); if (DtM_A != null) { for (int i = 0; i <= DtM_A.Rows.Count - 1; i++) { arrayList.Clear(); arrayList.Add(DtM_A.Rows[i]["STORE"].ToString()); arrayList.Add(DtM_A.Rows[i]["P_DATE"].ToString()); arrayList.Add(DtM_A.Rows[i]["CHAN_NO"].ToString()); arrayList.Add(DtM_A.Rows[i]["CHAN_SOURCE_NO"].ToString()); arrayList.Add(DtM_A.Rows[i]["SIGN_DATE"].ToString()); //arrayList.Add(DtM_A.Rows[i]["ST_ACCEPT_DATE"].ToString()); arrayList.Add(UID); M_ID = dbo.InsertMain(arrayList, DBT); } DtM_A.Clear(); } if (DtM_M != null) { for (int i = 0; i <= DtM_M.Rows.Count - 1; i++) { arrayList.Clear(); arrayList.Add(Convert.ToInt32(DtM_M.Rows[i]["ID", DataRowVersion.Original].ToString())); arrayList.Add(DtM_M.Rows[i]["CHAN_SOURCE_NO", DataRowVersion.Current].ToString()); arrayList.Add(DtM_M.Rows[i]["UPDATEUID", DataRowVersion.Original].ToString()); arrayList.Add(UID); arrayList.Add(DtM_M.Rows[i]["UPDATEDATE", DataRowVersion.Original]); arrayList.Add(DtM_M.Rows[i]["UPDATEDATE", DataRowVersion.Current]); dbo.UpdateMain(arrayList, DBT); } DtM_M.Clear(); } if (DtD_D != null) { for (int i = 0; i <= DtD_D.Rows.Count - 1; i++) { arrayList.Clear(); arrayList.Add(DtD_D.Rows[i]["ID", DataRowVersion.Original].ToString()); arrayList.Add(DtD_D.Rows[i]["UPDATEUID", DataRowVersion.Original].ToString()); arrayList.Add(DtD_D.Rows[i]["UPDATEDATE", DataRowVersion.Original]); dbo.DeleteDetail(arrayList, DBT); } DtD_D.Clear(); } if (DtD_A != null) { for (int i = 0; i <= DtD_A.Rows.Count - 1; i++) { arrayList.Clear(); arrayList.Add(M_ID); arrayList.Add(DtD_A.Rows[i]["FULLBARCODE"]); arrayList.Add(DtD_A.Rows[i]["BARCODE"]); arrayList.Add(DtD_A.Rows[i]["PERIOD_BARCODE"]); arrayList.Add(DtD_A.Rows[i]["ITEM"]); arrayList.Add(DtD_A.Rows[i]["ITEM_NAME"]); arrayList.Add(DtD_A.Rows[i]["PERIOD"]); arrayList.Add(DtD_A.Rows[i]["ITEM_MAP"]); arrayList.Add(int.Parse(DtD_A.Rows[i]["P_QTY"].ToString())); arrayList.Add(DtD_A.Rows[i]["P_CLASS"]); arrayList.Add(DtD_A.Rows[i]["P_NOTES"]); arrayList.Add(UID); dbo.InsertDetail(arrayList, DBT); } DtD_A.Clear(); } if (DtD_M != null) { for (int i = 0; i <= DtD_M.Rows.Count - 1; i++) { arrayList.Clear(); arrayList.Add(DtD_M.Rows[i]["ID", DataRowVersion.Original].ToString()); arrayList.Add(DtD_M.Rows[i]["P_QTY", DataRowVersion.Current].ToString()); arrayList.Add(DtD_M.Rows[i]["P_CLASS", DataRowVersion.Current].ToString()); arrayList.Add(DtD_M.Rows[i]["P_NOTES", DataRowVersion.Current].ToString()); arrayList.Add(DtD_M.Rows[i]["UPDATEUID", DataRowVersion.Original].ToString()); arrayList.Add(UID); arrayList.Add(DtD_M.Rows[i]["UPDATEDATE", DataRowVersion.Original]); arrayList.Add(DtD_M.Rows[i]["UPDATEDATE", DataRowVersion.Current]); dbo.UpdateDetail(arrayList, DBT); } DtD_M.Clear(); } #region 交易成功 if (IsRootTranscation) { //獨立呼叫Transcation成立 DBT.Commit(); } #endregion } catch (Exception ex) { #region 交易失敗 //if (IsRootTranscation) //{ //獨立呼叫Transcation失敗 DBT.Rollback(); //} #endregion throw ex; } finally { #region 判斷是否關閉交易連線 if (IsRootTranscation) { //獨立呼叫Transcation,關閉連線 if (Conn.State == ConnectionState.Connecting) { Conn.Close(); } } #endregion } }
/// <summary> /// 如果正常刪除,回傳1 /// 如果"此筆再退單已指定門市進貨日,不可刪除!" 回傳 0 /// </summary> /// <param name="ParameterList"></param> /// <param name="RootDBT"></param> /// <returns></returns> public int DelSorterException(ArrayList ParameterList, DbTransaction RootDBT) { int result; bool IsRootTranscation = false; DBO.VDS_CGR03_DBO CGRM = new VDS_CGR03_DBO(ref USEDB); try { //判斷是否有傳入Root Transcation IsRootTranscation = (RootDBT == null) ? true : false; #region 啟動交易或指定RootTranscation if (IsRootTranscation) { //獨立呼叫啟動Transcation Conn = USEDB.CreateConnection(); Conn.Open(); DBT = Conn.BeginTransaction(); } else { DBT = RootDBT; } #endregion result = CGRM.DelSorterException(ParameterList, DBT); #region 交易成功 if (IsRootTranscation) { //獨立呼叫Transcation成立 DBT.Commit(); } #endregion return result; } catch (Exception ex) { #region 交易失敗 if (IsRootTranscation) { //獨立呼叫Transcation失敗 DBT.Rollback(); } #endregion throw ex; } finally { #region 判斷是否關閉交易連線 if (IsRootTranscation) { //獨立呼叫Transcation,關閉連線 if (Conn.State == ConnectionState.Connecting) { Conn.Close(); } } #endregion } }
public string GetChanNoByStore(ArrayList ParameterList) { DBO.VDS_CGR03_DBO CGRM = new VDS_CGR03_DBO(ref USEDB); DataTable Dt; try { Dt = CGRM.GetChanNo(ParameterList); if (Dt.Rows.Count > 0) { return Dt.Rows[0]["chan_no"].ToString(); } return ""; } catch (Exception ex) { throw ex; } }
public DataTable GetRouteStep(ArrayList ParameterList) { DBO.VDS_CGR03_DBO CGRM = new VDS_CGR03_DBO(ref USEDB); DataTable Dt; try { Dt = CGRM.GetRouteStep(ParameterList); return Dt; } catch (Exception ex) { throw ex; } }
public DataTable FindP_Class() { DBO.VDS_CGR03_DBO CGRM = new VDS_CGR03_DBO(ref USEDB); DataTable Dt; try { Dt = CGRM.FindP_Class(); return Dt; } catch (Exception ex) { throw ex; } }