Esempio n. 1
0
        // GET: Category/Delete/5
        public ActionResult Delete(string id)
        {
            CategoryDAL categoryDAL = new CategoryDAL();
            var         model       = categoryDAL.GetById(id);

            return(View(model));
        }
        public JsonResult GetKategori()
        {
            CategoryDAL catDAL  = new CategoryDAL();
            var         results = catDAL.GetAll();

            return(Json(results, JsonRequestBehavior.AllowGet));
        }
Esempio n. 3
0
 public CategoryViewModel(CategoryDAL Cat)
 {
     _Id           = Cat.Categories.Id;
     _CategoryName = Cat.Categories.CategoryName;
     _Entity_Order = Cat.Categories.Entity_Order;
     _CatType      = Cat.Categories.CatType;
 }
Esempio n. 4
0
        private void toolStripButtonDelete_Click(object sender, EventArgs e)
        {
            if (trvwRsses.SelectedNode.Level == 2) //删除RSS节点
            {
                if (DialogResult.Yes ==
                    MessageBox.Show("真的要删除选中的RSS来源吗?", "警告", MessageBoxButtons.YesNo, MessageBoxIcon.Warning))

                {
                    RssDAL.Delete(trvwRsses.SelectedNode.Name);
                    BindTreeView();
                }
            }
            else if (trvwRsses.SelectedNode.Level == 1) //删除分类节点
            {
                string categoryID = trvwRsses.SelectedNode.Name;

                if (DialogResult.Yes ==
                    MessageBox.Show("真的要删除选中的分类,包括分类下所有的RSS来源吗?", "警告", MessageBoxButtons.YesNo, MessageBoxIcon.Warning))

                {
                    //删除分类下的所有 RSS 来源
                    foreach (
                        var r in
                        RssDAL.GetAllRsses().Where(r => r.Category.ToString() == categoryID))
                    {
                        RssDAL.Delete(r.ID.ToString());
                    }

                    //删除分类本身
                    CategoryDAL.Delete(categoryID);
                    BindTreeView();
                }
            }
        }
Esempio n. 5
0
 public HomeController(IHostingEnvironment env, AdminDAL adminDAL, BlogDAL blogDAL, CategoryDAL categoryDAL)
 {
     this.hostingEvn = env;
     AdminDAL        = adminDAL;
     BlogDAL         = blogDAL;
     CategoryDAL     = categoryDAL;
 }
Esempio n. 6
0
        public ActionResult Add(VMCampaignAdd model, HttpPostedFileBase file, string MakeID, string StartedDate, int EndingDate)
        {
            Campaign campaign = new Campaign();

            campaign.CampaignID  = Guid.NewGuid();
            campaign.Title       = model.Campaign.Title;
            campaign.StartedDate = DateTime.Parse(StartedDate);
            campaign.EndingDate  = campaign.StartedDate.AddDays(EndingDate);
            campaign.Discount    = model.Campaign.Discount;
            campaign.Status      = model.Campaign.Status;
            campaign.IsActive    = true;
            if (file != null && file.ContentLength > 0)
            {
                string path = Path.Combine(Server.MapPath("~/Assets/img/campaign"), Path.GetFileName(file.FileName));
                file.SaveAs(path);
                campaign.PictureUrl = Path.GetFileName(file.FileName);
            }
            Category cat  = CategoryDAL.Get();
            Guid     temp = Guid.Parse(MakeID);
            Make     make = MakeDAL.Get(x => x.MakeID == temp);

            foreach (var m in make.Models)
            {
                foreach (var p in m.Products)
                {
                    campaign.Products.Add(p);
                }
            }

            CampaignDAL.Add(campaign);

            return(RedirectToAction("Index", "Campaign"));
        }
