Exemplo n.º 1
0
        public Result <List <MenuVM> > GetMenuForWeb(string Node)
        {
            try
            {
                List <MenuVM> menus = new List <MenuVM>();

                var children = ConvertDataTableToList.BindList <Menu>(_dataSource.GetChildren(Node));

                if (children.Count > 0)
                {
                    for (int i = 0; i < children.Count; i++)
                    {
                        var child = ConvertDataTableToList.BindList <Menu>(_dataSource.GetChildren(children[i].Node));
                        if (child.Count > 0)
                        {
                            menus.Add(new MenuVM {
                                IconText = children[i].IconText, Url = children[i].Url, ID = children[i].ID, Name = children[i].Name, Parameters = children[i].Parameters, Children = ChildRender(child)
                            });
                            //str += ChildRender(child, children[i].ID);
                        }

                        else
                        {
                            menus.Add(new MenuVM {
                                IconText = children[i].IconText, Url = children[i].Url, ID = children[i].ID, Parameters = children[i].Parameters, Name = children[i].Name, Children = null
                            });
                        }
                    }
                }
                return(Result <List <MenuVM> > .Successful(data : menus));
            }
            catch (Exception e) { return(Result <List <MenuVM> > .Failure()); }
        }
Exemplo n.º 2
0
        private List <MenuVM> ChildRender(List <Menu> child)
        {
            List <MenuVM> menus = new List <MenuVM>();

            if (child.Count > 0)
            {
                for (int i = 0; i < child.Count; i++)
                {
                    var subchild = ConvertDataTableToList.BindList <Menu>(_dataSource.GetChildren(child[i].Node));
                    if (subchild.Count > 0)
                    {
                        menus.Add(new MenuVM {
                            IconText = child[i].IconText, Url = child[i].Url, ID = child[i].ID, Name = child[i].Name, Children = ChildRender(subchild), Parameters = child[i].Parameters
                        });
                    }
                    else
                    {
                        menus.Add(new MenuVM {
                            IconText = child[i].IconText, Url = child[i].Url, ID = child[i].ID, Name = child[i].Name, Parameters = child[i].Parameters
                        });
                    }
                }
            }
            return(menus);
        }
        public Result <SettingVM> GetSetting()
        {
            var result = ConvertDataTableToList.BindList <GeneralSetting>(_dataSource.List());

            if (result.Count > 0 || result.Count == 0)
            {
                var setting = new SettingVM();
                setting.SiteUrl         = result.FirstOrDefault(x => x.Name.Equals("SiteUrl")).Value;
                setting.SiteName        = result.FirstOrDefault(x => x.Name.Equals("SiteName")).Value;
                setting.SiteKeyword     = result.FirstOrDefault(x => x.Name.Equals("SiteKeyword")).Value;
                setting.SiteDescription = result.FirstOrDefault(x => x.Name.Equals("SiteDescription")).Value;

                setting.Address          = result.FirstOrDefault(x => x.Name.Equals("Address")).Value;
                setting.CountShowArticle = result.FirstOrDefault(x => x.Name.Equals("CountShowArticle")).Value;
                setting.CountShowNews    = result.FirstOrDefault(x => x.Name.Equals("CountShowNews")).Value;
                setting.CountShowProduct = result.FirstOrDefault(x => x.Name.Equals("CountShowProduct")).Value;
                setting.CountShowEvents  = result.FirstOrDefault(x => x.Name.Equals("CountShowEvents")).Value;

                setting.CountShowSlider = result.FirstOrDefault(x => x.Name.Equals("CountShowSlider")).Value;
                setting.FacebookUrl     = result.FirstOrDefault(x => x.Name.Equals("FacebookUrl")).Value;
                setting.Fax             = result.FirstOrDefault(x => x.Name.Equals("Fax")).Value;
                setting.InstagramUrl    = result.FirstOrDefault(x => x.Name.Equals("InstagramUrl")).Value;

                setting.Mobile      = result.FirstOrDefault(x => x.Name.Equals("Mobile")).Value;
                setting.Phone       = result.FirstOrDefault(x => x.Name.Equals("Phone")).Value;
                setting.SiteMetaTag = result.FirstOrDefault(x => x.Name.Equals("SiteMetaTag")).Value;
                setting.TelegramUrl = result.FirstOrDefault(x => x.Name.Equals("TelegramUrl")).Value;

                setting.TwitterUrl  = result.FirstOrDefault(x => x.Name.Equals("TwitterUrl")).Value;
                setting.WhatsAppUrl = result.FirstOrDefault(x => x.Name.Equals("WhatsAppUrl")).Value;
                return(Result <SettingVM> .Successful(data : setting));
            }
            return(Result <SettingVM> .Failure());
        }
