public ActionResult GetCalendarData() { List <AppointmentsItem> lstAppData = new List <AppointmentsItem>(); AppointmentsItem objAppoint = new AppointmentsItem(); AppointmentService objAppService = new AppointmentService(); int cid = 0; if (Session["CompID"] != null) { cid = Convert.ToInt32(Session["CompID"].ToString()); } lstAppData = objAppService.getAppointmentData(cid); var eventList = from e in lstAppData select new { id = e.ID, title = e.Subject, start = e.StDt.Value.ToString("yyyy-MM-dd") + " " + e.StTime, end = e.EndDt.Value.ToString("yyyy-MM-dd") + " " + e.EndTime }; var rows = eventList.ToArray(); return(Json(rows, JsonRequestBehavior.AllowGet)); }
public ActionResult View(int id) { AppointmentService objAppointService = new AppointmentService(); AppointmentsItem objAItem = new AppointmentsItem(); objAItem = objAppointService.GetById(id); //Session["Empid"] = objPassItem.EmpId; List <AppointmentsItem> lstAppoint = new List <AppointmentsItem>(); objAItem.ListAppointment = new List <AppointmentsItem>(); objAItem.ListAppointment.AddRange(lstAppoint); ViewBag.Menuid = Request.QueryString["menuId"]; SponsorService objService = new SponsorService(); List <CompanyItem> lstCompany = new List <CompanyItem>(); lstCompany = objService.GetCompany(); objAItem.ListCompany = new List <CompanyItem>(); objAItem.ListCompany.AddRange(lstCompany); VehicleMasterService objVehicle = new VehicleMasterService(); #region Bind DropDown Branch List <BranchItem> lstBranch = new List <BranchItem>(); lstBranch = objVehicle.GetBranch(); objAItem.ListBranch = new List <BranchItem>(); objAItem.ListBranch.AddRange(lstBranch); #endregion return(View(objAItem)); }
public AppointmentsItem GetById(int id) { Mapper.CreateMap <AppointmentsMaster, AppointmentsItem>(); AppointmentsMaster objAppoint = DbContext.AppointmentsMasters.SingleOrDefault(m => m.ID == id); AppointmentsItem objAppointItem = Mapper.Map <AppointmentsItem>(objAppoint); return(objAppointItem); }
public int Update(AppointmentsItem model) { Mapper.CreateMap <AppointmentsItem, AppointmentsMaster>(); AppointmentsMaster objAppoint = DbContext.AppointmentsMasters.SingleOrDefault(m => m.ID == model.ID); objAppoint = Mapper.Map(model, objAppoint); return(DbContext.SaveChanges()); }
public ActionResult Edit(AppointmentsItem model) { // int Empid = Convert.ToInt32(Url.RequestContext.RouteData.Values["id"].ToString()); //model.EmpID = Empid; AppointmentService objAppoint = new AppointmentService(); objAppoint.Update(model); return(RedirectToAction("Create", new { @menuId = model.Viewbagidformenu })); }
public int Insert(AppointmentsItem model) { try { Mapper.CreateMap <AppointmentsItem, AppointmentsMaster>(); AppointmentsMaster objAppoint = Mapper.Map <AppointmentsMaster>(model); DbContext.AppointmentsMasters.Add(objAppoint); return(DbContext.SaveChanges()); } catch (Exception ex) { throw; } }
public ActionResult Create(AppointmentsItem model) { AppointmentService objAppoint = new AppointmentService(); int cid = 0; if (Session["CompID"] != null) { cid = Convert.ToInt32(Session["CompID"].ToString()); } if (model.CompID == null) { model.CompID = cid; } objAppoint.Insert(model); return(RedirectToAction("Create", new { @menuId = model.Viewbagidformenu })); }
public ActionResult delete(int id, int menuid) { try { //int Empid = Convert.ToInt32(Url.RequestContext.RouteData.Values["id"].ToString()); AppointmentService objService = new AppointmentService(); AppointmentsItem objDoc = new AppointmentsItem(); objDoc = objService.GetById(id); db.AppointmentsMasters.Remove(db.AppointmentsMasters.Find(id)); db.SaveChanges(); //ViewBag.Empid = Empid; ViewBag.Menuid = Request.QueryString["menuId"]; } catch (Exception ex) { //ViewBag.ErrorMsg = "First Delete This Tenancy No's All Documents. "; return(View("Error")); } return(RedirectToAction("Create", new { @id = id, @menuId = Request.QueryString["menuId"] })); }
public ActionResult Create() { List <AppointmentsItem> lstAppoint = new List <AppointmentsItem>(); AppointmentService objAppoint = new AppointmentService(); int cid = 0; if (Session["CompID"] != null) { cid = Convert.ToInt32(Session["CompID"].ToString()); } lstAppoint = objAppoint.getAppointmentData(cid); AppointmentsItem objAppointItem = new AppointmentsItem(); objAppointItem.ListAppointment = new List <AppointmentsItem>(); objAppointItem.ListAppointment.AddRange(lstAppoint); ViewBag.Menuid = Request.QueryString["menuId"]; SponsorService objService = new SponsorService(); List <CompanyItem> lstCompany = new List <CompanyItem>(); lstCompany = objService.GetCompany(); objAppointItem.ListCompany = new List <CompanyItem>(); objAppointItem.ListCompany.AddRange(lstCompany); VehicleMasterService objVehicle = new VehicleMasterService(); #region Bind DropDown Branch List <BranchItem> lstBranch = new List <BranchItem>(); lstBranch = objVehicle.GetBranch(); objAppointItem.ListBranch = new List <BranchItem>(); objAppointItem.ListBranch.AddRange(lstBranch); #endregion return(View(objAppointItem)); }