Esempio n. 7
0
        private void KategoriSilToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (dGvKategoriler.SelectedRows.Count > 0)
                {
                    DialogResult sonuc = MessageBox.Show("Silmek İstediğinizden Emin Misiniz ?", "Uyarı", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                    if (sonuc == DialogResult.OK)
                    {
                        CategoryDAL cDal = new CategoryDAL();
                        foreach (DataGridViewRow row in dGvKategoriler.SelectedRows)
                        {
                            cDal.Delete(dGvKategoriler.SelectedRows[0].Cells[0].Value);

                            MessageBox.Show("Kategoriniz Başarılı Bir Şekilde Silinmiştir.", "Bilgi Mesajı", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                    else
                    {
                        return;
                    }
                }
                else
                {
                    MessageBox.Show("Lütfen Bir Kategori Seçiniz!!!");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Lütfen Silmek İstediğiniz Kategoriyi 'Kategoriler' Sekmesinden Listeleyip Kategori Seçiniz...\n\n" + ex.Message);
            }
        }
Esempio n. 8
0
 private void frmCategory_Load(object sender, EventArgs e)
 {
     btnDelete.Enabled        = false;
     btnUpdate.Enabled        = false;
     txtId.Enabled            = false;
     dataGridView1.DataSource = CategoryDAL.GetAllCategory();
 }
        protected void btnGetData_Click(object sender, EventArgs e)
        {
            CategoryDAL categoryDAL = new CategoryDAL();

            gvProduct.DataSource = categoryDAL.GetAll();
            gvProduct.DataBind();
        }
Esempio n. 10
0
        public ActionResult Edit(VMCategory model, Guid CategoryID, Guid id)
        {
            Category cat = CategoryDAL.Get(x => x.CategoryID == id);

            cat.IsActive = false;
            CategoryDAL.Update(cat);

            Category c = new Category();

            c.CategoryID    = Guid.NewGuid();
            c.CategoryName  = model.Category.CategoryName;
            c.Description   = model.Category.Description;
            c.SubCategoryID = CategoryID;
            c.IsActive      = true;

            foreach (var item in cat.Makes)
            {
                c.Makes.Add(item);
            }
            foreach (var item in cat.Properties)
            {
                c.Properties.Add(item);
            }
            foreach (var item in cat.ProductModels)
            {
                c.ProductModels.Add(item);
            }

            CategoryDAL.Add(c);
            return(RedirectToAction("Index", "Category"));
        }
Esempio n. 11
0
        public static bool DeleteCategoryBL(int deleteCategoryID)
        {
            bool categoryDeleted = false;

            try
            {
                if (deleteCategoryID > 0)
                {
                    CategoryDAL categoryDAL = new CategoryDAL();
                    categoryDeleted = categoryDAL.DeleteCategoryDAL(deleteCategoryID);
                }
                else
                {
                    throw new GOException("Invalid Category ID");
                }
            }
            catch (GOException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(categoryDeleted);
        }
Esempio n. 12
0
        private void dgvCategory_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            CategoryDAL categoryDAL = new CategoryDAL();
            var         category    = categoryDAL.GetByFilter(x => x.Id == Convert.ToInt32(dgvCategory.CurrentRow.Cells[0].Value));

            txbNameCategories.Text = category.Name;
        }
Esempio n. 13
0
 public JsonResult AddModal(Category model)
 {
     model.CategoryID = Guid.NewGuid();
     model.IsActive   = true;
     CategoryDAL.Add(model);
     return(Json(true));
 }
Esempio n. 14
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.Configure <CookiePolicyOptions>(options =>
            {
                // This lambda determines whether user consent for non-essential cookies is needed for a given request.
                options.CheckConsentNeeded    = context => false;
                options.MinimumSameSitePolicy = SameSiteMode.None;
            });
            string   ConnString     = Configuration.GetConnectionString("DefaultConnectionString");
            string   UserConnString = Configuration.GetConnectionString("UserDB");
            AdminDAL adminDAL       = new AdminDAL(ConnString);

            services.AddSingleton <AdminDAL>(adminDAL);

            BlogDAL blogDAL = new BlogDAL(ConnString);

            services.AddSingleton <BlogDAL>(blogDAL);

            UserDAL userDAL = new UserDAL(UserConnString);

            services.AddSingleton <UserDAL>(userDAL);

            CategoryDAL categoryDAL = new CategoryDAL(ConnString);

            services.AddSingleton <CategoryDAL>(categoryDAL);
            services.AddSession();
            //services.AddSingleton<BlogDbConnection>();
            //services.AddSingleton<ConnectionFactory>();
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
        }
Esempio n. 15
0
        public CategoryControl(Form form) : this()
        {
            _loginControl = form;
            CategoryDAL categoryDAL = new CategoryDAL();

            categoryDAL.GetGridData(dgvCategory);
        }
Esempio n. 16
0
        public void TestUpdateCategory()
        {
            CategoryDAL  objCategoryDAL  = new CategoryDAL();
            CategoryInfo objCategoryInfo = new CategoryInfo(304, "Oracle", "Oracle Related Technology", 101, DateTime.Now, 101, DateTime.Now);

            objCategoryDAL.UpdateCategory(objCategoryInfo);
        }
Esempio n. 17
0
        public void TestCreateCategory()
        {
            CategoryDAL  objCategoryDAL  = new CategoryDAL();
            CategoryInfo objCategoryInfo = new CategoryInfo("Apple", "iOS Related Technology", 101, DateTime.Now, 101, DateTime.Now);

            objCategoryDAL.CreateCategory(objCategoryInfo);
        }
Esempio n. 18
0
        public static List <StaticsData> GetTimeAvgByCategory(int userCode)
        {
            List <StaticsData> staticsDatas = new List <StaticsData>();

            List <Category__tbl> categories = CategoryDAL.GetAllCategory();


            Dictionary <string, List <Schedule_tbl> > pairs = categories.Distinct().Select(c =>
                                                                                           new KeyValuePair <string, List <Schedule_tbl> >(
                                                                                               c.CategoryName,
                                                                                               c.Business__tbl.SelectMany(b => b.Schedule_tbl).Where(s => s.Events__tbl?.UserCode == userCode && s.Duration != null).ToList()
                                                                                               )).ToDictionary(kv => kv.Key, kv => kv.Value);

            foreach (var item in pairs)
            {
                if (item.Value.Count > 0)
                {
                    staticsDatas.Add(new StaticsData {
                        CategoryName = item.Key, Data = (int)item.Value.Average(s => s.Duration)
                    });
                }
            }

            return(staticsDatas);
        }
Esempio n. 19
0
        public static List <CategoryViewModel> GetCategoryList()
        {
            List <CategoryViewModel> CList = new List <CategoryViewModel>();

            CategoryDAL.GetCategoriesList().ForEach(c => CList.Add(new CategoryViewModel(c)));
            return(CList);
        }
Esempio n. 20
0
        // GET: Test
        public ActionResult Index()
        {
            string connectionstring = ConfigurationManager.ConnectionStrings["litecommercedb"].ConnectionString;
            //ICityDAL dal = new CityDAL(connectionstring);
            //var data = dal.List();
            //ISupplierDAL dal = new SupplierDAL(connectionstring);
            //var data = dal.Count("11");
            //ISupplierDAL dal = new SupplierDAL(connectionstring);
            //var data = dal.Get(11);
            //ISupplierDAL dal = new SupplierDAL(connectionstring);
            //Supplier s = new Supplier
            //{
            //    SupplierName = "Võ Văn Huy",
            //    ContactName = "hihi",
            //    Address = "Quảng Trị",
            //    City = "Huế",
            //    PostalCode = "123",
            //    Country="Việt Nam",
            //    Phone="123456"
            //};
            //var data = dal.Add(s);
            //ISupplierDAL dal = new SupplierDAL(connectionstring);
            //var data = dal.Delete(32);

            ICategoryDAL dal  = new CategoryDAL(connectionstring);
            var          data = dal.Count("");

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Esempio n. 21
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["AID"] == null)
     {
         Response.Redirect("Default.aspx");
     }
     if (!IsPostBack)
     {            //绑定类别
         this.DropDownList1.DataSource     = CategoryDAL.getBSCategoryList();
         this.DropDownList1.DataTextField  = "BSName";
         this.DropDownList1.DataValueField = "BSID";
         this.DropDownList1.DataBind();
         //根据图书ID查询出商品
         string a   = Request.QueryString["BID"];
         int    BID = Convert.ToInt32(a);
         Book   b   = BookDAL.selectByID(BID)[0];
         this.txtName.Text    = b.BName;
         this.txtAuthor.Text  = b.BAuthor;
         this.txtbisd.Text    = b.BISBN.ToString();
         this.txtPrice.Text   = b.BPrice.ToString();
         Session ["FileName"] = b.BPic.ToString();
         //this.labFileName.Text = b.BPic.ToString();
         this.txtBcount.Text = b.BCount.ToString();
         this.DropDownList1.SelectedValue = b.BSID.ToString();
     }
 }
Esempio n. 22
0
 public HomeController(CategoryDAL categoryDal, BlogDAL blogDal, IHostingEnvironment hostingEnvironment, AdminDAL adminDAL)
 {
     _CategoryDAL = categoryDal;
     _BlogDAL     = blogDal;
     _AdminDAL    = adminDAL;
     hostingEnv   = hostingEnvironment;
 }
Esempio n. 23
0
        public ActionResult Index(int?id)
        {
            ViewBag.PageType = __type;
            AllCategoriesModel model = CategoryDAL.GetAllWithType(id.HasValue ? id.Value : 0, true);

            return(View(model));
        }
Esempio n. 24
0
        public ActionResult Index()
        {
            string str = "";
            Random r   = new Random();

            DAL.BlogDAL blo = new BlogDAL();

            DAL.CategoryDAL       call    = new CategoryDAL();
            List <Model.Category> list_ca = call.GetList("");

            for (int i = 0; i < 102; i++)
            {
                string         title = $"新闻标题";
                string         body = title + "的内容";
                Model.Category ca = list_ca[r.Next(0, list_ca.Count)];
                string         cabh = ca.Number, caname = ca.CaName;
                blo.Insert(new Model.Blog {
                    Title = title, Body = body, VistitNum = r.Next(100, 9999), CaNumber = cabh, CaName = caname
                });
            }
            str += "添加102条测试新闻成功!";
            //str += "新增分类" + call.Insert(new Model.Blog {CaName="newCaName" })+ "<hr />";
            //bool b = call.Delete(7);
            //str+= "删除Id-7的数据:" + b + "<hr />";
            //Model.Category ca = call.GetModel(5);
            //if (ca!=null)
            //{
            //    ca.CaName = "新修改的名称" + DateTime.Now;
            //    bool b2 = call.Update(ca);
            //    str+="修改后的数据"+b2+ "<hr />";
            //}
            return(Content(str));
        }
Esempio n. 25
0
 public EntityBL()
 {
     _userDAL     = new UserDAL();
     _goodDAL     = new GoodDAL();
     _feedBackDAL = new FeedBackDAL();
     _categoryDAL = new CategoryDAL();
 }
        // GET: Category
        public ActionResult Index()
        {
            CategoryDAL catdal = new CategoryDAL();
            var         models = catdal.GetAll();

            return(View(models));
        }
Esempio n. 27
0
        public JsonResult EditModal(Category model)
        {
            Category temp = CategoryDAL.Get(x => x.CategoryID == model.CategoryID);

            temp.IsActive = false;
            CategoryDAL.Update(temp);

            Category temp2 = new Category()
            {
                CategoryID    = Guid.NewGuid(),
                CategoryName  = model.CategoryName,
                Description   = model.Description,
                IsActive      = true,
                SubCategoryID = temp.SubCategoryID,
            };

            foreach (Make item in temp.Makes)
            {
                temp2.Makes.Add(item);
            }
            foreach (ProductModel item in temp.ProductModels)
            {
                temp2.ProductModels.Add(item);
            }
            foreach (Property item in temp.Properties)
            {
                temp2.Properties.Add(item);
            }


            CategoryDAL.Add(temp2);

            return(Json(true));
        }
Esempio n. 28
0
        public static List <Category> LayDSLoaiThietBi()
        {
            List <Category> _ds;

            _ds = CategoryDAL.LayDSLoaiThietBi();
            return(_ds);
        }
Esempio n. 29
0
        static public string QueryAll(out string msg, ref int totalPage, ref int currentPage)
        {
            List <Category> list = CategoryDAL.QueryAll(out msg);

            if (list == null)
            {
                totalPage   = 0;
                currentPage = -1;
                return(null);
            }
            totalPage = (int)System.Math.Floor((decimal)(list.Count / 10));
            if (list.Count != 0 && list.Count % 10 == 0)
            {
                --totalPage;
            }
            if (currentPage < totalPage)
            {
                ++currentPage;
            }
            try
            {
                return(JsonConvert.SerializeObject(list.GetRange(currentPage * 10, 10)));
            }
            catch
            {
                return(JsonConvert.SerializeObject(list.GetRange(currentPage * 10, list.Count - currentPage * 10)));
            }
        }
Esempio n. 30
0
 public ChallanController()
 {
     customerDAL = new CustomerDAL();
     categoryDAL = new CategoryDAL();
     taxDAL      = new TaxDAL();
     challanDAL  = new ChallanDAL();
 }
Esempio n. 31
0
File: ramo.cs Progetto: niqt/test
        // Mappa un oggetto di tipo CategoryDAL (Infrastructure.logging.dal) su un oggetto Category(Infrastructure.logging.datamodel.model)
        public Category categoryDALtoCategory(CategoryDAL categoryDAL)
        {
            Category categoryToBack = new Category();

            categoryToBack.idTipo = (CategoryType)categoryDAL.CategoryId;
            categoryToBack.tipo = categoryDAL.name;

            return categoryToBack;
        }
Esempio n. 32
0
File: ramo.cs Progetto: niqt/test
        // Mappa un oggetto di tipo Category(Infrastructure.logging.datamodel.model) su un oggetto CategoryDAL (Infrastructure.logging.dal)
        public CategoryDAL categoryToCategoryDAL(Category category)
        {
            CategoryDAL categoryDALToBack = new CategoryDAL();

            using (var log = new LoggingContext())
            {
                var result = (log.categories.Where(cat => (cat.CategoryId == (int)category.idTipo)));

                if (result != null)
                {
                    categoryDALToBack.CategoryId = result.First().CategoryId;
                    categoryDALToBack.name = result.First().name;
                }
            }
            return categoryDALToBack;
        }
Esempio n. 33
0
    private void LoadCategories()
    {
        CategoryDAL categoryOperator = new CategoryDAL();
        List<Category> categoryList = categoryOperator.SelectAll(IsArabic);

        if (categoryList != null && categoryList.Count > 0)
        {
            drpCategory.DataSource = categoryList;
            drpCategory.DataValueField = Category.CommonColumns.ID;
            if (IsArabic)
                drpCategory.DataTextField = Category.TableColumns.NameAr;
            else
                drpCategory.DataTextField = Category.TableColumns.NameEn;
            drpCategory.DataBind();
        }
        drpCategory.Items.Insert(0, Literals.ListHeader);
    }
Esempio n. 34
0
    private void SearchOffers()
    {
        MainPager = new PagedDataSource();

        if (!string.IsNullOrEmpty(Request.QueryString["SuppID"]))
        {
            MainPager.DataSource = offersOperator.SelectBySupplierID(Convert.ToInt32(Request.QueryString["SuppID"].Trim()), "All", IsArabic, true);

            Supplier temp = new SupplierDAL().SelectByID(Convert.ToInt32(Request.QueryString["SuppID"].Trim()), IsArabic);
            if (temp != null)
            {
                if (IsArabic)
                    ltrlTitle.Text = temp.NameAr;
                else
                    ltrlTitle.Text = temp.NameEn;
            }
        }
        else if (!string.IsNullOrEmpty(Request.QueryString["BrandID"]))
        {
            MainPager.DataSource = offersOperator.SelectByBrandID(Convert.ToInt32(Request.QueryString["BrandID"].Trim()), "All", IsArabic, true);

            Brand temp = new BrandDAL().SelectByID(Convert.ToInt32(Request.QueryString["BrandID"].Trim()), IsArabic);
            if (temp != null)
            {
                if (IsArabic)
                    ltrlTitle.Text = temp.NameAr;
                else
                    ltrlTitle.Text = temp.NameEn;
            }
        }
        else if (!string.IsNullOrEmpty(Request.QueryString["CatID"]))
        {
            ArrayList categoryList = new ArrayList();
            GetCategoriesList(Convert.ToInt32(Request.QueryString["CatID"].Trim()), categoryList);

            if (categoryList != null && categoryList.Count > 0)
                MainPager.DataSource = offersOperator.SelectByCategoryID(categoryList, "All", IsArabic, true);
            else
                MainPager.DataSource = null;

            Category temp = new CategoryDAL().SelectByID(Convert.ToInt32(Request.QueryString["CatID"].Trim()), IsArabic);
            if (temp != null)
            {
                if (IsArabic)
                    ltrlTitle.Text = temp.NameAr;
                else
                    ltrlTitle.Text = temp.NameEn;
            }
        }
        else
        {
            ltrlTitle.Text = string.Empty;
        }

        BindMainRepeater();
    }
Esempio n. 35
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            offerOperator = new OfferDAL();
            categoryOperator = new CategoryDAL();

            if (!IsPostBack)
            {
                if (Request.QueryString[CommonStrings.ID] != null)
                {
                    Offer info
                        = offerOperator.SelectByID(Convert.ToInt32(Request.QueryString[CommonStrings.ID]), (bool?)IsArabic);

                    if (info != null)
                    {
                        offerOperator.View(Convert.ToInt32(Request.QueryString[CommonStrings.ID]));

                        imgOffer.ImageUrl = GetSmallImage(info.Image);
                        ltrlID.Text = hiddenOfferID.Value = Convert.ToString(info.ID);
                        ltrlViews.Text = Convert.ToString(info.Views);
                        ltrlLikes.Text = Convert.ToString(info.Likes);
                        supplierAnch.HRef = Utility.AppendQueryString(PagesPathes.ViewSupplierDetails, new KeyValue(CommonStrings.ID, Convert.ToString(info.SupplierID)));

                        if (info.Rate != 0)
                            ratingCtrl.CurrentRating = info.Rate / 20;
                        else
                            ratingCtrl.CurrentRating = 0;

                        if (HasUserRated(info.ID))
                            ratingCtrl.ReadOnly = true;
                        else
                            ratingCtrl.ReadOnly = false;

                        if (info.IsProduct)
                        {
                            newPriceSpan.Visible = true;
                            oldPriceSpan.Visible = true;

                            ltrlNewPrice.Text = info.NewPrice.ToString();
                            ltrlOldPrice.Text = info.OldPrice.ToString();

                            if (IsArabic)
                                ltrlNewCurrency.Text = ltrlOldCurrency.Text = info.CurrencyInfo.UnitAr;
                            else
                                ltrlNewCurrency.Text = ltrlOldCurrency.Text = info.CurrencyInfo.UnitEn;
                        }
                        else
                        {
                            newPriceSpan.Visible = false;
                            oldPriceSpan.Visible = false;
                        }

                        if (info.IsSale)
                        {
                            saleSpan.Visible = true;
                            ltrlSale.Text = string.Concat(Convert.ToString(info.SaleUpTo), "%");
                        }
                        else
                        {
                            saleSpan.Visible = false;
                        }

                        if (info.IsPackage)
                        {
                            packageSpan.Visible = true;

                            if (IsArabic)
                                ltrlPackage.Text = info.PackageDescriptionAr;
                            else
                                ltrlPackage.Text = info.PackageDescriptionEn;
                        }
                        else
                        {
                            packageSpan.Visible = false;
                        }

                        if (info.BrandID.HasValue)
                        {
                            brandAnch.Visible = true;
                            brandAnch.HRef = Utility.AppendQueryString(PagesPathes.ViewBrandDetails, new KeyValue(CommonStrings.ID, Convert.ToString(info.BrandID.Value)));
                        }
                        else
                        {
                            brandAnch.Visible = false;
                        }

                        if (info.StartDate.HasValue)
                        {
                            startDateSpan.Visible = true;
                            ltrlStartDate.Text = Convert.ToDateTime(info.StartDate.Value).ToShortDateString();
                        }
                        else
                        {
                            startDateSpan.Visible = false;
                        }

                        if (info.EndDate.HasValue)
                        {
                            endDateSpan.Visible = true;
                            ltrlEndDate.Text = Convert.ToDateTime(info.EndDate.Value).ToShortDateString();
                        }
                        else
                        {
                            endDateSpan.Visible = false;
                        }

                        if (info.IsBestDeal)
                        {
                            bestDealSpan.Visible = true;
                            ltrlBestDeal.Text = Resources.Literals.BestDeal;
                        }
                        else
                        {
                            bestDealSpan.Visible = false;
                        }

                        if (info.IsFeaturedOffer)
                        {
                            featuredSpan.Visible = true;
                            ltrlFeatured.Text = Resources.Literals.FeaturedOffer;
                        }
                        else
                        {
                            featuredSpan.Visible = false;
                        }

                        if (IsArabic)
                        {
                            imgOffer.AlternateText = info.TitleAr;
                            imgOffer.ToolTip = info.TitleAr;
                            ratingCtrl.RatingDirection = AjaxControlToolkit.RatingDirection.RightToLeftBottomToTop;

                            ltrlSupplier.Text = new SupplierDAL().SelectByID(info.SupplierID, IsArabic).NameAr;

                            if (info.BrandID.HasValue)
                                ltrlBrand.Text = new BrandDAL().SelectByID(info.BrandID.Value, IsArabic).NameAr;

                            ltrlTitle.Text = info.TitleAr;

                            if (string.IsNullOrEmpty(info.DescriptionAr))
                                ltrlDescription.Text = info.ShortDescriptionAr;
                            else
                                ltrlDescription.Text = info.DescriptionAr;
                        }
                        else
                        {
                            imgOffer.AlternateText = info.TitleEn;
                            imgOffer.ToolTip = info.TitleEn;
                            ratingCtrl.RatingDirection = AjaxControlToolkit.RatingDirection.LeftToRightTopToBottom;

                            ltrlSupplier.Text = new SupplierDAL().SelectByID(info.SupplierID, IsArabic).NameEn;

                            if (info.BrandID.HasValue)
                                ltrlBrand.Text = new BrandDAL().SelectByID(info.BrandID.Value, IsArabic).NameEn;

                            ltrlTitle.Text = info.TitleEn;

                            if (string.IsNullOrEmpty(info.DescriptionEn))
                                ltrlDescription.Text = info.ShortDescriptionEn;
                            else
                                ltrlDescription.Text = info.DescriptionEn;
                        }

                        List<KeyValue> categoryList = new List<KeyValue>();
                        GetCategories(info.CategoryID, categoryList);
                        AddCategories(categoryList);

                        emptyDataDiv.Visible = false;
                    }
                    else
                    {
                        emptyDataDiv.Visible = true;
                    }
                }
            }
        }
        catch
        {
            Response.Redirect(Utility.AppendQueryString(PagesPathes.ErrorPage, new KeyValue(CommonStrings.BackUrl, "ListOffers")));
        }
    }
