Example #1
0
        public ResponseModel GetStoreTimeSlotMasterList(int StoreID = 0)
        {
            ResponseModel objResponseModel = new ResponseModel();
            int           statusCode       = 0;
            List <StoreTimeSlotMasterModel> TimeSlotList = new List <StoreTimeSlotMasterModel>();
            string statusMessage = "";

            try
            {
                string       token        = Convert.ToString(Request.Headers["X-Authorized-Token"]);
                Authenticate authenticate = new Authenticate();
                authenticate = SecurityService.GetAuthenticateDataFromToken(_radisCacheServerAddress, SecurityService.DecryptStringAES(token));

                AppointmentCaller newAppointment = new AppointmentCaller();

                TimeSlotList = newAppointment.GetStoreTimeSlotMasterList(new AppointmentServices(_connectioSting), authenticate.TenantId, authenticate.ProgramCode, StoreID);

                statusCode = TimeSlotList.Count.Equals(0) ? (int)EnumMaster.StatusCode.RecordNotFound : (int)EnumMaster.StatusCode.Success;

                statusMessage = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)statusCode);


                objResponseModel.Status       = true;
                objResponseModel.StatusCode   = statusCode;
                objResponseModel.Message      = statusMessage;
                objResponseModel.ResponseData = TimeSlotList;
            }
            catch (Exception)
            {
                throw;
            }
            return(objResponseModel);
        }
Example #2
0
        public ResponseModel DeleteTimeSlotMaster(int SlotID)
        {
            List <AlreadyScheduleDetail> alreadyScheduleDetails = new List <AlreadyScheduleDetail>();
            ResponseModel objResponseModel = new ResponseModel();
            int           statusCode = 0; int ResultCount = 0;
            string        statusMessage = "";

            try
            {
                string       token        = Convert.ToString(Request.Headers["X-Authorized-Token"]);
                Authenticate authenticate = new Authenticate();
                authenticate = SecurityService.GetAuthenticateDataFromToken(_radisCacheServerAddress, SecurityService.DecryptStringAES(token));

                AppointmentCaller newAppointment = new AppointmentCaller();

                ResultCount = newAppointment.DeleteTimeSlotMaster(new AppointmentServices(_connectioSting), SlotID, authenticate.TenantId);

                statusCode = ResultCount.Equals(0) ? (int)EnumMaster.StatusCode.RecordNotFound : (int)EnumMaster.StatusCode.Success;

                statusMessage = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)statusCode);


                objResponseModel.Status       = true;
                objResponseModel.StatusCode   = statusCode;
                objResponseModel.Message      = statusMessage;
                objResponseModel.ResponseData = ResultCount;
            }
            catch (Exception)
            {
                throw;
            }
            return(objResponseModel);
        }
