public ActionResult MyAccount(FormCollection collection)
 {
     try
     {
         var EMAIL = collection["EMAIL"].Trim();
         var MOBILE_NUM = collection["MOBILE_NUM"].Trim();
         var COMPANY_TEL = collection["COMPANY_TEL"].Trim();
         var PASSWORD = collection["PASSWORD"].Trim();
         var PASSWORD_RE = collection["PASSWORD_RE"].Trim();
         Models.z_user model_z_user = ViewBag.model_z_user;
         if (PASSWORD != null && PASSWORD != "")
         {
             if (PASSWORD == PASSWORD_RE)
             {
                 model_z_user.PASSWORD = Common.Common.MD5(PASSWORD);
             }
             else
             {
                 ViewBag.message = "Modify failed, password does not match";
                 return View();
             }
         }
         model_z_user.EMAIL = EMAIL;
         model_z_user.COMPANY_TEL = COMPANY_TEL;
         model_z_user.MOBILE_NUM = MOBILE_NUM;
         DAL.z_user dal_z_user = new DAL.z_user();
         dal_z_user.Update(model_z_user);
         ViewBag.message = "Modify Successfully";
         return View();
     }
     catch
     {
         ViewBag.message = "Modify failed";
         return View();
     }
 }
 public ActionResult Edit(String id, FormCollection collection)
 {
     DAL.z_user dal_z_user = new DAL.z_user();
     Models.z_user model_z_user = dal_z_user.GetModel(new Guid(id));
     DAL.z_r_user_role dal_z_r_user_role = new DAL.z_r_user_role();
     DAL.z_parameter dal_z_parameter = new DAL.z_parameter();
     DAL.z_role dal_z_role = new DAL.z_role();
     ViewBag.role_list = dal_z_role.GetModelList();
     ViewBag.role_list_user = dal_z_role.GetModelList(new Guid(id));
     try
     {
         // TODO: Add insert logic here
         string USER_CD = collection["USER_CD"].Trim();
         string PASSWORD = collection["PASSWORD"].Trim();
         string PASSWORD_RE = collection["PASSWORD_RE"].Trim();
         string LAST_NAME = collection["LAST_NAME"].Trim();
         string EMAIL = collection["EMAIL"].Trim();
         string MOBILE_NUM = collection["MOBILE_NUM"].Trim();
         string DESCRIPTION = collection["DESCRIPTION"].Trim();
         string ROLE = collection["ROLE"];
         if (USER_CD == "" || LAST_NAME == "" || ROLE == null)
         {
             ViewBag.message = "Create Failed, field with red start can't be blank";
             return View(model_z_user);
         }
         if (PASSWORD != "" && PASSWORD != PASSWORD_RE)
         {
             ViewBag.message = "Create Failed, password does not match";
             return View(model_z_user);
         }
         if (dal_z_user.isCdDuplicate(USER_CD, model_z_user.ID.ToString()))
         {
             ViewBag.message = "Create Failed, account is already exist";
             return View(model_z_user);
         }
         model_z_user.USER_CD = USER_CD;
         if (PASSWORD != "")
         {
             model_z_user.PASSWORD = Common.Common.MD5(PASSWORD);
         }
         model_z_user.LAST_NAME = LAST_NAME;
         model_z_user.EMAIL = EMAIL;
         model_z_user.MOBILE_NUM = MOBILE_NUM;
         model_z_user.DESCRIPTION = DESCRIPTION;
         model_z_user.UPDATE_DATETIME = DateTime.Now;
         dal_z_user.Update(model_z_user);
         dal_z_r_user_role.DeleteRoleByUserID(model_z_user.ID.ToString());
         dal_z_r_user_role.Add(model_z_user.ID.ToString(), ROLE);
         return RedirectToAction("Index", new { message = HttpUtility.UrlEncode("Edit Succeed") });
     }
     catch
     {
         ViewBag.message = "Edit Failed";
         return View(model_z_user);
     }
 }