public ActionResult Edit(int id) { try { ViewBag.Saved = false; Models.AccommodationTypeModel mRoomType = new Models.AccommodationTypeModel() { AccommodationTypeId = 0 }; CLayer.AccommodationType roomtype = BLayer.AccommodationType.Get(id); if (roomtype != null) { mRoomType = new Models.AccommodationTypeModel() { AccommodationTypeId = roomtype.AccommodationTypeId, Title = roomtype.Title } } ; return(PartialView("_edit", mRoomType)); } catch (Exception ex) { Common.LogHandler.HandleError(ex); return(Redirect("~/Admin/ErrorPage")); } }
public ActionResult Edit(Models.AccommodationTypeModel data) { try { if (ModelState.IsValid) { CLayer.AccommodationType roomtype = new CLayer.AccommodationType() { AccommodationTypeId = data.AccommodationTypeId, Title = data.Title }; int roomId = BLayer.AccommodationType.Save(roomtype); string types = ""; if (data.StayTypesAssigned != null) { types = data.StayTypesAssigned.Trim(); //the following method is for preventing hidden text field modification /* int ids; * string[] splitted = types.Split(new char[] {','}); * if (splitted.Length == 0) * types = ""; * else * if(splitted.Length == 1) * { * if (int.TryParse(splitted[0], out ids)) * types = ids.ToString(); * } * else * { * types = ""; * foreach(string s in splitted) * { * if (int.TryParse(s, out ids)) * { * if (types != "") types = types + ","; * types = ids.ToString(); * } * * } * }*/ } BLayer.AccommodationType.SetCategoryType(roomId, types); ViewBag.Saved = true; } else { ViewBag.Saved = false; } return(RedirectToAction("Index")); } catch (Exception ex) { Common.LogHandler.HandleError(ex); return(Redirect("~/Admin/ErrorPage")); } }
public int Save(CLayer.AccommodationType data) { List <DataPlug.Parameter> param = new List <DataPlug.Parameter>(); param.Add(Connection.GetParameter("pTypeId", DataPlug.DataType._BigInt, data.AccommodationTypeId)); param.Add(Connection.GetParameter("pTitle", DataPlug.DataType._Varchar, data.Title)); object result = Connection.ExecuteQueryScalar("accommodationtype_Save", param); return(Connection.ToInteger(result)); }
public CLayer.AccommodationType Get(int accTypeId) { CLayer.AccommodationType accType = null; List <DataPlug.Parameter> param = new List <DataPlug.Parameter>(); param.Add(Connection.GetParameter("pTypeId", DataPlug.DataType._BigInt, accTypeId)); DataTable dt = Connection.GetTable("accommodationtype_Get", param); if (dt.Rows.Count > 0) { accType = new CLayer.AccommodationType(); accType.AccommodationTypeId = Connection.ToInteger(dt.Rows[0]["AccommodationTypeId"]); accType.Title = Connection.ToString(dt.Rows[0]["Title"]); } return(accType); }
public static int Save(CLayer.AccommodationType roomtype) { DataLayer.AccommodationType accType = new DataLayer.AccommodationType(); roomtype.Validate(); return(accType.Save(roomtype)); }
public async Task <bool> ResendemailSGST(long OfflineBookingId, long BookingDetailsId, string key) { try { string lck = BLayer.Settings.GetValue(CLayer.Settings.PUBLIC_PAGE_LOCK); if (key != lck) { return(true); } if (OfflineBookingId < 1) { return(false); } CLayer.OfflineBooking Offlinedata = BLayer.OfflineBooking.GetAllDetailsById(OfflineBookingId); CLayer.OfflineBooking OfflinePropertydata = BLayer.OfflineBooking.GetAllpropertyDetails(OfflineBookingId); CLayer.OfflineBooking CustomerDetails = BLayer.OfflineBooking.GetAllCustomerDetails(OfflineBookingId); if (CustomerDetails == null) { return(false); } if (OfflinePropertydata == null) { return(false); } CLayer.StayCategory Staycategorydetails = BLayer.StayCategory.Get(Convert.ToInt32(Offlinedata.StayCategoryid)); CLayer.AccommodationType AccommodationTypedetails = BLayer.AccommodationType.Get(Convert.ToInt32(Offlinedata.Accommodationtypeid)); CLayer.Role.Roles rle = BLayer.User.GetRole(Offlinedata.CustomerId); string message = ""; Common.Mailer ml = new Common.Mailer(); if (OfflineBookingId < 1) { return(false); } try { if (OfflinePropertydata.PropertyEmail != "") { message = await Common.Mailer.MessageFromHtml(System.Configuration.ConfigurationManager.AppSettings.Get("SupplierIntemationOfflineBookGST") + OfflineBookingId.ToString() + "&key=" + BLayer.Settings.GetValue(CLayer.Settings.PUBLIC_PAGE_LOCK) + "&BookingDetailsId=" + BookingDetailsId); System.Net.Mail.MailMessage supplierMsg = new System.Net.Mail.MailMessage(); string BccEmailsforsupp = BLayer.Settings.GetValue(CLayer.Settings.CC_SUPPLIERCOMMUNICATION); if (BccEmailsforsupp != "") { string[] emails = BccEmailsforsupp.Split(','); for (int i = 0; i < emails.Length; ++i) { supplierMsg.Bcc.Add(emails[i]); } } supplierMsg.Subject = "Booking Confirmation"; supplierMsg.Body = message; if (OfflinePropertydata.PropertyEmail != "") { supplierMsg.To.Add(OfflinePropertydata.PropertyEmail); } supplierMsg.IsBodyHtml = true; try { await ml.SendMailAsync(supplierMsg, Common.Mailer.MailType.Reservation); } catch (Exception ex) { Common.LogHandler.HandleError(ex); } } } catch (Exception ex) { Common.LogHandler.HandleError(ex); } } catch (Exception ex) { Common.LogHandler.HandleError(ex); } return(true); }
public async Task <bool> ResendemailC(long OfflineBookingId) { return(true); try { if (OfflineBookingId < 1) { return(false); } CLayer.OfflineBooking Offlinedata = BLayer.OfflineBooking.GetAllDetailsById(OfflineBookingId); CLayer.OfflineBooking OfflinePropertydata = BLayer.OfflineBooking.GetAllpropertyDetails(OfflineBookingId); CLayer.OfflineBooking CustomerDetails = BLayer.OfflineBooking.GetAllCustomerDetails(OfflineBookingId); if (CustomerDetails == null) { return(false); } if (OfflinePropertydata == null) { return(false); } CLayer.StayCategory Staycategorydetails = BLayer.StayCategory.Get(Convert.ToInt32(Offlinedata.StayCategoryid)); CLayer.AccommodationType AccommodationTypedetails = BLayer.AccommodationType.Get(Convert.ToInt32(Offlinedata.Accommodationtypeid)); CLayer.Role.Roles rle = BLayer.User.GetRole(Offlinedata.CustomerId); string message = ""; Common.Mailer ml = new Common.Mailer(); string link = System.Configuration.ConfigurationManager.AppSettings.Get("OfflineBookingConfirmation") + OfflineBookingId.ToString() + "&key=" + BLayer.Settings.GetValue(CLayer.Settings.PUBLIC_PAGE_LOCK); //for normal user mail body message = await Common.Mailer.MessageFromHtml(link); System.Net.Mail.MailMessage customerMsg = new System.Net.Mail.MailMessage(); //guest mail added customerMsg.To.Add(CustomerDetails.CustomerEmail); string BccEmailsforcususer = BLayer.Settings.GetValue(CLayer.Settings.CC_CUSTOMERCOMMUNICATION); if (BccEmailsforcususer != "") { string[] emails = BccEmailsforcususer.Split(','); for (int i = 0; i < emails.Length; ++i) { customerMsg.Bcc.Add(emails[i]); } } customerMsg.Subject = "Booking Confirmation"; customerMsg.Body = message; customerMsg.IsBodyHtml = true; try { await ml.SendMailAsync(customerMsg, Common.Mailer.MailType.Reservation); } catch (Exception ex) { Common.LogHandler.HandleError(ex); } } catch (Exception ex) { Common.LogHandler.HandleError(ex); } return(true); }
public async Task <bool> OfflineBookingConfirmGST(long OfflineBookId, long BookingDetailsId, string GuestEmail) { try { if (OfflineBookId < 1) { return(false); } if (BookingDetailsId < 1) { return(false); } CLayer.OfflineBooking Offlinedata = BLayer.OfflineBooking.GetAllDetailsById(OfflineBookId); CLayer.OfflineBooking OfflinePropertydata = BLayer.OfflineBooking.GetAllpropertyDetails(OfflineBookId); CLayer.OfflineBooking CustomerDetails = BLayer.OfflineBooking.GetAllCustomerDetails(OfflineBookId); if (CustomerDetails == null) { return(false); } if (OfflinePropertydata == null) { return(false); } CLayer.StayCategory Staycategorydetails = BLayer.StayCategory.Get(Convert.ToInt32(Offlinedata.StayCategoryid)); CLayer.AccommodationType AccommodationTypedetails = BLayer.AccommodationType.Get(Convert.ToInt32(Offlinedata.Accommodationtypeid)); CLayer.Role.Roles rle = BLayer.User.GetRole(Offlinedata.CustomerId); string message = ""; Common.Mailer ml = new Common.Mailer(); try { #region Repeat portion //List<CLayer.OfflineBooking> BListGST = BLayer.OfflineBooking.GetMultipleBookingDetailsGST(OfflineBookId); //foreach (CLayer.OfflineBooking dt in BListGST) //{ System.Net.Mail.MailMessage customerMsg = new System.Net.Mail.MailMessage(); //customerMsg.To.Add(CustomerDetails.CustomerEmail); string BccEmailsforcususer = BLayer.Settings.GetValue(CLayer.Settings.CC_CUSTOMERCOMMUNICATION); if (BccEmailsforcususer.Trim() != "") { string[] emails = Common.Utils.SplitEmails(BccEmailsforcususer); //BccEmailsforcususer.Split(','); for (int i = 0; i < emails.Length; ++i) { customerMsg.CC.Add(emails[i]); } } customerMsg.Subject = "CHECK-IN REMINDER"; customerMsg.IsBodyHtml = true; if (GuestEmail != null) { if (GuestEmail != null && GuestEmail != "") { string[] emails = Common.Utils.SplitEmails(GuestEmail); for (int i = 0; i < emails.Length; ++i) { customerMsg.To.Add(emails[i]); } } } string link = System.Configuration.ConfigurationManager.AppSettings.Get("OfflineBookingConfirmationBeforeCheckin") + OfflineBookId.ToString() + "&BookingDetailsId=" + BookingDetailsId + "&key=" + BLayer.Settings.GetValue(CLayer.Settings.PUBLIC_PAGE_LOCK); message = await Common.Mailer.MessageFromHtml(link); customerMsg.Body = message; //Select Distinct Mail address in To mails System.Net.Mail.MailAddress[] DistinctTo = customerMsg.To.Distinct().ToArray(); customerMsg.To.Clear(); for (int i = 0; i < DistinctTo.Length; ++i) { customerMsg.To.Add(DistinctTo[i]); } //Select Distinct Mail address in CC mails System.Net.Mail.MailAddress[] DistinctCC = customerMsg.CC.Distinct().Except(DistinctTo).ToArray(); customerMsg.CC.Clear(); for (int i = 0; i < DistinctCC.Length; ++i) { customerMsg.CC.Add(DistinctCC[i]); } try { await ml.SendMailAsync(customerMsg, Common.Mailer.MailType.Reservation); } catch (Exception ex) { Common.LogHandler.HandleError(ex); } //} #endregion } catch (Exception ex) { Common.LogHandler.HandleError(ex); } } catch (Exception ex) { Common.LogHandler.HandleError(ex); } return(true); }