public List <API.LABURNUM.COM.Class> GetClassByAdvanceSearch(DTO.LABURNUM.COM.ClassModel model) { IQueryable <API.LABURNUM.COM.Class> iQuery = null; if (model.ClassId > 0) { iQuery = this._laburnum.Classes.Where(x => x.ClassId == model.ClassId && x.IsActive == true); } if (iQuery != null) { if (model.ClassName != null) { iQuery = iQuery.Where(x => x.ClassName.Trim().ToLower().Equals(model.ClassName.Trim().ToLower()) && x.IsActive == true); } } else { if (model.ClassName != null) { iQuery = this._laburnum.Classes.Where(x => x.ClassName.Trim().ToLower().Equals(model.ClassName.Trim().ToLower()) && x.IsActive == true); } } List <API.LABURNUM.COM.Class> dbClasses = iQuery.ToList(); return(dbClasses); }
public void UpdateStatus(DTO.LABURNUM.COM.ClassModel model) { if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password)) { new FrontEndApi.ClassApi().UpdateIsActive(model); } }
public dynamic SearchClassById(DTO.LABURNUM.COM.ClassModel model) { if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password)) { if (model.ClassId <= 0) { return(GetApiResponseModel("Class Id Cannnot be null.", true, null)); } List <DTO.LABURNUM.COM.ClassModel> dbClasses = new ClassHelper(new FrontEndApi.ClassApi().GetClassByAdvanceSearch(model)).Map(); if (dbClasses.Count == 0) { return(GetApiResponseModel("No Record Found For Given Class Id", true, null)); } if (dbClasses.Count > 1) { return(GetApiResponseModel("More Than One Record Please Contact Administrator", true, null)); } return(GetApiResponseModel("Successfully Performed.", true, dbClasses[0])); } else { return(GetApiResponseModel("Api Access User Name or Password Invalid.", false, null)); } }
public string GetErrorView() { DTO.LABURNUM.COM.ClassModel model = new DTO.LABURNUM.COM.ClassModel(); ControllerContext cont = new ControllerContext(); string html = new LABURNUM.COM.Component.HtmlHelper().RenderViewToString(cont, "~/Views/Error404.cshtml", model); return(html); }
public long Add(DTO.LABURNUM.COM.ClassModel model) { if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password)) { return(new FrontEndApi.ClassApi().Add(model)); } else { return(-1); } }
public List <DTO.LABURNUM.COM.ClassModel> SearchClassByAdvanceSearch(DTO.LABURNUM.COM.ClassModel model) { if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password)) { return(new ClassHelper(new FrontEndApi.ClassApi().GetClassByAdvanceSearch(model)).Map()); } else { return(null); } }
private long AddClass(DTO.LABURNUM.COM.ClassModel model) { API.LABURNUM.COM.Class apiclass = new Class() { ClassName = model.ClassName, CreatedOn = System.DateTime.Now, IsActive = true }; this._laburnum.Classes.Add(apiclass); this._laburnum.SaveChanges(); return(apiclass.ClassId); }
private DTO.LABURNUM.COM.ClassModel MapCore(API.LABURNUM.COM.Class apiclass) { DTO.LABURNUM.COM.ClassModel dtoClass = new DTO.LABURNUM.COM.ClassModel() { ClassId = apiclass.ClassId, ClassName = apiclass.ClassName, CreatedOn = apiclass.CreatedOn, IsActive = apiclass.IsActive, LastUpdated = apiclass.LastUpdated }; return(dtoClass); }
public dynamic SearchAllClasses(DTO.LABURNUM.COM.ClassModel model) { if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password)) { List <DTO.LABURNUM.COM.ClassModel> dbClasses = new ClassHelper(new FrontEndApi.ClassApi().GetActiveClass()).Map(); return(GetApiResponseModel("Successfully Performed.", true, dbClasses)); } else { return(GetApiResponseModel("Api Access User Name or Password Invalid.", false, null)); } }
private long AddClass(DTO.LABURNUM.COM.ClassModel model) { API.LABURNUM.COM.Class apiclass = new Class() { ClassName = model.ClassName, CreatedOn = new Component.Utility().GetISTDateTime(), IsActive = true }; this._laburnum.Classes.Add(apiclass); this._laburnum.SaveChanges(); return(apiclass.ClassId); }
public ActionResult SeachClassByAdvanceSearch(DTO.LABURNUM.COM.ClassModel model) { try { List <DTO.LABURNUM.COM.ClassModel> dbClassList = new LABURNUM.COM.Component.Class().GetClassesByAdvanceSearch(model); string html = new LABURNUM.COM.Component.HtmlHelper().RenderViewToString(this.ControllerContext, "~/Views/SeachClassByAdvanceSearch/Search.cshtml", dbClassList); return(Json(new { code = 0, message = "success", result = html })); } catch (Exception) { //string html = new LABURNUM.COM.Component.HtmlHelper().RenderViewToString(this.ControllerContext, "~/Views/SeachClassByAdvanceSearch/Search.cshtml", dbClassList); return(Json(new { code = -2, message = "failed" })); } }
public ActionResult StatusUpdateAlert(long id, bool cIsActive) { try { DTO.LABURNUM.COM.ClassModel model = new DTO.LABURNUM.COM.ClassModel() { ClassId = id, IsActive = cIsActive }; string html = new LABURNUM.COM.Component.HtmlHelper().RenderViewToString(this.ControllerContext, "~/Views/AjaxRequest/StatusUpdateAlert.cshtml", model); return(Json(new { code = 0, message = "success", result = html })); } catch (Exception) { return(Json(new { code = -1, message = "failed", result = new LABURNUM.COM.Component.Common().GetErrorView() })); } }
public ActionResult EditClassPopup(long id) { DTO.LABURNUM.COM.ClassModel model = new DTO.LABURNUM.COM.ClassModel(); string html; try { model = new LABURNUM.COM.Component.Class().GetClassByClassId(id); html = new LABURNUM.COM.Component.HtmlHelper().RenderViewToString(this.ControllerContext, "~/Views/AjaxRequest/EditClassPopup.cshtml", model); return(Json(new { code = 0, message = "success", result = html })); } catch (Exception) { html = new LABURNUM.COM.Component.HtmlHelper().RenderViewToString(this.ControllerContext, "~/Views/Error404.cshtml", model); return(Json(new { code = -1, message = "failed", result = html })); } }
private DTO.LABURNUM.COM.ClassModel MapCore(API.LABURNUM.COM.Class apiclass) { DTO.LABURNUM.COM.ClassModel dtoClass = new DTO.LABURNUM.COM.ClassModel() { ClassId = apiclass.ClassId, ClassName = apiclass.ClassName, CreatedOn = apiclass.CreatedOn, IsActive = apiclass.IsActive, LastUpdated = apiclass.LastUpdated }; dtoClass.Sections = new SectionHelper(new FrontEndApi.SectionApi().GetSectionByAdvanceSearch(new DTO.LABURNUM.COM.SectionModel() { ClassId = apiclass.ClassId })).Map(); dtoClass.EncryptId = new API.LABURNUM.COM.Component.Crypto().EncryptStringAES(Convert.ToString(apiclass.ClassId), LABURNUM.COM.Component.Constants.KEYS.SHAREDKEY); return(dtoClass); }
public void UpdateIsActive(DTO.LABURNUM.COM.ClassModel model) { model.ClassId.TryValidate(); IQueryable <API.LABURNUM.COM.Class> iQuery = this._laburnum.Classes.Where(x => x.ClassId == model.ClassId && x.IsActive == true); List <API.LABURNUM.COM.Class> dbClasses = iQuery.ToList(); if (dbClasses.Count == 0) { throw new Exception(API.LABURNUM.COM.Component.Constants.ERRORMESSAGES.NO_RECORD_FOUND); } if (dbClasses.Count > 1) { throw new Exception(API.LABURNUM.COM.Component.Constants.ERRORMESSAGES.MORE_THAN_ONE_RECORDFOUND); } dbClasses[0].IsActive = model.IsActive; dbClasses[0].LastUpdated = System.DateTime.Now; this._laburnum.SaveChanges(); }
public void UpdateClasseStatus(DTO.LABURNUM.COM.ClassModel model) { try { model.ApiClientModel = new LABURNUM.COM.Component.Common().GetApiClientModel(); HttpClient client = new LABURNUM.COM.Component.Common().GetHTTPClient("application/json"); HttpResponseMessage response = client.PostAsJsonAsync("Class/UpdateStatus", model).Result; if (response.IsSuccessStatusCode) { } else { } } catch (Exception) { throw new Exception("Error While Updating Class Status"); } }
public ActionResult StatusUpdate(DTO.LABURNUM.COM.ClassModel model) { try { model.ApiClientModel = new LABURNUM.COM.Component.Common().GetApiClientModel(); HttpClient client = new LABURNUM.COM.Component.Common().GetHTTPClient("application/json"); HttpResponseMessage response = client.PostAsJsonAsync("Class/UpdateStatus", model).Result; if (response.IsSuccessStatusCode) { return(Json(new { code = 0, message = "success" })); } else { return(Json(new { code = -1, message = "failed" })); } } catch (Exception) { return(Json(new { code = -2, message = "failed" })); } }
public List <DTO.LABURNUM.COM.ClassModel> GetClassesByAdvanceSearch(DTO.LABURNUM.COM.ClassModel model) { try { model.ApiClientModel = new LABURNUM.COM.Component.Common().GetApiClientModel(); HttpClient client = new LABURNUM.COM.Component.Common().GetHTTPClient("application/json"); HttpResponseMessage response = client.PostAsJsonAsync("Class/SearchClassByAdvanceSearch", model).Result; if (response.IsSuccessStatusCode) { var data = response.Content.ReadAsStringAsync().Result; return(JsonConvert.DeserializeObject <List <DTO.LABURNUM.COM.ClassModel> >(data)); } else { return(null); } } catch (Exception) { throw new Exception("Error While Getting Class List"); } }
public DTO.LABURNUM.COM.ClassModel GetClassByClassId(long classId) { DTO.LABURNUM.COM.ClassModel model = new DTO.LABURNUM.COM.ClassModel() { ClassId = classId }; try { List <DTO.LABURNUM.COM.ClassModel> dbclasses = GetClassesByAdvanceSearch(model); if (dbclasses.Count == 0) { throw new Exception(LABURNUM.COM.Component.Constants.ERRORMESSAGES.NO_RECORD_FOUND); } if (dbclasses.Count > 1) { throw new Exception(LABURNUM.COM.Component.Constants.ERRORMESSAGES.MORE_THAN_ONE_RECORDFOUND); } return(dbclasses[0]); } catch (Exception) { return(model); } }
public ActionResult AddClass(DTO.LABURNUM.COM.ClassModel model) { try { model.ApiClientModel.UserName = LABURNUM.COM.Component.Constants.APIACCESS.APIUSERNAME; model.ApiClientModel.Password = LABURNUM.COM.Component.Constants.APIACCESS.APIPASSWORD; HttpClient client = new HttpClient(); client.BaseAddress = new Uri(LABURNUM.COM.Component.Constants.URL.WEBAPIURL); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); HttpResponseMessage response = client.PostAsJsonAsync("Class/Add", model).Result; if (response.IsSuccessStatusCode) { return(Json(new { code = 0, message = "success" })); } else { return(Json(new { code = -1, message = "failed" })); } } catch (Exception) { return(Json(new { code = -2, message = "failed" })); } }
// // GET: /SeachClassByAdvanceSearch/ public ActionResult Index() { DTO.LABURNUM.COM.ClassModel model = new DTO.LABURNUM.COM.ClassModel(); return(View(model)); }
private long AddValidation(DTO.LABURNUM.COM.ClassModel model) { model.ClassName.TryValidate(); return(AddClass(model)); }
public long Add(DTO.LABURNUM.COM.ClassModel model) { return(AddValidation(model)); }