Пример #1
0
        public void SetCategoryFilter(string category)
        {
            uint antFilter = m_CategoryFilter;

            if (category.Length == 0)
            {
                m_CategoryFilter = 0;
            }
            else if (category == "LBL_VIDEO")
            {
                m_CategoryFilter = uint.MaxValue - 1;
            }
            else if (category == "LBL_AUDIO")
            {
                m_CategoryFilter = uint.MaxValue - 2;
            }
            else if (category == "LBL_FILE")
            {
                m_CategoryFilter = uint.MaxValue - 3;
            }
            else
            {
                CCategory cat = krnGateway.GetCategoryByName(category);
                if (cat != null)
                {
                    m_CategoryFilter = cat.ID;
                }
            }
            if (m_CategoryFilter != antFilter)
            {
                ReloadList();
            }
        }
Пример #2
0
 public CategoryModel(CCategory oCategory)
 {
     CategoryID  = oCategory.CategoryID;
     Name        = oCategory.Name;
     Description = oCategory.Description;
     ImgPath     = oCategory.ImgPath;
 }
Пример #3
0
        public CCategory GetCategory(int id)
        {
            CCategory cCategory = new CCategory();

            cCategory = _categoryService.CategoryDetailGetById(id);
            return(cCategory);
        }
Пример #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string strID = Request.QueryString["id"];
         if ((strID == null) || (strID == "0"))
         {
             MySqlConnection  conn = CMain.GetConnection(ApplicationSession.DBName);
             List <CCategory> lst  = CCategory.ListOfCategoryZero(conn, ApplicationSession.StoreID, ApplicationSession.OutletID);
             lvwCategory.DataSource = lst;
             lvwCategory.DataBind();
         }
         else
         {
             bool isNumeric = int.TryParse(strID, out int iCategoryID);
             if (isNumeric)
             {
                 MySqlConnection conn = CMain.GetConnection(ApplicationSession.DBName);
                 CCategory       cat  = new CCategory(iCategoryID, conn);
                 lblTitle.Text = cat.Caption;
                 List <CCategory> lst = cat.ListOfChildren(conn);
                 lvwCategory.DataSource = lst;
                 lvwCategory.DataBind();
             }
         }
     }
 }
Пример #5
0
        public void DisplayModalDialog_CategoryInfo()
        {
            CCategory cat = ApplicationSession.category;

            lblName_CategoryInfo.InnerText = cat.Caption;
            if (cat.OrderDate != null)
            {
                DateTime dt = (DateTime)cat.OrderDate;
                txtDate_CategoryInfo.Text = dt.ToString("yyyy-MM-dd");
                txtTime_CategoryInfo.Text = dt.ToString("hh\\:mm");
            }

            if (cat.OrderQty == 0)
            {
                cat.OrderQty = cat.MinQty;
            }
            txtQty_CategoryInfo.Text = cat.OrderQty_ToString;

            if (cat.MinQty > 0)
            {
                lblMinQty_CategoryInfo.Visible = true;
                lblMinQty_CategoryInfo.Text    = "Minimum Order: " + cat.MinQty_ToString + " pax";
            }
            else
            {
                lblMinQty_CategoryInfo.Visible = false;
            }
            ShowModalDialog_CategoryInfo();
        }
        protected void MasterCatInfoEdit(object sender, EventArgs e)
        {
            CCategory cat = ApplicationSession.category;

            lblDateOfFunction.Text = cat.OrderDate_ToString;
            lblNoOfPax.Text        = cat.OrderQty_ToString;
            //UpdatePanel1.Update();
        }
Пример #7
0
        private void _UpdateList(int offset, bool force = false)
        {
            bool isInCategory = CBase.Songs.IsInCategory();
            int  itemCount    = isInCategory ? CBase.Songs.GetNumSongsVisible() : CBase.Songs.GetNumCategories();

            itemCount += 2 * _LAdj;
            int totalSongNumber = CBase.Songs.GetNumSongs();

            offset = offset.Clamp(0, itemCount - _ListLength, true);

            if (offset == _Offset && !force)
            {
                return;
            }

            for (int i = 0; i < _Covers.Count; i++)
            {
                if (offset + i < _LAdj || offset + i > itemCount - _LAdj - 1)
                {
                    _Covers[i].Visible = false;
                    _Tiles[i].Visible  = false;
                    _Covers[i].Texture = _CoverBGTexture;
                    _Artists[i].Text   = "";
                    _Titles[i].Text    = "";
                }
                else if (i - _LAdj + offset < itemCount - _LAdj)
                {
                    _Covers[i].Color   = new SColorF(1f, 1f, 1f, 1f);
                    _Covers[i].Visible = true;
                    _Tiles[i].Visible  = true;
                    if (isInCategory)
                    {
                        CSong currentSong = CBase.Songs.GetVisibleSong(i - _LAdj + offset);
                        _Covers[i].Texture = currentSong.CoverTextureSmall;
                        _Artists[i].Text   = currentSong.Artist;
                        _Titles[i].Text    = currentSong.Title;
                    }
                    else
                    {
                        CCategory currentCat = CBase.Songs.GetCategory(i - _LAdj + offset);
                        _Covers[i].Texture = currentCat.CoverTextureSmall;
                        int    num         = currentCat.GetNumSongsNotSung();
                        String songOrSongs = (num == 1) ? "TR_SCREENSONG_NUMSONG" : "TR_SCREENSONG_NUMSONGS";
                        _Titles[i].Text  = currentCat.Name;
                        _Artists[i].Text = CBase.Language.Translate(songOrSongs).Replace("%v", num.ToString());
                    }
                }
                else
                {
                    _Covers[i].Visible = false;
                    _Tiles[i].Visible  = false;
                    _Covers[i].Texture = _CoverBGTexture;
                    _Artists[i].Text   = "";
                    _Titles[i].Text    = "";
                }
            }
            _Offset = offset;
        }
Пример #8
0
        public async void LoadData()
        {
            try
            {
                Int32 countCategory = 0;
                Int32 countBook     = 0;
                Int32 countAuthor   = 0;
                IEnumerable <String> categotiesNames = await this.GetFoldersNames();

                List <CCategory> _categories = new List <CCategory>();
                List <CBook>     _books      = new List <CBook>();
                List <CAuthor>   _authors    = new List <CAuthor>();

                foreach (String cat in categotiesNames)
                {
                    CCategory currentCategory = new CCategory {
                        Id = ++countCategory, Name = cat, Books = new List <CBook>()
                    };
                    IEnumerable <CBook> booksByCategory = await this.GetBooksFromFolder(cat);


                    foreach (CBook book in booksByCategory)
                    {
                        List <Int32>    currentBookAuthorsIds = new List <Int32>();
                        MatchCollection matches = Regex.Matches(book.Name, authorNamePattern);
                        foreach (Match match in matches)
                        {
                            if (_authors.Where(x => x.Name == match.Value).Count() == 0)
                            {
                                _authors.Add(new CAuthor {
                                    Name = match.Value, Id = ++countAuthor
                                });
                                currentBookAuthorsIds.Add(countAuthor);
                            }
                            else
                            {
                                currentBookAuthorsIds.Add(_authors.Where(x => x.Name == match.Value).FirstOrDefault().Id);
                            }
                        }
                        book.Name       = book.Name.Substring(book.Name.IndexOf(']') + 2);
                        book.Id         = ++countBook;
                        book.CategoryId = countCategory;
                        book.AuthorsIds = currentBookAuthorsIds.ToArray();
                        _books.Add(book);
                        currentCategory.Books.Add(book);
                    }
                    _categories.Add(currentCategory);
                }
                this.Books      = _books;
                this.Categories = _categories;
                this.Authors    = _authors;
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error " + ex.Message);             //todo: NLog
            }
        }