Exemplo n.º 4
0
        public Result <List <GetPermission> > GetPermission()
        {
            var table = ConvertDataTableToList.BindList <GetPermission>(_dataSource.GetPermission());

            if (table.Count > 0)
            {
                return(Result <List <GetPermission> > .Successful(data : table));
            }
            return(Result <List <GetPermission> > .Failure());
        }
Exemplo n.º 5
0
        public Result <List <Command> > ListForRole(CommandListVM model)
        {
            var table = ConvertDataTableToList.BindList <Command>(_dataSource.ListForRole(model));

            if (table.Count > 0 || table.Count == 0)
            {
                return(Result <List <Command> > .Successful(data : table));
            }
            return(Result <List <Command> > .Failure());
        }
Exemplo n.º 6
0
        public Result <List <FaqGroupListVM> > ListForWeb()
        {
            var table = ConvertDataTableToList.BindList <FaqGroupListVM>(_dataSource.ListForWeb());

            if (table.Count > 0 || table.Count == 0)
            {
                return(Result <List <FaqGroupListVM> > .Successful(data : table));
            }
            return(Result <List <FaqGroupListVM> > .Failure());
        }
Exemplo n.º 7
0
        public Result <List <FAQ> > List(Guid FAQGroupID)
        {
            var table = ConvertDataTableToList.BindList <FAQ>(_dataSource.List(FAQGroupID));

            if (table.Count > 0 || table.Count == 0)
            {
                return(Result <List <FAQ> > .Successful(data : table));
            }
            return(Result <List <FAQ> > .Failure());
        }
Exemplo n.º 8
0
        public Result <List <Position> > List(PositionListVM model)
        {
            var table = ConvertDataTableToList.BindList <Position>(_dataSource.List(model));

            if (table.Count > 0)
            {
                return(Result <List <Position> > .Successful(data : table));
            }
            return(Result <List <Position> > .Failure());
        }
Exemplo n.º 9
0
        public Result <List <ShowProductOnHomePageListVM> > ListForWeb(ProductListVM listVM, int Count)
        {
            var table = ConvertDataTableToList.BindList <ShowProductOnHomePageListVM>(_dataSource.ListForWeb(listVM, Count));

            if (table.Count > 0 || table.Count == 0)
            {
                return(Result <List <ShowProductOnHomePageListVM> > .Successful(data : table));
            }
            return(Result <List <ShowProductOnHomePageListVM> > .Failure());
        }
Exemplo n.º 10
0
        public Result <List <TagsSearchListVM> > SearchByName(string Name)
        {
            var table = ConvertDataTableToList.BindList <TagsSearchListVM>(_dataSource.SearchByName(Name.Trim()));

            if (table.Count > 0 || table.Count == 0)
            {
                return(Result <List <TagsSearchListVM> > .Successful(data : table));
            }
            return(Result <List <TagsSearchListVM> > .Failure());
        }
