public JsonResult TacticCampaignList(int?subCampaignId) { DropDownResponse dropDownResponse = new DropDownResponse(); try { if (subCampaignId == null || subCampaignId <= 0) { dropDownResponse.List = _tacticCampaignServices.TacticCampaignTable().Where(x => !string.IsNullOrEmpty(x.Name)).Select(x => new DropDownValues { Id = x.Id, Value = x.Name }).ToList(); } else { dropDownResponse.List = _tacticCampaignServices.TacticCampaignTable().Where(x => x.ChildCampaigns.Id == subCampaignId && !string.IsNullOrEmpty(x.Name)).Select(x => new DropDownValues { Id = x.Id, Value = x.Name }).ToList(); } dropDownResponse.IsSuccess = true; } catch (Exception ex) { dropDownResponse.IsSuccess = false; dropDownResponse.Message = ex.Message; } return(Json(dropDownResponse, JsonRequestBehavior.AllowGet)); }
// GET: API public JsonResult MasterCampaignList(string key) { DropDownResponse dropDownResponse = new DropDownResponse(); try { if (string.IsNullOrEmpty(key)) { dropDownResponse.List = _masterCampaignServices.MasterCampaignTable().Where(x => !string.IsNullOrEmpty(x.Name)).Select(x => new DropDownValues { Id = x.Id, Value = x.Name }).ToList(); } else { dropDownResponse.List = _masterCampaignServices.MasterCampaignTable().Where(x => x.Name.Contains(key) && !string.IsNullOrEmpty(x.Name)).Select(x => new DropDownValues { Id = x.Id, Value = x.Name }).ToList(); } dropDownResponse.IsSuccess = true; } catch (Exception ex) { dropDownResponse.IsSuccess = false; dropDownResponse.Message = ex.Message; } return(Json(dropDownResponse, JsonRequestBehavior.AllowGet)); }
/// <summary> /// GetTCampaign /// </summary> /// <param name="MasterCampaignId"></param> /// <param name="ChildCampaignId"></param> /// <returns> /// It return Tactic campaign list /// </returns> /// <Written By> /// Faizan Ahmad /// </Written> public JsonResult GetTCampaign(string ChildCampaignId, string TacticId) { DropDownResponse dropDownResponse = new DropDownResponse(); try { if (string.IsNullOrEmpty(ChildCampaignId) && ChildCampaignId != "" && string.IsNullOrEmpty(TacticId) && TacticId != "") { dropDownResponse.List = _tacticCampaignServices.TacticCampaignTable().Where(x => !string.IsNullOrEmpty(x.Name)).Select(x => new DropDownValues { Id = x.Id, Value = x.Name }).ToList(); } else { if (ChildCampaignId == null || ChildCampaignId == "" || (IsNumeric(ChildCampaignId) == false)) { ChildCampaignId = null; } if (TacticId == null || TacticId == "" || (IsNumeric(TacticId) == false)) { TacticId = null; } dropDownResponse.List = _tacticCampaignServices.TacticCampaignTable().Where(x => (ChildCampaignId != null && (x.ChildCampaigns.Id == Convert.ToInt32(ChildCampaignId) && !string.IsNullOrEmpty(x.Name))) || (TacticId != null && (x.Id == Convert.ToInt32(TacticId) && !string.IsNullOrEmpty(x.Name)))).Select(x => new DropDownValues { Id = x.Id, Value = x.Name }).ToList(); } dropDownResponse.IsSuccess = true; } catch (Exception ex) { dropDownResponse.IsSuccess = false; dropDownResponse.Message = ex.Message; } return(Json(dropDownResponse, JsonRequestBehavior.AllowGet)); }
public DropDownResponse GetPlantList() { DropDownResponse response = new DropDownResponse(); try { var list = new EntityCall.MasterRepository(_Companyinformation).GetPlantList(); if (list != null) { string str = Newtonsoft.Json.JsonConvert.SerializeObject(list); response.Data = Newtonsoft.Json.JsonConvert.DeserializeObject <List <DropDownValue> >(str); } else { throw new Exception("No Data Available in Place List"); } } catch (Exception ex) { //var errorRequest = "authenticatedCustomerId:" + customerId; //response = Response.Failed(response, ex, errorRequest, MethodBase.GetCurrentMethod().Name, _companyinfo.PrivateConnectionString, _companyinfo.CompanyID); } return(response); }
/// <summary> /// Get MCampaign /// </summary> /// <param name="BusinessGroupId"></param> /// <param name="MasterCampaignId"></param> /// <param name="SegmentId"></param> /// <returns></returns> /// <Written By> /// Faizan Ahmad /// </Written> public JsonResult GetMCampaign(string BusinessGroupId, string MasterCampaignId, string SegmentId) { DropDownResponse dropDownResponse = new DropDownResponse(); try { if (string.IsNullOrEmpty(BusinessGroupId) && BusinessGroupId != "" && string.IsNullOrEmpty(MasterCampaignId) && MasterCampaignId != "" && string.IsNullOrEmpty(SegmentId) && SegmentId != "") { dropDownResponse.List = _masterCampaignServices.MasterCampaignTable().Where(x => !string.IsNullOrEmpty(x.Name)).Select(x => new DropDownValues { Id = x.Id, Value = x.Name }).ToList(); } else { if (BusinessGroupId == null || BusinessGroupId == "" || (IsNumeric(BusinessGroupId) == false)) { BusinessGroupId = null; } if (MasterCampaignId == null || MasterCampaignId == "" || (IsNumeric(MasterCampaignId) == false)) { MasterCampaignId = null; } if (SegmentId == null || SegmentId == "" || (IsNumeric(SegmentId) == false)) { SegmentId = null; } dropDownResponse.List = _masterCampaignServices.GetMasterCampaignForApi(). Where(x => ((BusinessGroupId != null && x.BusinessGroups.Any(y => y.Id == Convert.ToInt32(BusinessGroupId))) && ((MasterCampaignId != null && x.Id.Equals(MasterCampaignId)) || (SegmentId != null && x.Segments.Any(s => s.Id == Convert.ToInt32(SegmentId))))) || ((BusinessGroupId != null && x.BusinessGroups.Any(y => y.Id == Convert.ToInt32(BusinessGroupId))) || (MasterCampaignId != null && x.Id.Equals(MasterCampaignId)) || (SegmentId != null && x.Segments.Any(s => s.Id == Convert.ToInt32(SegmentId)))) ) .Select(x => new DropDownValues { Id = x.Id, Value = x.Name }).ToList(); } dropDownResponse.IsSuccess = true; } catch (Exception ex) { dropDownResponse.IsSuccess = false; dropDownResponse.Message = ex.Message; } return(Json(dropDownResponse, JsonRequestBehavior.AllowGet)); }
public DropDownResponse GetPlantList() { DropDownResponse response = new DropDownResponse(); try { response = _requestManager.Master.GetPlantList(); } catch (Exception ex) { Request.CreateErrorResponse(HttpStatusCode.NotFound, "No Plant found"); } return(response); }
public DropDownResponse FixedLandPermissionTypesList([FromUri] int?EmitraServiceID) { DropDownResponse response = new DropDownResponse(); try { response = _requestManager.Master.GetFixedLandPermissionTypesList(EmitraServiceID); } catch (Exception ex) { Request.CreateErrorResponse(HttpStatusCode.NotFound, "No Place found"); } return(response); }
public JsonResult CompleteAfterEndDatePass() { DropDownResponse dropDownResponse = new DropDownResponse(); try { _tacticCampaignServices.CompleteAfterEndDatePass(); dropDownResponse.IsSuccess = true; } catch (Exception ex) { dropDownResponse.IsSuccess = false; dropDownResponse.Message = ex.Message; } return(Json(dropDownResponse, JsonRequestBehavior.AllowGet)); }
public JsonResult DeleteLastyearVisited() { DropDownResponse dropDownResponse = new DropDownResponse(); try { _tacticCampaignServices.DeleteLastyearVisited(); _childCampaignServices.DeleteLastyearVisited(); _masterCampaignServices.DeleteLastyearVisited(); } catch (Exception ex) { dropDownResponse.IsSuccess = false; dropDownResponse.Message = ex.Message; } return(Json(dropDownResponse, JsonRequestBehavior.AllowGet)); }
/// <summary> /// Industry List /// </summary> /// <returns> /// It returns complete Industry List /// </returns> /// <written by> /// Faizan Ahmad /// </written> public JsonResult GetIndustryList() { DropDownResponse dropDownResponse = new DropDownResponse(); try { dropDownResponse.List = _industryServices.IndustryTable().Where(x => !string.IsNullOrEmpty(x.Name)).Select(x => new DropDownValues { Id = x.Id, Value = x.Name }).ToList(); dropDownResponse.IsSuccess = true; } catch (Exception ex) { dropDownResponse.IsSuccess = false; dropDownResponse.Message = ex.Message; } return(Json(dropDownResponse, JsonRequestBehavior.AllowGet)); }
public DropDownResponse FixedLandPermissionTypesList(int?EmitraServiceID) { DropDownResponse model = new DropDownResponse(); using (HttpClient httpClient = new HttpClient()) { httpClient.BaseAddress = new Uri(baseAddress); //httpClient1.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("bearer", token.AccessToken); //httpClient.DefaultRequestHeaders.Add("Authorization", String.Format("Bearer {0}", token.AccessToken)); httpClient.DefaultRequestHeaders.Add("Referer", "http://localhost:1843"); HttpResponseMessage response = httpClient.GetAsync("api/Master/FixedLandPermissionTypesList?EmitraServiceID" + EmitraServiceID).Result; if (response.IsSuccessStatusCode) { string str = response.Content.ReadAsStringAsync().Result; model = Newtonsoft.Json.JsonConvert.DeserializeObject <DropDownResponse>(str); } } return(model); }