Пример #9
0
 private void _FillCategorySlide()
 {
     _SelectSlides[_SelectSlideCategory].Clear();
     for (int i = 0; i < CBase.Songs.GetNumCategories(); i++)
     {
         CCategory cat   = CBase.Songs.GetCategory(i);
         string    value = cat.Name + " (" + cat.GetNumSongsNotSung() + " " + CBase.Language.Translate("TR_SONGS", PartyModeID) + ")";
         _SelectSlides[_SelectSlideCategory].AddValue(value);
     }
 }
Пример #10
0
        public void DisplayDropdownMenu()
        {
            MySqlConnection conn = CMain.GetConnection(ApplicationSession.DBName);

            if (ApplicationSession.SalesType.IsCatering())
            {
                //Category:
                List <CCategory> lst = CCategory.ListOfCategoryZero(conn, ApplicationSession.StoreID, ApplicationSession.OutletID);
                foreach (CCategory cat in lst)
                {
                    HtmlGenericControl li = new HtmlGenericControl("li");
                    tabs.Controls.Add(li);
                    HtmlGenericControl anchor = new HtmlGenericControl("a");
                    string             url    = "CategoryPage.aspx?id=" + cat.ID.ToString();
                    anchor.Attributes.Add("href", url);
                    //anchor.Attributes.Add("runat", "server");
                    //anchor.Attributes.Add("onclick", "return MyFunction();");
                    anchor.InnerText = cat.Caption;
                    li.Controls.Add(anchor);
                }
            }
            else
            {
                //ItemGroups:
                List <CItemGroup> lst = COutlet.ListOfItemGroups(conn, ApplicationSession.StoreID, ApplicationSession.OutletID);
                foreach (CItemGroup ig in lst)
                {
                    HtmlGenericControl li = new HtmlGenericControl("li");
                    tabs.Controls.Add(li);
                    HtmlGenericControl anchor = new HtmlGenericControl("a");
                    string             url    = "MenuItemPage.aspx?id=" + ig.ID.ToString();
                    anchor.Attributes.Add("href", url);
                    //anchor.Attributes.Add("runat", "server");
                    //anchor.Attributes.Add("onclick", "return MyFunction();");
                    anchor.InnerText = ig.Name;
                    li.Controls.Add(anchor);
                }
            }

            //DeliveryMethods:
            List <CDeliveryMode> lstDelMode = COutlet.ListOfDeliveryModes(conn, ApplicationSession.StoreID, ApplicationSession.OutletID);

            foreach (CDeliveryMode delMode in lstDelMode)
            {
                HtmlGenericControl li = new HtmlGenericControl("li");
                delTabs.Controls.Add(li);
                HtmlGenericControl anchor = new HtmlGenericControl("a");
                //string url = "MenuItemPage.aspx?id=" + ig.ID.ToString();
                //anchor.Attributes.Add("href", url);
                //anchor.Attributes.Add("runat", "server");
                //anchor.Attributes.Add("onclick", "return MyFunction();");
                anchor.InnerText = delMode.Name;
                li.Controls.Add(anchor);
            }
        }
Пример #11
0
        private void tabControl1_Selected(object sender, TabControlEventArgs e)
        {
            _currentTab = e.TabPage.Tag.ToString();

            switch (_currentTab)
            {
            case "GENERAL":
                butSave.Enabled = true;
                butSave.Text    = "Save General Info";
                break;

            case "CONSUMPTION":
                butSave.Enabled = true;
                butSave.Text    = "Save Consumption";

                if (!_contabSelected)
                {
                    DataUsageEnum duenum = (DataUsageEnum)Enum.Parse(typeof(DataUsageEnum), _forecastInfo.DataUsage);
                    switch (duenum)
                    {
                    case DataUsageEnum.DATA_USAGE1:
                        CDataUsage ctr = new CDataUsage(_forecastInfo);
                        //  ctr.OnDataUsageEdit += new EventHandler(ctr_OnDataUsageEdit);
                        ctr.ForecastInfoDataChanged += new EventHandler <EventArgs>(ctr_ForecastInfoDataChanged);
                        ctr.Dock = DockStyle.Fill;
                        tabConsumption.Controls.Add(ctr);
                        break;

                    case DataUsageEnum.DATA_USAGE2:
                        CReported ctr1 = new CReported(_forecastInfo);
                        ctr1.ForecastInfoDataChanged += new EventHandler <EventArgs>(ctr_ForecastInfoDataChanged);
                        ctr1.Dock = DockStyle.Fill;
                        tabConsumption.Controls.Add(ctr1);
                        break;

                    case DataUsageEnum.DATA_USAGE3:
                        CCategory ctr2 = new CCategory(_forecastInfo);
                        ctr2.ForecastInfoDataChanged += new EventHandler <EventArgs>(ctr_ForecastInfoDataChanged);
                        ctr2.Dock = DockStyle.Fill;
                        tabConsumption.Controls.Add(ctr2);
                        break;
                    }
                    _contabSelected = true;
                }

                break;

            case "REPORT":
                butSave.Enabled = false;
                break;
            }
        }
Пример #12
0
        private void _UpdateList(int offset, bool force = false)
        {
            bool isInCategory    = CBase.Songs.IsInCategory();
            int  itemCount       = isInCategory ? CBase.Songs.GetNumSongsVisible() : CBase.Songs.GetNumCategories();
            int  totalSongNumber = CBase.Songs.GetNumSongs();

            offset = offset.Clamp(0, itemCount - _ListLength, true);

            if (offset == _Offset && !force)
            {
                return;
            }

            for (int i = 0; i < _Tiles.Count; i++)
            {
                if (i + offset < itemCount)
                {
                    _Tiles[i].Color = new SColorF(1f, 1f, 1f, 1f);
                    if (isInCategory)
                    {
                        CSong currentSong = CBase.Songs.GetVisibleSong(i + offset);
                        _Tiles[i].Texture = currentSong.CoverTextureSmall;

                        if (CBase.Config.GetSongSorting() == ESongSorting.TR_CONFIG_TITLE_LETTER)
                        {
                            _Texts[i].Text = currentSong.Title + " - " + currentSong.Artist;
                        }
                        else
                        {
                            _Texts[i].Text = currentSong.Artist + " - " + currentSong.Title;
                        }
                    }
                    else
                    {
                        CCategory currentCat = CBase.Songs.GetCategory(i + offset);
                        _Tiles[i].Texture = currentCat.CoverTextureSmall;
                        int    num         = currentCat.GetNumSongsNotSung();
                        String songOrSongs = (num == 1) ? "TR_SCREENSONG_NUMSONG" : "TR_SCREENSONG_NUMSONGS";
                        _Texts[i].Text = currentCat.Name + " " + CBase.Language.Translate(songOrSongs).Replace("%v", num.ToString());
                    }
                }
                else
                {
                    _Tiles[i].Color.A = 0;
                    _Texts[i].Text    = "";
                }
            }
            _Offset = offset;
        }
