Ejemplo n.º 1
0
    //檢視異常報表
    protected void but_Unusual_Report_Click(object sender, EventArgs e)
    {
        #region
        try
        {
            string s_LoginUser = string.Empty;
            DataTable dt_Return = new DataTable();
            ArrayList ParameterList = new ArrayList();

            s_LoginUser = Session["UID"].ToString();//登入人員

            ParameterList.Clear();
            ParameterList.Add(Session["UID"].ToString());
            ParameterList.Add(string.Empty);
            ParameterList.Add(Session["UID"].ToString());
            ParameterList.Add(DateTime.Now);

            Int32 iTopRowNum;
            Int32.TryParse(TextBoxRowCountLimit.Text.Trim(), out iTopRowNum);
            ParameterList.Add(iTopRowNum);
            ParameterList.Add(PageTimeStamp.Value);

            CRMModel.ImportCRMOrder BCO = new CRMModel.ImportCRMOrder(ConnectionDB);
            dt_Return = BCO.QueryErrorByFind(ParameterList);

            if (dt_Return.Rows.Count > 0)
            {
                //string SessionIDName = "CRM04A_" + PageTimeStamp.Value;
                string SessionIDName = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value);
                Session[SessionIDName] = dt_Return;
                this.gv_ErrorData.DataSource = dt_Return.DefaultView;

                this.gv_ErrorData.PageSize = (TextBoxPagesize.Text == "") ? 10 : (int.Parse(TextBoxPagesize.Text) <= 0) ? 10 : int.Parse(TextBoxPagesize.Text);
                this.gv_ErrorData.PageIndex = 0;
                this.gv_ErrorData.DataBind();

                btn_Export.Enabled = true;

            }
            else
            {
                btn_Export.Enabled = false;

                this.gv_ErrorData.DataSource = dt_Return.DefaultView;
                this.gv_ErrorData.DataBind();
                ResultMsgLabel.Text = "查無資料";

            }

        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
            up_ErrorMsg.Update();
        }
        #endregion
    }
Ejemplo n.º 2
0
    private void TempDataToDataBase()
    {
        #region

        DataTable dtBatchImportResult = null;
        string strSerialBatchNo = "";

        try
        {
            ArrayList arl_Return = null;
            string s_LoginUser = string.Empty;
            string s_UploadPath_File = string.Empty;
            string s_BackPath_File = string.Empty;


            s_LoginUser = Session["UID"].ToString();//登入人員

            CRMModel.ImportCRMOrder BCO = new CRMModel.ImportCRMOrder(ConnectionDB);

            ArrayList ParameterList = new ArrayList();
            ParameterList.Clear();
            ParameterList.Add(s_AP_FileName);
            ParameterList.Add(s_LoginUser);
            ParameterList.Add(PageTimeStamp.Value);
            ParameterList.Add(DateTime.Now.ToString("yyyy/MM/dd"));


            if (s_AP_FileName != string.Empty)
            {
                arl_Return = BCO.TmpToDB(ParameterList, out strSerialBatchNo, out dtBatchImportResult);
            }
            else
            {
                this.Response.Write("請重新匯入 EXCEL 檔");
            }

            if (arl_Return[0].ToString() == "TEMPTODB 正確")
            {
                #region 設定 UploadStatusPanel 的值

                //匯入結果
                UploadStatusPanel1.ImportSum = iProcessingCounts;
                UploadStatusPanel1.ImportOK = iProcessingCounts;
                UploadStatusPanel1.ImportNG = 0;

                #endregion

                ShowBatchImportGridView(true, dtBatchImportResult);

                btn_LackPrint.Enabled = true;
                up_File_To_Temp.Update();
            }

            this.but_Temp_To_DB.Enabled = false;
            this.but_File_To_Temp.Enabled = true;
            this.but_Unusual_Report.Enabled = true;
            this.ButtonQuery.Enabled = true;
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
            up_ErrorMsg.Update();
        }
        #endregion
    }
Ejemplo n.º 3
0
    private bool CheckBookLackDataIsExisted(string strUserID, string strPageTimeStamp)
    {
        #region check data
        bool bResult = false;
        ArrayList ParameterList = new ArrayList();
        ParameterList.Clear();
        ParameterList.Add(strUserID);
        ParameterList.Add(strPageTimeStamp);

        CRMModel.ImportCRMOrder BCO = new CRMModel.ImportCRMOrder(ConnectionDB);
        DataTable dtBookLack = BCO.CheckBookLack(ParameterList);
        string SessionIDName = string.Format("{0}_{1}_BOOKLACK", "CRM04A_MST", strPageTimeStamp);
        Session[SessionIDName] = dtBookLack;

        if (dtBookLack == null || dtBookLack.Rows.Count <= 0)
        {
            bResult = false;
        }
        else
        {
            bResult = true;
        }
        return bResult;
        #endregion
    }
