public bool addReceipt(Receipts c) { try { int param = 7; string[] name = new string[param]; object[] value = new object[param]; name[0] = "@dateestablish"; value[0] = c.Dateestablish; name[1] = "@reason"; value[1] = c.Reason; name[2] = "@total"; value[2] = c.Total; name[3] = "@contractid"; value[3] = c.Contractid; name[4] = "@billid"; value[4] = c.Billid; name[5] = "@customername"; value[5] = c.Customername; name[6] = "@note"; value[6] = c.Contents; int result = this.Update("receipts_Insert", name, value, param); if (result != 0) { return true; } } catch (System.Exception ex) { Console.WriteLine("Message = {1}", ex.Message); } return false; }
public ReceiptEdit(Receipts c) { InitializeComponent(); this.objectReceipt = c; // date.Format = DateTimePickerFormat.Custom; // this.date.CustomFormat = "MM-dd-yyyy"; if (this.objectReceipt != null) { this.id.Text = this.objectReceipt.Id; this.reason.Text = this.objectReceipt.Reason; this.contractId.Text = this.objectReceipt.Contractid; this.customer.Text = this.objectReceipt.Customername; this.date.Text = this.objectReceipt.Dateestablish; this.note.Text = this.objectReceipt.Contents; this.total.Text = this.objectReceipt.Total.ToString(); this.billID.Text = this.objectReceipt.Billid.ToString(); } }
public bool updateReceipts(Receipts c) { return receiptDAT.updateReceipts(c); }
public bool addReceipts(Receipts c) { return receiptDAT.addReceipt(c); }
public DataTable searchReceipts(Receipts rpt) { return receiptDAT.searchReceipts(rpt); }
/// <summary> /// Tìm xem trong bảng ReceiptBills đã có thông tin TollBillsID này chưa? /// - Nếu có rồi thì không cho chỉnh sửa và xóa ServiceNoteId này nữa, chỉ cho xem thôi; /// - Nếu chưa có thì cho phép chỉnh sửa và xóa. /// </summary> /// <param name="tollBillsId"></param> private void CheckEditTollBills(string tollBillsId) { var temp = new Receipts() { Billid = tollBillsId, Dateestablish = "" }; DataTable result = receiptsBLT.searchReceipts(temp); if (result != null && result.Rows.Count>0) { this.btnEdit.Text = "View detail"; this.btnDelete.Enabled = false; } else { this.btnEdit.Text = "Edit"; this.btnDelete.Enabled = true; } }
public bool updateReceipts(Receipts c) { try { string sql = "Update receipts set dateestablish =('" + c.Dateestablish + "'), reason =('" + c.Reason + "'), total =('" + c.Total + "'), contractid =('" + c.Contractid + "') , billid =('" + c.Billid + "') , customername =('" + c.Customername + "') , contents =('" + c.Contents + "') where id = ('" + c.Id.Trim() + "')"; int result = this.ExecuteNonQuery(sql); if (result != 0) { return true; } } catch (System.Exception ex) { Console.WriteLine("Message = {1}", ex.Message); } return false; }