public static bool UpdateSaleInvoice(SaleInvoice_DTO invoice) { SqlConnection con = DataProvider.OpenConnection(); try { cmd = new SqlCommand("[JEWELRYSTOREMGMT].[dbo].[usp_updateSaleInvoice]", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter p = new SqlParameter("@TransID", invoice.TransID); cmd.Parameters.Add(p); p = new SqlParameter("@CreateDate", invoice.CreateDate); cmd.Parameters.Add(p); p = new SqlParameter("@CustomerID", invoice.CustomerId); cmd.Parameters.Add(p); cmd.ExecuteNonQuery(); DataProvider.CloseConnection(con); return(true); } catch (Exception ex) { MessageBox.Show(ex.Message, "Notification", MessageBoxButtons.OK, MessageBoxIcon.Error); DataProvider.CloseConnection(con); return(false); } }
private void btnDeleteBillExport_Click(object sender, EventArgs e) { try { if (txtIDBillExport.Text == "" || txtIDCustomer.Text == "" || cmbIDCustomer.Text == "") { XtraMessageBox.Show("You have to choose at least one invoice to delete", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); ClearDisplay(); return; } SaleInvoice_DTO invoice = new SaleInvoice_DTO(); invoice.TransID = Convert.ToInt32(dtgvInfoListOfBillExport.CurrentRow.Cells["TransID"].Value); if (SaleInvoice_BUS.DeleteSaleInvoice(invoice)) { LoadSaleInvoice(); uctCustomer.uctCustomerInfo.LoadCustomer(); ClearDisplay(); XtraMessageBox.Show("Delete Post Invoice Successfully", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } catch (Exception ex) { XtraMessageBox.Show(ex.Message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
private void btnAddBillExport_Click(object sender, EventArgs e) { try { if (txtIDBillExport.Text == "" || txtIDCustomer.Text == "" || cmbIDCustomer.Text == "") { XtraMessageBox.Show("Missing Information!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } SaleInvoice_DTO invoice = new SaleInvoice_DTO(); invoice.TransID = Convert.ToInt32(txtIDBillExport.Text); invoice.CustomerId = Convert.ToInt32(txtIDCustomer.Text.ToString()); invoice.CreateDate = Convert.ToDateTime(dtpkDateTimeExport.Text.ToString()); invoice.CustomerName = cmbIDCustomer.Text.ToString(); invoice.TotalPrice = 0; if (SaleInvoice_BUS.InsertSaleInvoice(invoice)) { LoadSaleInvoice(); cmbIDBillExportDetail.Text = txtIDBillExport.Text; ClearDisplay(); uctCustomer.uctCustomerInfo.LoadCustomer(); XtraMessageBox.Show("Insert Sale Invoice Successfully!", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } catch { XtraMessageBox.Show("Insert Post Invoice Failed!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
public static List <SaleInvoice_DTO> LoadSaleInvoice() { SqlConnection con = DataProvider.OpenConnection(); try { cmd = new SqlCommand("[JEWELRYSTOREMGMT].[dbo].[usp_getSaleInvoice]", con); cmd.CommandType = CommandType.StoredProcedure; cmd.ExecuteNonQuery(); da = new SqlDataAdapter(); da.SelectCommand = cmd; dt = new DataTable(); da.Fill(dt); } catch { return(null); } if (dt.Rows.Count == 0) { return(null); } List <SaleInvoice_DTO> saleInvoiceList = new List <SaleInvoice_DTO>(); for (int i = 0; i < dt.Rows.Count; i++) { SaleInvoice_DTO invoice = new SaleInvoice_DTO(); invoice.TransID = Convert.ToInt32(dt.Rows[i]["TransID"].ToString()); invoice.CustomerId = Convert.ToInt32(dt.Rows[i]["CustomerId"].ToString()); invoice.CustomerName = dt.Rows[i]["CustomerName"].ToString(); invoice.CreateDate = Convert.ToDateTime(dt.Rows[i]["TransDate"].ToString()); invoice.TotalPrice = Convert.ToDouble(dt.Rows[i]["TotalPrice"].ToString()); saleInvoiceList.Add(invoice); } DataProvider.CloseConnection(con); return(saleInvoiceList); }
public static bool DeleteSaleInvoice(SaleInvoice_DTO invoice) { return(SaleInvoice_DAL.DeleteSaleInvoice(invoice)); }
public static bool UpdateSaleInvoice(SaleInvoice_DTO invoice) { return(SaleInvoice_DAL.UpdateSaleInvoice(invoice)); }
public static bool InsertSaleInvoice(SaleInvoice_DTO invoice) { return(SaleInvoice_DAL.InsertSaleInvoice(invoice)); }