public static bool UpdateInvoice(Invoice inv) { string sql = "spUpdateInvoice"; SqlParameter InvoiceID = new SqlParameter("InvoiceID", inv.InvoiceID); SqlParameter ShipperID = new SqlParameter("ShipperID", inv.ShipperID); SqlParameter Description = new SqlParameter("Description", inv.Description); SqlParameter ShipmentDate = new SqlParameter("ShipmentDate", inv.ShipmentDate); return DataProvider.ExecuteNonQuery(sql, CommandType.StoredProcedure, InvoiceID, ShipperID, ShipmentDate, Description); }
public static bool InsertInvoice(Invoice inv) { string sql = "spAddInvoice"; SqlParameter CustomerID = new SqlParameter("CustomerID", inv.CustomerID); SqlParameter ShipperID = new SqlParameter("ShipperID", inv.ShipperID); SqlParameter ShipmentDate = new SqlParameter("ShipmentDate", inv.ShipmentDate); SqlParameter Total = new SqlParameter("Total", inv.Total); SqlParameter Status = new SqlParameter("Status", inv.Status); SqlParameter StaffID = new SqlParameter("StaffID", inv.StaffID); SqlParameter Description = new SqlParameter("Description", inv.Description); return DataProvider.ExecuteNonQuery(sql, System.Data.CommandType.StoredProcedure, CustomerID, ShipperID, ShipmentDate, StaffID,Total, Status, Description); }
private void btnEditSchedule_Click(object sender, RoutedEventArgs e) { try { if (dgdInvoice.SelectedIndex >= 0) { DataRow dr = dt.Rows[dgdInvoice.SelectedIndex]; Invoice inv = new Invoice(); inv.InvoiceID = (int)dr["InvoiceID"]; inv.CustomerID = dr["CustomerID"].ToString(); inv.Description = dr["Description"].ToString(); inv.ShipmentDate = (DateTime)dr["ShipmentDate"]; inv.ShipperID = (int)dr["ShipperID"]; inv.StaffID = (int)dr["StaffID"]; inv.Status = dr["Status"].ToString(); inv.Total = (double)dr["Total"]; EditSchedule es = new EditSchedule(inv, Shippers); es.EditFinished += new ActionCompleted(EditCurRow); es.ShowDialog(); } } catch(Exception g) { System.Windows.Forms.MessageBox.Show(g.Message); } }
private void EditCurRow(Invoice a) { DataRow dr = dt.Rows.Find(a.InvoiceID); dr["ShipperID"] = a.ShipperID; dr["ShipmentDate"] = a.ShipmentDate; dr["Description"] = a.Description; dr["Status"] = a.Status; }
private void updateTable(Invoice a) { dt.Rows.Add(a.InvoiceID, a.CustomerID, a.ShipperID, a.ShipmentDate, a.Total, a.StaffID, a.Status, a.Description); }
public static bool UpdateInvoiceByID(Invoice inv) { return InvoiceData.UpdateInvoice(inv); }
public static bool AddInvoice(Invoice inv) { return InvoiceData.InsertInvoice(inv); }
private void btnOk_Click(object sender, RoutedEventArgs e) { try { Invoice newInv = new Invoice(); DataRowView cur = (DataRowView)dgdCustomer.SelectedItem; newInv.InvoiceID = nextIden; newInv.CustomerID = cur[0].ToString(); newInv.Description = txtDescription.Text; newInv.ShipmentDate = dpDeliTime.SelectedDate.Value.Date; newInv.ShipperID = ((Shipper)cbbShipper.SelectedItem).ShipperID; newInv.StaffID = curUser.UserID; newInv.Status = "Pending"; double total = 0; foreach (InvoiceDetail id in InvoiceDetails) { total += id.SubTotal; } newInv.Total = total; InvoiceBLL.AddInvoice(newInv); InvoiceDetailBLL.AddInvoiceDetails(InvoiceDetails); System.Windows.Forms.MessageBox.Show("Successfully"); if (AddFinshed != null) { AddFinshed(newInv); } } catch (Exception g) { System.Windows.Forms.MessageBox.Show("Error: " + g.Message); } finally { this.Close(); } }
public EditSchedule(Invoice inv, List<Shipper> sp) { InitializeComponent(); this.inv = inv; this.Shippers = sp; }