Ejemplo n.º 1
0
        public SYS_tblGroupUserDRO DeleteGroupUser(string Username, string LanguageID, string GroupUserIDList)
        {
            SYS_tblGroupUserDRO result = new SYS_tblGroupUserDRO();
            try
            {
                using (var scope = Container.BeginLifetimeScope())
                {
                    string temp = "";
                    var db = scope.Resolve<ISYS_tblGroupUserDAO>();
                    if (GroupUserIDList.Contains("$"))
                        temp = db.DeleteGroupUserList(GroupUserIDList, Username, LanguageID);
                    else temp = db.DeleteGroupUser(GroupUserIDList, Username, LanguageID);

                    result.ResponseItem = new DCO.ResponseItem
                    {
                        Result = string.IsNullOrEmpty(temp) ? true : false,
                        Status = string.IsNullOrEmpty(temp) ? DCO.ResponseStatus.Success : DCO.ResponseStatus.Failure,
                        Message = string.IsNullOrEmpty(temp) ? string.Empty : temp,
                        RequestUser = Username,
                        TotalItemCount = string.IsNullOrEmpty(temp) ? 1 : 0
                    };
                }
            }
            catch (Exception ex)
            {
                result.ResponseItem = new DCO.ResponseItem
                {
                    Result = false,
                    Status = DCO.ResponseStatus.Exception,
                    Message = "Delete group user failed because " + ex.Message,
                    RequestUser = Username,
                    TotalItemCount = 0
                };
                logger.Error(ex);
            }

            return result;
        }
Ejemplo n.º 2
0
        public SYS_tblGroupUserDRO GetGroupUserByID(string Username, string LanguageID, string GroupID)
        {
            SYS_tblGroupUserDRO result = new SYS_tblGroupUserDRO();
            try
            {
                using (var scope = Container.BeginLifetimeScope())
                {
                    SYS_tblGroupUserDTO temp = new SYS_tblGroupUserDTO();
                    var db = scope.Resolve<ISYS_tblGroupUserDAO>();
                    temp = db.GetDataByID(GroupID, Username, LanguageID);
                    if (temp != null)
                    {
                        result.GroupUserItem = Mapper.Map<SYS_tblGroupUserDCO>(temp);
                        result.ResponseItem = new DCO.ResponseItem
                        {
                            Result = true,
                            Status = DCO.ResponseStatus.Success,
                            Message = "",
                            RequestUser = Username,
                            TotalItemCount = 1
                        };
                    }
                }
            }
            catch (Exception ex)
            {
                result.GroupUserItem = Mapper.Map<SYS_tblGroupUserDCO>(new SYS_tblGroupUserDTO());
                result.ResponseItem = new DCO.ResponseItem
                {
                    Result = false,
                    Status = DCO.ResponseStatus.Exception,
                    Message = "Get data failed: " + ex.Message,
                    RequestUser = Username,
                    TotalItemCount = 0
                };
                logger.Error(ex);
            }

            return result;
        }
Ejemplo n.º 3
0
        public SYS_tblGroupUserDRO InsertUpdateGroupUser(SYS_tblGroupUserDCO groupUser)
        {
            SYS_tblGroupUserDRO result = new SYS_tblGroupUserDRO();
            try
            {
                using (var scope = Container.BeginLifetimeScope())
                {
                    string temp = "";
                    var db = scope.Resolve<ISYS_tblGroupUserDAO>();
                    var data = Mapper.Map<SYS_tblGroupUserDTO>(groupUser);
                    if (groupUser.Activity.Equals(BaseConstant.COMMAND_INSERT_EN))
                        temp = db.InsertGroupUser(data);
                    else temp = db.UpdateGroupUser(data);

                    result.ResponseItem = new DCO.ResponseItem
                    {
                        Result = string.IsNullOrEmpty(temp) ? true : false,
                        Status = string.IsNullOrEmpty(temp) ? DCO.ResponseStatus.Success : DCO.ResponseStatus.Failure,
                        Message = string.IsNullOrEmpty(temp) ? string.Empty : temp,
                        RequestUser = groupUser.UserID,
                        TotalItemCount = string.IsNullOrEmpty(temp) ? 1 : 0
                    };
                }
            }
            catch (Exception ex)
            {
                result.ResponseItem = new DCO.ResponseItem
                {
                    Result = false,
                    Status = DCO.ResponseStatus.Exception,
                    Message = "Insert new group user failed because " + ex.Message,
                    RequestUser = groupUser.UserID,
                    TotalItemCount = 0
                };
                logger.Error(ex);
            }

            return result;
        }
Ejemplo n.º 4
0
        public SYS_tblGroupUserDRO GetAllGroupUsers(string Username, string LanguageID, bool GetComboBox)
        {
            SYS_tblGroupUserDRO result = new SYS_tblGroupUserDRO();
            try
            {
                using (var scope = Container.BeginLifetimeScope())
                {
                    List<SYS_tblGroupUserDTO> temp = new List<SYS_tblGroupUserDTO>();
                    var db = scope.Resolve<ISYS_tblGroupUserDAO>();
                    if (!GetComboBox)
                        temp = db.LoadAllData(Username, LanguageID);
                    else temp = db.GetDataCombobox(Username, LanguageID);
                    if (temp != null)
                    {
                        result.GroupUserList = Mapper.Map<List<SYS_tblGroupUserDCO>>(temp);
                        result.ResponseItem = new DCO.ResponseItem
                        {
                            Result = true,
                            Status = DCO.ResponseStatus.Success,
                            Message = "",
                            RequestUser = Username,
                            TotalItemCount = temp.Count
                        };
                    }
                }
            }
            catch (Exception ex)
            {
                result.GroupUserList = Mapper.Map<List<SYS_tblGroupUserDCO>>(new List<SYS_tblGroupUserDTO>());
                result.ResponseItem = new DCO.ResponseItem
                {
                    Result = false,
                    Status = DCO.ResponseStatus.Exception,
                    Message = "Load group user list failed: " + ex.Message,
                    RequestUser = Username,
                    TotalItemCount = 0
                };
                logger.Error(ex);
            }

            return result;
        }