Esempio n. 1
0
        private void BtnUpdate_Click(object sender, EventArgs e)
        {
            //get column values where MK not null or empty
            DataTable dt = uIUtility.SubmitChanges();

            if (dt.Rows.Count > 0)
            {
                //send to web service
                frmCustomerMasterMaintenanceController oController = new frmCustomerMasterMaintenanceController();
                try
                {
                    DataTable result = oController.Submit(dt, out uIUtility.MetaData);

                    //update data grid view
                    uIUtility.UpdateReturnedresults(result);
                }
                catch (System.TimeoutException)
                {
                    MetroMessageBox.Show(this, "\n" + Messages.General.ServerTimeOut, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                catch (System.Net.WebException)
                {
                    MetroMessageBox.Show(this, "\n" + Messages.General.NoConnection, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                catch (Exception ex)
                {
                    Utility.WriteErrorLog(ex.Message, ex, false);
                    MetroMessageBox.Show(this, "\n" + Messages.General.ThereWasAnError, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
        private void BindGrid()
        {
            try
            {
                frmCustomerMasterMaintenanceController oController = new frmCustomerMasterMaintenanceController();
                DataSet ds = oController.GetPopupScreenData(COMPANY_NO_BOX, REQ_SEQ, out uIUtility.MetaData);

                DataTable dt1 = ds.Tables[0];
                DataTable dt2 = ds.Tables[1];

                lblCompanyNoBox.Text = COMPANY_NO_BOX;
                dgvList.DataSource   = dt1;
                dgvList1.DataSource  = dt2;
                dgvList.ScrollBars   = ScrollBars.None;
            }
            catch (System.TimeoutException ex)
            {
                MetroMessageBox.Show(this, "\n" + Messages.General.ServerTimeOut, "Search Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (System.Net.WebException ex)
            {
                MetroMessageBox.Show(this, "\n" + Messages.General.NoConnection, "Search Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception ex)
            {
                MetroMessageBox.Show(this, "\n" + Messages.General.ThereWasAnError, "Search Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 3
0
        private void BindGrid()
        {
            try
            {
                //assign search keywords
                string company_no_box       = txtCompanyNoBox.Text;
                string company_name         = txtCompanyName.Text;
                string company_name_reading = txtCompanyNameReading.Text;
                string edi_account          = txtEDIAccount.Text;
                string mialAddress          = txtMailAddress.Text;
                string contractor           = "";
                string invoice                 = "";
                string serviceDesk             = "";
                string notificationDestination = "";

                #region CheckBox
                if (chkContractor.Checked)
                {
                    contractor = chkContractor.Text;
                }
                else
                {
                    contractor = "";
                }

                if (chkInvoice.Checked)
                {
                    invoice = chkInvoice.Text;
                }
                else
                {
                    invoice = "";
                }

                if (chkServiceDesk.Checked)
                {
                    serviceDesk = chkServiceDesk.Text;
                }
                else
                {
                    serviceDesk = "";
                }

                if (chkNotificationDestination.Checked)
                {
                    notificationDestination = chkNotificationDestination.Text;
                }
                else
                {
                    notificationDestination = "";
                }
                #endregion


                //assign search keywords
                frmCustomerMasterMaintenanceController oController = new frmCustomerMasterMaintenanceController();
                DataTable dt = oController.GetCustomerMasterMaintenanceList(company_no_box, company_name, company_name_reading, edi_account, mialAddress, contractor, invoice, serviceDesk, notificationDestination, uIUtility.MetaData.Offset, uIUtility.MetaData.Limit, out uIUtility.MetaData); //need to add more parameter
                if (dt.Rows.Count > 0)
                {
                    uIUtility.dtList   = dt;
                    dgvList.DataSource = uIUtility.dtList;
                    uIUtility.dtOrigin = uIUtility.dtList.Copy();

                    //pagination
                    uIUtility.CalculatePagination(lblcurrentPage, lblTotalPages, lblTotalRecords);
                }
                else
                {
                    //clear data except headers
                    uIUtility.ClearDataGrid();
                    uIUtility.CalculatePagination(lblcurrentPage, lblTotalPages, lblTotalRecords);
                }

                uIUtility.CheckPagination(btnFirst, btnPrev, btnNext, btnLast, lblcurrentPage.Text, lblTotalPages.Text);
                uIUtility.FormatUpdatedat();

                //check for disable flag
                uIUtility.CheckForDisableField();
            }
            catch (System.TimeoutException)
            {
                MetroMessageBox.Show(this, "\n" + Messages.General.ServerTimeOut, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (System.Net.WebException)
            {
                MetroMessageBox.Show(this, "\n" + Messages.General.NoConnection, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception ex)
            {
                Utility.WriteErrorLog(ex.Message, ex, false);
                MetroMessageBox.Show(this, "\n" + Messages.General.ThereWasAnError, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }