/// <summary>
        /// �ت�:�N�W���ɮפ��e�A�s�J�Ȧs��
        /// �ǤJ�ѼơG
        /// �e@�ҥΤ�f
        /// 1.���M���e�@���A�P�@�ϥΪ̰��檺�פJ�Ȧs��T�P���~��T�C
        ///    ����Table:
        ///    B=VDS_STM_ROUTE_STORE_TMP
        /// 2.Ū���פJ�ɮר�ȦsDataSet�C
        /// B.EFF_START=�e@�ҥΤ�f�A��L���ѷ��ɮ׮榡�C
        /// 3.�ˬd�פJ�ɮ׮榡���e�O�_���T�A�p�������~�A�h����W�Ǭy�{�A�æ^�ǿ��~�T���C
        ///   �yXX�ɮסA�ɮפ��e���~�G@���~�����z (�榡�аѦҸ�ƮwTable Shcema)
        ///       * ����G�ˬd����榡�C
        ///       * �Ʀr�G�ˬd���e�O�_���Ʀr�C
        ///       * ��r�G�ˬd���׬O�_����C
        ///       * �ɮ����ƬO�_�����C
        ///       * ��Ӥu�@��פJ���e����@�����A�ҵ������~�A�����C
        ///       * �פJ���Ӹ`�����аѦҡGWEB UI SPEC ���
        /// 4. �榡�ˬd���T�L�~��
        ///    a) �Ȧs�ɤ���[���A]���վ㬰1:FILE TO TMP
        ///    b) �I�s [CheckData] �A�ˬd��Ƥ��e�޿西�T��
        /// 5. �L��CheckData()�ˬd���G�O�_��True�A
        ///    �ұN�W���ɮפ��e�s�W���ƮwTmp Table:�A
        ///    �ðO�����~��]�B�פJ�̡B�פJ����B�B�z�ɮצW��=�W���ɦW�C
        ///    c)�W�z�פJ�ݤ@��Commit�A�B�z�����������~�A�ҵ������`�A���Rollback�A�æ^�ǿ��~�T���C
        /// 6. �W�Ǭy�{�����A�^�dzB�z���ưT���G�W���`���ơB���\���ơB���ѵ��ơC
        /// 7.�p�GCheckData()�ˬd���G��True�A�I�s [ProcessImportRoute.TmpToDB]�A�B�z�פJ�������C
        /// * �פJ�ɮ׹����A�аѦҤu�@��GSTM24 ��u����פJ(�ɮ׮榡)�C
        /// </summary>
        public void FileToTmp(DataTable dt, DbTransaction RootDBT, string V_DATA_SOURCE, string V_RUN_STATUS, string V_CREATEUID, out string ErrorMsg)
        {
            bool IsRootTranscation = false;

            try
            {
                OUT04 dbo = new OUT04(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_OUT_VENDOR_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 != 7)
                            {
                                ErrorMsg = "��J�~���Ȥ�q���ɮץ��ѡA���ӼƤ��� 7 �ӡA���˵����`����I";
                                throw new Exception(ErrorMsg);
                            }
                            else
                            {
                                int[] V_LENGTH_ARRAY = { 10, 30, 15, 5, 6, 10, 5 };
                                string V_LENGTH_LIMIT = "" ; // �i�H���ŭȪ����(���q�ǯu,�|�pE-MAIL,���f�a�}_2)
                                // Ū�J�}�C�����
                                string V_STORE = V_DATA[0];
                                string V_ITEM_NAME = V_DATA[1];
                                string V_BARCODE = V_DATA[2];
                                string V_PRICE = V_DATA[3];
                                string V_ST_ORDER_QTY = V_DATA[4];
                                string V_VENDOR = V_DATA[5];
                                string V_PRICE_DISCOUNT = V_DATA[6];
                                // ��ƪ����ˬd
                                for (int j = 0; j < V_LENGTH_ARRAY.Length;j++ )
                                {
                                    // ���o���ŭȪ�����ˬd
                                    if (V_DATA[j].Length <= 0 && V_LENGTH_LIMIT.IndexOf((j+1).ToString()) == -1)
                                    {
                                        ErrorMsg = string.Format("��J�~���Ȥ�q���ɮץ��ѡA��{0}����ơA��{1}�����A�H�Ϥ��o���ŭȪ�����", i, j);
                                        throw new Exception(ErrorMsg);
                                    }
                                    // �����ת��ˬd
                                    if (V_DATA[j].Length > V_LENGTH_ARRAY[j])
                                    {
                                        ErrorMsg = string.Format("��J�~���Ȥ�q���ɮץ��ѡA��{0}����ơA��{1}�����A��ƪ��׶W�L����", i, j);
                                        throw new Exception(ErrorMsg);
                                    }
                                }
                                // ��ƫ��O�ˬd
                                int V_IntTryParse;
                                Decimal V_DecTryParse;
                                if (!Decimal.TryParse(V_PRICE_DISCOUNT, out V_DecTryParse) && !int.TryParse(V_PRICE, out V_IntTryParse) && !int.TryParse(V_ST_ORDER_QTY, out V_IntTryParse))
                                {
                                    ErrorMsg = "��J�~���Ȥ�q���ɮץ��ѡA��ƫ��O�����T�A���˵����`����I";
                                    throw new Exception(ErrorMsg);
                                }

                                ParameterList.Clear();
                                ParameterList.Add(V_DATA_SOURCE);
                                ParameterList.Add(System.DateTime.Now);
                                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(V_RUN_STATUS , V_CREATEUID, DBT, out V_RESULT);

                if (V_RESULT == "0")
                    ErrorMsg = "��J�~���Ȥ�q���ɮץ��ѡ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�ߤW�ǫ᪺���\����
        /// Table:VDS_VDM_VCMS_MAIN_TMP
        /// ����:V_CREATEUID
        /// </summary>
        public void QueryItemTmpImportStat(string V_CREATEUID, out int N_TMP_CNT, out int N_TAB_CNT)
        {
            try
            {
                OUT04 dbo = new OUT04(ref USEDB);

                dbo.doQueryItemTmpImportStat(V_CREATEUID, out N_TMP_CNT, out N_TAB_CNT);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#3
0
    }//page_load

    /// <summary>
    /// 繫結資料到控制項
    /// </summary>
    /// <param name="vdb">0:查詢鈕,1:匯出鈕</param>
    private void databind(char src)
    {
        //抓取本頁初次登記的時間
        string SessionIDName = "OUT041_" + PageTimeStamp.Value;

        OUT04 BCO = new OUT04(ConntionDB);
        DataTable Dt = BCO.QuerySKUByFind_2(ParameterList, src);

        // 將結案按鈕打開
        //Button v_btnClose = (Button)this.FindControl("btnClose");
        if (Dt.Rows.Count > 0)
            btnClose.Enabled = true;
        else
            btnClose.Enabled = false;

        DataTable dt = Dt.Copy(); //複製成另一份,因匯出時有將ID及Enable欄位移除
        Session["OUT04" + PageTimeStamp.Value] = dt;
        DataTable dtTemp = Dt.DefaultView.ToTable("TempTable", true, "ID",
        "BUSDATE",
        "PO_SOURCE_NO",
        "STORE",
        "STORE_NAME",
        "BARCODE",
        "ITEM_NAME",
        "ST_ORDER_QTY",
        "STATUS",
        "CLOSE_STATUS",
        "STATUS_REASON"
        );

        Session["OUT041_" + 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["OUT041_SortKey" + PageTimeStamp.Value] = arl_Key;
        }
            #endregion
    }//databind
 /// <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
     {
         OUT04 dbo = new OUT04(ref USEDB);
         return dbo.doQueryItemTmpError(V_CREATEUID, V_CREATEDATE_S, V_CREATEDATE_E);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#5
0
 protected void btnClose_Click(object sender, EventArgs e)
 {
     ArrayList al = new ArrayList();
     foreach (GridViewRow dr in GridView1.Rows)
     {
         CheckBox cbCloseStatus = (CheckBox)dr.FindControl("cbCLOSE_STATUS");
         if (cbCloseStatus.Checked)
         {
             string id = ((Label)dr.FindControl("lblID")).Text;
             string status_reason = ((DropDownList)dr.FindControl("ddlSTATUS_REASON")).SelectedValue;
             al.Add(new string[] { id, status_reason, Session["UID"].ToString() });
         }
     }
     OUT04 BCO = new OUT04(ConntionDB);
     BCO.CloseOrder(al, null);
     // 針對結案後的頁面進行重新查詢
     Query_Data('0');
 }