Beispiel #1
0
        private void gitdata()
        {
            //AdminRepository _Obj = new AdminRepository();
            //grd.DataSource = _Obj.LoadByActiveState();
            //grd.DataBind();

            //ddl.DataSource = _Obj.LoadByActiveState();
            //ddl.DataTextField = "username";
            //ddl.DataValueField = "Id";

            //ddl.DataBind();

            ProductImagesRepositories _obj = new ProductImagesRepositories();
            grd.DataSource = _obj.LoadByProductIdAndLanguageId("b5c66d73-b2fa-436d-817a-e5332af83934", "c9dd4e88-fca1-460d-a0ab-233ddcf876ca");
            grd.DataBind();
            //PageSectionsRepository _obj = new PageSectionsRepository();
            //grd.DataSource = _obj.LoadByActiveState();
            //grd.DataBind();

            //LanguageRepository _Obj = new LanguageRepository();
            //grd.DataSource = _Obj.LoadByActiveState();
            //grd.DataBind();

            //PageRepository _Obj = new PageRepository();
            //grd.DataSource = _Obj.LoadByActiveState();
            //grd.DataBind();
        }
 protected void lstview_ItemCommand(object sender, ListViewCommandEventArgs e)
 {
     _rpoObj = new ProductImagesRepositories();
     switch (e.CommandName)
     {
         case "restoreitem":
             if (_rpoObj.Restore(e.CommandArgument.ToString(), Request.Cookies["CooLoginUserId"].Value))
             { lstview.DataBind(); }
             break;
         case "deleteitem":
             if (_rpoObj.Delete(e.CommandArgument.ToString(), Request.Cookies["CooLoginUserId"].Value))
             { lstview.DataBind(); }
             break;
         case "edititem":
             ProductImageId = e.CommandArgument.ToString();
             GetInfo();
             break;
     }
 }
        bool Save(string FileName, out string MSG)
        {
            _rpoObj = new ProductImagesRepositories();
            if (string.IsNullOrEmpty(ProductImageId))
            {
                //Add
                if (!string.IsNullOrEmpty(FileName))
                {
                    //ProductImageId = _rpoObj.Add(null, ProductId, FileName, Request.Cookies["UserWebsiteId"].Value);
                    _rpoObj._Obj.ProductId = new Guid(ProductId);
                    _rpoObj._Obj.ImageFile = FileName;
                    _rpoObj._Obj.CreatedBy = new Guid(Request.Cookies["CooLoginUserId"].Value);
                    _rpoObj._Obj.LanguageId = new Guid(LanguageId);
                    ProductImageId = _rpoObj.Add().ToString();

                    if (!string.IsNullOrEmpty(ProductImageId))
                    {
                        MSG = "done";
                        return true;
                    }
                    else
                    {
                        MSG = "Select Images to upload";
                        return false;
                    }
                }
                else
                {
                    MSG = "Select Images to be uploaded";
                    return false;
                }
            }
            else
            {

                _rpoObj._Obj = _rpoObj.LoadById(ProductImageId);
                _rpoObj._Obj.ProductId = new Guid(ProductId);
                _rpoObj._Obj.ImageFile = FileName;
                _rpoObj._Obj.ModifiedBy = new Guid(Request.Cookies["CooLoginUserId"].Value);
                _rpoObj._Obj.LanguageId = new Guid(LanguageId);

                //Edit
                if (_rpoObj.Edit())
                {
                    MSG = "Update Complete.";
                    return true;
                }
                else
                {
                    MSG = "Update Failed";
                    return false;
                }
            }
        }
        void GetInfo()
        {
            if (!string.IsNullOrEmpty(ProductImageId))
            {
                AjaxFileUpload1.MaximumNumberOfFiles = 1;
                _rpoObj = new ProductImagesRepositories();
                ProductImage ProductImageEnt = _rpoObj.LoadById(ProductImageId);

                if (ProductImageEnt != null)
                {
                    imgEdit.ImageUrl = "~/Files/Products/" + ProductImageEnt.ImageFile;
                    ImageFile = ProductImageEnt.ImageFile;
                    tbEdit.Visible = true;
                }
            }
        }