public tbl_Posting_Restrictions GetPostingRestrictionsbyID(int ID) { try { tbl_Posting_Restrictions row = new tbl_Posting_Restrictions(); using (var db = new SoneriCISEntities()) { row = db.tbl_Posting_Restrictions.FirstOrDefault(e => e.ID == ID); } return(row); } catch (Exception ex) { throw ex; } }
public bool AddPostingRestrictions(tbl_Posting_Restrictions row) { try { using (var db = new SoneriCISEntities()) { db.tbl_Posting_Restrictions.Add(row); db.SaveChanges(); } return(true); } catch (Exception ex) { return(false); } }
public bool DeletePostingRestrictions(tbl_Posting_Restrictions row) { try { using (var db = new SoneriCISEntities()) { tbl_Posting_Restrictions val = new tbl_Posting_Restrictions(); val = db.tbl_Posting_Restrictions.Where(a => a.ID == row.ID).FirstOrDefault(); val.IsActive = false; db.SaveChanges(); } return(true); } catch (Exception ex) { return(false); } }
public JsonResult UpdatePostingRestriction(string PostingRestriction, string Code, bool?IsActive) { var lst = new tbl_Posting_Restrictions() { Description = PostingRestriction, Code = Code, IsActive = IsActive }; var success = new PostingRestrictionDataAccess().UpdatePostingRestrictions(lst); if (success == true) { return(Json(new { result = success, ErrorMessage = CustomMessages.Success }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { result = success, ErrorMessage = CustomMessages.GenericErrorMessage }, JsonRequestBehavior.AllowGet)); } }
public bool UpdatePostingRestrictions(tbl_Posting_Restrictions row) { try { using (var db = new SoneriCISEntities()) { tbl_Posting_Restrictions val = new tbl_Posting_Restrictions(); val = db.tbl_Posting_Restrictions.Where(a => a.Code == row.Code).FirstOrDefault(); val.Code = row.Code; val.Description = row.Description; val.IsActive = row.IsActive; db.SaveChanges(); } return(true); } catch (Exception ex) { return(false); } }
public bool CheckPostingCode(List <string> Codes) { try { tbl_Posting_Restrictions row = new tbl_Posting_Restrictions(); using (var db = new SoneriCISEntities()) { row = db.tbl_Posting_Restrictions.FirstOrDefault(e => Codes.Contains(e.Code.ToUpper()) && e.IsActive == true); } if (row != null) { return(true); } else { return(false); } } catch (Exception ex) { return(false); } }