Exemplo n.º 1
0
        private void summaryDepartment_Click(object sender, EventArgs e)
        {
            try
            {
                Loading_Screen.ShowSplashScreen();
                DataTable searchResult = new DataTable();

                searchResult = downloadMasterBLL.GetSummary(modeFlg);

                if (searchResult.Rows.Count > 0)
                {
                    DownloadMasterSummaryForm dSummary = new DownloadMasterSummaryForm(); // Instantiate a Form3 object.
                    dSummary.SummaryDownloadMaster(searchResult, modeFlg);
                    Loading_Screen.CloseForm();
                    dSummary.Show();
                }
                else
                {
                    Loading_Screen.CloseForm();
                    MessageBox.Show(MessageConstants.NoDatafound, MessageConstants.TitleInfomation, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                log.Error(String.Format("Exception : {0}", ex.StackTrace));
            }
        }
Exemplo n.º 2
0
 static private void ShowForm()
 {
     try
     {
         splashForm = new Loading_Screen();
         Application.Run(splashForm);
         threadCall = false;
     }
     catch (Exception ex)
     {
         log.Error(String.Format("Exception : {0}", ex.StackTrace));
     }
 }
Exemplo n.º 3
0
        private void GetSearchData()
        {
            Loading_Screen.ShowSplashScreen();
            dataTableForShow.Clear();
            DataTable result = downloadMasterBLL.GetMasterDownload(modeFlg, dataType);

            if (result.Rows.Count > 0)
            {
                dataTableForShow = result;
                DisplayData(dataTableForShow);
                Loading_Screen.CloseForm();
            }
            else
            {
                Loading_Screen.CloseForm();
                MessageBox.Show(MessageConstants.NoDatafound, MessageConstants.TitleInfomation, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemplo n.º 4
0
 private void printButton_Click(object sender, EventArgs e)
 {
     try
     {
         Loading_Screen.ShowSplashScreen();
         List <LocationBarcode> barcodeData   = barcodeBLL.GenDataToBarCode(displayData);
         BarCodeReportForm      barcodeReport = new BarCodeReportForm();
         bool isCreateReportSuccess           = barcodeReport.CreateReport(barcodeData);
         Loading_Screen.CloseForm();
         if (isCreateReportSuccess)
         {
             barcodeReport.StartPosition = FormStartPosition.CenterParent;
             DialogResult dialogResult = barcodeReport.ShowDialog();
         }
         else
         {
             MessageBox.Show(MessageConstants.cannotgeneratereport, MessageConstants.TitleError, MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     catch (Exception ex)
     {
         log.Error(String.Format("Exception : {0}", ex.StackTrace));
     }
 }
Exemplo n.º 5
0
 static public void CloseForm()
 {
     try
     {
         if (splashForm != null)
         {
             if (splashForm.InvokeRequired)
             {
                 splashForm.Invoke(new CloseDelegate(Loading_Screen.CloseFormInternal));
             }
             splashForm = null;
         }
         else if (threadCall)
         {
             thread.Abort();
             threadCall = false;
         }
     }
     catch (Exception ex)
     {
         //log.Error(String.Format("Exception : {0}", ex.StackTrace));
         log.Error(String.Format("Exception : {0}", ex == null ? string.Empty : ex.Message));
     }
 }
Exemplo n.º 6
0
        private void btnLoad_Click(object sender, EventArgs e)
        {
            string file        = "";
            bool   isFileExist = false;

            Loading_Screen.ShowSplashScreen();
            try
            {
                switch (dataType)
                {
                case "SKU":
                    file        = filePathSKU.Text;
                    isFileExist = ReadTextFile(file);
                    break;

                case "Barcode":
                    file        = filePathBarcode.Text;
                    isFileExist = ReadTextFile(file);
                    break;

                case "PackBarcode":
                    file        = filePathPackBarcode.Text;
                    isFileExist = ReadTextFile(file);
                    break;

                case "Brand":
                    file        = filePathBrand.Text;
                    isFileExist = ReadTextFile(file);
                    break;
                }

                if (!isFileExist)
                {
                    Loading_Screen.CloseForm();
                    MessageBox.Show(MessageConstants.Pleaseuploadfile, MessageConstants.TitleWarning, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    //Validate
                    //bool validate = ValidateLengthData();
                    dataTableForShow.Clear();
                    Hashtable result = downloadMasterBLL.AddDataToDatabase(dataType, dataFromTxt, modeFlg, dataTableForShow, catagoryFlag);

                    if (result["result"].ToString() == "success")
                    {
                        GetSearchData();
                        //DataTable displayDataTable = (DataTable)result["resultTable"];
                        //dataTableForShow = displayDataTable;

                        //int count = dataTableForShow.Columns.Count;
                        //dataTableForShow.Columns.RemoveAt(count - 1);
                        //dataTableForShow.Columns.RemoveAt(count - 2);
                        //if (dataType == "Barcode")
                        //{
                        //    dataTableForShow.Columns.RemoveAt(count - 3);
                        //}

                        //DisplayData(dataTableForShow);
                        //Loading_Screen.CloseForm();
                    }
                    else if (result["result"].ToString() == "wrongformat")
                    {
                        Loading_Screen.CloseForm();
                        MessageBox.Show(MessageConstants.WrongFormatData, MessageConstants.TitleWarning, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else if (result["result"].ToString() == "null")
                    {
                        Loading_Screen.CloseForm();
                        MessageBox.Show(MessageConstants.WrongFormatFileEmptyfield, MessageConstants.TitleWarning, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else if (result["result"].ToString() == "wrongdata")
                    {
                        Loading_Screen.CloseForm();
                        MessageBox.Show(MessageConstants.WrongFormatFileTextinnumberfield, MessageConstants.TitleWarning, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else
                    {
                        Loading_Screen.CloseForm();
                        MessageBox.Show(MessageConstants.CannotLoadDataToDatabase, MessageConstants.TitleError, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            catch (Exception ex)
            {
                log.Error(String.Format("Exception : {0}", ex.StackTrace));
            }
        }