Пример #13
0
    public static CCategory GetCategoryInfo(int catId, int langid, bool useCache)
    {
        if (useCache && catInfoCache != null && catInfoCache.ContainsKey(catId))
        {
            return(catInfoCache[catId]);
        }

        Hashtable pars = new Hashtable();

        pars["catid"]  = catId;
        pars["langid"] = langid;
        CCategory pi = GetObject <CCategory>("GetCategoryInfo", pars);

        catInfoCache[catId] = pi;
        return(pi);
    }
Пример #14
0
        private List <ViewMenuItem> InsertViewSubMenu(List <CMenuItem> list, string lang)
        {
            DbDataContext       db = new DbDataContext("CloudAppWebSiteView");
            List <ViewMenuItem> mm = new List <ViewMenuItem>();

            foreach (var p in list.Where(k => k.ActiveStatus == EActiveStatus.Active).OrderBy(p => p.Order))
            {
                if (p.MenuType == EMenuType.Category)
                {
                    mm.Add(new ViewMenuItem {
                        Name = p.LanguageValues.FirstOrDefault(f => f.Lang == lang) != null ? p.LanguageValues.FirstOrDefault(f => f.Lang == lang).Name : "-", Url = GetUrlString(p.CategoryId.Value, EMenuType.Category, p.OrganizationId.Value, lang)
                    });
                }
                else if (p.MenuType == EMenuType.CategoryContent)
                {
                    CCategory cg = db.Categories.Where(t => t.OrganizationId == p.OrganizationId && t.ActiveStatus == EActiveStatus.Active && t.Id == p.CategoryId.Value).FirstOrDefault();
                    InsertCotegoryContent(cg, lang);
                }
                else if (p.MenuType == EMenuType.Root)
                {
                    ViewMenuItem ii = new ViewMenuItem();
                    ii.Name = p.LanguageValues.FirstOrDefault(f => f.Lang == lang) != null?p.LanguageValues.FirstOrDefault(f => f.Lang == lang).Name : "-";

                    ii.Url = p.Url;
                    if (p.SubMenu != null)
                    {
                        ii.SubMenu = InsertViewSubMenu(p.SubMenu.ToList(), lang);
                    }
                    mm.Add(new ViewMenuItem {
                        Name = p.LanguageValues.FirstOrDefault(f => f.Lang == lang) != null ? p.LanguageValues.FirstOrDefault(f => f.Lang == lang).Name : "-", Url = "#"
                    });
                }
                else if (p.MenuType == EMenuType.Text)
                {
                    mm.Add(new ViewMenuItem {
                        Name = p.LanguageValues.FirstOrDefault(f => f.Lang == lang) != null ? p.LanguageValues.FirstOrDefault(f => f.Lang == lang).Name : "-", Url = GetUrlString(p.TextId.Value, EMenuType.Text, p.OrganizationId.Value, lang)
                    });
                }
                else if (p.MenuType == EMenuType.Url)
                {
                    mm.Add(new ViewMenuItem {
                        Name = p.LanguageValues.FirstOrDefault(f => f.Lang == lang) != null ? p.LanguageValues.FirstOrDefault(f => f.Lang == lang).Name : "-", Url = p.Url
                    });
                }
            }
            return(mm);
        }
Пример #15
0
        public List <ViewMenuItem> GetViewMenu(CMenu item, string lang)
        {
            //List<ViewMenuItem> itemList = new List<ViewMenuItem>();
            lang = lang.ToLower();
            DbDataContext db = new DbDataContext("CloudAppWebSiteView");

            foreach (var p in item.MenuItem.Where(k => k.ActiveStatus == EActiveStatus.Active).OrderBy(p => p.Order).ToList())
            {
                if (p.MenuType == EMenuType.Category)
                {
                    MenuList.Add(new ViewMenuItem {
                        Name = p.LanguageValues.FirstOrDefault(f => f.Lang.ToLower() == lang) != null ? p.LanguageValues.FirstOrDefault(f => f.Lang.ToLower() == lang).Name : "-", Url = GetUrlString(p.CategoryId.Value, EMenuType.Category, p.OrganizationId.Value, lang)
                    });
                }
                else if (p.MenuType == EMenuType.CategoryContent)
                {
                    CCategory cg = db.Categories.Where(t => t.OrganizationId == item.OrganizationId && t.ActiveStatus == EActiveStatus.Active && t.Id == p.CategoryId.Value).FirstOrDefault();
                    InsertCotegoryContent(cg, lang);
                }
                else if (p.MenuType == EMenuType.Root)
                {
                    ViewMenuItem ii = new ViewMenuItem();
                    ii.Name = p.LanguageValues.FirstOrDefault(f => f.Lang.ToLower() == lang) != null?p.LanguageValues.FirstOrDefault(f => f.Lang.ToLower() == lang).Name : "-";

                    ii.Url = "#";
                    if (p.SubMenu != null)
                    {
                        ii.SubMenu = InsertViewSubMenu(p.SubMenu.ToList(), lang);
                    }
                    MenuList.Add(ii);
                }
                else if (p.MenuType == EMenuType.Text)
                {
                    MenuList.Add(new ViewMenuItem {
                        Name = p.LanguageValues.FirstOrDefault(f => f.Lang.ToLower() == lang) != null ? p.LanguageValues.FirstOrDefault(f => f.Lang.ToLower() == lang).Name : "-", Url = GetUrlString(p.TextId.Value, EMenuType.Text, p.OrganizationId.Value, lang)
                    });
                }
                else if (p.MenuType == EMenuType.Url)
                {
                    MenuList.Add(new ViewMenuItem {
                        Name = p.LanguageValues.FirstOrDefault(f => f.Lang.ToLower() == lang) != null ? p.LanguageValues.FirstOrDefault(f => f.Lang.ToLower() == lang).Name : "-", Url = p.Url
                    });
                }
            }
            return(MenuList);
        }
Пример #16
0
        private void _RebuildSlides()
        {
            // build num player slide (min player ... max player);
            _SelectSlides[_SelectSlideNumPlayers].Clear();
            for (int i = _PartyMode.MinPlayers; i <= _PartyMode.MaxPlayers; i++)
            {
                _SelectSlides[_SelectSlideNumPlayers].AddValue(i.ToString());
            }
            _SelectSlides[_SelectSlideNumPlayers].Selection = _PartyMode.GameData.NumPlayer - _PartyMode.MinPlayers;

            _SelectSlides[_SelectSlideNumSongs].Clear();
            for (int i = _PartyMode.MinSongs; i <= _PartyMode.MaxSongs; i++)
            {
                _SelectSlides[_SelectSlideNumSongs].AddValue(i.ToString());
            }
            _SelectSlides[_SelectSlideNumSongs].Selection = _PartyMode.GameData.NumSongs - _PartyMode.MinSongs;

            _SelectSlides[_SelectSlideSongSource].Clear();
            _SelectSlides[_SelectSlideSongSource].SetValues <ESongSource>((int)_PartyMode.GameData.SongSource);

            List <string> playlists = CBase.Playlist.GetNames();

            _SelectSlides[_SelectSlidePlaylist].Clear();
            for (int i = 0; i < playlists.Count; i++)
            {
                string value = playlists[i] + " (" + CBase.Playlist.GetSongCount(i) + " " + CBase.Language.Translate("TR_SONGS", PartyModeID) + ")";
                _SelectSlides[_SelectSlidePlaylist].AddValue(value);
            }
            _SelectSlides[_SelectSlidePlaylist].Selection = _PartyMode.GameData.PlaylistID;
            _SelectSlides[_SelectSlidePlaylist].Visible   = _PartyMode.GameData.SongSource == ESongSource.TR_PLAYLIST;

            _SelectSlides[_SelectSlideCategory].Clear();
            for (int i = 0; i < CBase.Songs.GetNumCategories(); i++)
            {
                CCategory cat   = CBase.Songs.GetCategory(i);
                string    value = cat.Name + " (" + cat.GetNumSongsNotSung() + " " + CBase.Language.Translate("TR_SONGS", PartyModeID) + ")";
                _SelectSlides[_SelectSlideCategory].AddValue(value);
            }
            _SelectSlides[_SelectSlideCategory].Selection = _PartyMode.GameData.CategoryIndex;
            _SelectSlides[_SelectSlideCategory].Visible   = _PartyMode.GameData.SongSource == ESongSource.TR_CATEGORY;

            _UpdateMicsAtOnce();
            _SetRoundSteps();
            _UpdateSlideRounds();
        }
        public ActionResult Edit(int id)
        {
            try
            {
                // USED IN POST METHOD
                ViewBag.IsSuccess = 0;
                ViewBag.Message   = "";
                fnSetProperties();

                CCategory     category         = CFCategory.CategoryDetailGetById(id);
                CategoryModel objCategoryModel = new CategoryModel(category);
                return(View(objCategoryModel));
            }
            catch (Exception ex)
            {
                return(RedirectToAction("Index", "Error", new { Message = ex.Message, InnerException = ex.InnerException }));
            }
        }
