예제 #1
0
 public ActionResult Edit(POS_USER pos_user)
 {
     try
     {
         if (Session[SessionVariables.Session_UserInfo] != null)
         {
             BranchList();
             if (pos_user.ConfirmPassword != pos_user.PASSWORD)
             {
                 ModelState.AddModelError("", "Confirm password is not correct.");
             }
             else
             {
                 pos_user.MODIFIEDBY   = SessionHandling.UserInformation.USERNAME;
                 pos_user.MODIFIEDWHEN = DateTime.Now;
                 if (ModelState.IsValid)
                 {
                     objNotify = _objBALUser.Update(pos_user);
                     if (objNotify.RowEffected > 0)
                     {
                         ShowAlert(AlertType.Success, objNotify.NotifyMessage);
                         return(RedirectToAction("Index"));
                     }
                     else
                     {
                         ShowAlert(AlertType.Error, objNotify.NotifyMessage);
                     }
                 }
                 else
                 {
                     return(View(pos_user));
                 }
             }
             return(View(pos_user));
         }
         else
         {
             return(RedirectToAction("Login", "Home"));
         }
     }
     catch (Exception ex)
     {
         error.Breadcrum = "Home > Users > List  > Edit";
         if (ex is BALException)
         {
             error.ErrorMsg = ex.Message.ToString() + "from " + ex.TargetSite.DeclaringType.Name + " method in " + ex.TargetSite.Name + " layer";
         }
         else
         {
             ExceptionLogger.WriteExceptionInDB(ex, ExceptionLevel.UI, ExceptionType.Error);
             error.ErrorMsg = ex.Message.ToString() + "from " + ex.TargetSite.DeclaringType.Name + " method in " + ex.TargetSite.Name + " layer";
         }
         return(RedirectToAction("ShowErrorPage", "Master", error));
     }
 }