Exemplo n.º 1
0
        private void getData(AutoCompleteStringCollection dataCollection)
        {
            materialBAL = new BAL.MaterialBAL();
            DataSet ds = new DataSet();

            ds = materialBAL.getMaterials(null);
            try
            {
                DataTable dt = new DataTable();
                dt = ds.Tables[0];
                dt.Columns.Remove("MaterialId");
                dt.Columns.Remove("MaterialDescription");
                dt.Columns.Remove("PriceId");
                dt.Columns.Remove("CreatedOn");
                dt.Columns.Remove("ModifiedOn");
                foreach (DataRow row in dt.Rows)
                {
                    dataCollection.Add(row[0].ToString());
                    dataCollection.Add(row[1].ToString());
                    dataCollection.Add(row[2].ToString());
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Can not open connection ! ");
            }
        }
Exemplo n.º 2
0
        private void BindEditForm(object[] data)
        {
            materialBAL = new BAL.MaterialBAL();
            DataSet table = new DataSet();

            table = materialBAL.getMaterials(data);
            BindFields(table);
        }
Exemplo n.º 3
0
        private DataTable GetTablesToExport()
        {
            materialBAL = new BAL.MaterialBAL();
            DataTable table = new DataTable();

            table = materialBAL.getMaterialsForExcel();
            return(table);
        }
Exemplo n.º 4
0
 public Challan()
 {
     InitializeComponent();
     customerBAL = new BAL.CustomerBAL();
     materialBAL = new BAL.MaterialBAL();
     orderBAL    = new BAL.OrderBAL();
     BindCustomer();
     BindProducts();
 }
Exemplo n.º 5
0
        private void btnYes_Click(object sender, EventArgs e)
        {
            switch (OfModule)
            {
            case "User":
                BAL.UserBAL userBAL = new BAL.UserBAL();
                if (userBAL.deleteUser(ToDeleteId))
                {
                    MessageBox.Show("Deleted Successfully");
                    this.Close();
                }
                break;

            case "Customer":
                BAL.CustomerBAL customerBAL = new BAL.CustomerBAL();
                if (customerBAL.deleteCustomer(ToDeleteId))
                {
                    MessageBox.Show("Deleted Successfully");
                    this.Close();
                }
                break;

            case "Supplier":
                BAL.SupplierBAL supplierBAL = new BAL.SupplierBAL();
                if (supplierBAL.deleteSupplier(ToDeleteId))
                {
                    MessageBox.Show("Deleted Successfully");
                    this.Close();
                }
                break;

            case "Material":
                BAL.MaterialBAL materialBAL = new BAL.MaterialBAL();
                if (materialBAL.deleteMaterial(ToDeleteId))
                {
                    MessageBox.Show("Deleted Successfully");
                    this.Close();
                }
                break;

            default:
                break;
            }
        }
Exemplo n.º 6
0
        private void BindMaterialPanel()
        {
            materialBAL = new BAL.MaterialBAL();
            DataSet   tables = new DataSet();
            DataTable dt     = new DataTable();

            tables = materialBAL.getMaterials(null);
            dt     = tables.Tables[0];
            tables.Relations.Add("DetailsPrices",
                                 tables.Tables[0].Columns["MaterialId"], tables.Tables[1].Columns["MaterialId"]);

            BindingSource bsMaterials = new BindingSource();

            bsMaterials.DataSource = tables;
            bsMaterials.DataMember = "Table";

            BindingSource bsPrices = new BindingSource();

            bsPrices.DataSource = bsMaterials;
            bsPrices.DataMember = "DetailsPrices";
            dataGridMaterial.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.EnableResizing;
            dataGridMaterial.DataSource = bsMaterials;
            dataGridPrice.DataSource    = bsPrices;

            this.dataGridUser.RowPostPaint += new System.Windows.Forms.DataGridViewRowPostPaintEventHandler(this.dataGridMaterial_RowPostPaint);
            //dataGridMaterial.DataSource = tables.Tables[0];
            this.dataGridMaterial.Columns["MaterialId"].Visible           = false;
            this.dataGridPrice.Columns["MaterialId"].Visible              = false;
            this.dataGridMaterial.Columns["PriceId"].Visible              = false;
            dataGridMaterial.Columns["CreatedOn"].DefaultCellStyle.Format = "MM/dd/yyyy";

            // Auto Resize
            dataGridMaterial.AutoResizeColumns();
            dataGridMaterial.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;

            dataGridPrice.AutoResizeColumns();
            dataGridPrice.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;

            BindAutoCompleteToMaterial(dt);
        }
Exemplo n.º 7
0
        private void AddMaterials()
        {
            materialBAL     = new BAL.MaterialBAL();
            material        = new Entity.Material();
            material.Prices = new Entity.Price();
            try
            {
                // Material
                try
                {
                    material.MaterialCode = txtMaterialCode.Text.ToString();
                }
                catch { }
                try
                {
                    material.MaterialName = txtmaterialName.Text.ToString();
                }
                catch { }
                try
                {
                    material.MaterialDescription = txtMatDescription.Text.ToString();
                }
                catch { }
                try
                {
                    material.HSNCode = txtHSNCode.Text.ToString();
                }
                catch { }
                //Prices
                try
                {
                    material.Prices.MaterialCode = txtMaterialCode.Text.ToString();
                }
                catch { }
                try
                {
                    material.Prices.OneKGSize = txtSize1.Text.ToString();
                }
                catch { }
                try
                {
                    material.Prices.OneKGPrice = Convert.ToDouble(txtPrice1.Text);
                }
                catch { }
                try
                {
                    material.Prices.HalfKGSize = txtSize2.Text.ToString();
                }
                catch { }
                try
                {
                    material.Prices.HalfKGPrice = Convert.ToDouble(txtPrice2.Text);
                }
                catch { }
                try
                {
                    material.Prices.Size1 = txtSize3.Text.ToString();
                }
                catch { }
                try
                {
                    material.Prices.Price1 = Convert.ToDouble(txtPrice3.Text);
                }
                catch { }
                try
                {
                    material.Prices.Size2 = txtSize4.Text.ToString();
                }
                catch { }
                try
                {
                    material.Prices.Price2 = Convert.ToDouble(txtPrice4.Text);
                }
                catch { }
                try
                {
                    material.Prices.Size3 = txtSize5.Text.ToString();
                }
                catch { }
                try
                {
                    material.Prices.Price3 = Convert.ToDouble(txtPrice5.Text);
                }
                catch { }
                try
                {
                    material.Prices.Size4 = txtSize6.Text.ToString();
                }
                catch { }
                try
                {
                    material.Prices.Price4 = Convert.ToDouble(txtPrice6.Text);
                }
                catch { }
                try
                {
                    material.Prices.Size5 = txtSize7.Text.ToString();
                }
                catch { }
                try
                {
                    material.Prices.Price5 = Convert.ToDouble(txtPrice7.Text);
                }
                catch { }
                try
                {
                    material.Prices.Size6 = txtSize8.Text.ToString();
                }
                catch { }
                try
                {
                    material.Prices.Price6 = Convert.ToDouble(txtPrice8.Text);
                }
                catch { }
                try
                {
                    material.Prices.Size7 = txtSize9.Text.ToString();
                }
                catch { }
                try
                {
                    material.Prices.Price7 = Convert.ToDouble(txtPrice9.Text);
                }
                catch { }
                try
                {
                    material.Prices.Size8 = txtSize10.Text.ToString();
                }
                catch { }
                try
                {
                    material.Prices.Price8 = Convert.ToDouble(txtPrice10.Text);
                }
                catch { }
                try
                {
                    material.Prices.Size9 = txtSize11.Text.ToString();
                }
                catch { }
                try
                {
                    material.Prices.Price9 = Convert.ToDouble(txtPrice11.Text);
                }
                catch { }
                // Common
                material.CreatedBy = "admin";
                material.IsActive  = true;
                material.IsDeleted = false;

                if (materialBAL.addMaterial(material))
                {
                    MessageBox.Show("Material added Successfully.");
                }
                else
                {
                    MessageBox.Show("Something went Wrong.");
                }
            }
            catch (Exception ex) { Exceptions.WriteExceptionLog(ex); }
        }
Exemplo n.º 8
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            materialBAL     = new BAL.MaterialBAL();
            material        = new Entity.Material();
            material.Prices = new Entity.Price();
            try
            {
                // Material
                try
                {
                    material.MaterialId = Convert.ToInt32(lblMaterialId.Text.ToString());
                }
                catch { }
                try
                {
                    material.MaterialCode = txtEditMaterialCode.Text.ToString();
                }
                catch { }
                try
                {
                    material.MaterialName = txtEditMaterialName.Text.ToString();
                }
                catch { }
                try
                {
                    material.MaterialDescription = txtEditMatDescription.Text.ToString();
                }
                catch { }
                try
                {
                    material.HSNCode = txtEditHSNCode.Text.ToString();
                }
                catch { }
                //Prices
                try
                {
                    material.Prices.MaterialCode = txtEditMaterialCode.Text.ToString();
                }
                catch { }
                try
                {
                    material.Prices.OneKGSize = txtEditSize1.Text.ToString();
                }
                catch { }
                try
                {
                    material.Prices.OneKGPrice = Convert.ToDouble(txtEditPrice1.Text);
                }
                catch { }
                try
                {
                    material.Prices.HalfKGSize = txtEditSize2.Text.ToString();
                }
                catch { }
                try
                {
                    material.Prices.HalfKGPrice = Convert.ToDouble(txtEditPrice2.Text);
                }
                catch { }
                try
                {
                    material.Prices.Size1 = txtEditSize3.Text.ToString();
                }
                catch { }
                try
                {
                    material.Prices.Price1 = Convert.ToDouble(txtEditPrice3.Text);
                }
                catch { }
                try
                {
                    material.Prices.Size2 = txtEditSize4.Text.ToString();
                }
                catch { }
                try
                {
                    material.Prices.Price2 = Convert.ToDouble(txtEditPrice4.Text);
                }
                catch { }
                try
                {
                    material.Prices.Size3 = txtEditSize5.Text.ToString();
                }
                catch { }
                try
                {
                    material.Prices.Price3 = Convert.ToDouble(txtEditPrice5.Text);
                }
                catch { }
                try
                {
                    material.Prices.Size4 = txtEditSize6.Text.ToString();
                }
                catch { }
                try
                {
                    material.Prices.Price4 = Convert.ToDouble(txtEditPrice6.Text);
                }
                catch { }
                try
                {
                    material.Prices.Size5 = txtEditSize7.Text.ToString();
                }
                catch { }
                try
                {
                    material.Prices.Price5 = Convert.ToDouble(txtEditPrice7.Text);
                }
                catch { }
                try
                {
                    material.Prices.Size6 = txtEditSize8.Text.ToString();
                }
                catch { }
                try
                {
                    material.Prices.Price6 = Convert.ToDouble(txtEditPrice8.Text);
                }
                catch { }
                try
                {
                    material.Prices.Size7 = txtEditSize9.Text.ToString();
                }
                catch { }
                try
                {
                    material.Prices.Price7 = Convert.ToDouble(txtEditPrice9.Text);
                }
                catch { }
                try
                {
                    material.Prices.Size8 = txtEditSize10.Text.ToString();
                }
                catch { }
                try
                {
                    material.Prices.Price8 = Convert.ToDouble(txtEditPrice10.Text);
                }
                catch { }
                try
                {
                    material.Prices.Size9 = txtEditSize11.Text.ToString();
                }
                catch { }
                try
                {
                    material.Prices.Price9 = Convert.ToDouble(txtEditPrice11.Text);
                }
                catch { }
                // Common
                material.ModifiedBy = "admin";

                if (materialBAL.updateMaterial(material))
                {
                    MessageBox.Show("Material updated successfully.");
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Something went wrong.");
                }
            }
            catch { }
        }
Exemplo n.º 9
0
 public EditMaterial(int MaterialId)
 {
     InitializeComponent();
     materialBAL = new BAL.MaterialBAL();
     BindEditForm(new object[] { MaterialId, "" });
 }