예제 #1
0
 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;
     }
 }
예제 #2
0
 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);
     }
 }
예제 #3
0
        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);
            }
        }
예제 #4
0
        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));
            }
        }
예제 #5
0
 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);
     }
 }
예제 #6
0
 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);
     }
 }