示例#1
0
        private void dataGridView1_CellContentClick_1(object sender, DataGridViewCellEventArgs e)
        {
            ItemMaster      itemMaster  = new ItemMaster();
            Billing_Item    billingItem = new Billing_Item();
            DataGridViewRow row         = this.dataGridView1.Rows[e.RowIndex];

            billingItem             = itemMaster.GetBillItemDetailsBasedOnId(Convert.ToInt32(row.Cells["ItemID"].Value));
            txtItemCode.Text        = billingItem.ItemCode;
            txtItemDescription.Text = billingItem.Description;
            txtDiscount.Text        = Convert.ToString(billingItem.Discount);
            txtMrp.Text             = Convert.ToString(billingItem.MRP);
            txtNetRate.Text         = Convert.ToString(billingItem.NetRate);
            txtQuantity.Text        = Convert.ToString(billingItem.quantity);
            txtItemCode.Tag         = billingItem.ItemID;



            //    if (e.RowIndex >= 0)
            //    {
            //        DataGridViewRow row = this.dataGridView1.Rows[e.RowIndex];

            //        txtBoxCode.Text = row.Cells["Item_Code"].Value.ToString();
            //        txtBoxDescription.Text = row.Cells["Description"].Value.ToString();
            //        txtBoxDiscount.Text = row.Cells["Discount"].Value.ToString();
            //        textBox2.Text = row.Cells["Lowest_Price"].Value.ToString();
            //        textBox8.Text = row.Cells["price"].Value.ToString();
            //        txtBoxOther.Text = row.Cells["Others"].Value.ToString();
            //    }
        }
示例#2
0
        private void LoadItemDetailsToGrid()
        {
            ItemMaster   itemMaster  = new ItemMaster();
            Billing_Item billingItem = new Billing_Item();

            dataGridView1.DataSource = itemMaster.GetBillingItemDetails();
            dataGridView1.Columns["ItemID"].Visible = false;
        }
        public Billing_Item GetBillItemDetailsBasedOnId(int itemId)
        {
            Billing_Item        billingItem = new Billing_Item();
            BillingDbContextBll db          = new BillingDbContextBll();

            billingItem = db.BillingItem.FirstOrDefault(a => a.ItemID == itemId);
            return(billingItem);
        }
        public void DeleteBillItemDetailsBasedOnId(int itemId)
        {
            Billing_Item        billingItem = new Billing_Item();
            BillingDbContextBll db          = new BillingDbContextBll();

            billingItem = db.BillingItem.FirstOrDefault(a => a.ItemID == itemId);
            db.Entry(billingItem).State = System.Data.Entity.EntityState.Deleted;
            db.SaveChanges();
        }
        public void SaveItemMasterDetails(Billing_Item billingItem)
        {
            BillingDbContextBll db = new BillingDbContextBll();

            if (billingItem.ItemID == 0)
            {
                db.Entry(billingItem).State = System.Data.Entity.EntityState.Added;
            }
            else
            {
                db.Entry(billingItem).State = System.Data.Entity.EntityState.Modified;
            }
            db.SaveChanges();
        }
示例#6
0
        //public frmMaster(Login log)
        //{
        //    this.log = log;
        //    InitializeComponent();
        //}

        ////DataTable dbtable;
        private void btnAdd_Click(object sender, EventArgs e)
        {
            Billing_Item billingItem = new Billing_Item();

            billingItem.ItemID      = Convert.ToInt32(txtItemCode.Tag);
            billingItem.ItemCode    = txtItemCode.Text;
            billingItem.Description = txtItemDescription.Text;
            billingItem.Discount    = Convert.ToDouble(txtDiscount.Text);
            billingItem.MRP         = Convert.ToDouble(txtMrp.Text);
            billingItem.NetRate     = Convert.ToDouble(txtNetRate.Text);
            billingItem.quantity    = Convert.ToDouble(txtQuantity.Text);
            ItemMaster itemMaster = new ItemMaster();

            itemMaster.SaveItemMasterDetails(billingItem);

            ClearItemMasterControls();
            LoadItemDetailsToGrid();

            //    if ((txtBoxCode.Text == "") || (txtBoxDescription.Text == "") || (txtBoxDiscount.Text == "") || (textBox2.Text == "") || (textBox8.Text == "") || (txtBoxOther.Text == ""))
            //    {
            //        MessageBox.Show("All the fields must be Filled");
            //    }
            //    else
            //    {
            //        int textboxCode = int.Parse(txtBoxCode.Text);
            //        string txtboxDescription = txtBoxDescription.Text;
            //        decimal txtboxDiscount = decimal.Parse(txtBoxDiscount.Text);
            //        decimal lowestPrice = decimal.Parse(textBox2.Text);
            //        decimal price = decimal.Parse(textBox8.Text);
            //        string txtboxOther = txtBoxOther.Text;

            //        ItemDBConnection adminDb = new ItemDBConnection();


            //        adminDb.Insert(textboxCode, txtboxDescription, txtboxDiscount, lowestPrice, price, txtboxOther);
            //        clearItem();

            //    }
        }