}//page_load /// <summary> /// 繫結資料到控制項 /// </summary> /// <param name="vdb">0:查詢鈕,1:匯出鈕</param> private void databind(char src) { //抓取本頁初次登記的時間 string SessionIDName = "OUT011_" + PageTimeStamp.Value; OUT01 BCO = new OUT01(ConntionDB); DataTable Dt = BCO.QuerySKUByFind_2(ParameterList, src); DataTable dt = Dt.Copy(); //複製成另一份,因匯出時有將ID及Enable欄位移除 Session["OUT01" + PageTimeStamp.Value] = dt; DataTable dtTemp = Dt.DefaultView.ToTable("TempTable", true, "ID", "BARCODE", "ITEM_NAME", "MDC_START_DATE", "MDC_END_DATE", "MANUFACTURE"); Session["OUT011_" + PageTimeStamp.Value] = dtTemp; if (src == '0') { ViewState["SortField"] = null; GridView1.DataSource = dtTemp; //設定分頁大小 GridView1.PageSize = (TextBoxPagesize.Text == "") ? 10 : (int.Parse(TextBoxPagesize.Text) < 0) ? 10 : int.Parse(TextBoxPagesize.Text); GridView1.PageIndex = 0; GridView1.DataBind(); #region 將Key值存到Session中 ArrayList arl_Key = new ArrayList(); foreach (DataRow drRow in Dt.Rows) { arl_Key.Add(drRow["ID"].ToString()); } Session["OUT011_SortKey" + PageTimeStamp.Value] = arl_Key; } #endregion }//databind
/// <summary> /// �ت�:�d�ߤW�ǫ᪺���\���� /// Table:VDS_VDM_VCMS_MAIN_TMP /// ����:V_CREATEUID /// </summary> public void QueryItemTmpImportStat(DateTime V_MDC_DATE_START , string V_CREATEUID, out int N_TMP_CNT, out int N_TAB_CNT) { try { OUT01 dbo = new OUT01(ref USEDB); dbo.doQueryItemTmpImportStat(V_MDC_DATE_START , V_CREATEUID, out N_TMP_CNT, out N_TAB_CNT); } catch (Exception ex) { throw ex; } }
/// <summary> /// �ت�:�N�W���ɮפ��e�A�s�J�Ȧs�� /// </summary> public void FileToTmp(DataTable dt, DbTransaction RootDBT, string V_DATA_SOURCE, string V_CREATEUID, string V_EFF_START,out string ErrorMsg) { bool IsRootTranscation = false; try { OUT01 dbo = new OUT01(ref USEDB); ErrorMsg = ""; //�P�_�O�_���ǤJRoot Transcation IsRootTranscation = (RootDBT == null) ? true : false; #region �Ұʥ���Ϋ��wRootTranscation if (IsRootTranscation) { //�W�ߩI�s�Ұ�Transcation Conn = USEDB.CreateConnection(); Conn.Open(); DBT = Conn.BeginTransaction(); } else { DBT = RootDBT; } #endregion #region �M��VDS_VDM_VCMS_MAIN_TMP dbo.doDeleteItemTmp(V_CREATEUID, DBT); #endregion #region FileToTmp ArrayList ParameterList = new ArrayList(); string V_RESULT = "1"; if (dt != null) { for (int i = 0; i < dt.Rows.Count; i++) { if (V_RESULT == "1") { string[] V_DATA = dt.Rows[i][0].ToString().Split(','); if (V_DATA.Length != 5) { ErrorMsg = "��J�~���ӫ~�ɮץ��ѡA���˵����`����I"; throw new Exception(ErrorMsg); } else { string V_ITEM_NAME = V_DATA[0]; string V_BARCODE = V_DATA[1]; string V_PRICE = V_DATA[2]; string V_WEIGHT = V_DATA[3]; string V_VENDOR = V_DATA[4]; // ��ƪ����ˬd if (V_ITEM_NAME.Length <= 0 && V_ITEM_NAME.Length > 30) { ErrorMsg = "��J�~���ӫ~�ɮץ��ѡA���˵����`����I"; throw new Exception(ErrorMsg); } else if (V_BARCODE.Length <= 0 && V_BARCODE.Length > 15) { ErrorMsg = "��J�~���ӫ~�ɮץ��ѡA���˵����`����I"; throw new Exception(ErrorMsg); } else if (V_VENDOR.Length <= 0 && V_VENDOR.Length > 10) { ErrorMsg = "��J�~���ӫ~�ɮץ��ѡA���˵����`����I"; throw new Exception(ErrorMsg); } // ��ƫ��O�ˬd int V_IntTryParse ; Decimal V_DecTryParse; if (! int.TryParse(V_PRICE,out V_IntTryParse)) { ErrorMsg = "��J�~���ӫ~�ɮץ��ѡA���˵����`����I"; throw new Exception(ErrorMsg); } else if (!Decimal.TryParse(V_WEIGHT, out V_DecTryParse) && !int.TryParse(V_WEIGHT, out V_IntTryParse)) { ErrorMsg = "��J�~���ӫ~�ɮץ��ѡA���˵����`����I"; throw new Exception(ErrorMsg); } ParameterList.Clear(); ParameterList.Add(V_DATA_SOURCE); ParameterList.Add(V_EFF_START); ParameterList.Add(dt.Rows[i][0].ToString()); ParameterList.Add(V_CREATEUID); ParameterList.Add(System.DateTime.Now); dbo.doCreateItemTmp(ParameterList, DBT, out V_RESULT); } } } } #endregion #region TmpToDB dbo.doCreateItem(Convert.ToDateTime(V_EFF_START), V_CREATEUID, DBT, out V_RESULT); if (V_RESULT == "0") ErrorMsg = "��J�~���ӫ~�ɮץ��ѡA���˵����`����I"; #endregion if (IsRootTranscation) { //�W�ߩI�sTranscation���� DBT.Commit(); } } catch (Exception ex) { #region ������� DBT.Rollback(); #endregion throw ex; } finally { #region �P�_�O�_��������s�u if (IsRootTranscation) { //�W�ߩI�sTranscation,�����s�u if (Conn.State == ConnectionState.Connecting) { Conn.Close(); } } #endregion } }
/// <summary> /// �ت�:�d�߿��~�T����� /// Table: /// B=VDS_STM_ROUTE_STORE_TMP /// ����:[��ƫ��A]=2:���~��ơB[�إߤH��]= /// </summary> public DataTable QueryErrorByFind(string V_CREATEUID, DateTime V_CREATEDATE_S, DateTime V_CREATEDATE_E) { try { OUT01 dbo = new OUT01(ref USEDB); return dbo.doQueryItemTmpError(V_CREATEUID, V_CREATEDATE_S, V_CREATEDATE_E); } catch (Exception ex) { throw ex; } }