private void LoadPRoducrData()
 {
     if (!string.IsNullOrEmpty(Request.Form["ProductId"]))
     {
         ProId = Request.Form["ProductId"].ToString();
     }
     ProductRepository _prorpoObj = new ProductRepository();
     Product _pro = new Product();
     _pro = _prorpoObj.LoadById(ProId);
     lblProductTitle.Text = _pro.ProductTitle;
     lblProductFullDescrition.Text = _pro.FullDescription;
 }
        protected void grdData_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            _rpoObj = new ProductRepository();
            switch (e.CommandName)
            {

                case "restoreitem":
                    if (_rpoObj.Restore(e.CommandArgument.ToString(), Request.Cookies["CooLoginUserId"].Value))
                    { grdData.DataBind(); }
                    break;
                case "deleteitem":
                    if (_rpoObj.Delete(e.CommandArgument.ToString(), Request.Cookies["CooLoginUserId"].Value))
                    { grdData.DataBind(); }
                    break;
            }
        }
        protected void rptrProductsSections_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                ProductRepository _prorpoObj = new ProductRepository();
                ProductAlbumRepository _rpoProAlbumObj = new ProductAlbumRepository();

                DataRowView row = (DataRowView)e.Item.DataItem;
                //tring varAlbumId = ((Label)e.Item.FindControl("lblAlbumId")).Text;
                Literal lbltitle = (Literal)e.Item.FindControl("lblProductTitle");
                Literal lblFullDesc = (Literal)e.Item.FindControl("lblProductFullDescrition");
                lbltitle.Text = row["ProductTitle"].ToString();
                lblFullDesc.Text = row["FullDescription"].ToString();

                Repeater albums = (Repeater)e.Item.FindControl("dlAlbums");
                albums.DataSource = _rpoProAlbumObj.LoadByProductIdAndLanguageId((row["LanguageId"].ToString()), (row["Id"].ToString()));
                albums.DataBind();

            }
        }
        private void LoadProductsSections()
        {
            ProductRepository _ProRepo = new ProductRepository();
            rptrProductsSections.DataSource = _ProRepo.LoadWoodFloorsByLanguageId("097BE02E-A019-4853-AD50-F22EF5F0BF0F");
            rptrProductsSections.DataBind();

            uiRepeaterWoodWall.DataSource = _ProRepo.LoadAllExceptWoodFloorByLanguageId("097BE02E-A019-4853-AD50-F22EF5F0BF0F"); //wood walls
            uiRepeaterWoodWall.DataBind();
        }
 private void LoadProducts()
 {
     ProductRepository _ProRepo = new ProductRepository();
     rptProducts.DataSource = _ProRepo.LoadByLanguageId("097BE02E-A019-4853-AD50-F22EF5F0BF0F");
     rptProducts.DataBind();
 }
        private void LoadProducts()
        {
            ProductRepository _Obj = new ProductRepository();
            ddlProducts.DataSource = _Obj.LoadByActiveState();
            ddlProducts.DataTextField = "ProductTitle";
            ddlProducts.DataValueField = "Id";

            ddlProducts.DataBind();
            ddlProducts.Items.Insert(0, "Select Product...");
        }
        void GetInfo()
        {
            if (!string.IsNullOrEmpty(ProductId))
            {
                _rpoObj = new ProductRepository();
                Product ProductEnt = _rpoObj.LoadById(ProductId);
                if (ProductEnt != null)
                {
                    txtproductTitile.Text = ProductEnt.ProductTitle;
                    edtrShortDescription.Content = ProductEnt.ShortDescription;
                    edtrFullDescription.Content = ProductEnt.FullDescription;

                    //ifrmProductImages.Attributes["src"] = "../MainPages/ProductImagesGallery.aspx?ProductId=" + ProductEnt.Id.ToString() + "&LanguageId=" + ProductEnt.LanguageId.ToString();
                    //TabContainer1.ActiveTabIndex = 1;

                    //TabGallery.Enabled = true;

                    if (!string.IsNullOrEmpty(ProductEnt.ImageFile))
                    {
                        imgProductImage.ImageUrl = ConfigurationManager.AppSettings["Products"].ToString() + ProductEnt.ImageFile;
                        imgProductImage.Visible = true;
                    }
                    else
                        imgProductImage.Visible = false;
                    try
                    {
                        ddlLanguage.SelectedValue = ProductEnt.LanguageId.ToString();
                    }
                    catch
                    {
                        ddlLanguage.SelectedIndex = -1;
                    }
                }
            }
        }
        void Save()
        {
            string ImageFile = string.Empty;
            _rpoObj = new ProductRepository();
            #region Manage Item
            //string FileName = string.Empty;
            string FileName = string.Empty;
            _rpoObj._Obj.LanguageId = new Guid(ddlLanguage.SelectedValue.ToString());
            _rpoObj._Obj.ProductTitle = txtproductTitile.Text;
            _rpoObj._Obj.ShortDescription = edtrShortDescription.Content;
            _rpoObj._Obj.FullDescription = edtrFullDescription.Content;

            //isdefault here

            if (string.IsNullOrEmpty(ProductId))
            {
                _rpoObj._Obj.CreatedBy = new Guid(Request.Cookies["CooLoginUserId"].Value);
                if (fpld.PostedFile.FileName != "")
                {
                    FileName = Guid.NewGuid().ToString() + System.IO.Path.GetExtension(fpld.PostedFile.FileName);
                    string PathUrl = Server.MapPath(ConfigurationManager.AppSettings["Products"].ToString()) + FileName;
                    fpld.SaveAs(PathUrl);
                    // DAL.ImagesFact.ResizeWithCropResizeImage("", FileName, "Section");
                    _rpoObj._Obj.ImageFile = FileName;
                }
                ProductId = _rpoObj.Add().ToString();
                //if (!string.IsNullOrEmpty(PageSectionId))
                //{
                //    BackendMessages(101);
                //}
                //else
                //{
                //    BackendMessages(201);
                //}
            }
            else
            {
                _rpoObj._Obj = _rpoObj.LoadById(ProductId);
                _rpoObj._Obj.LanguageId = new Guid(ddlLanguage.SelectedValue.ToString());
                _rpoObj._Obj.ProductTitle = txtproductTitile.Text;
                _rpoObj._Obj.ShortDescription = edtrShortDescription.Content;
                _rpoObj._Obj.FullDescription = edtrFullDescription.Content;

                if (fpld.PostedFile.FileName != "")
                {
                    if (_rpoObj._Obj.ImageFile != null)
                    {
                        DirectoryInfo di = new DirectoryInfo(Server.MapPath(ConfigurationManager.AppSettings["Products"]));
                        foreach (FileInfo fi in di.GetFiles())
                        {
                            if (_rpoObj._Obj.ImageFile == fi.Name)
                            {
                                File.Delete(fi.Name);
                            }
                        }
                    }
                    FileName = Guid.NewGuid().ToString() + System.IO.Path.GetExtension(fpld.PostedFile.FileName);
                    string PathUrl = Server.MapPath(ConfigurationManager.AppSettings["Products"].ToString()) + FileName;
                    fpld.SaveAs(PathUrl);
                    // DAL.ImagesFact.ResizeWithCropResizeImage("", FileName, "Section");
                    _rpoObj._Obj.ImageFile = FileName;
                }

                _rpoObj._Obj.ModifiedBy = new Guid(Request.Cookies["CooLoginUserId"].Value);
                if (_rpoObj.Edit())
                {
                    //lblMessge.Text = "Done, changes has been saved successfully!";
                    //msg.Attributes["class"] = "msg-success";
                }
                else
                {
                    //lblMessge.Text = "Error, Please try again later!";
                    //msg.Attributes["class"] = "msg-error";
                }
            }
            #endregion
        }
        private void LoadProductsSections()
        {
            ProductRepository _ProRepo = new ProductRepository();
            rptrProductsSections.DataSource = _ProRepo.LoadWoodFloorsByLanguageId("b5c66d73-b2fa-436d-817a-e5332af83934");
            rptrProductsSections.DataBind();

            uiRepeaterWoodWall.DataSource = _ProRepo.LoadAllExceptWoodFloorByLanguageId("b5c66d73-b2fa-436d-817a-e5332af83934"); //wood walls
            uiRepeaterWoodWall.DataBind();
        }
Beispiel #10
0
 private void LoadProducts()
 {
     ProductRepository _ProRepo = new ProductRepository();
     rptProducts.DataSource = _ProRepo.LoadByLanguageId("b5c66d73-b2fa-436d-817a-e5332af83934");
     rptProducts.DataBind();
 }
 private void LoadProductsByLanguageID()
 {
     _rpoObj = new ProductRepository();
     grdData.DataSource = _rpoObj.LoadByLanguageId(ddlLanguage.SelectedValue.ToString());
     grdData.DataBind();
 }