Esempio 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");
        }
Esempio n. 2
0
        protected void dtlist_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            string js     = null;
            string appUrl = ConfigurationManager.AppSettings["appURL"].ToString();

            CheckBox   cbxPrint  = e.Item.FindControl("cbxPrint") as CheckBox;
            LeadsImage leadImage = e.Item.DataItem as LeadsImage;

            if (cbxPrint != null && leadImage != null)
            {
                js = string.Format("javascript:togglePrintOption(this, {0});", leadImage.LeadImageId);
                cbxPrint.Attributes["onclick"] = js;
            }

            System.Web.UI.WebControls.Image photo = e.Item.FindControl("Image1") as System.Web.UI.WebControls.Image;

            if (!string.IsNullOrEmpty(leadImage.ImageName))
            {
                photo.ImageUrl = string.Format("{0}/LeadsImage/{1}/{2}/{3}", appUrl, leadImage.LeadId, leadImage.LeadImageId, leadImage.ImageName);
            }
            else
            {
                photo.ImageUrl = string.Format("{0}/Images/no.jpg", appUrl);
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            string LeadId       = "";
            int    policyTypeID = 0;

            if (context.Session["LeadIds"] != null)
            {
                LeadId = Convert.ToString(context.Session["LeadIds"]);
            }
            HttpPostedFile fileToUpload = context.Request.Files["Filedata"];


            string ext                = System.IO.Path.GetExtension(fileToUpload.FileName);
            string ActualFileName     = fileToUpload.FileName.Substring(fileToUpload.FileName.LastIndexOf(@"\") + 1);
            string FileNameWithoutExt = ActualFileName.Replace(ext, "");

            if (ext != ".doc" && ext != ".exl" && ext != ".pdf")
            {
                LeadsImage objLeadImage = new LeadsImage();
                objLeadImage.LeadId    = Convert.ToInt32(LeadId);
                objLeadImage.ImageName = ActualFileName;
                objLeadImage.Status    = 1;

                if (context.Session["policyTypeID"] != null)
                {
                    policyTypeID = (int)context.Session["policyTypeID"];
                }

                objLeadImage.policyTypeID = policyTypeID;

                // 2013-09-24 tortega
                objLeadImage.isPrint = true;

                objLeadImage = LeadsUploadManager.SaveImage(objLeadImage);

                if (Convert.ToInt32(LeadId) > 0)
                {
                    if (!Directory.Exists(HttpContext.Current.Server.MapPath("~/LeadsImage/" + Convert.ToInt32(LeadId) + "/" + objLeadImage.LeadImageId)))
                    {
                        Directory.CreateDirectory(HttpContext.Current.Server.MapPath("~/LeadsImage/" + Convert.ToInt32(LeadId) + "/" + objLeadImage.LeadImageId));
                    }

                    fileToUpload.SaveAs(HttpContext.Current.Server.MapPath("~/LeadsImage/" + Convert.ToInt32(LeadId) + "/" + objLeadImage.LeadImageId + "/" + ActualFileName));
                }
            }

            //string pathToSave = HttpContext.Current.Server.MapPath("~/TempLeadsImage/") + LeadId + "/" +fileToUpload.FileName;


            //if (!Directory.Exists(HttpContext.Current.Server.MapPath("~\\TempLeadsImage\\" + LeadId)))
            //    Directory.CreateDirectory(HttpContext.Current.Server.MapPath("~\\TempLeadsImage\\" + LeadId));

            //fileToUpload.SaveAs(pathToSave);
        }
Esempio n. 4
0
        protected void dlImagesLocationDescription_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                Image photoImage = (Image)e.Item.FindControl("photoImage");

                LeadsImage leadImage = e.Item.DataItem as LeadsImage;

                string imageUrl = leadImage.ImageName == String.Empty ? "../../Images/no.jpg" : "../../LeadsImage/" + Convert.ToString(leadImage.LeadId) + "/" + Convert.ToString(leadImage.LeadImageId) + "/" + Convert.ToString(leadImage.ImageName);

                photoImage.ImageUrl = imageUrl;
            }
        }
        private void FillImage(int LeadId, int LeadImageId)
        {
            LeadsImage img = LeadsUploadManager.getLeadsImageByLeadID(LeadId).Where(x => x.LeadImageId == LeadImageId).SingleOrDefault();

            if (img != null)
            {
                txtLocation.Text    = img.Location;
                txtDescription.Text = img.Description;
                string imageName = img.ImageName == String.Empty ? "../../Images/no.jpg" : "../../LeadsImage/" + Convert.ToString(img.LeadId) + "/" + Convert.ToString(img.LeadImageId) + "/" + Convert.ToString(img.ImageName);
                myimage.ImageUrl = imageName;
            }
            else
            {
            }
        }
Esempio n. 6
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);
                }
            }
        }
Esempio n. 7
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);
        }
