public JsonResult GetOfficeDetailsByEntity(string entityId) { //string apiUrl = (TempData.Peek("ConfigData") as IDictionary<string, string>)?.FirstOrDefault(x => x.Key == Constants.GetOfficeDetailsByEntity).Value + entityId; string apiUrl = ConfigReader.ReadDatafromConfig(Constants.GetOfficeDetailsByEntity) + entityId; List <OfficeDetailsModel> model = null; try { var result = CommonApiClient.CallWebApiServiceAsync(apiUrl, Request.HttpMethod); if (!String.IsNullOrEmpty(result.Result)) { model = JsonConvert.DeserializeObject <List <OfficeDetailsModel> >(result.Result); } if (UserSecurity.UserType == "Corporate") { return(Json(model, JsonRequestBehavior.AllowGet)); } List <string> lstOffice = UserSecurity.Offices; if (model != null && model.Count > 0 && lstOffice != null && lstOffice.Count > 0) { model = model.Where(x => lstOffice.Contains(x.OfficeId)) != null?model.Where(x => lstOffice.Contains(x.OfficeId)).ToList() : new List <OfficeDetailsModel>(); } else { model = new List <OfficeDetailsModel>(); } } catch (Exception ex) { LogProvider.ErrorFormat("Controller:{0} Error: {1}", "OfficeDetailsController.GetOfficeDetailsByEntity", ex.ToString()); } return(JsonResult(model, JsonRequestBehavior.AllowGet)); }
public JsonResult GetAuxBusinessServiceAndOfficeConfigAndAppointmentsbyOfficeId(string officeId, string statusIds, string startDate, string endDate) { List <object> lstObject = new List <object>(); List <KeyValuePair <string, string> > lstUrl = new List <KeyValuePair <string, string> >(); try { //Fetch the office operation hours. lstUrl.Add(new KeyValuePair <string, string>(Constants.GetOfficeOperationHoursByOfficeId, ConfigReader.ReadDatafromConfig(Constants.GetOfficeOperationHoursByOfficeId) + officeId)); //Fetch Axu business service. lstUrl.Add(new KeyValuePair <string, string>(Constants.GetAuxBusinessServicesByOfficeId, ConfigReader.ReadDatafromConfig(Constants.GetAuxBusinessServicesByOfficeId) + officeId)); //Fetch appointment details. startDate = Convert.ToDateTime(startDate).ToString("MM-dd-yyyy"); endDate = Convert.ToDateTime(endDate).ToString("MM-dd-yyyy"); lstUrl.Add(new KeyValuePair <string, string>(Constants.GetAppointmentByStatus, ConfigReader.ReadDatafromConfig(Constants.GetAppointmentByStatus) + officeId + "/" + statusIds + "/" + startDate + "/" + endDate)); //Iterate for each urls. foreach (KeyValuePair <string, string> apiUrl in lstUrl) { //Call Web api. var result = CommonApiClient.CallWebApiServiceAsync(apiUrl.Value, Request.HttpMethod); if (!String.IsNullOrEmpty(result.Result)) { switch (apiUrl.Key) { case Constants.GetOfficeOperationHoursByOfficeId: { lstObject.Add(JsonConvert.DeserializeObject <List <OfficeOperationHoursModel> >(result.Result)); break; } case Constants.GetAuxBusinessServicesByOfficeId: { lstObject.Add(JsonConvert.DeserializeObject <List <AuxBusinessServiceModel> >(result.Result)); break; } case Constants.GetAppointmentByStatus: { lstObject.Add(JsonConvert.DeserializeObject <CalendarAppointmentModel>(result.Result)); break; } } } } } catch (Exception ex) { LogProvider.ErrorFormat("Controller:{0} Error: {1}", "OfficeDetailsController.GetAuxBusinessServiceAndOfficeConfigAndAppointmentsbyOfficeId", ex.ToString()); } //Merge the response and return response. return(JsonResult(lstObject, JsonRequestBehavior.AllowGet)); }
public JsonResult GetDayAndWeekAppointmentCount(string officeId, string currentDate, string startdate, string enddate) { List <DashboardServiceModel> model = new List <DashboardServiceModel>(); List <KeyValuePair <string, string> > lstUrl = new List <KeyValuePair <string, string> >(); try { //Url for week appointment count //lstUrl.Add(new KeyValuePair<string, string>("week", (TempData.Peek("ConfigData") as IDictionary<string, string>)?.FirstOrDefault(x => x.Key == Constants.GetDashboardMetricsByOfficeId).Value + officeId + "/week?startdate=" + startdate + "&enddate=" + enddate)); lstUrl.Add(new KeyValuePair <string, string>("week", ConfigReader.ReadDatafromConfig(Constants.GetDashboardMetricsByOfficeId) + officeId + "/week?startdate=" + startdate + "&enddate=" + enddate)); //url for day appoiment count. //lstUrl.Add(new KeyValuePair<string, string>("day", (TempData.Peek("ConfigData") as IDictionary<string, string>)?.FirstOrDefault(x => x.Key == Constants.GetDashboardMetricsByOfficeId).Value + officeId + "/day?startdate=" + currentDate + "&enddate=" + currentDate)); lstUrl.Add(new KeyValuePair <string, string>("day", ConfigReader.ReadDatafromConfig(Constants.GetDashboardMetricsByOfficeId) + officeId + "/day?startdate=" + currentDate + "&enddate=" + currentDate)); foreach (KeyValuePair <string, string> strurl in lstUrl) { //call web api. var res = CommonApiClient.CallWebApiServiceAsync(strurl.Value, Request.HttpMethod); if (!String.IsNullOrEmpty(res.Result)) { List <DashboardServiceModel> resmodel = JsonConvert.DeserializeObject <List <DashboardServiceModel> >(res.Result); switch (strurl.Key) { case "day": { //Set ViewType as day for Todays appointment count. resmodel?.ForEach(x => x.ViewType = "day"); break; } case "week": { //Set ViewType as week for Week appointment count resmodel?.ForEach(x => x.ViewType = "week"); break; } } //Add Appointment count into the response object list. model.AddRange(resmodel); } } } catch (Exception ex) { LogProvider.ErrorFormat("Controller:{0} Error: {1}", "AppointmentDetailsController.GetDayAndWeekAppointmentCount", ex.ToString()); } return(JsonResult(model, JsonRequestBehavior.AllowGet)); }
public JsonResult GetEntities() { //string apiUrl = (TempData.Peek("ConfigData") as IDictionary<string, string>)?.FirstOrDefault(x => x.Key == Constants.GetEntityDetailsAsync).Value; string apiUrl = ConfigReader.ReadDatafromConfig(Constants.GetEntityDetailsAsync); List <EntityDetailsModel> entityDetailsModels = null; try { var result = CommonApiClient.CallWebApiServiceAsync(apiUrl, Request.HttpMethod); entityDetailsModels = result?.Result != null?JsonConvert.DeserializeObject <List <EntityDetailsModel> >(result.Result) : null; } catch (Exception ex) { LogProvider.ErrorFormat("Controller:{0} Error: {1}", "UserAuthController.GetEntities", ex.ToString()); } return(Json(entityDetailsModels, JsonRequestBehavior.AllowGet)); }
public JsonResult GetDashboardDetailsByOfficeId(string officeId, string dashboardType, string startdate, string enddate) { List <DashboardServiceModel> model = new List <DashboardServiceModel>(); string apiUrl = ""; if (string.IsNullOrEmpty(dashboardType)) { // apiUrl = (TempData.Peek("ConfigData") as IDictionary<string, string>)?.FirstOrDefault(x => x.Key == Constants.GetDashboardMetricsByOfficeId).Value + officeId + "/currentweek?startdate=" + startdate + "&enddate=" + enddate; apiUrl = ConfigReader.ReadDatafromConfig(Constants.GetDashboardMetricsByOfficeId) + officeId + "/currentweek?startdate=" + startdate + "&enddate=" + enddate; var res = CommonApiClient.CallWebApiServiceAsync(apiUrl, Request.HttpMethod); if (!String.IsNullOrEmpty(res.Result)) { model = JsonConvert.DeserializeObject <List <DashboardServiceModel> >(res.Result); } model?.ForEach(x => x.ViewType = "currentweek"); dashboardType = "today"; //apiUrl = (TempData.Peek("ConfigData") as IDictionary<string, string>)?.FirstOrDefault(x => x.Key == Constants.GetDashboardMetricsByOfficeId).Value + officeId + "/today?startdate=" + startdate + "&enddate=" + enddate; apiUrl = ConfigReader.ReadDatafromConfig(Constants.GetDashboardMetricsByOfficeId) + officeId + "/today?startdate=" + startdate + "&enddate=" + enddate; } else { //apiUrl = (TempData.Peek("ConfigData") as IDictionary<string, string>)?.FirstOrDefault(x => x.Key == Constants.GetDashboardMetricsByOfficeId).Value + officeId + "/" + dashboardType + "?startdate=" + startdate + "&enddate=" + enddate; apiUrl = ConfigReader.ReadDatafromConfig(Constants.GetDashboardMetricsByOfficeId) + officeId + "/" + dashboardType + "?startdate=" + startdate + "&enddate=" + enddate; } try { var result = CommonApiClient.CallWebApiServiceAsync(apiUrl, Request.HttpMethod); if (!String.IsNullOrEmpty(result.Result)) { List <DashboardServiceModel> resmodel = new List <DashboardServiceModel>(); resmodel = JsonConvert.DeserializeObject <List <DashboardServiceModel> >(result.Result); resmodel?.ForEach(x => x.ViewType = dashboardType); model?.AddRange(resmodel); } } catch (Exception ex) { LogProvider.ErrorFormat("Controller:{0} Error: {1}", "AppointmentDetailsController.GetDashboardDetailsByOfficeId", ex.ToString()); } return(JsonResult(model, JsonRequestBehavior.AllowGet)); }
public JsonResult GetDashBoardData(string durationType) { List <AuxBusinessServiceModel> model = null; // string apiUrl = (TempData.Peek("ConfigData") as IDictionary<string, string>)?.FirstOrDefault(x => x.Key == Constants.GetDashBoardData).Value + durationType; string apiUrl = ConfigReader.ReadDatafromConfig(Constants.GetDashBoardData) + durationType; try { var result = CommonApiClient.CallWebApiServiceAsync(apiUrl, Request.HttpMethod); if (!String.IsNullOrEmpty(result.Result)) { model = JsonConvert.DeserializeObject <List <AuxBusinessServiceModel> >(result.Result); } } catch (Exception ex) { LogProvider.ErrorFormat("Controller:{0} Error: {1}", "OfficeDetailsController.GetOfficeDetailsByEntity", ex.ToString()); } return(JsonResult(model, JsonRequestBehavior.AllowGet)); }
private List <OfficeDetailsModel> GetOfficeByentityId(string entityId) { List <OfficeDetailsModel> model = null; //string apiUrl = (TempData.Peek("ConfigData") as IDictionary<string, string>)?.FirstOrDefault(x => x.Key == Constants.GetOfficeDetailsByEntity).Value + entityId; string apiUrl = ConfigReader.ReadDatafromConfig(Constants.GetOfficeDetailsByEntity) + entityId; try { var result = CommonApiClient.CallWebApiServiceAsync(apiUrl, Request.HttpMethod); if (!String.IsNullOrEmpty(result.Result)) { model = JsonConvert.DeserializeObject <List <OfficeDetailsModel> >(result.Result); } } catch (Exception ex) { LogProvider.ErrorFormat("Controller:{0} Error: {1}", "UserAuthController.GetOfficeDetailsByEntity", ex.ToString()); } return(model); }
public JsonResult UpdateAppointmentDetails(CustomerAppointmentDetailsModel customerAppointmentDetailsModel) { //string apiUrl = (TempData.Peek("ConfigData") as IDictionary<string, string>)?.FirstOrDefault(x => x.Key == Constants.UpdateAppointmentStatus).Value; //string apiUrl = "api/AppointmentDetails/UpdateAppointmentStatus"; string apiUrl = ConfigReader.ReadDatafromConfig(Constants.UpdateAppointmentStatus); customerAppointmentDetailsModel.CreatedBy = UserSecurity.Name; customerAppointmentDetailsModel.UpdatedBy = UserSecurity.Name; customerAppointmentDetailsModel.CustomerDetails.CreatedBy = UserSecurity.Name; try { var result = CommonApiClient.CallWebApiServiceAsync(apiUrl, Request.HttpMethod, customerAppointmentDetailsModel); } catch (Exception ex) { LogProvider.ErrorFormat("Controller:{0} Error: {1}", "Appointment.UpdateAppointmentDetails", ex.ToString()); } return(JsonResult(customerAppointmentDetailsModel, JsonRequestBehavior.AllowGet)); }
public JsonResult GetOfficeDateTime(int timeZoneOffset, string stateCode = "") { OfficeTimeZoneInfo model = null; string apiUrl = ConfigReader.ReadDatafromConfig(Constants.GetOfficeDatetimeAndTimeZone) + timeZoneOffset + "/" + stateCode; try { var result = CommonApiClient.CallWebApiServiceAsync(apiUrl, Request.HttpMethod); if (!String.IsNullOrEmpty(result.Result)) { model = JsonConvert.DeserializeObject <OfficeTimeZoneInfo>(result.Result); } } catch (Exception ex) { LogProvider.ErrorFormat("Controller:{0} Error: {1}", "OfficeDetailsController.GetOfficeDateTime", ex.ToString()); } return(JsonResult(model, JsonRequestBehavior.AllowGet)); }
public JsonResult GetScheduledAndAvailableSlotsByOfficeId(string officeId, string date) { date = DateTime.Now.ToString("dddd, dd MMMM yyyy"); //string apiUrl = (TempData.Peek("ConfigData") as IDictionary<string, string>)?.FirstOrDefault(x => x.Key == Constants.GetScheduledAndAvailableSlotsByOfficeId).Value + officeId + "/" + date; string apiUrl = ConfigReader.ReadDatafromConfig(Constants.GetScheduledAndAvailableSlotsByOfficeId) + officeId + "/" + date; List <DashboardAppointmentSlots> model = null; try { var result = CommonApiClient.CallWebApiServiceAsync(apiUrl, Request.HttpMethod); if (!String.IsNullOrEmpty(result.Result)) { model = JsonConvert.DeserializeObject <List <DashboardAppointmentSlots> >(result.Result); } } catch (Exception ex) { LogProvider.ErrorFormat("Controller:{0} Error: {1}", "DashboardController.DashboardAppointmentSlots", ex.ToString()); } return(JsonResult(model, JsonRequestBehavior.AllowGet)); }
public JsonResult GetAppointmentByStatus(string officeId, string statusIds, string startDate, string endDate) { startDate = Convert.ToDateTime(startDate).ToString("MM-dd-yyyy"); endDate = Convert.ToDateTime(endDate).ToString("MM-dd-yyyy"); CalendarAppointmentModel model = null; //string apiUrl = (TempData.Peek("ConfigData") as IDictionary<string, string>)?.FirstOrDefault(x => x.Key == Constants.GetAppointmentByStatus).Value + officeId + "/" + statusIds + "/" + startDate + "/" + endDate; string apiUrl = ConfigReader.ReadDatafromConfig(Constants.GetAppointmentByStatus) + officeId + "/" + statusIds + "/" + startDate + "/" + endDate; try { var result = CommonApiClient.CallWebApiServiceAsync(apiUrl, Request.HttpMethod); if (!String.IsNullOrEmpty(result.Result)) { model = JsonConvert.DeserializeObject <CalendarAppointmentModel>(result.Result); } } catch (Exception ex) { LogProvider.ErrorFormat("Controller:{0} Error: {1}", "AppointmentDetailsController.GetAppointmentByStatus", ex.ToString()); } return(JsonResult(model, JsonRequestBehavior.AllowGet)); }
public JsonResult UpdateOfficeConfigurationHoursDetails(List <OfficeOperationHoursModel> OfficeOperationHoursData) { // string apiUrl = (TempData.Peek("ConfigData") as IDictionary<string, string>)?.FirstOrDefault(x => x.Key == Constants.UpdateOfficeOperationHours).Value; string apiUrl = ConfigReader.ReadDatafromConfig(Constants.UpdateOfficeOperationHours); // string apiUrl = "api/OfficeDetails/UpdateOfficeOperationHours"; OfficeOperationHoursData?.ForEach(OfficeoperationHoursConfig => { OfficeoperationHoursConfig.CreatedBy = UserSecurity.Name; OfficeoperationHoursConfig.UpdatedBy = UserSecurity.Name; }); try { var result = CommonApiClient.CallWebApiServiceAsync(apiUrl, Request.HttpMethod, OfficeOperationHoursData); } catch (Exception ex) { LogProvider.ErrorFormat("Controller:{0} Error: {1}", "OfficeDetailsController.UpdateOfficeConfigurationHoursDetails", ex.ToString()); } return(JsonResult(OfficeOperationHoursData, JsonRequestBehavior.AllowGet)); }