private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)//save { // Commen_Form.Functions.DateConverter dc = new Commen_Form.Functions.DateConverter(); gridView1.RefreshData(); DataTable source = gridControl1.DataSource as DataTable; //source = dc.gridvalidation(source); DataTable dt = new DataTable(); dt.Clear(); dt.Columns.Add("deliveryno"); dt.Columns.Add("date"); dt.Columns.Add("salesPerson"); dt.Columns.Add("customerId"); dt.Columns.Add("customerName"); dt.Columns.Add("address"); dt.Columns.Add("contact"); dt.Columns.Add("status"); dt.Rows.Add(new object[] { txtdeliveryNo.Text, dtpdate.Text, txtsalesPerson.Text, CustomerId, txtCustomerName.Text, txtaddress.Text, txtemail.Text, "No Invoice" }); Test.Sale.Database.SalesDeliveryData quatationData = new Sale.Database.SalesDeliveryData(source, dt); quatationData.FnConn(); quatationData.fnTransactionData(); string res = quatationData.FnTrans(); MessageBox.Show(res, "Alert", MessageBoxButtons.OK, MessageBoxIcon.Information); barButtonItem1.Enabled = false; barButtonItem5.Enabled = true; }
void loadData() { Sale.Database.SalesDeliveryData salesDeliveryData = new Sale.Database.SalesDeliveryData(); salesDeliveryData.FnConn(); DataTable dt = salesDeliveryData.FillData("S", "", "spsalesDelivery"); if (dt.Rows.Count > 0) { gridControl1.DataSource = dt; } salesDeliveryData.FnTrans(); }
private void Delivery_Note_Load(object sender, EventArgs e) { salesDeliveryData.FnConn(); DataTable dt = salesDeliveryData.FillData("S", "", "spCustomer"); AutoCompleteStringCollection collection = new AutoCompleteStringCollection(); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { collection.Add(dt.Rows[i]["name"].ToString()); } } txtCustomerName.MaskBox.AutoCompleteMode = AutoCompleteMode.SuggestAppend; txtCustomerName.MaskBox.AutoCompleteSource = AutoCompleteSource.CustomSource; txtCustomerName.MaskBox.AutoCompleteCustomSource = collection; if (deliveryNoteNo != null) { barButtonItem1.Enabled = false; barButtonItem5.Enabled = true; DataSet ds = salesDeliveryData.FillDataSet("searchgrid", deliveryNoteNo, "spsalesDelivery"); DataTable tab = ds.Tables[0]; salesDeliveryData.FnTrans(); if (tab.Rows.Count > 0) { txtdeliveryNo.Text = tab.Rows[0]["deliveryNo"] + ""; Commen_Form.Functions.DateConverter dc = new Commen_Form.Functions.DateConverter(); dtpdate.EditValue = dc.dateconverter(tab.Rows[0]["date"] + ""); txtsalesPerson.Text = tab.Rows[0]["salesPerson"] + ""; txtCustomerName.Text = tab.Rows[0]["customerName"] + ""; txtaddress.Text = tab.Rows[0]["address"] + ""; txtemail.Text = tab.Rows[0]["contact"] + ""; DataTable gridData = ds.Tables[1]; gridControl1.DataSource = gridData; } } else { dtpdate.EditValue = DateTime.Now; barButtonItem5.Enabled = false; DataTable dt1 = salesDeliveryData.FillData("M", "", "spsalesDelivery"); if (dt1.Rows.Count > 0) { int slno = Convert.ToInt32(dt1.Rows[0][0].ToString()) + 1; string deno = slno + ""; txtdeliveryNo.Text = "DLN/" + deno.PadLeft(5, '0'); } DataTable dt3 = new DataTable(); dt3.Columns.Add("slno", Type.GetType("System.Int32")); dt3.Columns.Add("deliveryNo", Type.GetType("System.String")); dt3.Columns.Add("barcode", Type.GetType("System.String")); dt3.Columns.Add("description", Type.GetType("System.String")); dt3.Columns.Add("quantity", Type.GetType("System.Double")); dt3.Columns.Add("status", Type.GetType("System.String")); gridControl1.DataSource = dt3; salesDeliveryData.FnTrans(); } }