Exemplo n.º 11
0
        public Result <List <Category> > List()
        {
            var table = ConvertDataTableToList.BindList <Category>(_dataSource.List());

            if (table.Count > 0)
            {
                return(Result <List <Category> > .Successful(data : table));
            }
            return(Result <List <Category> > .Failure());
        }
Exemplo n.º 12
0
        public Result <List <EventsListVM> > List(int count)
        {
            var table = ConvertDataTableToList.BindList <EventsListVM>(_dataSource.List(count));

            if (table.Count > 0 || table.Count == 0)
            {
                return(Result <List <EventsListVM> > .Successful(data : table));
            }
            return(Result <List <EventsListVM> > .Failure());
        }
        public Result <List <Department> > ListByNode(string Node)
        {
            var table = ConvertDataTableToList.BindList <Department>(_dataSource.ListByNode(Node));

            if (table.Count > 0 || table.Count == 0)
            {
                return(Result <List <Department> > .Successful(data : table));
            }
            return(Result <List <Department> > .Failure());
        }
Exemplo n.º 14
0
        public Result <List <Section> > List(SectionListVM listVM)
        {
            var table = ConvertDataTableToList.BindList <Section>(_dataSource.List(listVM));

            if (table.Count > 0 || table.Count == 0)
            {
                return(Result <List <Section> > .Successful(data : table));
            }
            return(Result <List <Section> > .Failure());
        }
Exemplo n.º 15
0
        public Result <List <GetCountCategoryVM> > GetCountCategory()
        {
            var table = ConvertDataTableToList.BindList <GetCountCategoryVM>(_dataSource.GetCountCategory());

            if (table.Count > 0 || table.Count == 0)
            {
                return(Result <List <GetCountCategoryVM> > .Successful(data : table));
            }
            return(Result <List <GetCountCategoryVM> > .Failure());
        }
        public Result <List <Notification> > GetActiveNotification()
        {
            var table = ConvertDataTableToList.BindList <Notification>(_dataSource.GetActiveNotification());

            if (table.Count > 0 || table.Count == 0)
            {
                return(Result <List <Notification> > .Successful(data : table));
            }
            return(Result <List <Notification> > .Failure());
        }
        public Result <List <Attachment> > List(Guid ParentID)
        {
            var table = ConvertDataTableToList.BindList <Attachment>(_dataSource.List(ParentID));

            if (table.Count > 0 || table.Count == 0)
            {
                return(Result <List <Attachment> > .Successful(data : table));
            }
            return(Result <List <Attachment> > .Failure());
        }
Exemplo n.º 18
0
        public Result <List <ShowProductOnHomePageListVM> > ListBySellingProductType(SellingProductType type, int?count)
        {
            count = count ?? 4;
            var table = ConvertDataTableToList.BindList <ShowProductOnHomePageListVM>(_dataSource.ListBySellingProductType(type, count.Value));

            if (table.Count > 0 || table.Count == 0)
            {
                return(Result <List <ShowProductOnHomePageListVM> > .Successful(data : table));
            }
            return(Result <List <ShowProductOnHomePageListVM> > .Failure());
        }
Exemplo n.º 19
0
        public Result <List <CommentForProductAdminListVM> > List(CommentForType commentForType)
        {
            var model = ConvertDataTableToList.BindList <CommentForProductAdminListVM>(_dataSource.List(commentForType));

            if (model.Count > 0 || model.Count == 0)
            {
                return(Result <List <CommentForProductAdminListVM> > .Successful(data : model));
            }
            else
            {
                return(Result <List <CommentForProductAdminListVM> > .Failure());
            }
        }
Exemplo n.º 20
0
        public Result <List <Pages> > List()
        {
            var result = ConvertDataTableToList.BindList <Pages>(_dataSource.List());

            if (result.Count > 0 || result.Count == 0)
            {
                return(Result <List <Pages> > .Successful(data : result));
            }
            else
            {
                return(Result <List <Pages> > .Failure());
            }
        }
