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;
        }
Beispiel #2
0
        public async static Task<PRO_tblDistrictDRO> InsertUpdateDistrict(PRO_tblDistrictDTO item, SYS_tblActionLogDTO actionLog)
        {
            PRO_tblDistrictDRO result = new PRO_tblDistrictDRO();
            try
            {
                string url = string.Format(@"{0}/InsertUpdateDistrict", GetBaseUrl());
                var postData = new PRO_tblDistrictDCO
                {
                    DistrictID = item.DistrictID,
                    DistrictCode = item.DistrictCode,
                    VNName = item.VNName, 
                    ENName = item.ENName,
                    ProvinceID = item.ProvinceID,
                    Rank = item.Rank,
                    Used = item.Used,
                    Note = item.Note,
                    Activity = item.Activity,
                    UserID = item.UserID,
                    LanguageID = item.LanguageID
                };
                var json_data = "{\"district\":" + JsonConvert.SerializeObject(postData, new JsonSerializerSettings
                {
                    DateFormatHandling = DateFormatHandling.MicrosoftDateFormat
                }) + "}";

                result = await PRO_tblDistrictDAO.InsertUpdateDistrict(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;
        }
        public string InsertUpdateLog(SYS_tblActionLogDTO actionLog)
        {
            string result = "";
            result = db.sExecuteSQL("SYS_spfrmActionLog", new string[] { "Activity", "Username", "LanguageID", "FullName", "ComputerName", "AccountWindows", "ActionVN", "ActionEN", "FunctionID", "FunctionNameVN", "FunctionNameEN", "IPLAN", "IPWAN", "MacAddress", "DescriptionVN", "DescriptionEN" }, new object[] { actionLog.Activity, actionLog.UserID, actionLog.LanguageID, actionLog.FullName, actionLog.ComputerName, actionLog.AccountWindows, actionLog.ActionVN, actionLog.ActionEN, actionLog.FunctionID, actionLog.FunctionNameVN, actionLog.FunctionNameEN, actionLog.IPLAN, actionLog.IPWAN, actionLog.MacAddress, actionLog.DescriptionVN, actionLog.DescriptionEN });

            if (!string.IsNullOrEmpty(result))
                logger.Error(result);
            return result;
        }
Beispiel #4
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;
        }
Beispiel #5
0
        public async static Task<PRO_tblDistrictDRO> GetAllDistricts(string username, string language_id, bool is_combobox, string province_id, SYS_tblActionLogDTO actionLog)
        {
            PRO_tblDistrictDRO result=new PRO_tblDistrictDRO();
            try
            {
                string url = string.Format(@"{0}/GetAllDistrict?Username={1}&LanguageID={2}&ProvinceID={3}&GetCombobox={4}", GetBaseUrl(), username, language_id, province_id, is_combobox ? "True" : "False");

                result = await PRO_tblDistrictDAO.GetAllDistricts(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;
        }
        public async static Task<SYS_tblGroupUserDRO> GetAllGroupUsers(string username, string language, bool is_combobox, SYS_tblActionLogDTO actionLog)
        {
            SYS_tblGroupUserDRO result = new SYS_tblGroupUserDRO();
            try
            {
                string url = string.Format("{0}/GetAllGroupUsers?Username={1}&LanguageID={2}&GetComboBox={3}", GetBaseUrl(), username, language, is_combobox ? "True" : "False");

                result = await SYS_tblGroupUserDAO.GetAllGroupUsers(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;
        }
        public async static Task<PRO_tblWarehouseDRO> InsertUpdateStore(PRO_tblWarehouseDTO item, SYS_tblActionLogDTO actionLog)
        {
            PRO_tblWarehouseDRO result = new PRO_tblWarehouseDRO();
            try
            {
                string url = string.Format(@"{0}/InsertUpdateWarehouse", GetBaseUrl());
                var postData = new PRO_tblWarehouseDCO
                {
                    WarehouseID = item.WarehouseID,
                    WarehouseCode = item.WarehouseCode,
                    VNName = item.VNName,
                    ENName = item.ENName,
                    StoreID = item.StoreID,
                    AddressVN = item.AddressVN,
                    AddressEN = item.AddressEN,
                    Phone = item.Phone,
                    Fax = item.Fax,
                    ProvinceID = string.IsNullOrEmpty(item.ProvinceID) ? null : item.ProvinceID,
                    DistrictID = string.IsNullOrEmpty(item.DistrictID) ? null : item.DistrictID,
                    Rank = item.Rank,
                    Used = item.Used,
                    Note = item.Note,
                    UserID = item.UserID,
                    Activity = item.Activity,
                    LanguageID = item.LanguageID
                };
                var json_data = "{\"warehouse\":" + JsonConvert.SerializeObject(postData, new JsonSerializerSettings
                {
                    DateFormatHandling = DateFormatHandling.MicrosoftDateFormat
                }) + "}";

                result = await PRO_tblWarehouseDAO.InsertUpdateWarehouse(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;
        }
        public async static Task<ResponseItem> InsertUpdateLog(SYS_tblActionLogDTO item)
        {
            ResponseItem result = new ResponseItem();
            try
            {
                string url = string.Format(@"{0}/InsertUpdateLog", GetBaseUrl());
                var postData = new SYS_tblActionLogDCO
                {
                    ID = item.ID,
                    ActionVN = item.ActionVN,
                    ActionEN = item.ActionEN,
                    ActionTime = item.ActionTime,
                    FunctionID = item.FunctionID,
                    FunctionNameVN = item.FunctionNameVN,
                    FunctionNameEN = item.FunctionNameEN,
                    DescriptionEN = item.DescriptionEN,
                    DescriptionVN = item.DescriptionVN,
                    FullName = item.FullName,
                    ComputerName = item.ComputerName,
                    AccountWindows = item.AccountWindows,
                    IPLAN = item.IPLAN,
                    IPWAN = item.IPWAN,
                    MacAddress = item.MacAddress,
                    Activity = item.Activity,
                    UserID = item.UserID,
                    LanguageID = item.LanguageID
                };
                var json_data = "{\"actionLog\":" + JsonConvert.SerializeObject(postData, new JsonSerializerSettings
                {
                    DateFormatHandling = DateFormatHandling.MicrosoftDateFormat
                }) + "}";

                result = await SYS_tblActionLogDAO.InsertUpdateLog(url, json_data);
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                result.Message = ex.Message;
            }

            return result;
        }
Beispiel #9
0
        public string InsertActionLog(SYS_tblActionLogDTO log)
        {
            string result = "";
            try
            {
                result = db.sExecuteSQL("SYS_spfrmActionLog", new string[] { "Activity", "Username", "LanguageID", "FullName", "ComputerName", "AccountWindows", "ActionVN", "ActionEN", "ActionTime", "FunctionID", "FunctionNameVN", "FunctionNameEN", "IPLAN", "IPWAN", "MacAddress", "DescriptionVN", "DescriptionEN" }, new object[] { log.Activity, log.UserID, log.LanguageID, log.FullName, log.ComputerName, log.AccountWindows, log.ActionVN, log.ActionEN, DateTime.Now, log.FunctionID, log.FunctionNameVN, log.FunctionNameEN, log.IPLAN, log.IPWAN, log.MacAddress, log.DescriptionVN, log.DescriptionEN });

                if (!string.IsNullOrEmpty(result))
                    logger.Error(result);

                return result;
            }
            catch (Exception ex)
            {
                result = ex.Message;
                logger.Error(ex);
            }

            return result;
        }
        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;
        }
Beispiel #11
0
        public async static Task<PRO_tblLevel2DRO> InsertUpdateLevel2(PRO_tblLevel2DTO item, SYS_tblActionLogDTO actionLog)
        {
            PRO_tblLevel2DRO result = new PRO_tblLevel2DRO();
            try
            {
                string url = string.Format(@"{0}/InsertUpdateLevel2", GetBaseUrl());
                var postData = new PRO_tblLevel2DCO
                {
                    Level2ID = item.Level2ID,
                    Level2Code = item.Level2Code,
                    Level2ShortCode = item.Level2ShortCode,
                    Level1ID = item.Level1ID,
                    VNName = item.VNName,
                    ENName = item.ENName,
                    Rank = string.IsNullOrEmpty(item.Rank) ? null : item.Rank,
                    Note = item.Note,
                    Description = item.Description,
                    Used = item.Used,
                    Activity = item.Activity,
                    UserID = item.UserID,
                    LanguageID = item.LanguageID
                };
                var json_data = "{\"level2\":" + JsonConvert.SerializeObject(postData, new JsonSerializerSettings
                {
                    DateFormatHandling = DateFormatHandling.MicrosoftDateFormat
                }) + "}";

                result = await PRO_tblLevel2DAO.InsertUpdateLevel2(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;
        }
Beispiel #12
0
        public async static Task<PRO_tblDistrictDRO> DeleteDistrict(string username, string language_id, string district_id_list, SYS_tblActionLogDTO actionLog)
        {
            PRO_tblDistrictDRO result = new PRO_tblDistrictDRO();
            try
            {
                string url = string.Format(@"{0}/DeleteDistrict?Username={1}&LanguageID={2}&DistrictIDList={3}", GetBaseUrl(), username, language_id, district_id_list);

                result = await PRO_tblDistrictDAO.DeleteDistrict(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;
        }
Beispiel #13
0
        public async static Task<SYS_tblGroupUserDRO> DeleteGroupUser(string group_id_list, string group_code_list, string username, string language, SYS_tblActionLogDTO actionLog)
        {
            SYS_tblGroupUserDRO result = new SYS_tblGroupUserDRO();
            try
            {
                string url = string.Format(@"{0}/DeleteGroupUser?Username={1}&LanguageID={2}&GroupUserIDList={3}&GroupUserCodeList={4}", GetBaseUrl(), username, language, group_id_list, group_code_list);

                result = await SYS_tblGroupUserDAO.DeleteGroupUser(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;
        }
Beispiel #14
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;
        }