Example #1
0
        public static object Update(SessionInfo sessioninfo, MA_USER record, int intCheckAD)
        {
            try
            {
                UserBusiness _userBusiness = new UserBusiness();
                if (intCheckAD == 1)
                {
                    bool validUser = LDAPHelper.UserExists(record.USERCODE);
                    if (!validUser)
                    {
                        return new { Result = "ERROR", Message = "User is not exist." }
                    }
                    ;
                }

                record.DEPARTMENT         = record.DEPARTMENT.ToUpper();
                record.NAME               = record.NAME.ToUpper();
                record.USER_OPICS         = record.USER_OPICS.ToUpper();
                record.USERCODE           = record.USERCODE.ToUpper();
                record.ISACTIVE           = record.ISACTIVE == null || !record.ISACTIVE.Value ? false : true;
                record.ISLOCKED           = record.ISLOCKED == null || !record.ISACTIVE.Value ? false : true;
                record.LOG.MODIFYBYUSERID = sessioninfo.CurrentUserId;
                record.LOG.MODIFYDATE     = DateTime.Now;
                var addedStudent = _userBusiness.UpdateUser(sessioninfo, record);
                return(new { Result = "OK" });
            }
            catch (Exception ex)
            {
                return(new { Result = "ERROR", Message = ex.Message });
            }
        }