Exemplo n.º 1
0
        protected void btnSaveContinue_Click(object sender, EventArgs e)
        {
            foreach (DataListItem item in dlImagesLocationDescription.Items)
            {
                int        leadImageID = (int)dlImagesLocationDescription.DataKeys[item.ItemIndex];
                LeadsImage leadImage   = null;

                TextBox txtLocation = item.FindControl("txtLocation") as TextBox;

                TextBox txtDescription = item.FindControl("txtDescription") as TextBox;

                if (!string.IsNullOrEmpty(txtLocation.Text) && !string.IsNullOrEmpty(txtDescription.Text))
                {
                    leadImage = LeadsUploadManager.GetLeadsImageById(leadImageID);
                    if (leadImage != null)
                    {
                        leadImage.Location = txtLocation.Text;

                        leadImage.Description = txtDescription.Text;

                        LeadsUploadManager.SaveImage(leadImage);
                    }
                }
            }

            // send user back to list of images
            Response.Redirect("~/Protected/Admin/LeadsImagesUpload.aspx");
        }
        protected void btnUpload_Click(object sender, EventArgs e)
        {
            //string filepath = myimage.ImageUrl;
            //using (WebClient client = new WebClient())
            //{
            //    client.DownloadFile(filepath, Server.MapPath("~/Image/apple.jpg"));
            //}


            var list = LeadsUploadManager.GetLeadsImageById(Convert.ToInt32(hfLeadImageId.Value));

            list.Location    = txtLocation.Text.Trim();
            list.Description = txtDescription.Text.Trim();
            LeadsUploadManager.SaveImage(list);



            //const string javaScript = "<script language=javascript>window.top.close(); window.opener.location.reload(true);</script>";
            const string javaScript = "<script language=javascript>window.top.close(); window.opener.RebindImages();</script>";

            if (!ClientScript.IsStartupScriptRegistered("CloseMyWindow"))
            {
                ClientScript.RegisterStartupScript(GetType(), "CloseMyWindow", javaScript);
            }
        }
Exemplo n.º 3
0
        public static void togglePrintFlag(bool isPrint, int leadImageID)
        {
            LeadsImage leadImage = LeadsUploadManager.GetLeadsImageById(leadImageID);

            if (leadImage != null)
            {
                leadImage.isPrint = isPrint;

                try {
                    LeadsUploadManager.SaveImage(leadImage);
                }
                catch (Exception ex) {
                    Core.EmailHelper.emailError(ex);
                }
            }
        }
Exemplo n.º 4
0
        public static string getLeadPhoto(int leadImageID)
        {
            string         result    = null;
            LeadsImage     leadImage = LeadsUploadManager.GetLeadsImageById(leadImageID);
            ClaimImageView claimView = null;

            if (leadImage != null)
            {
                claimView = new ClaimImageView {
                    location    = leadImage.Location,
                    description = leadImage.Description
                };
            }
            result = ComputerBeacon.Json.Serializer.Serialize(claimView);
            return(result);
        }
Exemplo n.º 5
0
        public static void saveLeadPhotoDescription(int leadImageID, string photoLocation, string photoDescription)
        {
            LeadsImage leadImage = LeadsUploadManager.GetLeadsImageById(leadImageID);

            if (leadImage != null)
            {
                leadImage.Location    = photoLocation.Trim();
                leadImage.Description = photoDescription.Trim();

                try {
                    LeadsUploadManager.SaveImage(leadImage);
                }
                catch (Exception ex) {
                    Core.EmailHelper.emailError(ex);
                }
            }
        }
Exemplo n.º 6
0
        protected void dtlist_ItemCommand(object sender, DataListCommandEventArgs e)
        {
            if (e.CommandName.Equals("DoDelete"))
            {
                int LeadImageId = Convert.ToInt32(e.CommandArgument);
                try {
                    var list = LeadsUploadManager.GetLeadsImageById(LeadImageId);
                    list.Status = 0;
                    LeadsUploadManager.SaveImage(list);


                    lblSave.Text    = "Image deleted Successfully.";
                    lblSave.Visible = true;
                    FillImage(this.leadID);
                }
                catch (Exception ex) {
                    lblError.Text    = "Image not deleted.";
                    lblError.Visible = true;
                }
            }
            if (e.CommandName.Equals("DoRotate"))
            {
                try {
                    System.Web.UI.WebControls.Image img = (System.Web.UI.WebControls.Image)e.Item.FindControl("Image1");
                    // get the full path of image url
                    string path = Server.MapPath(img.ImageUrl);

                    // creating image from the image url
                    System.Drawing.Image i = System.Drawing.Image.FromFile(path);

                    // rotate Image 90' Degree
                    i.RotateFlip(RotateFlipType.Rotate90FlipXY);

                    // save it to its actual path
                    i.Save(path);
                    // release Image File
                    i.Dispose();

                    img.Attributes.Add("ImageUrl", path);
                }
                catch (Exception ex) {
                }
            }
        }