Esempio n. 8
0
        public static LeadsImage SaveImage(LeadsImage objLeadsImage)
        {
            if (objLeadsImage.LeadImageId == 0)
            {
                objLeadsImage.InsertDate        = DateTime.Now;
                objLeadsImage.InsertMachineInfo = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"].ToString();
                DbContextHelper.DbContext.Add(objLeadsImage);
            }

            //secUser.UpdatedBy = Convert.ToInt32(HttpContext.Current.User.Identity.Name);
            objLeadsImage.UpdateMachineInfo = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"].ToString();
            objLeadsImage.UpdateDate        = DateTime.Now;
            DbContextHelper.DbContext.SaveChanges();

            return(objLeadsImage);
        }
        public void ProcessRequest(HttpContext context)
        {
            string LeadId = "";
            int policyTypeID = 0;

            if (context.Session["LeadIds"] != null) {
                LeadId = Convert.ToString(context.Session["LeadIds"]);
            }
            HttpPostedFile fileToUpload = context.Request.Files["Filedata"];

            string ext = System.IO.Path.GetExtension(fileToUpload.FileName);
            string ActualFileName = fileToUpload.FileName.Substring(fileToUpload.FileName.LastIndexOf(@"\") + 1);
            string FileNameWithoutExt = ActualFileName.Replace(ext, "");
            if (ext != ".doc" && ext != ".exl" && ext != ".pdf") {

                LeadsImage objLeadImage = new LeadsImage();
                objLeadImage.LeadId = Convert.ToInt32(LeadId);
                objLeadImage.ImageName = ActualFileName;
                objLeadImage.Status = 1;

                if (context.Session["policyTypeID"] != null)
                    policyTypeID = (int) context.Session["policyTypeID"];

                objLeadImage.policyTypeID = policyTypeID;

                // 2013-09-24 tortega
                objLeadImage.isPrint = true;

                objLeadImage = LeadsUploadManager.SaveImage(objLeadImage);

                if (Convert.ToInt32(LeadId) > 0) {
                    if (!Directory.Exists(HttpContext.Current.Server.MapPath("~/LeadsImage/" + Convert.ToInt32(LeadId) + "/" + objLeadImage.LeadImageId)))
                        Directory.CreateDirectory(HttpContext.Current.Server.MapPath("~/LeadsImage/" + Convert.ToInt32(LeadId) + "/" + objLeadImage.LeadImageId));

                    fileToUpload.SaveAs(HttpContext.Current.Server.MapPath("~/LeadsImage/" + Convert.ToInt32(LeadId) + "/" + objLeadImage.LeadImageId + "/" + ActualFileName));

                }
            }

            //string pathToSave = HttpContext.Current.Server.MapPath("~/TempLeadsImage/") + LeadId + "/" +fileToUpload.FileName;

            //if (!Directory.Exists(HttpContext.Current.Server.MapPath("~\\TempLeadsImage\\" + LeadId)))
            //    Directory.CreateDirectory(HttpContext.Current.Server.MapPath("~\\TempLeadsImage\\" + LeadId));

            //fileToUpload.SaveAs(pathToSave);
        }
Esempio n. 10
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);
                }
            }
        }
Esempio n. 11
0
        protected void uploadFile(FileUpload fileupload, int leadID, string fileDescription)
        {
            string appPath  = ConfigurationManager.AppSettings["appPath"].ToString();
            string filePath = null;

            if (fileupload.HasFile)
            {
                LeadsImage objLeadImage = new LeadsImage();
                objLeadImage.LeadId    = leadID;
                objLeadImage.ImageName = fileupload.FileName;
                objLeadImage.Status    = 1;
                objLeadImage.InsertBy  = userID;
                objLeadImage.isPrint   = true;

                if (!string.IsNullOrEmpty(fileDescription))
                {
                    objLeadImage.Description = fileDescription;
                }

                objLeadImage.policyTypeID = Convert.ToInt32(ucPolicyType1.SelectedValue);
                objLeadImage = LeadsUploadManager.SaveImage(objLeadImage);

                if (fileupload.PostedFile.ContentType == "application/msword")
                {
                }
                else
                {
                    // images
                    string filename = Path.GetFileName(fileupload.FileName);
                    filePath = string.Format("{0}\\LeadsImage\\{1}\\{2}", appPath, leadID, objLeadImage.LeadImageId);

                    if (!Directory.Exists(filePath))
                    {
                        Directory.CreateDirectory(filePath);
                    }

                    fileupload.SaveAs(filePath + "\\" + filename);
                }
            }
        }
Esempio n. 12
0
        protected void uploadFile(FileUpload fileupload, int leadID, string fileDescription)
        {
            string appPath = ConfigurationManager.AppSettings["appPath"].ToString();
            string filePath = null;

            if (fileupload.HasFile) {
                LeadsImage objLeadImage = new LeadsImage();
                objLeadImage.LeadId = leadID;
                objLeadImage.ImageName = fileupload.FileName;
                objLeadImage.Status = 1;
                objLeadImage.InsertBy = userID;
                objLeadImage.isPrint = true;

                if (!string.IsNullOrEmpty(fileDescription))
                    objLeadImage.Description = fileDescription;

                objLeadImage.policyTypeID = Convert.ToInt32(ucPolicyType1.SelectedValue);
                objLeadImage = LeadsUploadManager.SaveImage(objLeadImage);

                if (fileupload.PostedFile.ContentType == "application/msword") {

                }
                else {
                    // images
                    string filename = Path.GetFileName(fileupload.FileName);
                    filePath = string.Format("{0}\\LeadsImage\\{1}\\{2}", appPath, leadID, objLeadImage.LeadImageId);

                    if (!Directory.Exists(filePath))
                        Directory.CreateDirectory(filePath);

                    fileupload.SaveAs(filePath + "\\" + filename);
                }
            }
        }