Пример #1
0
 protected void btnPhotoPreview_Click(object sender, EventArgs e)
 {
     if (FUBanner.HasFile)
     {
         TempImageLogicLayer Temp = new TempImageLogicLayer();
         Temp.image = System.IO.Path.GetExtension(FUBanner.FileName).ToLower();
         string Str = TempImageLogicLayer.InsertTempImageDetials(Temp);
         ViewState["ViewStateImage"] = Str;
         FUBanner.SaveAs(MapPath("~/Admin//TempImage//" + Str));
         System.Drawing.Image objImage = System.Drawing.Image.FromFile(Server.MapPath("~/Admin//TempImage//" + Str));
         int width  = objImage.Width;
         int height = objImage.Height;
         if (width != 950 && height != 432)
         {
             ViewState["ViewStateImage"] = null;
             img1.Src = null;
             //System.IO.File.Delete((MapPath("~/" + "Admin\\TempImage\\" + Str)));
             Response.Write("<script>alert('Image Size Is Not Valid, Allow image size 950 X 432');</script>");
         }
         else
         {
             System.Drawing.Image img2 = System.Drawing.Image.FromFile(MapPath("~/Admin//TempImage//") + Str);
             img1.Src = "~/Admin//TempImage//" + Str;
         }
     }
 }
Пример #2
0
    protected void GridView_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        GridViewRow row         = (GridViewRow)GridView1.Rows[e.RowIndex];
        HiddenField hfBannerIdD = (HiddenField)row.FindControl("hfBannerId");

        string s = hfBannerIdD.Value;

        try
        {
            DataTable CamaignDetail = BannerLogicLayer.GetAllIDWiseBannerDetials(s);
            hfMobileBrandId1.Value = s;
            txtBannerName.Text     = CamaignDetail.Rows[0]["BannerName"].ToString();
            ChkActive.Checked      = Convert.ToBoolean(CamaignDetail.Rows[0]["IsAcitve"].ToString());
            hfImadeName.Value      = CamaignDetail.Rows[0]["Image"].ToString();

            string Str1              = Convert.ToString(CamaignDetail.Rows[0]["ImageName"]);
            int    index             = Str1.IndexOf('.');
            string pennies           = Str1.Substring(index, Str1.Length - index);
            TempImageLogicLayer Temp = new TempImageLogicLayer();
            Temp.image = pennies;
            string Str = TempImageLogicLayer.InsertTempImageDetials(Temp);

            ViewState["ViewStateImage"] = Str;
            string path1 = Server.MapPath("~/" + "Admin\\banner\\" + Convert.ToString(CamaignDetail.Rows[0]["ImageName"]));
            string path  = Server.MapPath("~/" + "Admin\\TempImage\\" + Str);
            SaveImage(MapPathReverse(path1), MapPathReverse(path));
            // System.IO.File.Delete(path1);
            System.Drawing.Image img2 = System.Drawing.Image.FromFile(MapPath("~/Admin//TempImage//") + Str);
            img1.Src = "~/Admin//TempImage//" + Str;

            BtnSave.Text = "UPDATE";
            //btn_save.Text = "UPDATE";
        }
        catch (Exception)
        {
        }
    }