Exemplo n.º 21
0
        public Result <List <Comment> > List(Guid ParentID, Guid DocumentID)
        {
            var model = ConvertDataTableToList.BindList <Comment>(_dataSource.List(ParentID, DocumentID));

            if (model.Count > 0)
            {
                for (int i = 0; i < model.Count; i++)
                {
                    var list = List(model[i].ID, model[i].DocumentID);
                    model[i].Children = list.Data;
                }
                return(Result <List <Comment> > .Successful(data : model));
            }
            else
            {
                return(Result <List <Comment> > .Failure());
            }
        }
Exemplo n.º 22
0
        public Result <List <Comment> > List(CommentListVM listVM)
        {
            List <Comment> comment = new List <Comment>();
            var            model   = ConvertDataTableToList.BindList <Comment>(_dataSource.List(listVM));

            if (model.Count > 0)
            {
                for (int i = 0; i < model.Count; i++)
                {
                    comment.Add(new Comment {
                        ID = model[i].ID, Body = model[i].Body, CreationDate = model[i].CreationDate, DisLikeCount = model[i].DisLikeCount, CommentType = model[i].CommentType, LikeCount = model[i].LikeCount, Children = List(model[i].ID, model[i].DocumentID).Data, ParentID = model[i].ParentID
                    });
                }
                var list = comment.Where(x => x.ParentID == Guid.Empty).Select(x => x).ToList();
                return(Result <List <Comment> > .Successful(data : list));
            }
            else
            {
                return(Result <List <Comment> > .Failure(data : comment));
            }
        }
        private List <SqlCommand> PreUpdate(SettingVM model)
        {
            var commands = new List <SqlCommand>();
            var setting  = new SettingVM();
            var result   = ConvertDataTableToList.BindList <GeneralSetting>(List());

            if (result.Count > 0 || result.Count == 0)
            {
                setting.SiteUrl         = result.FirstOrDefault(x => x.Name.Equals("SiteUrl")).Value;
                setting.SiteName        = result.FirstOrDefault(x => x.Name.Equals("SiteName")).Value;
                setting.SiteKeyword     = result.FirstOrDefault(x => x.Name.Equals("SiteKeyword")).Value;
                setting.SiteDescription = result.FirstOrDefault(x => x.Name.Equals("SiteDescription")).Value;

                setting.Address          = result.FirstOrDefault(x => x.Name.Equals("Address")).Value;
                setting.CountShowArticle = result.FirstOrDefault(x => x.Name.Equals("CountShowArticle")).Value;
                setting.CountShowNews    = result.FirstOrDefault(x => x.Name.Equals("CountShowNews")).Value;
                setting.CountShowProduct = result.FirstOrDefault(x => x.Name.Equals("CountShowProduct")).Value;
                setting.CountShowEvents  = result.FirstOrDefault(x => x.Name.Equals("CountShowEvents")).Value;

                setting.CountShowSlider = result.FirstOrDefault(x => x.Name.Equals("CountShowSlider")).Value;
                setting.FacebookUrl     = result.FirstOrDefault(x => x.Name.Equals("FacebookUrl")).Value;
                setting.Fax             = result.FirstOrDefault(x => x.Name.Equals("Fax")).Value;
                setting.InstagramUrl    = result.FirstOrDefault(x => x.Name.Equals("InstagramUrl")).Value;

                setting.Mobile      = result.FirstOrDefault(x => x.Name.Equals("Mobile")).Value;
                setting.Phone       = result.FirstOrDefault(x => x.Name.Equals("Phone")).Value;
                setting.SiteMetaTag = result.FirstOrDefault(x => x.Name.Equals("SiteMetaTag")).Value;
                setting.TelegramUrl = result.FirstOrDefault(x => x.Name.Equals("TelegramUrl")).Value;

                setting.TwitterUrl  = result.FirstOrDefault(x => x.Name.Equals("TwitterUrl")).Value;
                setting.WhatsAppUrl = result.FirstOrDefault(x => x.Name.Equals("WhatsAppUrl")).Value;
            }


            if (setting.Address != model.Address)
            {
                SqlParameter[] param = new SqlParameter[2];
                param[0] = new SqlParameter("@Name", "Address");
                param[1] = new SqlParameter("@Value", model.Address);
                commands.Add(SQLHelper.CreateCommand("pbl.spModifyGeneralSetting", CommandType.StoredProcedure, param));
            }
            if (setting.CountShowArticle != model.CountShowArticle)
            {
                SqlParameter[] param = new SqlParameter[2];
                param[0] = new SqlParameter("@Name", "CountShowArticle");
                param[1] = new SqlParameter("@Value", model.CountShowArticle);
                commands.Add(SQLHelper.CreateCommand("pbl.spModifyGeneralSetting", CommandType.StoredProcedure, param));
            }
            if (setting.CountShowNews != model.CountShowNews)
            {
                SqlParameter[] param = new SqlParameter[2];
                param[0] = new SqlParameter("@Name", "CountShowNews");
                param[1] = new SqlParameter("@Value", model.CountShowNews);
                commands.Add(SQLHelper.CreateCommand("pbl.spModifyGeneralSetting", CommandType.StoredProcedure, param));
            }
            if (setting.CountShowProduct != model.CountShowProduct)
            {
                SqlParameter[] param = new SqlParameter[2];
                param[0] = new SqlParameter("@Name", "CountShowProduct");
                param[1] = new SqlParameter("@Value", model.CountShowProduct);
                commands.Add(SQLHelper.CreateCommand("pbl.spModifyGeneralSetting", CommandType.StoredProcedure, param));
            }
            if (setting.CountShowSlider != model.CountShowSlider)
            {
                SqlParameter[] param = new SqlParameter[2];
                param[0] = new SqlParameter("@Name", "CountShowSlider");
                param[1] = new SqlParameter("@Value", model.CountShowSlider);
                commands.Add(SQLHelper.CreateCommand("pbl.spModifyGeneralSetting", CommandType.StoredProcedure, param));
            }
            if (setting.FacebookUrl != model.FacebookUrl)
            {
                SqlParameter[] param = new SqlParameter[2];
                param[0] = new SqlParameter("@Name", "FacebookUrl");
                param[1] = new SqlParameter("@Value", model.FacebookUrl);
                commands.Add(SQLHelper.CreateCommand("pbl.spModifyGeneralSetting", CommandType.StoredProcedure, param));
            }
            if (setting.Fax != model.Fax)
            {
                SqlParameter[] param = new SqlParameter[2];
                param[0] = new SqlParameter("@Name", "Fax");
                param[1] = new SqlParameter("@Value", model.Fax);
                commands.Add(SQLHelper.CreateCommand("pbl.spModifyGeneralSetting", CommandType.StoredProcedure, param));
            }
            if (setting.InstagramUrl != model.InstagramUrl)
            {
                SqlParameter[] param = new SqlParameter[2];
                param[0] = new SqlParameter("@Name", "InstagramUrl");
                param[1] = new SqlParameter("@Value", model.InstagramUrl);
                commands.Add(SQLHelper.CreateCommand("pbl.spModifyGeneralSetting", CommandType.StoredProcedure, param));
            }
            if (setting.Mobile != model.Mobile)
            {
                SqlParameter[] param = new SqlParameter[2];
                param[0] = new SqlParameter("@Name", "Mobile");
                param[1] = new SqlParameter("@Value", model.Mobile);
                commands.Add(SQLHelper.CreateCommand("pbl.spModifyGeneralSetting", CommandType.StoredProcedure, param));
            }
            if (setting.Phone != model.Phone)
            {
                SqlParameter[] param = new SqlParameter[2];
                param[0] = new SqlParameter("@Name", "Phone");
                param[1] = new SqlParameter("@Value", model.Phone);
                commands.Add(SQLHelper.CreateCommand("pbl.spModifyGeneralSetting", CommandType.StoredProcedure, param));
            }
            if (setting.SiteDescription != model.SiteDescription)
            {
                SqlParameter[] param = new SqlParameter[2];
                param[0] = new SqlParameter("@Name", "SiteDescription");
                param[1] = new SqlParameter("@Value", model.SiteDescription);
                commands.Add(SQLHelper.CreateCommand("pbl.spModifyGeneralSetting", CommandType.StoredProcedure, param));
            }
            if (setting.SiteKeyword != model.SiteKeyword)
            {
                SqlParameter[] param = new SqlParameter[2];
                param[0] = new SqlParameter("@Name", "SiteKeyword");
                param[1] = new SqlParameter("@Value", model.SiteKeyword);
                commands.Add(SQLHelper.CreateCommand("pbl.spModifyGeneralSetting", CommandType.StoredProcedure, param));
            }
            if (setting.SiteMetaTag != model.SiteMetaTag)
            {
                SqlParameter[] param = new SqlParameter[2];
                param[0] = new SqlParameter("@Name", "SiteMetaTag");
                param[1] = new SqlParameter("@Value", model.SiteMetaTag);
                commands.Add(SQLHelper.CreateCommand("pbl.spModifyGeneralSetting", CommandType.StoredProcedure, param));
            }
            if (setting.SiteName != model.SiteName)
            {
                SqlParameter[] param = new SqlParameter[2];
                param[0] = new SqlParameter("@Name", "SiteName");
                param[1] = new SqlParameter("@Value", model.SiteName);
                commands.Add(SQLHelper.CreateCommand("pbl.spModifyGeneralSetting", CommandType.StoredProcedure, param));
            }
            if (setting.SiteUrl != model.SiteUrl)
            {
                SqlParameter[] param = new SqlParameter[2];
                param[0] = new SqlParameter("@Name", "SiteUrl");
                param[1] = new SqlParameter("@Value", model.SiteUrl);
                commands.Add(SQLHelper.CreateCommand("pbl.spModifyGeneralSetting", CommandType.StoredProcedure, param));
            }
            if (setting.TelegramUrl != model.TelegramUrl)
            {
                SqlParameter[] param = new SqlParameter[2];
                param[0] = new SqlParameter("@Name", "TelegramUrl");
                param[1] = new SqlParameter("@Value", model.TelegramUrl);
                commands.Add(SQLHelper.CreateCommand("pbl.spModifyGeneralSetting", CommandType.StoredProcedure, param));
            }
            if (setting.TwitterUrl != model.TwitterUrl)
            {
                SqlParameter[] param = new SqlParameter[2];
                param[0] = new SqlParameter("@Name", "TwitterUrl");
                param[1] = new SqlParameter("@Value", model.TwitterUrl);
                commands.Add(SQLHelper.CreateCommand("pbl.spModifyGeneralSetting", CommandType.StoredProcedure, param));
            }
            if (setting.WhatsAppUrl != model.WhatsAppUrl)
            {
                SqlParameter[] param = new SqlParameter[2];
                param[0] = new SqlParameter("@Name", "WhatsAppUrl");
                param[1] = new SqlParameter("@Value", model.WhatsAppUrl);
                commands.Add(SQLHelper.CreateCommand("pbl.spModifyGeneralSetting", CommandType.StoredProcedure, param));
            }
            if (setting.CountShowEvents != model.CountShowEvents)
            {
                SqlParameter[] param = new SqlParameter[2];
                param[0] = new SqlParameter("@Name", "CountShowEvents");
                param[1] = new SqlParameter("@Value", model.CountShowEvents);
                commands.Add(SQLHelper.CreateCommand("pbl.spModifyGeneralSetting", CommandType.StoredProcedure, param));
            }
            return(commands);
        }