예제 #1
0
        public async static Task <SYS_tblUserDRO> GetAllUsers(string username, string language_id, SYS_tblActionLogDTO actionLog)
        {
            SYS_tblUserDRO result = new SYS_tblUserDRO();

            try
            {
                string url = string.Format("{0}/GetAllUsers?Username={1}&LanguageID={2}", GetBaseUrl(), username, language_id);

                result = await SYS_tblUserDAO.GetAllUsers(url);

                if (string.IsNullOrEmpty(result.ResponseItem.Message))
                {
                    if (actionLog != null)
                    {
                        result.ResponseItem = await SYS_tblActionLogBUS.InsertUpdateLog(actionLog);
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                result.ResponseItem.Message = ex.Message;
            }

            return(result);
        }
예제 #2
0
        public async static Task <SYS_tblPermissionDRO> UpdatePermission(string username, string language_id, List <SYS_tblPermissionDTO> permissions, bool is_user, SYS_tblActionLogDTO actionLog)
        {
            SYS_tblPermissionDRO result = new SYS_tblPermissionDRO();

            try
            {
                string url       = string.Format("{0}/UpdatePermission", GetBaseUrl());
                var    json_data = "{\"Username\":\"" + username + "\",\"LanguageID\":\"" + language_id + "\",\"IsUser\":" + (is_user ? "true" : "false") + ",\"permissionList\":" + JsonConvert.SerializeObject(permissions, new JsonSerializerSettings
                {
                    DateFormatHandling = DateFormatHandling.MicrosoftDateFormat
                }) + "}";

                result = await SYS_tblPermissionDAO.UpdatePermission(url, json_data);

                if (string.IsNullOrEmpty(result.ResponseItem.Message))
                {
                    result.ResponseItem = await SYS_tblActionLogBUS.InsertUpdateLog(actionLog);
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                result.ResponseItem.Message = ex.Message;
            }

            return(result);
        }
예제 #3
0
        public async static Task <SYS_tblUserDRO> InsertUpdateUser(SYS_tblUserDTO item, SYS_tblActionLogDTO actionLog)
        {
            SYS_tblUserDRO result = new SYS_tblUserDRO();

            try
            {
                string url      = string.Format(@"{0}/InsertUpdateUser", GetBaseUrl());
                var    postData = new SYS_tblUserDCO
                {
                    Username           = item.Username,
                    Password           = item.Password,
                    GroupID            = item.GroupID,
                    GroupName          = item.GroupName,
                    EffectiveDate      = item.EffectiveDate,
                    ToDate             = item.ToDate,
                    DateChangePass     = item.DateChangePass,
                    Locked             = item.Locked,
                    LockDate           = item.LockDate,
                    UnlockDate         = item.UnlockDate,
                    PassNeverExpired   = item.PassNeverExpired,
                    ChangePassNextTime = item.ChangePassNextTime,
                    EmpID                = item.EmpID,
                    FullName             = item.FullName,
                    Email                = item.EmpID,
                    Note                 = item.Note,
                    CanNotChangePassword = item.CanNotChangePassword,
                    Activity             = item.Activity,
                    UserID               = item.UserID,
                    LanguageID           = item.LanguageID
                };
                var json_data = "{\"user\":" + JsonConvert.SerializeObject(postData, new JsonSerializerSettings
                {
                    DateFormatHandling = DateFormatHandling.MicrosoftDateFormat
                }) + "}";

                result = await SYS_tblUserDAO.InsertUpdateUser(url, json_data);

                if (string.IsNullOrEmpty(result.ResponseItem.Message))
                {
                    result.ResponseItem = await SYS_tblActionLogBUS.InsertUpdateLog(actionLog);
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                result.ResponseItem.Message = ex.Message;
            }

            return(result);
        }
예제 #4
0
        public async static Task <SYS_tblGroupUserDRO> InsertUpdateGroupUser(SYS_tblGroupUserDTO item, SYS_tblActionLogDTO actionLog)
        {
            SYS_tblGroupUserDRO result = new SYS_tblGroupUserDRO();

            try
            {
                string url      = string.Format(@"{0}/InsertUpdateGroupUser", GetBaseUrl());
                var    postData = new SYS_tblGroupUserDCO
                {
                    GroupID    = string.IsNullOrEmpty(item.GroupID) ? "0" : item.GroupID,
                    GroupCode  = item.GroupCode,
                    VNName     = item.VNName,
                    ENName     = item.ENName,
                    Note       = item.Note,
                    IsDefault  = item.IsDefault,
                    Active     = item.Active,
                    Activity   = item.Activity,
                    UserID     = item.UserID,
                    LanguageID = item.LanguageID
                };
                var json_data = "{\"groupUser\":" + JsonConvert.SerializeObject(postData, new JsonSerializerSettings
                {
                    DateFormatHandling = DateFormatHandling.MicrosoftDateFormat
                }) + "}";

                result = await SYS_tblGroupUserDAO.InsertUpdateGroupUser(url, json_data);

                if (string.IsNullOrEmpty(result.ResponseItem.Message))
                {
                    result.ResponseItem = await SYS_tblActionLogBUS.InsertUpdateLog(actionLog);
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                result.ResponseItem.Message = ex.Message;
            }

            return(result);
        }
예제 #5
0
        public async static Task <SYS_tblUserDRO> ChangeUserPassword(string username, string language_id, string password, SYS_tblActionLogDTO actionLog)
        {
            SYS_tblUserDRO result = new SYS_tblUserDRO();

            try
            {
                string url = string.Format(@"{0}/ChangeUserPassword?Username={1}&LanguageID={2}&Password={3}", GetBaseUrl(), username, language_id, password);

                result = await SYS_tblUserDAO.ChangeUserPassword(url);

                if (string.IsNullOrEmpty(result.ResponseItem.Message))
                {
                    result.ResponseItem = await SYS_tblActionLogBUS.InsertUpdateLog(actionLog);
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                result.ResponseItem.Message = ex.Message;
            }

            return(result);
        }
예제 #6
0
        public async static Task <SYS_tblUserDRO> DeleteUser(string user_code_list, string username, string language_id, SYS_tblActionLogDTO actionLog)
        {
            SYS_tblUserDRO result = new SYS_tblUserDRO();

            try
            {
                string url = string.Format(@"{0}/DeleteUser?Username={1}&LanguageID={2}&UserCodeList={3}", GetBaseUrl(), username, language_id, user_code_list);

                result = await SYS_tblUserDAO.DeleteUser(url);

                if (string.IsNullOrEmpty(result.ResponseItem.Message))
                {
                    result.ResponseItem = await SYS_tblActionLogBUS.InsertUpdateLog(actionLog);
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                result.ResponseItem.Message = ex.Message;
            }

            return(result);
        }