Пример #18
0
        protected void lvwCategory_ItemDataBound(object sender, ListViewItemEventArgs e)
        {
            using (ListViewDataItem item = (ListViewDataItem)e.Item)
            {
                if (item != null)
                {
                    HiddenField hf    = (HiddenField)item.FindControl("hf_Category");
                    CCategory   cat   = (CCategory)item.DataItem;
                    string      sJson = JsonConvert.SerializeObject(cat);
                    hf.Value = sJson;

                    Label lblPrice = (Label)item.FindControl("lblPrice");
                    if (cat.Price == 0)
                    {
                        lblPrice.Visible = false;
                    }
                    else
                    {
                        lblPrice.Visible = true;
                        lblPrice.Text    = cat.UnitPrice_ToString;
                    }

                    LinkButton btn = (LinkButton)item.FindControl("btnDetail");
                    btn.Visible = true;

                    if (cat.HasDetail)
                    {
                        if (cat.MinQty > 0)
                        {
                            Label lblDesc = (Label)item.FindControl("lblDesc");
                            lblDesc.Text = "Minimum Order: " + cat.MinQty_ToString + " pax";
                        }
                        btn.Text = "order";
                    }
                    else
                    {
                        btn.Text = "view";
                    }
                }
            }
        }
Пример #19
0
        public ViewPartialObject GetCategoryPartial(int id, HttpRequestBase req)
        {
            string rootPah = "~/blog/Theme/";
            int    orgId   = GetOrganizationId(req);

            rootPah += orgId.ToString() + "/Views/CategoryPartial/";
            DbDataContext     db     = new DbDataContext("CloudAppWebSiteView");
            ViewPartialObject view   = new ViewPartialObject();
            CCategory         slider = db.Categories.Where(p => p.ActiveStatus == EActiveStatus.Active && p.OrganizationId == orgId && p.Id == id).FirstOrDefault();

            if (slider != null)
            {
                view.ViewName  = rootPah + slider.ItemTheme.ThemePath;
                view.ViewModel = slider;
                return(view);
            }
            else
            {
                return(null);
            }
        }
Пример #20
0
        private void _FillSlides()
        {
            _SelectSlides[_SelectSlideNumFields].Clear();
            _SelectSlides[_SelectSlideNumFields].AddValue(9);
            _SelectSlides[_SelectSlideNumFields].AddValue(16);
            _SelectSlides[_SelectSlideNumFields].AddValue(25);

            _SelectSlides[_SelectSlideNumFields].SelectedTag = _PartyMode.GameData.NumFields;

            _SelectSlides[_SelectSlideSongSource].Clear();
            _SelectSlides[_SelectSlideSongSource].SetValues <ESongSource>((int)_PartyMode.GameData.SongSource);

            List <string> playlists = CBase.Playlist.GetNames();

            _SelectSlides[_SelectSlidePlaylist].Clear();
            for (int i = 0; i < playlists.Count; i++)
            {
                string value = playlists[i] + " (" + CBase.Playlist.GetSongCount(i) + " " + CBase.Language.Translate("TR_SONGS", PartyModeID) + ")";
                _SelectSlides[_SelectSlidePlaylist].AddValue(value);
            }
            _SelectSlides[_SelectSlidePlaylist].Selection = _PartyMode.GameData.PlaylistID;
            _SelectSlides[_SelectSlidePlaylist].Visible   = _PartyMode.GameData.SongSource == ESongSource.TR_PLAYLIST;

            _SelectSlides[_SelectSlideCategory].Clear();
            for (int i = 0; i < CBase.Songs.GetNumCategories(); i++)
            {
                CCategory cat   = CBase.Songs.GetCategory(i);
                string    value = cat.Name + " (" + cat.GetNumSongsNotSung() + " " + CBase.Language.Translate("TR_SONGS", PartyModeID) + ")";
                _SelectSlides[_SelectSlideCategory].AddValue(value);
            }
            _SelectSlides[_SelectSlideCategory].Selection = _PartyMode.GameData.CategoryIndex;
            _SelectSlides[_SelectSlideCategory].Visible   = _PartyMode.GameData.SongSource == ESongSource.TR_CATEGORY;

            _SelectSlides[_SelectSlideGameMode].Visible = true;
            _SelectSlides[_SelectSlideGameMode].Clear();
            _SelectSlides[_SelectSlideGameMode].AddValues(_PartyMode.AvailableGameModes.Select(gm => gm.ToString()));
            _SelectSlides[_SelectSlideGameMode].Selection = _PartyMode.GameData.GameMode;
        }
Пример #21
0
        public List <ViewNavigation> GetCategoryNavigation(CCategory text, HttpRequestBase req, string lang)
        {
            List <ViewNavigation> nList = new List <ViewNavigation>();
            DbDataContext         db    = new DbDataContext("CloudAppWebSiteView");
            SeoUrlController      sc    = new SeoUrlController();

            nList.Add(new ViewNavigation {
                Name = "Anasayfa", Level = -1, Url = "#"
            });
            nList.Add(new ViewNavigation {
                Name = text.LanguageValues.FirstOrDefault(f => f.Lang == lang) != null ? text.LanguageValues.FirstOrDefault(f => f.Lang == lang).Name : "-", Level = 999, Url = sc.GetUrlString(text.Id, EMenuType.Category, text.OrganizationId.Value, lang)
            });
            if (text.TopCategory != null)
            {
                nList.Add(new ViewNavigation {
                    Name = text.TopCategory.LanguageValues.FirstOrDefault(f => f.Lang == lang) != null ? text.TopCategory.LanguageValues.FirstOrDefault(f => f.Lang == lang).Name : "-", Level = 4, Url = sc.GetUrlString(text.TopCategory.Id, EMenuType.Category, GetOrganizationId(req), lang)
                });
                if (text.TopCategory.TopCategory != null)
                {
                    nList.Add(new ViewNavigation {
                        Name = text.TopCategory.TopCategory.LanguageValues.FirstOrDefault(f => f.Lang == lang) != null ? text.TopCategory.TopCategory.LanguageValues.FirstOrDefault(f => f.Lang == lang).Name : "-", Level = 3, Url = sc.GetUrlString(text.TopCategory.TopCategory.Id, EMenuType.Category, GetOrganizationId(req), lang)
                    });
                    if (text.TopCategory.TopCategory.TopCategory != null)
                    {
                        nList.Add(new ViewNavigation {
                            Name = text.TopCategory.TopCategory.TopCategory.LanguageValues.FirstOrDefault(f => f.Lang == lang) != null ? text.TopCategory.TopCategory.TopCategory.LanguageValues.FirstOrDefault(f => f.Lang == lang).Name : "-", Level = 2, Url = sc.GetUrlString(text.TopCategory.TopCategory.TopCategory.Id, EMenuType.Category, GetOrganizationId(req), lang)
                        });
                        if (text.TopCategory.TopCategory.TopCategory.TopCategory != null)
                        {
                            nList.Add(new ViewNavigation {
                                Name = text.TopCategory.TopCategory.TopCategory.TopCategory.LanguageValues.FirstOrDefault(f => f.Lang == lang) != null ? text.TopCategory.TopCategory.TopCategory.TopCategory.LanguageValues.FirstOrDefault(f => f.Lang == lang).Name : "-", Level = 1, Url = sc.GetUrlString(text.TopCategory.TopCategory.TopCategory.TopCategory.Id, EMenuType.Category, GetOrganizationId(req), lang)
                            });
                        }
                    }
                }
            }
            return(nList);
        }
