public string FindOrdersInfo(char type, int id) { if (type == 'C') { var rdg = new RDGs.RGDtblCompanyOrders(this.session.ConnectionString); return(rdg.Find(id).DescriptionTask); } else if (type == 'P') { var rdg = new RDGs.RDGtblPrivetOrders(this.session.ConnectionString); return(rdg.Find(id).DescriptionTask); } else { throw new ArgumentException("Type"); } }
public bool CompanyOrdersUpdate(int orderId, int createById, int customerId, string descriptionTask, double hourUse, double paidHour, int toAcc, DateTime taskDate) { var rdg = new RDGs.RGDtblCompanyOrders(this.session.ConnectionString); var newOrder = new InterfaceAdaptor.CompanyOrder() { CreateBy = new InterfaceAdaptor.Worker() { WorkNo = createById }, Customer = new InterfaceAdaptor.CompanyCustomer() { CompanyCustomersNo = customerId }, DescriptionTask = descriptionTask, HoutsUse = hourUse, InvoiceNo = orderId, PaidHour = paidHour, PaidToAcc = toAcc, TaskDate = taskDate, }; try { rdg.Update(newOrder); } catch (Exception) { return(false); } for (int i = 0; i < this.privetOrders.Count; i++) { if (this.privetOrders.GetAt(i).InvoiceNo == orderId) { this.companyOrders.Update(rdg.Find(newOrder.InvoiceNo), i); break; } } return(true); }
public bool CompanyOrdersAdd(int createById, int customerId, string descriptionTask, double hourUse, double paidHour, int toAcc, DateTime taskDate) { var rdg = new RDGs.RGDtblCompanyOrders(this.session.ConnectionString); var newOrder = new InterfaceAdaptor.CompanyOrder() { CreateBy = new InterfaceAdaptor.Worker() { WorkNo = createById }, CreateDate = DateTime.Now, Customer = new InterfaceAdaptor.CompanyCustomer() { CompanyCustomersNo = customerId }, DescriptionTask = descriptionTask, HoutsUse = hourUse, Paid = false, PaidHour = paidHour, PaidToAcc = toAcc, TaskDate = taskDate }; try { rdg.Add(newOrder); } catch (Exception) { return(false); } this.companyOrders.Add(rdg.Find(rdg.NextId - 1)); return(true); }
public Interface.IcompanyCustomer FindCompanyCustomerBaseOrder(int orderId) { var rdg = new RDGs.RGDtblCompanyOrders(this.session.ConnectionString); return(rdg.Find(orderId).Customer); }