Пример #1
0
        public void deleteSupplierDetails()
        {
            int Id = Convert.ToInt32(txtSupplierId.Text);

            supplier = new SupplierMasterBL();
            try
            {
                if (supplier.deleteSupplierDetails(Id) > 0)
                {
                    MessageBox.Show("Record is Deleted", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

                else
                {
                    MessageBox.Show("Record is Not Deleted", "Information", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show("Record is Not Deleted", "Information", MessageBoxButtons.OK);
                string errorMessage = ErrorHandling.Class1.CreateErrorMessage(ex);
                ErrorHandling.Class1.LogFileWrite(errorMessage);
            }
        }
Пример #2
0
        public void updateSupplierDetails()
        {
            try
            {
                SupplierMaster suplier = new SupplierMaster();
                suplier.supplierId     = Convert.ToInt32(txtSupplierId.Text);
                suplier.supplierName   = txtSupplierName.Text;
                suplier.supplierStatus = cmbStatus.Text == "Active" ? 1 : 0;

                supplier = new SupplierMasterBL();
                if (supplier.updateSupplierDetails(suplier) > 0)
                {
                    MessageBox.Show("Record is Updated", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

                else
                {
                    MessageBox.Show("Record is Not Updated", "Information", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show("Record is Not Updated", "Information", MessageBoxButtons.OK);
                string errorMessage = ErrorHandling.Class1.CreateErrorMessage(ex);
                ErrorHandling.Class1.LogFileWrite(errorMessage);
            }
        }
Пример #3
0
        public bool validateControls()
        {
            int            id;
            string         ErrorString      = "";
            SupplierMaster supplierEntities = new SupplierMaster();

            try
            {
                supplierEntities.supplierId     = int.TryParse(txtSupplierId.Text, out id) == true ? id : 0;
                supplierEntities.supplierName   = txtSupplierName.Text;
                supplierEntities.supplierStatus = cmbStatus.SelectedIndex;

                supplier    = new SupplierMasterBL();
                ErrorString = supplier.ValidationOfControls(supplierEntities);

                if (!string.IsNullOrEmpty(ErrorString))
                {
                    if (ErrorString == "txtSupplierId")
                    {
                        MessageBox.Show("Supplier Id Cannot be Empty!!!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        txtSupplierId.Focus();
                        return(false);
                    }

                    else if (ErrorString == "txtSupplierName")
                    {
                        MessageBox.Show("Supplier Name Cannot be Empty!!! OR It Cannot Exceed 10 Characters...", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        txtSupplierName.Focus();
                        return(false);
                    }

                    else if (ErrorString == "cmbStatus")
                    {
                        MessageBox.Show("Supplier Status Cannot be Empty!!!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        cmbStatus.Select();
                        return(false);
                    }
                }
            }

            catch (Exception ex)
            {
                string errorMessage = ErrorHandling.Class1.CreateErrorMessage(ex);
                ErrorHandling.Class1.LogFileWrite(errorMessage);
                return(false);
            }

            return(true);
        }
Пример #4
0
        public void RetrieveSupplierID()
        {
            try
            {
                supplier           = new SupplierMasterBL();
                id                 = supplier.RetrieveSupplierID();
                txtSupplierId.Text = Convert.ToString(++id);
            }

            catch (Exception ex)
            {
                string errorMessage = ErrorHandling.Class1.CreateErrorMessage(ex);
                ErrorHandling.Class1.LogFileWrite(errorMessage);
            }
        }
Пример #5
0
        public void GetSupplierDetails()
        {
            supplier = new SupplierMasterBL();
            dt       = new DataTable();
            try
            {
                dt = supplier.GetSupplierDetails();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    dataGridView1.Rows.Add();
                    dataGridView1["SupplierId", i].Value     = dt.Rows[i]["SupplierId"];
                    dataGridView1["SupplierName", i].Value   = dt.Rows[i]["SupplierName"];
                    dataGridView1["SupplierStatus", i].Value = Convert.ToInt32(dt.Rows[i]["SupplierStatus"]) == 1 ? "Active" : "In Active";
                }
            }

            catch (Exception ex)
            {
                string errorMessage = ErrorHandling.Class1.CreateErrorMessage(ex);
                ErrorHandling.Class1.LogFileWrite(errorMessage);
            }
        }
Пример #6
0
        private void txtSearch_KeyPress(object sender, KeyPressEventArgs e)
        {
            //spSearchSupplierById
            supplier = new SupplierMasterBL();
            dt       = new DataTable();
            int Id = 0;

            if (e.KeyChar == (char)13)
            {
                if (supplier.ValidationOfControls(txtSearch.Text))
                {
                    dataGridView1.Rows.Clear();
                    dt = supplier.GetSupplierDetails(Convert.ToInt32(txtSearch.Text));

                    if (dt.Rows.Count > 0)
                    {
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            dataGridView1.Rows.Add();
                            dataGridView1["SupplierId", i].Value     = dt.Rows[i]["SupplierId"];
                            dataGridView1["SupplierName", i].Value   = dt.Rows[i]["SupplierName"];
                            dataGridView1["SupplierStatus", i].Value = Convert.ToInt32(dt.Rows[i]["SupplierStatus"]) == 1 ? "Active" : "In Active";
                        }
                    }

                    else
                    {
                        MessageBox.Show("There is No Supplier Record with this Id.. ", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }

                else
                {
                    MessageBox.Show("Please Enter the Number", "Earning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtSearch.Focus();
                }
            }
        }