Exemplo n.º 1
0
        public PaymentsCtrl()
        {
            InitializeComponent();

            try
            {
                bsSupplierTypes.DataSource = Data_SupplierType.GetSupplierTypes();
                bsBankAccounts.DataSource  = Data_BankAccount.GetBankAccounts();
                txtReference.Text          = Data_SystemParameters.GetPaymentRef();

                String  regAmount = Utils.GetRegistryValue("PaymentAmount") == null ? "0" : Utils.GetRegistryValue("PaymentAmount").ToString();
                decimal amount;
                if (!Decimal.TryParse(regAmount, out amount))
                {
                    throw new Exception("Error retrieving Amount from Registry! Invalid decimal type.");
                }
                numAmount.Value = amount;


                GetRecords();
            }
            catch (Exception ex)
            {
                Utils.ShowException(ex);
            }
        }
Exemplo n.º 2
0
        public SupplierDialogFrm(Common.FormMode formMode, Data_Supplier supplier)
        {
            InitializeComponent();

            try {
                this.formMode = formMode;
                if (Global.HideSensitiveSupplierFields)
                {
                    HideSensitiveFields();
                }

                bsSupplierTypes.DataSource = Data_SupplierType.GetSupplierTypes();
                if (formMode == Common.FormMode.Add)
                {
                    supplierID = -1;
                    luSupplierType.SelectedIndex = -1;
                }
                else
                {
                    BindControls(supplier);

                    if (formMode == Common.FormMode.View)
                    {
                        Utils.DisableAllControls(this);
                        this.Text = String.Format("View Supplier {0} ({1})", supplier.SupplierID, supplier.Name);
                        return;
                    }

                    this.Text = String.Format("Edit Supplier {0} ({1})", supplier.SupplierID, supplier.Name);
                }
            } catch (Exception ex) {
                Utils.ShowException(ex);
            }
        }
Exemplo n.º 3
0
        protected override void DeleteRecord()
        {
            try
            {
                Data_SupplierType supplierType = Utils.GetCurrentRecord <Data_SupplierType>(bsRecords);

                if (supplierType != null)
                {
                    if (Utils.AskQuestion(String.Format("Are you sure you want to delete Supplier Type {0}", supplierType.SupplierTypeCode)) == DialogResult.Yes)
                    {
                        if (Data_SupplierType.DeleteSupplierType(supplierType.SupplierTypeCode))
                        {
                            GetRecords();
                        }
                        else
                        {
                            Utils.ShowError(String.Format(Global.FKVIOLATIONMSG, "Supplier Type", supplierType.SupplierTypeCode));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Utils.ShowException(ex);
            }
        }
Exemplo n.º 4
0
        protected override void EditRecord()
        {
            try
            {
                Data_SupplierType record = Utils.GetCurrentRecord <Data_SupplierType>(bsRecords);

                if (record != null)
                {
                    Data_SupplierType supplierType = Data_SupplierType.GetSupplierType(record.SupplierTypeCode);

                    if (supplierType != null)
                    {
                        SupplierTypeDialogFrm frm = new SupplierTypeDialogFrm(Common.FormMode.Edit, supplierType);
                        if (frm.ShowDialog() == DialogResult.OK)
                        {
                            GetRecords();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Utils.ShowException(ex);
            }
        }
Exemplo n.º 5
0
        private bool ValidateCode(String supplierTypeCode)
        {
            try
            {
                Data_SupplierType type = Data_SupplierType.GetSupplierType(supplierTypeCode);

                return(type == null);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 6
0
        public SupplierTypeDialogFrm(Common.FormMode mode, Data_SupplierType supplierType)
        {
            InitializeComponent();

            formMode = mode;

            if (mode == Common.FormMode.Edit)
            {
                this.Text        = String.Format("Edit Supplier Type {0}", supplierType.SupplierTypeCode);
                txtCode.ReadOnly = true;

                txtCode.Text = supplierType.SupplierTypeCode;
                txtName.Text = supplierType.Name;
            }
        }
Exemplo n.º 7
0
 private void GetRecords()
 {
     try
     {
         Cursor.Current       = Cursors.WaitCursor;
         bsRecords.DataSource = Data_SupplierType.GetSupplierTypes();
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         Cursor.Current = Cursors.Default;
     }
 }
Exemplo n.º 8
0
        public SupplierSelectDialogFrm(decimal amount = 0)
        {
            InitializeComponent();

            try
            {
                bsSupplierTypes.DataSource = Data_SupplierType.GetSupplierTypes();
                this.amount = amount;

                suppliers = Data_Supplier.GetSuppliersWithPaymentStagingCheck(Global.Username);
                bsSuppliers.DataSource = suppliers;

                luSupplierType.SelectedIndex = -1;
            }
            catch (Exception ex)
            {
                Utils.ShowException(ex);
            }
        }
Exemplo n.º 9
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtCode.Text.Trim() == String.Empty)
                {
                    Utils.ShowInformation("You must enter a Supplier Type Code!");
                    txtCode.Focus();
                }
                else
                {
                    if (formMode == Common.FormMode.Add)
                    {
                        if (!ValidateCode(txtCode.Text.Trim()))
                        {
                            if (Utils.AskQuestion(String.Format("Supplier Type Code {0} aleady exists! Do you want to overwrite?", txtCode.Text.Trim())) == DialogResult.No)
                            {
                                txtCode.Focus();
                                return;
                            }
                        }
                    }

                    Data_SupplierType.SaveSupplierType(new Data_SupplierType()
                    {
                        SupplierTypeCode = txtCode.Text.Trim(),
                        Name             = txtName.Text.Trim()
                    });

                    DialogResult = DialogResult.OK;
                }
            }
            catch (Exception ex)
            {
                Utils.ShowException(ex);
            }
        }
Exemplo n.º 10
0
        public PaymentEnquiryCtrl()
        {
            InitializeComponent();

            try
            {
                bsSuppliers.DataSource     = Data_Supplier.GetSuppliers();
                bsSupplierTypes.DataSource = Data_SupplierType.GetSupplierTypes();
                bsUsers.DataSource         = Data_User.GetUsers();
                bsBankAccounts.DataSource  = Data_BankAccount.GetBankAccounts();

                luSuppliers.SelectedIndex     = -1;
                luSupplierTypes.SelectedIndex = -1;
                luUsers.SelectedIndex         = -1;
                luBankAccount.SelectedIndex   = -1;

                dtDateFrom.Value = DateTime.Parse(String.Format("01/01/{0}", DateTime.Now.Year));
                dtDateTo.Value   = DateTime.Now.Date;
            }
            catch (Exception ex)
            {
                Utils.ShowException(ex);
            }
        }