Пример #22
0
        public ActionResult GetCategory(string cat)
        {
            bool isOnline = GetOrganizationIsOnline(Request);

            if (isOnline == false)
            {
                return(RedirectToAction("AppOffline", "HomePage"));
            }
            SetTheme();
            int           orgId = GetOrganizationId(Request);
            DbDataContext db    = new DbDataContext("CloudAppWebSiteView");
            int           id    = Convert.ToInt32(StaticWebUtilities.GetQueryId(cat));
            CCategory     text  = db.Categories.Where(p => p.ActiveStatus == EActiveStatus.Active && p.OrganizationId == orgId && p.Id == id).FirstOrDefault();

            if (text != null)
            {
                return(View(text));
            }
            else
            {
                return(View());
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            lblMessage.Text = "";
            if (!IsPostBack)
            {
                CCategory cat = ApplicationSession.category;
                if (cat.IsEmpty())
                {
                    lblMessage.Text = "No Record of Category";
                }
                else
                {
                    MySqlConnection conn = CMain.GetConnection(ApplicationSession.DBName);
                    lblTitle.Text = cat.Caption;
                    List <CCatGroup> lst = cat.ListOfCategoryGroup(conn, ApplicationSession.StoreID, ApplicationSession.OutletID);
                    lvwCatGroup.DataSource = lst;
                    lvwCatGroup.DataBind();

                    lblDateOfFunction.Text = cat.OrderDate_ToString;
                    lblNoOfPax.Text        = cat.OrderQty_ToString;
                }
            }
        }
Пример #24
0
        public CCategory CategoryDetailGetById(int CategoryID)
        {
            CCategory oResult = new CCategory();

            try
            {
                // SELECT THE INFORMATION FROM THE STORE-PROCEDURE AND SET INFORMATION TO THE DATASET
                DataSet dsCategoryInfo = _sqlService.GetDataSet("TCategoryInfo", "uspCategoryInfoGet " + CategoryID);

                using (DataTable dtCategoryInfo = dsCategoryInfo.Tables["TCategoryInfo"])
                {
                    if (dtCategoryInfo.Rows.Count > 0 && CategoryID > 0)
                    {
                        oResult.CategoryID    = Convert.ToInt32(dtCategoryInfo.Rows[0]["CategoryID"].ToString());
                        oResult.Name          = dtCategoryInfo.Rows[0]["Name"].ToString();
                        oResult.Description   = dtCategoryInfo.Rows[0]["Description"].ToString();
                        oResult.ImgPath       = _sqlService.ImagePathGet(dtCategoryInfo.Rows[0]["LogoImage"].ToString(), 0, string.Empty);
                        oResult.Success       = true;
                        oResult.WasSuccessful = 1;
                    }
                    else
                    {
                        oResult.Success       = false;
                        oResult.WasSuccessful = 0;
                        oResult.Exception     = "No Record Found!";
                    }
                    return(oResult);
                }
            }
            catch (Exception ex)
            {
                oResult.Success       = false;
                oResult.WasSuccessful = 0;
                oResult.Exception     = ex.Message;
                return(oResult);
            }
        }
Пример #25
0
        protected void lvwCategory_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            ListViewItem item = e.Item;
            HiddenField  hf   = (HiddenField)item.FindControl("hf_Category");
            CCategory    cat  = JsonConvert.DeserializeObject <CCategory>(hf.Value);

            if ((cat != null) && (!cat.IsEmpty()))
            {
                ApplicationSession.category = cat;
                if (cat.HasDetail)
                {
                    MySqlConnection conn = CMain.GetConnection(ApplicationSession.DBName);
                    if (cat.HasMenuOption(conn, ApplicationSession.StoreID, ApplicationSession.OutletID))
                    {
                        Master.DisplayModalDialog_CategoryInfo();
                    }
                }
                else
                {
                    string url = "CategoryPage.aspx?id=" + cat.ID.ToString();
                    Response.Redirect(url);
                }
            }
        }
        private void CreateObjectMyCart(List <CCatDetail> lstCatDetail)
        {
            CCategory cat = ApplicationSession.category;

            ApplicationSession.idx += 1;
            int          flg = (int)CSalesDetail.EFlagStatus.TRANS_ITEM;
            CSalesDetail sd  = new CSalesDetail(ApplicationSession.idx, cat.ID, "Category", cat.Caption, "", cat.OrderQty, cat.Price,
                                                "", cat.Notes, "", 0, ApplicationSession.StoreID,
                                                ApplicationSession.OutletID, flg, ApplicationSession.ChairNo);

            flg = (flg | (int)CSalesDetail.EFlagStatus.TYPE_DETAIL);
            foreach (CCatDetail catDetail in lstCatDetail)
            {
                ApplicationSession.idx += 1;
                CSalesDetail obj = new CSalesDetail(ApplicationSession.idx, catDetail.ItemMasterID, catDetail.ItemCode, catDetail.ItemName,
                                                    catDetail.GroupName, catDetail.ItemQty, catDetail.ItemPrice, catDetail.UnitSymbol, catDetail.Notes, "", 0, ApplicationSession.StoreID,
                                                    ApplicationSession.OutletID, flg, ApplicationSession.ChairNo);
                sd.Children.Add(obj);
            }

            ApplicationSession.SalesMaster.CollectionSalesDetail().Add(sd);
            //Master.MyProperty = ApplicationSession.QtyCart;
            Master.DisplayOrderItem(sd);
        }