Example #3
0
        public ResponseModel UpdateAppointmentStatus([FromBody] AppointmentCustomer appointment)
        {
            AppointmentCaller newAppointment   = new AppointmentCaller();
            ResponseModel     objResponseModel = new ResponseModel();
            int    StatusCode    = 0;
            string statusMessage = "";

            try
            {
                string       token        = Convert.ToString(Request.Headers["X-Authorized-Token"]);
                Authenticate authenticate = new Authenticate();
                authenticate = SecurityService.GetAuthenticateDataFromToken(_radisCacheServerAddress, SecurityService.DecryptStringAES(token));

                int result = newAppointment.updateAppoinment(new AppointmentServices(_connectioSting), appointment, authenticate.TenantId);
                StatusCode =
                    result == 0 ?
                    (int)EnumMaster.StatusCode.RecordNotFound : (int)EnumMaster.StatusCode.Success;
                statusMessage               = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)StatusCode);
                objResponseModel.Status     = true;
                objResponseModel.StatusCode = StatusCode;
                objResponseModel.Message    = statusMessage;
            }
            catch (Exception)
            {
                throw;
            }
            return(objResponseModel);
        }
        /// <summary>
        /// Uses date to fetch all appointment-times for that date/practitioner using the API/AppointmentCaller.
        /// Also there is a client side validation of the date selected.
        /// </summary>
        /// <param name="date">Find all appointment times on this date</param>
        /// <returns></returns>
        public ActionResult ChooseAppointmentTime(DateTime date)
        {
            DateTime currentDate = new DateTime();

            if (date < currentDate || date.DayOfWeek == DayOfWeek.Saturday || date.DayOfWeek == DayOfWeek.Sunday)
            {
                TempData["ErrorMessage"] = "Du skal vælge en date der er valid og vi holder ikke åben i weekenden!";
                return(View());
            }
            AppointmentCaller appointmentCaller = new AppointmentCaller();
            var appointments = appointmentCaller.GetByDate(date, Session["PractitionerId"] as string);

            ViewBag.SelectedDate = date.ToShortDateString();
            return(View(appointments));
        }
        /// <summary>
        /// BookTime takes the two datetime objects and uses the API to book a time for the selected date, practitioner and time span selected.
        /// Concurrency issues throws exception with suitable response message. The 'ChoseAppointmentTime'-view is shown with the error message.
        /// </summary>
        /// <param name="startDateTime">aka apointment start time</param>
        /// <param name="endDateTime">aka apointment end time</param>
        /// <returns>The new appoinment is passed to the view if successfull</returns>
        public ActionResult BookTime(DateTime startDateTime, DateTime endDateTime)
        {
            Appointment a = new Appointment();

            a.Enddate   = endDateTime;
            a.Startdate = startDateTime;

            a.Customer     = Session["UserId"] as string;
            a.Practitioner = Session["PractitionerId"] as string;
            AppointmentCaller ac = new AppointmentCaller();

            try
            {
                ac.BookTime(a);
            }
            catch (Exception e)
            {
                TempData["ErrorMessage"] = e.Message;
                return(RedirectToAction("ChooseAppointmentTime", startDateTime.Date));
            }
            return(View(a));;
        }
        public ResponseModel GetStoreDetailsByStoreCode(string storeCode)
        {
            StoreDetails  storeDetails     = new StoreDetails();
            ResponseModel objResponseModel = new ResponseModel();
            int           statusCode       = 0;
            string        statusMessage    = "";

            try
            {
                ////Get token (Double encrypted) and get the tenant id
                string       token        = Convert.ToString(Request.Headers["X-Authorized-Token"]);
                Authenticate authenticate = new Authenticate();
                authenticate = SecurityService.GetAuthenticateDataFromToken(_radisCacheServerAddress, SecurityService.DecryptStringAES(token));

                AppointmentCaller newAppointment = new AppointmentCaller();

                storeDetails = newAppointment.GetStoreDetailsByStoreCode(new AppointmentServices(_connectioSting), authenticate.TenantId, authenticate.UserMasterID, authenticate.ProgramCode, storeCode);

                statusCode =
                    string.IsNullOrEmpty(storeDetails.StoreName) ?
                    (int)EnumMaster.StatusCode.RecordNotFound : (int)EnumMaster.StatusCode.Success;

                statusMessage = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)statusCode);

                objResponseModel.Status       = true;
                objResponseModel.StatusCode   = statusCode;
                objResponseModel.Message      = statusMessage;
                objResponseModel.ResponseData = storeDetails;
            }
            catch (Exception)
            {
                throw;
            }

            return(objResponseModel);
        }
Example #7
0
        public ResponseModel GetAppointmentCount()
        {
            List <AppointmentCount> objAppointmentCount = new List <AppointmentCount>();
            ResponseModel           objResponseModel    = new ResponseModel();
            int    statusCode    = 0;
            string statusMessage = "";

            try
            {
                ////Get token (Double encrypted) and get the tenant id
                string       token        = Convert.ToString(Request.Headers["X-Authorized-Token"]);
                Authenticate authenticate = new Authenticate();
                authenticate = SecurityService.GetAuthenticateDataFromToken(_radisCacheServerAddress, SecurityService.DecryptStringAES(token));

                AppointmentCaller newAppointment = new AppointmentCaller();

                objAppointmentCount = newAppointment.GetAppointmentCountList(new AppointmentServices(_connectioSting), authenticate.TenantId, authenticate.UserMasterID);

                statusCode =
                    objAppointmentCount.Count == 0 ?
                    (int)EnumMaster.StatusCode.RecordNotFound : (int)EnumMaster.StatusCode.Success;

                statusMessage = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)statusCode);

                objResponseModel.Status       = true;
                objResponseModel.StatusCode   = statusCode;
                objResponseModel.Message      = statusMessage;
                objResponseModel.ResponseData = objAppointmentCount;
            }
            catch (Exception)
            {
                throw;
            }

            return(objResponseModel);
        }