Esempio n. 36
0
    private List<KeyValue> FilterList(List<Offer> offersList, string filterBy)
    {
        List<KeyValue> filteredList = null;

        if (offersList != null && offersList.Count > 0)
        {
            filteredList = new List<KeyValue>();
            List<Offer> subList = null;

            if (filterBy == "Brand")
            {
                List<Offer> nullList = new List<Offer>();

                for (int i = 0; i < offersList.Count; i++)
                {
                    if (offersList[i].BrandID == null)
                    {
                        nullList.Add(offersList[i]);
                        offersList.RemoveAt(i);
                        i = i - 1;
                    }
                }

                while (offersList.Count > 0)
                {
                    subList = new List<Offer>();
                    subList.Add(offersList[0]);
                    for (int j = 1; j < offersList.Count; j++)
                    {
                        if (offersList[j].BrandID == offersList[0].BrandID)
                        {
                            subList.Add(offersList[j]);
                            offersList.RemoveAt(j);
                            j = j - 1;
                        }
                    }
                    offersList.RemoveAt(0);

                    string brandName = null;
                    if (IsArabic)
                        brandName = new BrandDAL().SelectByID(subList[0].BrandID.Value, IsArabic).NameAr;
                    else
                        brandName = new BrandDAL().SelectByID(subList[0].BrandID.Value, IsArabic).NameEn;

                    filteredList.Add(new KeyValue(brandName, subList));
                }

                SortAlpha(filteredList);

                if (nullList != null && nullList.Count > 0)
                    filteredList.Add(new KeyValue(Resources.Literals.NoBrand, nullList));
            }
            else if (filterBy == "Supplier")
            {
                while (offersList.Count > 0)
                {
                    subList = new List<Offer>();
                    subList.Add(offersList[0]);
                    for (int j = 1; j < offersList.Count; j++)
                    {
                        if (offersList[j].SupplierID == offersList[0].SupplierID)
                        {
                            subList.Add(offersList[j]);
                            offersList.RemoveAt(j);
                            j = j - 1;
                        }
                    }
                    offersList.RemoveAt(0);

                    string supplierName = null;
                    if (IsArabic)
                        supplierName = new SupplierDAL().SelectByID(subList[0].SupplierID, IsArabic).NameAr;
                    else
                        supplierName = new SupplierDAL().SelectByID(subList[0].SupplierID, IsArabic).NameEn;

                    filteredList.Add(new KeyValue(supplierName, subList));
                }
                SortAlpha(filteredList);
            }
            else if (filterBy == "Category")
            {
                while (offersList.Count > 0)
                {
                    subList = new List<Offer>();
                    subList.Add(offersList[0]);
                    for (int j = 1; j < offersList.Count; j++)
                    {
                        if (offersList[j].CategoryID == offersList[0].CategoryID)
                        {
                            subList.Add(offersList[j]);
                            offersList.RemoveAt(j);
                            j = j - 1;
                        }
                    }
                    offersList.RemoveAt(0);

                    string categoryName = null;
                    if (IsArabic)
                        categoryName = new CategoryDAL().SelectByID(subList[0].CategoryID, IsArabic).NameAr;
                    else
                        categoryName = new CategoryDAL().SelectByID(subList[0].CategoryID, IsArabic).NameEn;

                    filteredList.Add(new KeyValue(categoryName, subList));
                }
                SortAlpha(filteredList);
            }
        }

        return filteredList;
    }