Пример #27
0
        private void _UpdatePreview()
        {
            //First hide everything so we just have to set what we actually want
            _CoverBig.Texture       = _CoverBigBGTexture;
            _Artist.Text            = String.Empty;
            _Title.Text             = String.Empty;
            _SongLength.Text        = String.Empty;
            _SongYear.Text          = String.Empty;
            _DuetIcon.Visible       = false;
            _VideoIcon.Visible      = false;
            _MedleyCalcIcon.Visible = false;
            _MedleyTagIcon.Visible  = false;
            _Length = -1f;

            //Check if nothing is selected (for preview)
            if (_PreviewNr < 0)
            {
                return;
            }

            if (CBase.Songs.IsInCategory())
            {
                CSong song = CBase.Songs.GetVisibleSong(_PreviewNr);
                //Check if we have a valid song (song still visible, index >=0 etc is checked by framework)
                if (song == null)
                {
                    //Display at least the category
                    CCategory category = CBase.Songs.GetCategory(CBase.Songs.GetCurrentCategoryIndex());
                    //Check if we have a valid category
                    if (category == null)
                    {
                        return;
                    }
                    _CoverBig.Texture = category.CoverTextureBig;
                    _Artist.Text      = category.Name;
                    return;
                }
                _CoverBig.Texture       = song.CoverTextureBig;
                _Artist.Text            = song.Artist;
                _Title.Text             = song.Title;
                _SongYear.Text          = song.Year;
                _DuetIcon.Visible       = song.IsDuet;
                _VideoIcon.Visible      = song.VideoFileName != "";
                _MedleyCalcIcon.Visible = song.Medley.Source == EDataSource.Calculated;
                _MedleyTagIcon.Visible  = song.Medley.Source == EDataSource.Tag;

                _UpdateLength(song);
            }
            else
            {
                CCategory category = CBase.Songs.GetCategory(_PreviewNr);
                //Check if we have a valid category
                if (category == null)
                {
                    return;
                }
                _CoverBig.Texture = category.CoverTextureBig;
                _Artist.Text      = category.Name;

                int    num         = category.GetNumSongsNotSung();
                String songOrSongs = (num == 1) ? "TR_SCREENSONG_NUMSONG" : "TR_SCREENSONG_NUMSONGS";
                _Title.Text = CBase.Language.Translate(songOrSongs).Replace("%v", num.ToString());
            }
        }
Пример #28
0
        public ActionResult GetCategory(string id, string page)
        {
            DbDataContext db    = new DbDataContext("CloudAppWebSite");
            int           orgId = GetOrganizationId();

            if (orgId == 0)
            {
                return(Redirect("/blog/Admin/Home/Index"));
            }
            int intId   = Convert.ToInt32(id);
            int intPage = Convert.ToInt32(page);
            List <CCategory> CategoryList;

            ViewBag.CurrentPage = page;
            if (intId == 0)
            {
                CategoryList      = db.Categories.Where(item => item.OrganizationId == orgId && item.SubCategoryId == null && item.ActiveStatus == EActiveStatus.Active).OrderByDescending(item => item.Id).Skip((intPage - 1) * PageSize).Take(PageSize).ToList();
                ViewBag.ListCount = db.Categories.Where(item => item.OrganizationId == orgId && item.SubCategoryId == null && item.ActiveStatus == EActiveStatus.Active).Count();
            }
            else
            {
                CategoryList      = db.Categories.Where(item => item.OrganizationId == orgId && item.SubCategoryId == intId && item.ActiveStatus == EActiveStatus.Active).OrderByDescending(item => item.Id).Skip((intPage - 1) * PageSize).Take(PageSize).ToList();
                ViewBag.ListCount = db.Categories.Where(item => item.OrganizationId == orgId && item.SubCategoryId == intId && item.ActiveStatus == EActiveStatus.Active).Count();
            }
            CCategory cat = null;

            if (intId != 0)
            {
                cat = db.Categories.Find(intId);
            }

            List <ViewBreadCrumb> breadCrumbList = new List <ViewBreadCrumb>();
            ViewBreadCrumb        breadCrumb3    = new ViewBreadCrumb();

            breadCrumb3.Name  = "";
            breadCrumb3.Url   = "/blog/Admin/Category/GetCategory/?id=0&page=1";
            breadCrumb3.Level = -1;
            breadCrumbList.Add(breadCrumb3);

            ViewBreadCrumb breadCrumbAll = new ViewBreadCrumb();

            breadCrumbAll.Name  = "Tüm Kategoriler";
            breadCrumbAll.Url   = "";
            breadCrumbAll.Level = 999999;
            breadCrumbList.Add(breadCrumbAll);

            if (intId == 0)
            {
                ViewBag.BreadCrumbList = breadCrumbList.OrderBy(item => item.Level).ToList();
            }
            else
            {
                ViewBreadCrumb breadCrumb = new ViewBreadCrumb();
                breadCrumb.Name = cat.LanguageValues.FirstOrDefault(h => h.Lang == "tr-TR") != null?cat.LanguageValues.FirstOrDefault(h => h.Lang == "tr-TR").Name : "";

                breadCrumb.Url   = "/blog/Admin/Category/GetCategory/?id=" + cat.Id + "&page=1";
                breadCrumb.Level = cat.Level.HasValue == true ? cat.Level.Value : 0;
                breadCrumbList.Add(breadCrumb);
                bool listContinue = false;
                int  breadCrumbId = cat.SubCategoryId.HasValue == true ? cat.SubCategoryId.Value : 0;
                while (listContinue == false)
                {
                    CCategory subCat = db.Categories.Where(item => item.Id == breadCrumbId && item.ActiveStatus == EActiveStatus.Active).FirstOrDefault();
                    if (subCat != null)
                    {
                        ViewBreadCrumb breadCrumbSub = new ViewBreadCrumb();
                        breadCrumbSub.Name = subCat.LanguageValues.FirstOrDefault(h => h.Lang == "tr-TR") != null?subCat.LanguageValues.FirstOrDefault(h => h.Lang == "tr-TR").Name : "";

                        breadCrumbSub.Url   = "/blog/Admin/Category/GetCategory/?id=" + subCat.Id + "&page=1";
                        breadCrumbSub.Level = subCat.Level.HasValue == true ? subCat.Level.Value : 0;
                        breadCrumbList.Add(breadCrumbSub);
                        breadCrumbId = subCat.SubCategoryId.HasValue == true ? subCat.SubCategoryId.Value : 0;
                        if (breadCrumbId == 0)
                        {
                            listContinue = true;
                        }
                    }
                    else
                    {
                        listContinue = true;
                    }
                }


                ViewBag.BreadCrumbList = breadCrumbList.OrderBy(item => item.Level).ToList();
            }

            return(View(CategoryList));
        }
