public async Task <IHttpActionResult> PutMethodOfPayment(int id, MethodOfPayment methodOfPayment) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != methodOfPayment.MethodOfPaymentId) { return(BadRequest()); } db.Entry(methodOfPayment).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MethodOfPaymentExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public bool AddMethodOfPaymentToHairSalon(int idHairSalon, MethodOfPayment addMethodOfPayment) { MethodOfPayment methodOfPayment = unitOfWork.MethodsOfPayment.Get(addMethodOfPayment.Id); HairSalonMethodsOfPayment newHairSalonMethodsOfPayment = new HairSalonMethodsOfPayment() { HairSalonId = idHairSalon, MethodOfPayment = methodOfPayment }; IEnumerable <HairSalonMethodsOfPayment> hairSalonMethodsOfPayment = unitOfWork.HairSalonMethodsOfPayment.GetHairSalonMethodsOfPayments(idHairSalon); foreach (HairSalonMethodsOfPayment hairSalonMethodOfPayment in hairSalonMethodsOfPayment) { if (hairSalonMethodOfPayment.MethodOfPaymentId == methodOfPayment.Id) { return(false); } } unitOfWork.HairSalonMethodsOfPayment.Add(newHairSalonMethodsOfPayment); int success = unitOfWork.Complete(); return(success > 0); }
public ActionResult DeleteConfirmed(int id) { MethodOfPayment methodofpayment = db.MethodsOfPayment.Find(id); db.MethodsOfPayment.Remove(methodofpayment); db.SaveChanges(); return(RedirectToAction("Index")); }
public BillingInfo(string ownerName, string address, string phoneNumber, string email, int numOfPets, MethodOfPayment method, long cardNum, string expDate, int cvv) : base(ownerName, address, phoneNumber, email, numOfPets) { MethodOfPayment = method; CardNumber = cardNum; ExpirationDate = expDate; CVV = cvv; }
public bool DeleteMethodOfPayment(int id) { MethodOfPayment methodOfPayment = unitOfWork.MethodsOfPayment.Get(id); unitOfWork.MethodsOfPayment.Remove(methodOfPayment); int success = unitOfWork.Complete(); return(success > 0); }
public bool EditMethodOfPayment(MethodOfPaymentEditVM methodOfPaymentEditVM) { MethodOfPayment methodOfPayment = unitOfWork.MethodsOfPayment.Get(methodOfPaymentEditVM.Id); methodOfPayment.Method = methodOfPaymentEditVM.Method; int success = unitOfWork.Complete(); return(success > 0); }
public ActionResult Edit(MethodOfPayment methodofpayment) { if (ModelState.IsValid) { db.Entry(methodofpayment).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(methodofpayment)); }
// // GET: /MethodsOfPayment/Delete/5 public ActionResult Delete(int id = 0) { MethodOfPayment methodofpayment = db.MethodsOfPayment.Find(id); if (methodofpayment == null) { return(HttpNotFound()); } return(View(methodofpayment)); }
public async Task <IHttpActionResult> GetMethodOfPayment(int id) { MethodOfPayment methodOfPayment = await db.MethodOfPayments.FindAsync(id); if (methodOfPayment == null) { return(NotFound()); } return(Ok(methodOfPayment)); }
public ActionResult Create(MethodOfPayment methodofpayment) { if (ModelState.IsValid) { db.MethodsOfPayment.Add(methodofpayment); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(methodofpayment)); }
public EditMethodOfPayment(MethodOfPayment methodOfPayment) { InitializeComponent(); ls = new LoadingScreen(); methodOfPaymentApi = new MethodOfPaymentApiClient(); this.methodOfPayment = methodOfPayment; SetMethodOfPaymentValues(); }
public async Task <IHttpActionResult> PostMethodOfPayment(MethodOfPayment methodOfPayment) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.MethodOfPayments.Add(methodOfPayment); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = methodOfPayment.MethodOfPaymentId }, methodOfPayment)); }
public bool Get(long DocProformaInvoice_ID) { string Err = null; Clear(); string sql = @"select dpi.IssueDate, dpi.DocDuration, dpi.DocDurationType, dpi.TermsOfPayment_ID, dpi.MethodOfPayment_ID, mop.Atom_BankAccount_ID, top.Description as TermsOfPayment_Description, mop.PaymentType, aba.TRR, ao.Name, ao.Tax_ID, ao.Registration_ID from DocProformaInvoice dpi left join TermsOfPayment top on dpi.TermsOfPayment_ID = top.ID left join MethodOfPayment mop on dpi.MethodOfPayment_ID = mop.ID left join Atom_BankAccount aba on mop.Atom_BankAccount_ID = aba.ID left join Atom_Bank ab on aba.Atom_Bank_ID = ab.ID left join Atom_Organisation ao on ab.Atom_Organisation_ID = ao.ID where dpi.ID = " + DocProformaInvoice_ID.ToString(); DataTable dt = new DataTable(); if (DBSync.DBSync.ReadDataTable(ref dt, sql, ref Err)) { if (dt.Rows.Count > 0) { m_IssueDate = DocProformaInvoice_AddOn.IssueDate.Set(dt.Rows[0]["IssueDate"]); m_Duration = DocProformaInvoice_AddOn.Duration.Set(dt.Rows[0]["DocDuration"], dt.Rows[0]["DocDurationType"]); m_TermsOfPayment = DocProformaInvoice_AddOn.TermsOfPayment.Set(dt.Rows[0]["TermsOfPayment_ID"], dt.Rows[0]["TermsOfPayment_Description"]); m_MethodOfPayment = DocProformaInvoice_AddOn.MethodOfPayment.Set(dt.Rows[0]["MethodOfPayment_ID"], dt.Rows[0]["PaymentType"], dt.Rows[0]["Name"], dt.Rows[0]["Tax_ID"], dt.Rows[0]["Registration_ID"], dt.Rows[0]["TRR"], dt.Rows[0]["Atom_BankAccount_ID"]); } return true; } else { LogFile.Error.Show("ERROR:TangentaDB:DocProformaInvoice_AddOn:Get:sql=" + sql + "\r\nErr=" + Err); return false; } }
public void Delete(int id) { MethodOfPayment method = Context.MethodsOfPayment.FirstOrDefault(x => x.Id.Equals(id)); if (method == null) { throw new InvalidOperationException(); } Context.MethodsOfPayment.Remove(method); Context.SaveChanges(); }
public bool InsertMethodOfPayment(MethodOfPaymentInsertVM methodOfPaymentInsertVM) { MethodOfPayment methodOfPayment = new MethodOfPayment() { Method = methodOfPaymentInsertVM.Method }; unitOfWork.MethodsOfPayment.Add(methodOfPayment); int success = unitOfWork.Complete(); return(success > 0); }
public async Task<bool> AddMethodOfPaymentToHairSalon(int idHairSalon, MethodOfPayment methodOfPayment) { StringContent content = GetStringContent(methodOfPayment); HttpClient request = new HttpClient(); HttpResponseMessage response = await request.PostAsync($"{ API_URL }/AddMethodOfPaymentToHairSalon/{ idHairSalon }", content); if (response.IsSuccessStatusCode) { bool result = await response.Content.ReadAsAsync<bool>(); return result; } return false; }
public MethodOfPaymentPanel(MethodOfPayment methodOfPayment, HairSalon hairSalon) { InitializeComponent(); ls = new LoadingScreen(); methodOfPaymentApi = new MethodOfPaymentApiClient(); hairSalonMethodsOfPaymentApi = new HairSalonMethodsOfPaymentApiClient(); this.methodOfPayment = methodOfPayment; this.hairSalon = hairSalon; SetMethodOfPaymentValues(); }
public void Update(int id, MethodOfPayment item) { var method = Context.MethodsOfPayment.FirstOrDefault(x => x.Id.Equals(id)); if (method == null) { throw new InvalidOperationException(); } method.Name = item.Name; method.Description = item.Description; Context.SaveChanges(); }
public MethodOfPayment AddMethodOfPayment(int Id, tblPaymentTypeRow parenttblPaymentTypeRowBytblPaymentTypetblMethodOfPaymentMap, tblApplicationGroupRow parenttblApplicationGroupRowBytblApplicationGrouptblMethodOfPaymentMap, int Mop, string Description) { MethodOfPayment rowMethodOfPayment = ((MethodOfPayment)(this.NewRow())); rowMethodOfPayment.ItemArray = new object[] { Id, parenttblPaymentTypeRowBytblPaymentTypetblMethodOfPaymentMap[0], parenttblApplicationGroupRowBytblApplicationGrouptblMethodOfPaymentMap[0], Mop, Description }; this.Rows.Add(rowMethodOfPayment); return(rowMethodOfPayment); }
public async Task <IHttpActionResult> DeleteMethodOfPayment(int id) { MethodOfPayment methodOfPayment = await db.MethodOfPayments.FindAsync(id); if (methodOfPayment == null) { return(NotFound()); } db.MethodOfPayments.Remove(methodOfPayment); await db.SaveChangesAsync(); return(Ok(methodOfPayment)); }
public DataTable SortBasedOn(MethodOfPayment MOP, DateTime start, DateTime end) { DataView dv_Period = DS_QAllClients.Tables[0].DefaultView; if (start <= end) { dv_Period.RowFilter = string.Format("pStoragePeriod >= '#{0}#' AND pStoragePeriod <= '#{1}#' AND pPaymentMethod like '%{2}%' ", start.ToString(), end.ToString(), MOP.ToString()); } else if (end <= start) { dv_Period.RowFilter = string.Format("pStoragePeriod >= '#{0}#' AND pStoragePeriod <= '#{1}#' AND pPaymentMethod like '%{2}%' ", end.ToString(), start.ToString(), MOP.ToString()); } DataTable DT = dv_Period.ToTable(); return(DT); }
public bool InsertAppointment(AppointmentInsertVM appointmentInsertVM) { HairSalon hairSalon = unitOfWork.HairSalons.Get(appointmentInsertVM.HairSalonId); RegisteredUser registeredUser = unitOfWork.RegisteredUsers.Get(appointmentInsertVM.RegisteredUser.Id); Worker worker = unitOfWork.Workers.Get(appointmentInsertVM.Worker.Id); MethodOfPayment methodOfPayment = unitOfWork.MethodsOfPayment.Get(appointmentInsertVM.MethodOfPayment.Id); string newTime = appointmentInsertVM.Time.ToString("hh':'mm"); TimeSpan newierTime = TimeSpan.Parse(newTime); Appointment appointment = new Appointment() { Date = appointmentInsertVM.Date, Time = newierTime, IsCompleted = false, HairSalon = hairSalon, RegisteredUser = registeredUser, Worker = worker, MethodOfPayment = methodOfPayment }; decimal sum = 0; foreach (Service service in appointmentInsertVM.Services) { sum += service.Price; } appointment.TotalPrice = sum; unitOfWork.Appointments.Add(appointment); unitOfWork.Complete(); Appointment appointmentForService = unitOfWork.Appointments.GetAppointment(appointment.Date, appointment.Time); foreach (Service service in appointmentInsertVM.Services) { Service serviceForAppointment = unitOfWork.Services.Get(service.Id); unitOfWork.AppointmentServices.Add(new AppointmentServices() { Appointment = appointmentForService, Service = serviceForAppointment }); } int success = unitOfWork.Complete(); return(success > 0); }
public bool InsertAppointmentByUser(AppointmentInsertVM appointmentInsertVM) { HairSalon hairSalon = unitOfWork.HairSalons.Get(appointmentInsertVM.HairSalonId); RegisteredUser registeredUser = unitOfWork.RegisteredUsers.Get(appointmentInsertVM.RegisteredUser.Id); Worker worker = unitOfWork.Workers.Get(int.Parse(appointmentInsertVM.SelectedWorkerId)); MethodOfPayment methodOfPayment = unitOfWork.MethodsOfPayment.Get(int.Parse(appointmentInsertVM.SelectedMethodOfPaymentId)); Appointment appointment = new Appointment() { Date = appointmentInsertVM.Date, Time = appointmentInsertVM.Time, IsCompleted = false, HairSalon = hairSalon, RegisteredUser = registeredUser, Worker = worker, MethodOfPayment = methodOfPayment }; decimal sum = 0; foreach (int serviceId in appointmentInsertVM.SelectedServices) { Service serviceForAppointment = unitOfWork.Services.Get(serviceId); sum += serviceForAppointment.Price; } appointment.TotalPrice = sum; unitOfWork.Appointments.Add(appointment); unitOfWork.Complete(); Appointment appointmentForService = unitOfWork.Appointments.GetAppointment(appointment.Id); foreach (int serviceId in appointmentInsertVM.SelectedServices) { Service serviceForAppointment = unitOfWork.Services.Get(serviceId); unitOfWork.AppointmentServices.Add(new AppointmentServices() { AppointmentId = appointmentForService.Id, ServiceId = serviceForAppointment.Id }); } int success = unitOfWork.Complete(); return(success > 0); }
public void Create(MethodOfPayment item) { item = Context.MethodsOfPayment.Add(item); Context.SaveChanges(); }
private void Clear() { m_IssueDate = null; m_TermsOfPayment = null; m_MethodOfPayment = null; m_PaymentDeadline = null; }
public void AddMethodOfPayment(MethodOfPayment row) { this.Rows.Add(row); }
public void RemoveMethodOfPayment(MethodOfPayment row) { this.Rows.Remove(row); }
public MethodOfPaymentChangeEvent(MethodOfPayment row, DataRowAction action) { this.eventRow = row; this.eventAction = action; }
private void Clear() { m_IssueDate = null; m_Duration = null; m_TermsOfPayment = null; m_MethodOfPayment = null; }
internal static MethodOfPayment Set(object oID, object oPaymentType, object oBankName, object oBank_Tax_ID, object oBank_Registration_ID, object oBankAccount, object oBankAccount_ID) { if ((oID is long) && (oPaymentType is string)) { MethodOfPayment xMethodOfPayment = new MethodOfPayment(); xMethodOfPayment.ID = (long)oID; string xPaymentType = (string)oPaymentType; string Err = null; xMethodOfPayment.eType = GlobalData.Get_ePaymentType(xPaymentType, ref Err); if (xMethodOfPayment.eType != GlobalData.ePaymentType.NONE) { xMethodOfPayment.PaymentType = GlobalData.Get_sPaymentType(xMethodOfPayment.eType); if (xMethodOfPayment.eType == GlobalData.ePaymentType.BANK_ACCOUNT_TRANSFER) { if ((oBankName is string) && (oBank_Tax_ID is string) && (oBankAccount is string) && (oBankAccount_ID is long)) { xMethodOfPayment.BankName = (string)oBankName; xMethodOfPayment.Bank_Tax_ID = (string)oBank_Tax_ID; xMethodOfPayment.BankAccount = (string)oBankAccount; xMethodOfPayment.BankAccount_ID = (long)oBankAccount_ID; xMethodOfPayment.m_Bank_Registration_ID = null; if (oBank_Registration_ID!=null) { if (oBank_Registration_ID is string) { xMethodOfPayment.Bank_Registration_ID = (string)oBank_Registration_ID; } } } else { if (!(oBankName is string)) { LogFile.Error.Show("ERROR:TangentaDB:DocProformaInvoice_AddOn.MethodOfPayment:Set:oBankName is not string"); } else if (!(oBank_Tax_ID is string)) { LogFile.Error.Show("ERROR:TangentaDB:DocProformaInvoice_AddOn.MethodOfPayment:Set:oBank_Tax_ID is not string"); } else if (!(oBankAccount is string)) { LogFile.Error.Show("ERROR:TangentaDB:DocProformaInvoice_AddOn.MethodOfPayment:Set: oBankAccount is not string"); } else if (!(oBankAccount_ID is long)) { LogFile.Error.Show("ERROR:TangentaDB:DocProformaInvoice_AddOn.MethodOfPayment:Set: oBankAccount_ID is not long"); } return null; } } return xMethodOfPayment; } } return null; }
private void SortDataFromExcelForStudent(object[] StudentInfo_ExcelRow) { Parent addedStudent = new Parent(); DAL Data = new DAL(); try { DateTime strSubmittedTime = (DateTime)StudentInfo_ExcelRow[0]; string strName = (string)StudentInfo_ExcelRow[1]; string strSurName = (string)StudentInfo_ExcelRow[2]; string strGuardianNumber = StudentInfo_ExcelRow[3].ToString(); string stringNumTrunks = (string)StudentInfo_ExcelRow[4]; string strStorageOption = (string)StudentInfo_ExcelRow[5]; string strPaymentMethod = (string)StudentInfo_ExcelRow[6]; string strHouse = (string)StudentInfo_ExcelRow[7]; string strNumber = StudentInfo_ExcelRow[8].ToString(); string strEmail = (string)StudentInfo_ExcelRow[9]; // sorted date time if (strSubmittedTime.Month <= 4) { DateTime SubmitedTime = new DateTime(strSubmittedTime.Year, 4, 1); addedStudent.StoragePeriod = SubmitedTime; } else if (strSubmittedTime.Month <= 8) { DateTime SubmitedTime = new DateTime(strSubmittedTime.Year, 8, 1); addedStudent.StoragePeriod = SubmitedTime; } else if (strSubmittedTime.Month <= 12) { DateTime SubmitedTime = new DateTime(strSubmittedTime.Year, 12, 1); addedStudent.StoragePeriod = SubmitedTime; } //Name check for & if (strName.Contains("&")) { strName = strName.Replace(" ", ""); int index = strName.IndexOf("&"); string FirtPerson = strName.Remove(index); string ExtraPerson = strName.Remove(0, index + 1); object[] NewPerson = { strSubmittedTime, ExtraPerson, strSurName, strGuardianNumber, stringNumTrunks, strStorageOption, strPaymentMethod, strHouse, strNumber, strEmail }; SortDataFromExcelForStudent(NewPerson); addedStudent.Name = FirtPerson; } else { addedStudent.Name = strName; } //Number of trunks stringNumTrunks = stringNumTrunks.Remove(1);// removing any excess information int NumTrunks = Convert.ToInt32(stringNumTrunks); //stroage option convertion strStorageOption = strStorageOption.ToLower(); if (strStorageOption.Contains("washing")) { StorageOption StorageOpt = StorageOption.StorageAndWashing; addedStudent.Option = StorageOpt; } else if (strStorageOption.Contains("only")) { StorageOption StorageOpt = StorageOption.Storage; addedStudent.Option = StorageOpt; } //payment Method strPaymentMethod = strPaymentMethod.ToLower(); if (strPaymentMethod.Contains("cash")) { MethodOfPayment PaymentMethod = MethodOfPayment.Cash; addedStudent.MethodOfPayment = PaymentMethod; } else if (strPaymentMethod.Contains("eco")) { MethodOfPayment PaymentMethod = MethodOfPayment.EcoCash; addedStudent.MethodOfPayment = PaymentMethod; } else if (strPaymentMethod.Contains("student")) { MethodOfPayment PaymentMethod = MethodOfPayment.StudentAccount; addedStudent.MethodOfPayment = PaymentMethod; } else if (strPaymentMethod.Contains("bank")) { MethodOfPayment PaymentMethod = MethodOfPayment.BankTransfer; addedStudent.MethodOfPayment = PaymentMethod; } //student house strHouse = strHouse.ToLower(); if (strHouse.Contains("founders")) { FalconCollegeHouse House = FalconCollegeHouse.Founders; addedStudent.House = House; } else if (strHouse.Contains("george")) { FalconCollegeHouse House = FalconCollegeHouse.GeorgeGrey; addedStudent.House = House; } else if (strHouse.Contains("hervey")) { FalconCollegeHouse House = FalconCollegeHouse.Hervey; addedStudent.House = House; } else if (strHouse.Contains("oates")) { FalconCollegeHouse House = FalconCollegeHouse.Oates; addedStudent.House = House; } else if (strHouse.Contains("tredgold")) { FalconCollegeHouse House = FalconCollegeHouse.Tredgold; addedStudent.House = House; } else if (strHouse.Contains("chubb")) { FalconCollegeHouse House = FalconCollegeHouse.Chubb; addedStudent.House = House; } addedStudent.Email = strEmail; addedStudent.Trunks = NumTrunks; addedStudent.Number = strNumber; addedStudent.GaurdianNumber = strGuardianNumber; addedStudent.Surname = strSurName; } catch (Exception ex) { string caption = "Error Adding Student"; MessageBoxButtons Button = MessageBoxButtons.OK; MessageBoxIcon icon = MessageBoxIcon.Error; MessageBox.Show(ex.Message, caption, Button, icon); } Data.QInsertStudent(addedStudent); }
public static Parent SortDataGridVeiwToParentClass(DataRow Row) { Parent ConStudent = new Bulawayo_Storage.Parent(); int strId = (int)Row.ItemArray[0]; string strName = (string)Row.ItemArray[1]; string strSurName = (string)Row.ItemArray[2]; string strHouse = (string)Row.ItemArray[3]; string strEmail = (string)Row.ItemArray[4]; string strNumber = (string)Row.ItemArray[5]; string strGuardianNumber = (string)Row.ItemArray[6]; int stringNumTrunks = (int)Row.ItemArray[7]; string strStorageOption = (string)Row.ItemArray[8]; string strPaymentMethod = (string)Row.ItemArray[9]; DateTime period = (DateTime)Row.ItemArray[10]; ConStudent.Id = strId; ConStudent.Name = strName; ConStudent.Surname = strSurName; strHouse = strHouse.ToLower(); if (strHouse.Contains("founders")) { FalconCollegeHouse House = FalconCollegeHouse.Founders; ConStudent.House = House; } else if (strHouse.Contains("george")) { FalconCollegeHouse House = FalconCollegeHouse.GeorgeGrey; ConStudent.House = House; } else if (strHouse.Contains("hervey")) { FalconCollegeHouse House = FalconCollegeHouse.Hervey; ConStudent.House = House; } else if (strHouse.Contains("oates")) { FalconCollegeHouse House = FalconCollegeHouse.Oates; ConStudent.House = House; } else if (strHouse.Contains("tredgold")) { FalconCollegeHouse House = FalconCollegeHouse.Tredgold; ConStudent.House = House; } else if (strHouse.Contains("chubb")) { FalconCollegeHouse House = FalconCollegeHouse.Chubb; ConStudent.House = House; } ConStudent.Email = strEmail; ConStudent.Number = strNumber; ConStudent.GaurdianNumber = strGuardianNumber; ConStudent.Trunks = stringNumTrunks; strStorageOption = strStorageOption.ToLower(); if (strStorageOption.Contains("washing")) { StorageOption StorageOpt = StorageOption.StorageAndWashing; ConStudent.Option = StorageOpt; } else if (strStorageOption.Contains("only")) { StorageOption StorageOpt = StorageOption.Storage; ConStudent.Option = StorageOpt; } strPaymentMethod = strPaymentMethod.ToLower(); if (strPaymentMethod.Contains("cash")) { MethodOfPayment PaymentMethod = MethodOfPayment.Cash; ConStudent.MethodOfPayment = PaymentMethod; } else if (strPaymentMethod.Contains("eco")) { MethodOfPayment PaymentMethod = MethodOfPayment.EcoCash; ConStudent.MethodOfPayment = PaymentMethod; } else if (strPaymentMethod.Contains("student")) { MethodOfPayment PaymentMethod = MethodOfPayment.StudentAccount; ConStudent.MethodOfPayment = PaymentMethod; } else if (strPaymentMethod.Contains("bank")) { MethodOfPayment PaymentMethod = MethodOfPayment.BankTransfer; ConStudent.MethodOfPayment = PaymentMethod; } ConStudent.StoragePeriod = period; return(ConStudent); }