Ejemplo n.º 1
0
        public List <UserProfileModel> RetrieveUserProfileByFilter(string sortParameter, List <SelectFilter> selectFilters)
        {
            MQUESTSYSEntities ent = new MQUESTSYSEntities();
            var query             = from i in ent.v_UserProfile
                                    select i;

            ApplyFilter <v_UserProfile>(ref query, selectFilters);
            ApplySorting <v_UserProfile>(ref query, "Code DESC", sortParameter);
            return(ObjectHelper.CopyList <v_UserProfile, UserProfileModel>(query.ToList()));
        }
Ejemplo n.º 2
0
        public List <RoleDetailModel> RetrieveRoleActions(string moduleID)
        {
            MQUESTSYSEntities ent = new MQUESTSYSEntities();

            var query = from i in ent.RoleDetail
                        where i.ModuleID == moduleID
                        select i;

            return(ObjectHelper.CopyList <RoleDetail, RoleDetailModel>(query.ToList()));
        }
Ejemplo n.º 3
0
        public List <string> RetrieveRoleActions(int roleID, string moduleID)
        {
            MQUESTSYSEntities ent = new MQUESTSYSEntities();

            var query = from i in ent.RoleDetail
                        where i.RoleID == roleID && i.ModuleID == moduleID
                        select i.Action;

            return(query.ToList());
        }
Ejemplo n.º 4
0
        public List <RoleModel> RetrieveRole(bool isActive)
        {
            MQUESTSYSEntities ent = new MQUESTSYSEntities();

            var query = from i in ent.Role
                        where i.IsActive == isActive
                        select i;

            return(ObjectHelper.CopyList <Role, RoleModel>(query.ToList()));
        }
Ejemplo n.º 5
0
        public void CreateRole(RoleModel role)
        {
            MQUESTSYSEntities ent = new MQUESTSYSEntities();
            Role obj = new Role();

            ObjectHelper.CopyProperties(role, obj);
            ent.AddToRole(obj);
            ent.SaveChanges();

            role.ID = obj.ID;
        }
Ejemplo n.º 6
0
        public void UpdateCompanySetting(CompanySettingModel companySetting)
        {
            MQUESTSYSEntities ent = new MQUESTSYSEntities();

            var query = from i in ent.CompanySetting
                        select i;

            var obj = query.FirstOrDefault();

            ObjectHelper.CopyProperties(companySetting, obj);
            ent.SaveChanges();
        }
Ejemplo n.º 7
0
        public List <CustomerModel> RetrieveCustomerAutoComplete(string key)
        {
            MQUESTSYSEntities ent = new MQUESTSYSEntities();

            var query = from i in ent.Customer
                        where (i.Name.ToLower().Contains(key.ToLower()) ||
                               i.Code.ToLower().Contains(key.ToLower())) &&
                        i.IsActive == true
                        select i;

            ApplySorting <Customer>(ref query, "Code", "");
            return(ObjectHelper.CopyList <Customer, CustomerModel>(query.Take(SystemConstants.AutoCompleteItemCount).ToList()));
        }
Ejemplo n.º 8
0
        public void DeleteRoleDetails(long roleID)
        {
            MQUESTSYSEntities ent = new MQUESTSYSEntities();

            var query = from i in ent.RoleDetail
                        where i.RoleID == roleID
                        select i;

            foreach (var obj in query.AsEnumerable())
            {
                ent.DeleteObject(obj);
            }

            ent.SaveChanges();
        }
Ejemplo n.º 9
0
        public void CreateRoleDetails(int roleID, List <RoleDetailModel> roleDetailList)
        {
            MQUESTSYSEntities ent = new MQUESTSYSEntities();

            foreach (var roleDetail in roleDetailList)
            {
                roleDetail.RoleID = roleID;

                RoleDetail obj = new RoleDetail();
                ObjectHelper.CopyProperties(roleDetail, obj);
                ent.AddToRoleDetail(obj);
            }

            ent.SaveChanges();
        }
Ejemplo n.º 10
0
        public MQUESTSYSReportEDSC.CompanySettingDTRow RetrieveCompanySetting()
        {
            MQUESTSYSEntities ent = new MQUESTSYSEntities();

            var query = from i in ent.CompanySetting
                        select i;

            MQUESTSYSReportEDSC.CompanySettingDTRow dr = new MQUESTSYSReportEDSC.CompanySettingDTDataTable().NewCompanySettingDTRow();

            if (query.FirstOrDefault() != null)
            {
                ObjectHelper.CopyProperties(query.FirstOrDefault(), dr);
            }
            else
            {
                return(null);
            }

            return(dr);
        }
Ejemplo n.º 11
0
        public CompanySettingModel RetrieveCompanySetting()
        {
            MQUESTSYSEntities ent = new MQUESTSYSEntities();

            var query = from i in ent.CompanySetting
                        select i;

            CompanySettingModel obj = new CompanySettingModel();

            if (query.FirstOrDefault() != null)
            {
                ObjectHelper.CopyProperties(query.FirstOrDefault(), obj);
            }
            else
            {
                return(null);
            }

            return(obj);
        }
Ejemplo n.º 12
0
        public CustomerModel RetrieveCustomerByCodeOrName(string key)
        {
            MQUESTSYSEntities ent = new MQUESTSYSEntities();

            var query = from i in ent.v_Customer
                        where i.Code == key || i.Name == key
                        select i;

            var obj = new CustomerModel();

            if (query.FirstOrDefault() != null)
            {
                ObjectHelper.CopyProperties(query.FirstOrDefault(), obj);
            }
            else
            {
                return(null);
            }

            return(obj);
        }