public void BindFuneralToUpdate() { bindSupportedDocuments(); btnClear.Enabled = true; FuneralModel model = client.SelectFuneralBypkid(FID, ParlourId); if ((model == null) || (model.parlourid != ParlourId)) { Response.Write("<script>alert('Sorry!you are not authorized to perform edit on this Funeral.');</script>"); } else //(model != null) { FID = model.pkiFuneralID; txtLastName.Text = model.Surname.ToString(); txtFirstname.Text = model.FullNames.ToString(); txtIdNumber.Text = model.IDNumber.ToString(); txtBirthDay.Text = (Convert.ToDateTime(model.DateOfBirth)).ToString("dd MMM yyyy"); string gender = model.Gender.ToString(); if (gender == rdbtnMale.Text) { rdbtnMale.Checked = true; } else { rdbtnFemale.Checked = true; } txtCOD.Text = model.CourseOfDearth.ToString(); txtDOD.Text = (Convert.ToDateTime(model.DateOfDeath)).ToString("dd MMM yyyy"); txtCollection.Text = model.BodyCollectedFrom.ToString(); txtSerialNo.Text = model.BI1663.ToString(); txtStreetAddress.Text = model.Address1.ToString(); txtTown.Text = model.Address2.ToString(); txtProvince.Text = model.Address3.ToString(); txtCode.Text = model.Code.ToString(); txtDateOfFuneral.Text = model.DateOfFuneral.ToString("dd MMM yyyy"); txtDriver.Text = model.DriverAndCars.ToString(); txtCemetery.Text = model.FuneralCemetery.ToString(); txtGraveNo.Text = model.GraveNo.ToString(); txtContactPerson.Text = model.ContactPerson; txtContactNumber.Text = model.ContactPersonNumber; btnService.Enabled = true; BtnAddDocs.Enabled = true; btnProcessPayment.Enabled = true; btnViewPayments.Enabled = true; } }
public FuneralModel Create(FuneralModel model) { var employeeIds = model.Employees.Select(x => x.ID); var employees = _employeeRepository.GetByIds(employeeIds); var funerals = employees .SelectMany(x => x.FuneralEmployees.Select(y => y.Funeral)) .Where(x => model.DateUtc.Date == x.DateUtc.Date) .ToList(); foreach (var employee in employees) { if (employee.FuneralEmployees.Select(x => x.Funeral).Any(x => x.DateUtc.Date == model.DateUtc.Date)) { throw new System.Exception($"Employee {employee.FirstName} {employee.LastName} is busy at this date"); } } var funeral = _mapper.Map <Funeral>(model); var newFuneral = _funeralRepository.Create(funeral); return(_mapper.Map <FuneralModel>(newFuneral)); }
public static int SaveFuneral(FuneralModel model) { string query = "SaveFuneral"; DbParameter[] ObjParam = new DbParameter[24]; ObjParam[0] = new DbParameter("@pkiFuneralID", DbParameter.DbType.Int, 0, model.pkiFuneralID); ObjParam[1] = new DbParameter("@FullNames", DbParameter.DbType.NVarChar, 0, model.FullNames); ObjParam[2] = new DbParameter("@Surname", DbParameter.DbType.NVarChar, 0, model.Surname); ObjParam[3] = new DbParameter("@Gender", DbParameter.DbType.NVarChar, 0, model.Gender); ObjParam[4] = new DbParameter("@IDNumber", DbParameter.DbType.NVarChar, 0, model.IDNumber); ObjParam[5] = new DbParameter("@DateOfBirth", DbParameter.DbType.DateTime, 0, model.DateOfBirth); ObjParam[6] = new DbParameter("@DateOfDeath", DbParameter.DbType.DateTime, 0, model.DateOfDeath); ObjParam[7] = new DbParameter("@DateOfFuneral", DbParameter.DbType.DateTime, 0, model.DateOfFuneral); ObjParam[8] = new DbParameter("@TimeOfFuneral", DbParameter.DbType.DateTime, 0, model.TimeOfFuneral); ObjParam[9] = new DbParameter("@FuneralCemetery", DbParameter.DbType.NVarChar, 0, model.FuneralCemetery); ObjParam[10] = new DbParameter("@Address1", DbParameter.DbType.NVarChar, 0, model.Address1); ObjParam[11] = new DbParameter("@Address2", DbParameter.DbType.NVarChar, 0, model.Address2); ObjParam[12] = new DbParameter("@Address3", DbParameter.DbType.NVarChar, 0, model.Address3); ObjParam[13] = new DbParameter("@Code", DbParameter.DbType.NVarChar, 0, model.Code); ObjParam[14] = new DbParameter("@BodyCollectedFrom", DbParameter.DbType.NVarChar, 0, model.BodyCollectedFrom); ObjParam[15] = new DbParameter("@CourseOfDearth", DbParameter.DbType.NVarChar, 0, model.CourseOfDearth); ObjParam[16] = new DbParameter("@BI1663", DbParameter.DbType.NVarChar, 0, model.BI1663); ObjParam[17] = new DbParameter("@DriverAndCars", DbParameter.DbType.NVarChar, 0, model.DriverAndCars); ObjParam[18] = new DbParameter("@GraveNo", DbParameter.DbType.NVarChar, 0, model.GraveNo); ObjParam[19] = new DbParameter("@parlourid", DbParameter.DbType.UniqueIdentifier, 0, model.parlourid); ObjParam[20] = new DbParameter("@LastModified", DbParameter.DbType.DateTime, 0, model.LastModified); ObjParam[21] = new DbParameter("@ModifiedUser", DbParameter.DbType.NVarChar, 0, model.ModifiedUser); ObjParam[22] = new DbParameter("@ContactPerson", DbParameter.DbType.NVarChar, 0, model.ContactPerson); ObjParam[23] = new DbParameter("@ContactPersonNumber", DbParameter.DbType.NVarChar, 0, model.ContactPersonNumber); // ObjParam[22] = new DbParameter("@InvoiceNumber", DbParameter.DbType.NVarChar, 0, model.InvoiceNumber); return(Convert.ToInt32(DbConnection.GetScalarValue(CommandType.StoredProcedure, query, ObjParam))); }
public void BindCustomerDetails() { if (QuotationID != 0 && ParlourId != Guid.Empty) { QuotationModel objQuotation = client.SelectQuotationByQuotationId(QuotationID, ParlourId); lblName.Text = objQuotation.ContactTitle + " " + objQuotation.ContactLastName + " " + objQuotation.ContactFirstName; lblcAdd1.Text = objQuotation.AddressLine1; lblcAdd2.Text = objQuotation.AddressLine2; lblcAdd3.Text = objQuotation.AddressLine3; lblcAdd4.Text = objQuotation.AddressLine4; lblcCode.Text = objQuotation.Code; lblDate.Text = objQuotation.DateOfQuotation.ToString("dd MMM yyyy"); lblInvoiceDateTitle.Text = "Quotation date"; lblInvoiceDate.Text = objQuotation.DateOfQuotation.ToString("dd MMM yyyy"); lblNumber1.Text = "Quotation Number"; lblNumber2.Text = objQuotation.QuotationNumber.ToString(); lblHeading.Text = "Quotation"; lblTax.Text = (objQuotation.Tax).ToString("N2"); lblDiscount.Text = (objQuotation.Discount).ToString(); lblNotes.Text = objQuotation.Notes; } else if (FID != 0 && ParlourId != Guid.Empty) { FuneralModel model = client.SelectFuneralBypkid(FID, ParlourId); lblName.Text = string.Format("<b>Contact Person : </b>{0}<br/><b>Contact Number : </b>{1}", model.ContactPerson, model.ContactPersonNumber); lblcAdd1.Text = model.Address1; lblcAdd2.Text = model.Address2; lblcAdd3.Text = model.Address3; lblcAdd4.Text = model.Address4; lblcCode.Text = model.Code; //string CreatedDate = model.CreatedDate.ToString(); if (model.CreatedDate == null || model.CreatedDate == DateTime.MinValue)//"01/01/0001 00:00:00" { if (model.DateOfFuneral != DateTime.MinValue) { lblDate.Text = model.DateOfFuneral.ToString("dd/MMM/yyyy"); } else { lblDate.Text = System.DateTime.Now.ToString("dd/MMM/yyyy"); } } else { lblDate.Text = model.CreatedDate.ToString("dd/MMM/yyyy"); } lblInvoiceDateTitle.Text = "Invoice date"; lblInvoiceDate.Text = lblDate.Text; //string datenow = lblDate.Text; DateTime Start = DateTime.Parse(lblDate.Text); DateTime end = Start.AddHours(48); lblDueDate1.Text = end.ToString("dd/MMM/yyyy"); lblDueDate.Text = "Due Date"; lblNumber1.Text = "Invoice Number"; lblNumber2.Text = model.InvoiceNumber.ToString(); lblHeading.Text = "Funeral Invoice"; lblTax.Text = (model.Tax).ToString("N2"); lblDiscount.Text = (model.Discount).ToString(); lblNotes.Text = model.Notes; lblDecename1.Text = "Name:"; lblDecename2.Text = string.Format("{0} {1}", model.FullNames, model.Surname); lblDeceIDnum1.Text = "ID Number:"; lblDeceIDnum2.Text = model.IDNumber; lblDeceBI1.Text = "BI663 Serial No:"; lblDeceBI2.Text = model.BI1663; lblCemetery1.Text = "Cemetery:"; lblCemetery2.Text = model.FuneralCemetery; lblDeceDate1.Text = "Date: " + (model.DateOfFuneral).ToString("dd/MMM/yyyy") + " "; lblDeceDate2.Text = "At " + (model.TimeOfFuneral).ToString("hh:mm"); lblsemi.Text = ":"; } else if (TBID != 0 && ParlourId != Guid.Empty) { TombStoneModel model = client.SelectTombStoneByParlAndPki(TBID, ParlourId); lblName.Text = string.Format("<b>Contact Person : </b>{0}<br/><b>Contact Number : </b>{1}", model.ContactPerson, model.ContactPersonNumber); lblcAdd1.Text = model.Address1; lblcAdd2.Text = model.Address2; lblcAdd3.Text = model.Address3; lblcAdd4.Text = model.Address4; lblcCode.Text = model.Code; //string CreatedDate = model.CreatedDate.ToString(); if (model.CreatedDate == null || model.CreatedDate == DateTime.MinValue)//"01/01/0001 00:00:00" { if (model.DateOfApplication != null && model.DateOfApplication != DateTime.MinValue) { lblDate.Text = Convert.ToDateTime(model.DateOfApplication).ToString("dd/MMM/yyyy"); } else { lblDate.Text = System.DateTime.Now.ToString("dd/MMM/yyyy"); } lblDate.Text = System.DateTime.Now.ToString("dd/MMM/yyyy"); } else { lblDate.Text = model.CreatedDate.ToString("dd/MMM/yyyy"); } //lblInvoiceDateTitle.Text = "Invoice date"; //lblInvoiceDate.Text = lblDate.Text; string datenow = lblDate.Text; DateTime Start = DateTime.Parse(datenow); DateTime end = Start.AddHours(48); lblDueDate1.Text = end.ToString("dd/MMM/yyyy"); lblDueDate.Text = "Due Date :"; lblNumber1.Text = "Invoice Number"; lblNumber2.Text = model.InvoiceNumber.ToString(); lblHeading.Text = "Tombstone Invoice"; lblTax.Text = (model.Tax).ToString("N2"); lblDiscount.Text = (model.DisCount).ToString(); lblNotes.Text = model.Notes; lblMsg1.Text = "Message:"; lblMsg2.Text = model.TombStoneMessage; lblsemi.Text = ":"; lblInvoiceDateTitle.Text = "<b>Deceased Info : </b>"; lblDecename1.Text = "<b>Id number : </b>"; lblDeceIDnum1.Text = "<b>Date of death : </b>"; lblDeceBI1.Text = "<b>Cemetery name : </b>"; lblCemetery1.Text = "<b>Grave no : </b>"; lblInvoiceDate.Text = string.Format("{0} {1}", model.DeceasedLastName, model.DeceasedFirstName); lblDecename2.Text = model.DeceasedIDNumber; lblDeceIDnum2.Text = model.DateOFMemorial.HasValue ? Convert.ToDateTime(model.DateOFMemorial).ToString("dd/MMM/yyyy") : "Not provided"; lblDeceBI2.Text = model.CemeterOrCrematorium; lblCemetery2.Text = model.GraveNo; } }
public FuneralModel Create(FuneralModel model) { throw new NotImplementedException(); }
protected void btnSaveFuneral_Click(object sender, EventArgs e) { if (Page.IsValid) { try { FuneralModel objfunModel = client.SelectFuneralBypkid(FID, ParlourId); if (objfunModel != null && FID == 0) { ShowMessage(ref lblMessage, MessageType.Danger, "Funeral Details Already Exists."); } else { objfunModel = new FuneralModel(); objfunModel.pkiFuneralID = FID; objfunModel.FullNames = txtFirstname.Text; objfunModel.Surname = txtLastName.Text; string gender = string.Empty; if (rdbtnMale.Checked) { gender = "Male"; } else if (rdbtnFemale.Checked) { gender = "Female"; } objfunModel.Gender = gender; objfunModel.IDNumber = txtIdNumber.Text; if (txtBirthDay.Text == null || txtBirthDay.Text == "") { objfunModel.DateOfBirth = null; } else { objfunModel.DateOfBirth = Convert.ToDateTime(txtBirthDay.Text); } objfunModel.DateOfDeath = Convert.ToDateTime(txtDOD.Text); objfunModel.DateOfFuneral = Convert.ToDateTime(txtDateOfFuneral.Text); objfunModel.TimeOfFuneral = Convert.ToDateTime(txtTIme.Text); objfunModel.CourseOfDearth = txtCOD.Text; objfunModel.FuneralCemetery = txtCemetery.Text; objfunModel.Address1 = txtStreetAddress.Text; objfunModel.Address2 = txtTown.Text; objfunModel.Address3 = txtProvince.Text; objfunModel.Code = txtCode.Text; objfunModel.BodyCollectedFrom = txtCollection.Text; objfunModel.BI1663 = txtSerialNo.Text; objfunModel.DriverAndCars = txtDriver.Text; objfunModel.GraveNo = txtGraveNo.Text; objfunModel.parlourid = ParlourId; objfunModel.LastModified = System.DateTime.Now; objfunModel.ModifiedUser = UserName; objfunModel.ContactPerson = txtContactPerson.Text; objfunModel.ContactPersonNumber = txtContactNumber.Text; FID = client.SaveFuneral(objfunModel); ShowMessage(ref lblMessage, MessageType.Success, "Funeral Successfully Saved."); //ClearControl(); //bindFuneralList(); BindFuneralToUpdate(); btnService.Enabled = true; } } catch (Exception ex) { ShowMessage(ref lblMessage, MessageType.Danger, ex.Message); } } }
public int SaveFuneral(FuneralModel model) { return(FuneralBAL.SaveFuneral(model)); }
public static int SaveFuneral(FuneralModel model) { return(FuneralDAL.SaveFuneral(model)); }
public void Update(FuneralModel entity, params Expression <Func <FuneralModel, object> >[] updatedProperties) { var funeral = _mapper.Map <Funeral>(updatedProperties); _funeralRepository.Update(funeral); }
public void Remove(FuneralModel item) { var funeral = _mapper.Map <Funeral>(item); _funeralRepository.Remove(funeral); }
public void Create(FuneralModel model) { var funeral = _mapper.Map <Funeral>(model); _funeralRepository.Create(funeral); }
public void Update(FuneralModel model, int id) { var funeral = _mapper.Map <Funeral>(model); _funeralRepository.Update(funeral, id, x => x.Id == id); }