public ActionResult ViewUpgradeServices(UpgradeServiceViewModel UpgradeServiceVM) { @TempData["Name"] = Session["Name"]; UpgradeServiceVM.GetUpgrdService = upgradeSerciceRepo.GetUpgrdService().ToList(); return(View(UpgradeServiceVM)); }
public ActionResult Create() { @TempData["Name"] = Session["Name"]; ViewData["PageRole"] = 1; int editDocInputs = (Session["Doctor"] != null) ? (Convert.ToInt32(Session["Doctor"])) : 0; UpgradeServiceViewModel UpgradeServiceVM = new UpgradeServiceViewModel(); UpgradeServiceVM.DurationList = upgradeSerciceRepo.GetDuration().ToList(); UpgradeServiceVM.MonthsList = upgradeSerciceRepo.GetMonths().ToList(); UpgradeServiceVM.GetUpgrdService = upgradeSerciceRepo.GetUpgrdService().ToList(); UpgradeServiceVM.membershipListTwo = new List <MembershipTwo>() { new MembershipTwo { MembershipId = 1, MembershipType = "Directory Listing" }, //{ID=1,Name="Group 1" }, new MembershipTwo { MembershipId = 2, MembershipType = "Online Appointment Scheduling" }, new MembershipTwo { MembershipId = 3, MembershipType = "Medical Answering Service " }, }; UpgradeServiceVM.SelectedMember = UpgradeServiceVM.membershipListTwo.Select(x => x.MembershipId).ToArray(); return(View(UpgradeServiceVM)); }
public ActionResult Create() { @TempData["Name"] = Session["Name"]; ViewData["PageRole"] = 1; int Id = (Convert.ToInt32(Session["EditDoctor"])); int editInputs = (Session["EditService"] != null) ? (Convert.ToInt32(Session["EditService"])) : 0; UpgradeServiceViewModel UpgradeServiceVM = new UpgradeServiceViewModel(); UpgradeServiceVM.DurationList = upgradeSerciceRepo.GetDuration().ToList(); UpgradeServiceVM.MonthsList = upgradeSerciceRepo.GetMonths().ToList(); UpgradeServiceVM.GetUpgrdService = upgradeSerciceRepo.GetUpgrdService().ToList(); UpgradeServiceVM.MembershipList = upgradeSerciceRepo.GetMembers().Where(x => x.InactiveFlag == "N").ToList(); UpgradeServiceVM.SelectedMember = UpgradeServiceVM.MembershipList.Select(x => x.MembershipId).ToArray(); //if (editInputs != 0) //{ // List<UpgradeService> NewService = upgradeSerciceRepo.GetServices().Where(x => x.LoginId == 4).ToList(); // foreach (var item in NewService) // { // int logid = item.LoginId; // int memID = item.MembershipId; // var AllUserInfo = (from u in db.Memberships // join m in db.upgradeServices on u.MembershipId equals m.MembershipId // where m.InactiveFlag == "N" && m.LoginId == logid // select new // { // CheckedStatus=m.CheckedStatus, // MembershipType=u.MembershipType, // MembershipId=u.MembershipId, // }).ToList(); // var AllUserInfoo = (from u in db.Memberships // join m in db.upgradeServices on u.MembershipId equals m.MembershipId // where m.InactiveFlag == "N" && u.MembershipId != memID // select new // { // CheckedStatus = u.CheckedStatus, // MembershipType = u.MembershipType, // MembershipId = u.MembershipId, // }).ToList(); // List<MCMDMembership> Membershipget = new List<MCMDMembership>(); // foreach (var itemm in AllUserInfo) // { // var s = new MCMDMembership(); // s.CheckedStatus = itemm.CheckedStatus; // s.MembershipType = itemm.MembershipType; // s.MembershipId = itemm.MembershipId; // Membershipget.Add(s); // } // foreach (var itemm in AllUserInfoo) // { // var s = new MCMDMembership(); // s.CheckedStatus = itemm.CheckedStatus; // s.MembershipType = itemm.MembershipType; // s.MembershipId = itemm.MembershipId; // Membershipget.Add(s); // } // UpgradeServiceVM.MembershipList = Membershipget; // UpgradeServiceVM.UpgradeServiceId = item.UpgradeServiceId; // UpgradeServiceVM.DurationId = item.Durations; // UpgradeServiceVM.AutoRenavalId = item.AutoRenaval; // Session["EditService"] = null; // } //} //else //{ // UpgradeServiceVM.MembershipList = upgradeSerciceRepo.GetMembers().Where(x => x.InactiveFlag == "N").ToList(); // UpgradeServiceVM.SelectedMember = UpgradeServiceVM.MembershipList.Select(x => x.MembershipId).ToArray(); //} return(View(UpgradeServiceVM)); }
public ActionResult Create(UpgradeServiceViewModel UpgradeServiceVM) { //try //{ // if (ModelState.IsValid) // { // int Id = (Convert.ToInt32(Session["EditDoctor"])); // StringBuilder sb = new StringBuilder(); // sb.Append("SELECTED SERVICES :- ").AppendLine(); // foreach (var item in UpgradeServiceVM.MembershipList) // { // if (item.CheckedStatus == true) // { // //Inserting Values Also in upgradeServiceL Tabale // var NewService = new UpgradeService(); // sb.Append(item.MembershipType + ", ").AppendLine(); // NewService.MembershipId = item.MembershipId; // NewService.LoginId = Id; // NewService.Durations = UpgradeServiceVM.DurationId; // NewService.AutoRenaval = UpgradeServiceVM.AutoRenavalId; // NewService.CheckedStatus = true; // NewService.CreatedById = 1; // NewService.InactiveFlag = "N"; // NewService.CreatedOnDate = DateTime.Now; // NewService.ModifiedById = 1; // NewService.ModifiedOnDate = DateTime.Now; // upgradeSerciceRepo.InsertSrvice(NewService); // upgradeSerciceRepo.Save(); // //Inserting Values Also in upgradeServiceLog History Tabale // //var NewSerLog = new UpgradeServiceLog(); // UpgradeServiceLog NewSerLog = new UpgradeServiceLog(); // NewSerLog.MembershipId = item.MembershipId; // NewSerLog.LoginId = Id; // NewSerLog.Durations = UpgradeServiceVM.DurationId; // NewSerLog.AutoRenaval = UpgradeServiceVM.AutoRenavalId; // NewService.CheckedStatus = true; // NewSerLog.CreatedById = 1; // NewSerLog.InactiveFlag = "N"; // NewSerLog.CreatedOnDate = DateTime.Now; // NewSerLog.ModifiedById = 1; // NewSerLog.ModifiedOnDate = DateTime.Now; // upgradeSerciceRepo.InsertServiceLog(NewSerLog); // upgradeSerciceRepo.Save(); // //if (Session["EditService"] != null) // //{ // // NewService.UpgradeServiceId = Convert.ToInt32(Session["EditService"]);// assign the View Model Id to Entities Id // // upgradeSerciceRepo.UpdateService(NewService); // // //Session["EditService"] = null; // //} // //else // //{ // // upgradeSerciceRepo.InsertSrvice(NewService); // //}; // //upgradeSerciceRepo.Save(); // @TempData["SuccessMessage"] = "Successfully added.."; // } // } // ViewBag.Message = "Successfully added.."; // } //} //catch (Exception) //{ // @TempData["Message"] = "Unable to save changes"; //} return(RedirectToAction("Create")); }
public ActionResult Create(UpgradeServiceViewModel UpgradeServiceVM) { try { if (ModelState.IsValid) { //int Id = (Convert.ToInt32(Session["EditDoctor"])); UpgradeServiceVM.LoginId = Convert.ToInt32(Session["Doctor"]);//Change StringBuilder sb = new StringBuilder(); sb.Append("SELECTED SERVICES :- ").AppendLine(); foreach (var item in UpgradeServiceVM.membershipListTwo) { if (item.CheckedStatus == true) { //Inserting Values Also in upgradeServiceL Tabale var NewService = new UpgradeService(); sb.Append(item.MembershipType + ", ").AppendLine(); NewService.MembershipId = item.MembershipId; NewService.LoginId = UpgradeServiceVM.LoginId;//Id; NewService.Durations = UpgradeServiceVM.DurationId; NewService.AutoRenaval = UpgradeServiceVM.AutoRenavalId; NewService.CreatedById = 1; NewService.InactiveFlag = "N"; NewService.CreatedOnDate = DateTime.Now; NewService.ModifiedById = 1; NewService.ModifiedOnDate = DateTime.Now; upgradeSerciceRepo.InsertSrvice(NewService); upgradeSerciceRepo.Save(); //Inserting Values Also in upgradeServiceLog History Tabale //var NewSerLog = new UpgradeServiceLog(); UpgradeServiceLog NewSerLog = new UpgradeServiceLog(); NewSerLog.MembershipId = item.MembershipId; NewSerLog.LoginId = UpgradeServiceVM.LoginId; //Id; NewSerLog.Durations = UpgradeServiceVM.DurationId; NewSerLog.AutoRenaval = UpgradeServiceVM.AutoRenavalId; NewSerLog.CreatedById = 1; NewSerLog.InactiveFlag = "N"; NewSerLog.CreatedOnDate = DateTime.Now; NewSerLog.ModifiedById = 1; NewSerLog.ModifiedOnDate = DateTime.Now; upgradeSerciceRepo.InsertServiceLog(NewSerLog); upgradeSerciceRepo.Save(); ViewBag.Message = "Record Successfully Added .."; } } ViewBag.MembershipTwo = sb.ToString(); ViewBag.Message = "Record Successfully Added .."; } } catch (Exception) { //ModelState.AddModelError(string.Empty, "Unable to save changes. Try again, and if the problem persists contact your system administrator."); } return(RedirectToAction("Create")); }