Esempio n. 37
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            offersOperator = new OfferDAL();
            categoryOperator = new CategoryDAL();

            if (!IsPostBack)
            {
                ctrlSearch.initializeControl();
                SearchOffers();
            }
        }
        catch
        {
            Response.Redirect(Utility.AppendQueryString(PagesPathes.ErrorPage, new KeyValue(CommonStrings.BackUrl, CommonStrings.ViewDefault)));
        }
    }
Esempio n. 38
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            categoryOperator = new CategoryDAL();

            if (!IsPostBack)
            {
                BindTree();
            }
        }
        catch
        {
            Response.Redirect(Utility.AppendQueryString(PagesPathes.ErrorPage, new KeyValue(CommonStrings.BackUrl, "AdminDefault")));
        }
    }
Esempio n. 39
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            categoryOperator = new CategoryDAL();

            if (!IsPostBack)
            {
                BindTree();
            }

            String csOfferType = "OfferTypeScript";
            Type csType = this.GetType();
            ClientScriptManager clientScript = Page.ClientScript;
            if (!clientScript.IsStartupScriptRegistered(csType, csOfferType))
            {
                clientScript.RegisterStartupScript(csType, csOfferType, "javascript:rblSelectedValue();", true);
            }
        }
        catch
        {
            Response.Redirect(Utility.AppendQueryString(PagesPathes.ErrorPage, new KeyValue(CommonStrings.BackUrl, "AdminDefault")));
        }
    }
Esempio n. 40
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            offersOperator = new OfferDAL();
            categoryOperator = new CategoryDAL();
            supplierOperator = new SupplierDAL();
            brandOperator = new BrandDAL();

            if (!IsPostBack)
            {
                FillCategoryDrpMenu();
                FillSuppliersDrpMenu();
                FillBrandsDrpMenu();
                BindGrid();
            }

            #region Select JS Script

            String csSelect = "SelectScript";
            Type csType = this.GetType();
            ClientScriptManager clientScript = Page.ClientScript;
            if (!clientScript.IsStartupScriptRegistered(csType, csSelect))
            {
                clientScript.RegisterStartupScript(csType, csSelect, "javascript:rblSelectedValue();", true);
            }

            #endregion
        }
        catch
        {
            Response.Redirect(Utility.AppendQueryString(PagesPathes.ErrorPage, new KeyValue(CommonStrings.BackUrl, CommonStrings.AdminDefault)));
        }
    }