Пример #29
0
        public ActionResult InsertCategory(CCategory cat)
        {
            if (ModelState.IsValid)
            {
                var             ff                 = Request.Files["uploadFile"];
                var             ffHeader           = Request.Files["uploadFileHeader"];
                ImageController ic                 = new ImageController();
                string          uploadResult       = ic.UploadImage(ff, Server.MapPath("~/"), GetOrganizationId());
                string          uploadResultHeader = ic.UploadImage(ffHeader, Server.MapPath("~/"), GetOrganizationId());
                DbDataContext   db                 = new DbDataContext("CloudAppWebSite");
                cat.SubCategoryId = Convert.ToInt32(Request.Form["SubCategoryId"]);
                cat.ItemThemeId   = Convert.ToInt32(Request.Form["ThemeId"]);
                if (cat.SubCategoryId == 0)
                {
                    cat.SubCategoryId = null;
                }

                if (cat.Id == 0)
                {
                    cat.OrganizationId = GetOrganizationId();
                    if (cat.OrganizationId == 0)
                    {
                        return(Redirect("/blog/Admin/Home/Index"));
                    }
                    cat.CreatedUserId = GetUserId();
                    cat.CreatedDate   = DateTime.Now;
                    cat.ItemThemeId   = Convert.ToInt32(Request.Form["ThemeId"]);
                    if (uploadResult == "")
                    {
                        cat.ImageUrl = "ERROR.png";
                    }
                    else
                    {
                        cat.ImageUrl = uploadResult;
                    }
                    if (uploadResultHeader == "")
                    {
                        cat.HeaderImageUrl = "ERROR.png";
                    }
                    else
                    {
                        cat.HeaderImageUrl = uploadResultHeader;
                    }
                    cat.ActiveStatus = Data.Enum.EActiveStatus.Active;
                    db.Categories.Add(cat);
                    db.SaveChanges();

                    foreach (var formItem in Request.Form)
                    {
                        if (formItem.ToString().Contains("|"))
                        {
                            string            lang           = formItem.ToString().Split('|')[0];
                            string            property       = formItem.ToString().Split('|')[1];
                            CCategoryLanguage cImageLanguage = null;
                            if (cat != null && cat.LanguageValues != null)
                            {
                                cImageLanguage = cat.LanguageValues.FirstOrDefault(f => f.Lang == lang);
                            }
                            string formValue = Request.Form[formItem.ToString()];
                            if (cImageLanguage != null)
                            {
                                if (property == "Name")
                                {
                                    cImageLanguage.Name = formValue;
                                }
                                if (property == "Description")
                                {
                                    cImageLanguage.Description = formValue;
                                }
                                if (property == "Content")
                                {
                                    cImageLanguage.Content = formValue;
                                }
                                if (property == "PageTitle")
                                {
                                    cImageLanguage.PageTitle = formValue;
                                }
                                if (property == "PageKeyword")
                                {
                                    cImageLanguage.PageKeyword = formValue;
                                }
                                if (property == "PageDescription")
                                {
                                    cImageLanguage.PageDescription = formValue;
                                }
                                if (property == "CustomProperty1")
                                {
                                    cImageLanguage.CustomProperty1 = formValue;
                                }
                                if (property == "CustomProperty2")
                                {
                                    cImageLanguage.CustomProperty2 = formValue;
                                }
                                if (property == "CustomProperty3")
                                {
                                    cImageLanguage.CustomProperty3 = formValue;
                                }
                                if (property == "CustomProperty4")
                                {
                                    cImageLanguage.CustomProperty4 = formValue;
                                }
                                if (property == "CustomProperty5")
                                {
                                    cImageLanguage.CustomProperty5 = formValue;
                                }
                                if (property == "CustomProperty6")
                                {
                                    cImageLanguage.CustomProperty6 = formValue;
                                }
                                if (property == "CustomProperty7")
                                {
                                    cImageLanguage.CustomProperty7 = formValue;
                                }
                                if (property == "CustomProperty8")
                                {
                                    cImageLanguage.CustomProperty8 = formValue;
                                }
                                if (property == "CustomProperty9")
                                {
                                    cImageLanguage.CustomProperty9 = formValue;
                                }
                                if (property == "CustomProperty10")
                                {
                                    cImageLanguage.CustomProperty10 = formValue;
                                }
                            }
                            else
                            {
                                CCategoryLanguage ln = new CCategoryLanguage();
                                if (property == "Name")
                                {
                                    ln.Name = formValue;
                                }
                                if (property == "Description")
                                {
                                    ln.Description = formValue;
                                }
                                if (property == "Content")
                                {
                                    ln.Content = formValue;
                                }
                                if (property == "PageTitle")
                                {
                                    ln.PageTitle = formValue;
                                }
                                if (property == "PageKeyword")
                                {
                                    ln.PageKeyword = formValue;
                                }
                                if (property == "PageDescription")
                                {
                                    ln.PageDescription = formValue;
                                }
                                if (property == "CustomProperty1")
                                {
                                    ln.CustomProperty1 = formValue;
                                }
                                if (property == "CustomProperty2")
                                {
                                    ln.CustomProperty2 = formValue;
                                }
                                if (property == "CustomProperty3")
                                {
                                    ln.CustomProperty3 = formValue;
                                }
                                if (property == "CustomProperty4")
                                {
                                    ln.CustomProperty4 = formValue;
                                }
                                if (property == "CustomProperty5")
                                {
                                    ln.CustomProperty5 = formValue;
                                }
                                if (property == "CustomProperty6")
                                {
                                    ln.CustomProperty6 = formValue;
                                }
                                if (property == "CustomProperty7")
                                {
                                    ln.CustomProperty7 = formValue;
                                }
                                if (property == "CustomProperty8")
                                {
                                    ln.CustomProperty8 = formValue;
                                }
                                if (property == "CustomProperty9")
                                {
                                    ln.CustomProperty9 = formValue;
                                }
                                if (property == "CustomProperty10")
                                {
                                    ln.CustomProperty10 = formValue;
                                }
                                ln.ActiveStatus   = EActiveStatus.Active;
                                ln.CreatedDate    = DateTime.Now;
                                ln.Lang           = lang;
                                ln.CreatedUserId  = GetUserId();
                                ln.OrganizationId = GetOrganizationId();
                                ln.CategoryId     = cat.Id;
                                db.CategoryLanguage.Add(ln);
                                db.SaveChanges();
                            }
                        }
                    }

                    InsertAlert(new ViewAlert {
                        Title = "Başarılı", Desc = "Başarılı bir şekilde eklenmiştir. ", AlertType = EAlertType.Success
                    });
                }
                else
                {
                    int orgId = GetOrganizationId();
                    if (orgId == 0)
                    {
                        return(Redirect("/blog/Admin/Home/Index"));
                    }
                    CCategory Dbcg = db.Categories.Where(p => p.Id == cat.Id && p.OrganizationId == orgId && p.ActiveStatus == EActiveStatus.Active).FirstOrDefault();
                    if (Dbcg != null)
                    {
                        if (uploadResult != "")
                        {
                            Dbcg.ImageUrl = uploadResult;
                        }
                        if (uploadResultHeader != "")
                        {
                            Dbcg.HeaderImageUrl = uploadResultHeader;
                        }
                        Dbcg.ItemThemeId = Convert.ToInt32(Request.Form["ThemeId"]);

                        foreach (var formItem in Request.Form)
                        {
                            if (formItem.ToString().Contains("|"))
                            {
                                string lang           = formItem.ToString().Split('|')[0];
                                string property       = formItem.ToString().Split('|')[1];
                                var    cImageLanguage = Dbcg.LanguageValues.FirstOrDefault(f => f.Lang == lang);
                                string formValue      = Request.Form[formItem.ToString()];
                                if (cImageLanguage != null)
                                {
                                    if (property == "Name")
                                    {
                                        cImageLanguage.Name = formValue;
                                    }
                                    if (property == "Description")
                                    {
                                        cImageLanguage.Description = formValue;
                                    }
                                    if (property == "Content")
                                    {
                                        cImageLanguage.Content = formValue;
                                    }
                                    if (property == "PageTitle")
                                    {
                                        cImageLanguage.PageTitle = formValue;
                                    }
                                    if (property == "PageKeyword")
                                    {
                                        cImageLanguage.PageKeyword = formValue;
                                    }
                                    if (property == "PageDescription")
                                    {
                                        cImageLanguage.PageDescription = formValue;
                                    }
                                    if (property == "CustomProperty1")
                                    {
                                        cImageLanguage.CustomProperty1 = formValue;
                                    }
                                    if (property == "CustomProperty2")
                                    {
                                        cImageLanguage.CustomProperty2 = formValue;
                                    }
                                    if (property == "CustomProperty3")
                                    {
                                        cImageLanguage.CustomProperty3 = formValue;
                                    }
                                    if (property == "CustomProperty4")
                                    {
                                        cImageLanguage.CustomProperty4 = formValue;
                                    }
                                    if (property == "CustomProperty5")
                                    {
                                        cImageLanguage.CustomProperty5 = formValue;
                                    }
                                    if (property == "CustomProperty6")
                                    {
                                        cImageLanguage.CustomProperty6 = formValue;
                                    }
                                    if (property == "CustomProperty7")
                                    {
                                        cImageLanguage.CustomProperty7 = formValue;
                                    }
                                    if (property == "CustomProperty8")
                                    {
                                        cImageLanguage.CustomProperty8 = formValue;
                                    }
                                    if (property == "CustomProperty9")
                                    {
                                        cImageLanguage.CustomProperty9 = formValue;
                                    }
                                    if (property == "CustomProperty10")
                                    {
                                        cImageLanguage.CustomProperty10 = formValue;
                                    }
                                }
                                else
                                {
                                    CCategoryLanguage ln = new CCategoryLanguage();
                                    if (property == "Name")
                                    {
                                        ln.Name = formValue;
                                    }
                                    if (property == "Description")
                                    {
                                        ln.Description = formValue;
                                    }
                                    if (property == "Content")
                                    {
                                        ln.Content = formValue;
                                    }
                                    if (property == "PageTitle")
                                    {
                                        ln.PageTitle = formValue;
                                    }
                                    if (property == "PageKeyword")
                                    {
                                        ln.PageKeyword = formValue;
                                    }
                                    if (property == "PageDescription")
                                    {
                                        ln.PageDescription = formValue;
                                    }
                                    if (property == "CustomProperty1")
                                    {
                                        ln.CustomProperty1 = formValue;
                                    }
                                    if (property == "CustomProperty2")
                                    {
                                        ln.CustomProperty2 = formValue;
                                    }
                                    if (property == "CustomProperty3")
                                    {
                                        ln.CustomProperty3 = formValue;
                                    }
                                    if (property == "CustomProperty4")
                                    {
                                        ln.CustomProperty4 = formValue;
                                    }
                                    if (property == "CustomProperty5")
                                    {
                                        ln.CustomProperty5 = formValue;
                                    }
                                    if (property == "CustomProperty6")
                                    {
                                        ln.CustomProperty6 = formValue;
                                    }
                                    if (property == "CustomProperty7")
                                    {
                                        ln.CustomProperty7 = formValue;
                                    }
                                    if (property == "CustomProperty8")
                                    {
                                        ln.CustomProperty8 = formValue;
                                    }
                                    if (property == "CustomProperty9")
                                    {
                                        ln.CustomProperty9 = formValue;
                                    }
                                    if (property == "CustomProperty10")
                                    {
                                        ln.CustomProperty10 = formValue;
                                    }
                                    ln.ActiveStatus   = EActiveStatus.Active;
                                    ln.CreatedDate    = DateTime.Now;
                                    ln.CreatedUserId  = GetUserId();
                                    ln.OrganizationId = GetOrganizationId();
                                    ln.CategoryId     = Dbcg.Id;
                                    db.CategoryLanguage.Add(ln);
                                    db.SaveChanges();
                                }
                            }
                        }

                        db.SaveChanges();
                        InsertAlert(new ViewAlert {
                            Title = "Başarılı", Desc = "Başarılı bir şekilde düzenlenmiştir.", AlertType = EAlertType.Success
                        });
                        return(RedirectToAction("InsertCategory", "Category", new { Id = cat.Id, CatId = cat.SubCategoryId }));
                    }
                    else
                    {
                        InsertAlert(new ViewAlert {
                            AlertType = EAlertType.Warning, Title = "Uyarı", Desc = "Yetkisiz Giriş"
                        });
                        return(RedirectToAction("Dashboard", "Home"));
                    }
                }


                var topCategory = db.Categories.Where(item => item.Id == cat.SubCategoryId).FirstOrDefault();
                if (topCategory != null)
                {
                    cat.Level = topCategory.Level + 1;
                }
                else
                {
                    cat.Level = 0;
                }

                db.SaveChanges();

                return(RedirectToAction("InsertCategory", "Category", new { CatId = cat.SubCategoryId }));
            }
            if (cat.Id != 0)
            {
                List <ViewBreadCrumb> breadCrumbList = new List <ViewBreadCrumb>();
                ViewBreadCrumb        breadCrumb     = new ViewBreadCrumb();
                breadCrumb.Name  = "";
                breadCrumb.Url   = "/blog/Admin/Category/InsertCategory";
                breadCrumb.Level = -1;
                breadCrumbList.Add(breadCrumb);

                ViewBreadCrumb breadCrumb1 = new ViewBreadCrumb();
                breadCrumb1.Name  = "Kategori Düzenle";
                breadCrumb1.Url   = "";
                breadCrumb1.Level = 1;
                breadCrumbList.Add(breadCrumb1);
                ViewBag.BreadCrumbList = breadCrumbList.OrderBy(item => item.Level).ToList();
            }
            else
            {
                List <ViewBreadCrumb> breadCrumbList = new List <ViewBreadCrumb>();
                ViewBreadCrumb        breadCrumb     = new ViewBreadCrumb();
                breadCrumb.Name  = "";
                breadCrumb.Url   = "/blog/Admin/Category/InsertCategory";
                breadCrumb.Level = -1;
                breadCrumbList.Add(breadCrumb);

                ViewBreadCrumb breadCrumb1 = new ViewBreadCrumb();
                breadCrumb1.Name  = "Kategori Ekle";
                breadCrumb1.Url   = "";
                breadCrumb1.Level = 1;
                breadCrumbList.Add(breadCrumb1);
                ViewBag.BreadCrumbList = breadCrumbList.OrderBy(item => item.Level).ToList();
            }
            ViewBag.SubCatId    = 0;
            ViewBag.ItemThemeId = 0;

            return(View(cat));
        }
