コード例 #1
0
ファイル: edit.aspx.cs プロジェクト: Minh740/diva123
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            int id  = Convert.ToInt32(Request["id"]);
            int cat = Convert.ToInt32(Request["cat"]);

            ImageCategoryManager IM = new ImageCategoryManager();
            editimage = IM.GetByID(id);

            string base64             = Request["base64"];
            byte[] imageBytes         = Convert.FromBase64String(base64);
            System.IO.MemoryStream ms = new System.IO.MemoryStream(imageBytes, 0, imageBytes.Length);
            ms.Write(imageBytes, 0, imageBytes.Length);
            System.Drawing.Image image1 = System.Drawing.Image.FromStream(ms, true);
            string fileName             = editimage.ID + ".jpg";
            image1.Save(System.IO.Path.Combine(Server.MapPath("~/images/services/"), fileName));
            Response.Write(JsonConvert.SerializeObject(new
            {
                success = 1
            }));
        }
        catch (Exception ex)
        {
            Response.Write(JsonConvert.SerializeObject(new
            {
                success = -1,
                error   = ex
            }));
        }
    }
コード例 #2
0
ファイル: ImageCategory.aspx.cs プロジェクト: Minh740/diva123
    protected void Page_Load(object sender, EventArgs e)
    {
        ImageCategoryManager ICM = new ImageCategoryManager();

        listImage = ICM.GetList();
        CategoryManager cm = new CategoryManager();

        listCat = cm.GetList();
    }
コード例 #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int id = Convert.ToInt32(Page.RouteData.Values["ImageID"]);
        ImageCategoryManager icm = new ImageCategoryManager();

        image = icm.GetByID(id);
        CategoryManager cm = new CategoryManager();

        listCat = cm.GetList().Where(ele => ele.ParentID == null).ToList();
    }
コード例 #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int id = Convert.ToInt32(Request["id"]);
        ImageCategoryManager icm = new ImageCategoryManager();

        image = icm.GetByID(id);
        CategoryManager cm = new CategoryManager();

        listCat = cm.GetList();
    }
コード例 #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            int cat = Convert.ToInt32(Request["categoryID"]);

            ImageCategoryManager IM       = new ImageCategoryManager();
            ImageCategoryTBx     imageAdd = new ImageCategoryTBx();
            imageAdd.Status     = 1;
            imageAdd.CategoryID = cat;
            imageAdd.Link       = "a";
            imageAdd.Link2      = "a";
            IM.AddNew(imageAdd);
            imageAdd.Link  = "/upload/service/image_" + imageAdd.ID + ".jpg";
            imageAdd.Link2 = "/upload/service/image_" + imageAdd.ID + "_1.jpg";
            IM.Save();

            string base64 = Request["base641"];
            if (!string.IsNullOrEmpty(base64))
            {
                byte[] imageBytes         = Convert.FromBase64String(base64);
                System.IO.MemoryStream ms = new System.IO.MemoryStream(imageBytes, 0, imageBytes.Length);
                ms.Write(imageBytes, 0, imageBytes.Length);
                System.Drawing.Image image1 = System.Drawing.Image.FromStream(ms, true);
                string fileName             = "image_" + imageAdd.ID + ".jpg";
                image1.Save(System.IO.Path.Combine(Server.MapPath("~/upload/service/"), fileName));
            }

            base64 = Request["base642"];
            if (!string.IsNullOrEmpty(base64))
            {
                byte[] imageBytes         = Convert.FromBase64String(base64);
                System.IO.MemoryStream ms = new System.IO.MemoryStream(imageBytes, 0, imageBytes.Length);
                ms.Write(imageBytes, 0, imageBytes.Length);
                System.Drawing.Image image1 = System.Drawing.Image.FromStream(ms, true);
                string fileName             = "image_" + imageAdd.ID + "_1.jpg";
                image1.Save(System.IO.Path.Combine(Server.MapPath("~/upload/service/"), fileName));
            }


            Response.Write(JsonConvert.SerializeObject(new
            {
                success = 1
            }));
        }
        catch (Exception ex)
        {
            Response.Write(JsonConvert.SerializeObject(new
            {
                success = -1,
                error   = ex
            }));
        }
    }
コード例 #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         int id = Convert.ToInt32(Request["id"]);
         ImageCategoryManager im = new ImageCategoryManager();
         delete        = im.GetByID(id);
         delete.Status = -1;
         im.Save();
         Response.Write(1);
     }
     catch (Exception ex)
     {
         Response.Write(ex);
     }
 }
コード例 #7
0
ファイル: Services.aspx.cs プロジェクト: Minh740/diva123
    protected void Page_Load(object sender, EventArgs e)
    {
        ServicesManager    SM          = new ServicesManager();
        List <ServicesTBx> listService = SM.GetList();

        CategoryManager CM = new CategoryManager();

        ImageCategoryManager ICM = new ImageCategoryManager();

        listCategoryService = CM.GetList().Where(ele => ele.ParentID == null).Select(ele => new CategoryService
        {
            categoryID          = ele.ID,
            categoryName        = ele.Name,
            categoryDescription = ele.Description,
            listChildCategory   = ele.CategoryTBxes.Where(element => element.Status == 1).Select(element => new CategoryChild
            {
                categoryID   = element.ID,
                categoryName = element.Name,
                listService  = listService.Where(element2 => element2.CategoryID == element.ID).ToList()
            }).ToList(),
            listImageCategory = ICM.GetByCategoryID(ele.ID),
            listService       = listService.Where(element => element.CategoryID == ele.ID).ToList()
        }).ToList();
    }
コード例 #8
0
ファイル: ImageCategory.aspx.cs プロジェクト: Minh740/diva123
    protected void Page_Load(object sender, EventArgs e)
    {
        ImageCategoryManager ICM = new ImageCategoryManager();

        listImage = ICM.GetList().OrderBy(ele => ele.CategoryID).ToList();
    }
コード例 #9
0
 public ImageController()
 {
     _imageCategoryManager = new ImageCategoryManager(_unitOfWork);
     _imageManager         = new ImageManager(_unitOfWork);
 }
コード例 #10
0
ファイル: HomeController.cs プロジェクト: kiryl22/ThreeTrunks
 public HomeController()
 {
     _unitOfWork           = new UnitOfWork();
     _imageCategoryManager = new ImageCategoryManager(_unitOfWork);
 }