Ejemplo n.º 4
0
    private bool ClientFileToServerTemp()
    {
        #region

        bool bResult = false;

        try
        {
            if (FileUpload1.FileName == "") return false;

            string s_UploadPath = string.Empty;
            string s_BackPath = string.Empty;
            string s_LoginUser = string.Empty;
            ArrayList arl_FileUpload_Return = null;
            ArrayList arl_FileToTmp_Return = null;

            CRMModel.ImportCRMOrder BCO = new CRMModel.ImportCRMOrder(ConnectionDB);

            #region 上傳檔案到AP端


            //取得要上傳的路徑
            s_UploadPath = Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["UploadPath"]).Replace("CRM\\", "") + "\\CRM\\";
            s_LoginUser = Session["UID"].ToString();

            arl_FileUpload_Return = BCO.FileUpload(s_UploadPath, this.FileUpload1, s_LoginUser);

            #endregion

            if (arl_FileUpload_Return[0].ToString() == "FALSE")//檔案上傳至AP端錯誤
            {
                return false;//檔案上傳至AP端錯誤,後面直接不做了
            }
            else if (arl_FileUpload_Return[0].ToString() == "TRUE")//檔案上傳至AP端正常
            {

                #region 讀取 Excel 資料

                DataSet ds_Excel = BCO.ReadDataFromExcel(arl_FileUpload_Return[1].ToString());

                #endregion

                #region 將檔案匯入TmpTable

                DateTime d_CreateDate = Convert.ToDateTime(arl_FileUpload_Return[2]);
                s_AP_FileName = string.Empty;
                s_AP_FileName = arl_FileUpload_Return[3].ToString();

                arl_FileToTmp_Return = BCO.FileToTmp2(ds_Excel, d_CreateDate, s_LoginUser, s_AP_FileName, PageTimeStamp.Value);

                #endregion

                if (arl_FileToTmp_Return[0].ToString() == "FALSE")
                {
                    this.but_Temp_To_DB.Enabled = false;
                    bResult = false;
                    ErrorMsgLabel.Text = arl_FileToTmp_Return[1].ToString();
                    up_ErrorMsg.Update();
                }
                else if (arl_FileToTmp_Return[0].ToString() == "TRUE")
                {
                    if (((bool)arl_FileToTmp_Return[1]) == false)
                    { this.but_Temp_To_DB.Enabled = false; }//代表內容邏輯不正確

                    else
                    { this.but_Temp_To_DB.Enabled = true; }

                    #region 將資料從 UploadPath 移至 BackPath

                    s_BackPath = Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["BackPath"]).Replace("CRM\\", "") + "\\CRM\\";

                    s_UploadPath += s_AP_FileName;
                    s_BackPath += s_AP_FileName;

                    System.IO.File.Copy(s_UploadPath, s_BackPath);
                    System.IO.File.Delete(s_UploadPath);

                    #endregion

                    #region 將結果顯示在 UploadStatusPanel 中


                    //上傳結果
                    this.UploadStatusPanel1.UploadSum = ((int)arl_FileToTmp_Return[2]);
                    this.UploadStatusPanel1.UploadOK = ((int)arl_FileToTmp_Return[3]);
                    this.UploadStatusPanel1.UploadNG = ((int)arl_FileToTmp_Return[4]);
                    //匯入結果
                    this.UploadStatusPanel1.ImportSum = 0;
                    this.UploadStatusPanel1.ImportOK = 0;
                    this.UploadStatusPanel1.ImportNG = 0;


                    iProcessingCounts = ((int)arl_FileToTmp_Return[2]);

                    #endregion

                    this.but_Unusual_Report.Enabled = true;
                    if ((int)arl_FileToTmp_Return[4] == 0)
                    {
                        bResult = true;
                    }
                    else
                    {
                        bResult = false;
                    }
                }

                return bResult;



            }
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
            up_ErrorMsg.Update();
            return bResult = false;
        }

        return bResult;
        #endregion
    }
Ejemplo n.º 5
0
    private void QueryData()
    {
        string s_LoginUser = string.Empty;
        DataTable dt_Return = new DataTable();
        ArrayList ParameterList = new ArrayList();

        s_LoginUser = Session["UID"].ToString();//登入人員

        ParameterList.Clear();
        ParameterList.Add(this.txt_User.Text.Trim());
        ParameterList.Add(this.txt_Date.Text.Trim());
        ParameterList.Add(Session["UID"].ToString());
        ParameterList.Add(DateTime.Now);

        Int32 iTopRowNum;
        Int32.TryParse(TextBoxRowCountLimit.Text.Trim(), out iTopRowNum);
        ParameterList.Add(iTopRowNum);

        if (this.txt_User.Text.Trim() != Session["UID"].ToString())
            ParameterList.Add(null);
        else
            ParameterList.Add(PageTimeStamp.Value);

        CRMModel.ImportCRMOrder BCO = new CRMModel.ImportCRMOrder(ConnectionDB);
        dt_Return = BCO.QueryErrorByFind(ParameterList);

        if (dt_Return.Rows.Count > 0)
        {
            string SessionIDName = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value);

            Session[SessionIDName] = dt_Return;
            this.gv_ErrorData.DataSource = dt_Return.DefaultView;

            this.gv_ErrorData.PageSize = (TextBoxPagesize.Text == "") ? 10 : (int.Parse(TextBoxPagesize.Text) <= 0) ? 10 : int.Parse(TextBoxPagesize.Text);
            this.gv_ErrorData.PageIndex = 0;
            this.gv_ErrorData.DataBind();
            btn_Export.Enabled = true;

        }
        else
        {
            btn_Export.Enabled = false;
            this.gv_ErrorData.DataBind();
            ResultMsgLabel.Text = "查無資料";

        }
    }