Пример #30
0
        public JsonResult GetCategoryCustomProperty(string catId)
        {
            if (!String.IsNullOrEmpty(catId))
            {
                DbDataContext db     = new DbDataContext("CloudAppWebSite");
                int           reelId = Convert.ToInt32(catId);
                if (reelId != 0)
                {
                    int orgId = GetOrganizationId();

                    CCategory ct = db.Categories.Where(item => item.OrganizationId == orgId && item.Id == reelId).FirstOrDefault();
                    if (ct != null)
                    {
                        var lg = ct.LanguageValues.FirstOrDefault(h => h.Lang == "TR");
                        if (lg != null)
                        {
                            return(Json(new
                            {
                                custom1 = lg.CustomProperty1,
                                custom2 = lg.CustomProperty2,
                                custom3 = lg.CustomProperty3,
                                custom4 = lg.CustomProperty4,
                                custom5 = lg.CustomProperty5,
                                custom6 = lg.CustomProperty6,
                                custom7 = lg.CustomProperty7,
                                custom8 = lg.CustomProperty8,
                                custom9 = lg.CustomProperty9,
                                custom10 = lg.CustomProperty10
                            }, JsonRequestBehavior.AllowGet));
                        }
                        else
                        {
                            return(Json(new
                            {
                                custom1 = "",
                                custom2 = "",
                                custom3 = "",
                                custom4 = "",
                                custom5 = "",
                                custom6 = "",
                                custom7 = "",
                                custom8 = "",
                                custom9 = "",
                                custom10 = ""
                            }, JsonRequestBehavior.AllowGet));
                        }
                    }
                    else
                    {
                        return(null);
                    }
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }