void loadData() { Purchase.database.discountData dis = new Purchase.database.discountData(); dis.FnConn(); DataTable dt = dis.FillData("productdetails", ""); if (dt.Rows.Count > 0) { gridControl1.DataSource = dt; } dis.FnTrans(); }
private void Product_for_Discount_Load(object sender, EventArgs e) { Test.Purchase.database.discountData dis = new Purchase.database.discountData(); dis.FnConn(); DataTable dt = dis.FillData("products", no); if (dt.Rows.Count > 0) { txtPCode.Text = dt.Rows[0]["productCode"] + ""; txtDescription.Text = dt.Rows[0]["itemName"] + ""; txtSalesRate.Text = dt.Rows[0]["salesRate1"] + ""; } }
private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (txtDescription.Text.Length != 0 && txtDiscount.Text.Length != 0 && txtPCode.Text.Length != 0 && txtSalesRate.Text.Length != 0) { DateTime startdate = DateTime.Parse(Convert.ToDateTime(dateEnd.Text).ToShortDateString()); DateTime enddate = DateTime.Parse(Convert.ToDateTime(dateStart.Text).ToShortDateString()); if (startdate < enddate) { MessageBox.Show("Start date is greater than End date"); } else { string type; if (chkDisType.Checked == true) { type = "Percentage"; } else { type = "Cash"; } DataTable dt = new DataTable(); dt.Clear(); dt.Columns.Add("productCode"); dt.Columns.Add("description"); dt.Columns.Add("salesRate"); dt.Columns.Add("discount"); dt.Columns.Add("discountType"); dt.Columns.Add("startDate"); dt.Columns.Add("endDate"); dt.Columns.Add("unitprice"); dt.Rows.Add(new object[] { txtPCode.Text, txtDescription.Text, txtSalesRate.Text, txtDiscount.Text, type, dateEnd.Text, dateStart.Text, calcUnitprice() }); Test.Purchase.database.discountData dis = new Purchase.database.discountData(dt); dis.FnConn(); dis.fnTransactionData(); dis.FnTrans(); MessageBox.Show("Discount Added.", "ALERT", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }