Beispiel #1
0
        protected void gvDocuments_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "DoDelete")
            {
                try {
                    ImageButton imsource   = (ImageButton)e.CommandSource;
                    GridViewRow currentrow = null;
                    if (imsource != null)
                    {
                        currentrow = (GridViewRow)imsource.NamingContainer;
                    }
                    HiddenField LeadId = (HiddenField)currentrow.FindControl("hfLeadId");

                    using (TransactionScope scope = new TransactionScope()) {
                        LeadsDocument doc = LeadsUploadManager.GetLeadsDocumentById(Convert.ToInt32(e.CommandArgument));
                        doc.Status = 0;
                        LeadsUploadManager.SaveDocument(doc);
                        scope.Complete();
                    }
                    FillDocument(Convert.ToInt32(LeadId.Value));
                    lblSave.Visible = true;
                    lblSave.Text    = "Record Deleted !!!";
                }
                catch (Exception ex) {
                    lblError.Visible = true;
                    lblError.Text    = "Record Not Deleted !!!";
                }
            }
            if (e.CommandName == "DoUpdate")
            {
            }
        }
Beispiel #2
0
        protected void btnUploadDoc_Click(object sender, EventArgs e)
        {
            string ext;
            string ActualFileName = "", SavedFileName = string.Empty;
            string FileNameWithoutExt = "";
            string OccasionId         = string.Empty;
            string Occasion           = string.Empty;

            try {
                LeadsDocument objLeadDoc = new LeadsDocument();
                if (FileUpload2.HasFile)
                {
                    int LeadID = 0;
                    if (hfLeadsId.Value != null && Convert.ToInt32(hfLeadsId.Value) > 0)
                    {
                        LeadID = Convert.ToInt32(hfLeadsId.Value);
                    }
                    else
                    {
                        lblError.Text    = string.Empty;
                        lblError.Text    = "There is a problem to upload.";
                        lblError.Visible = true;
                        return;
                    }
                    string Location = "";
                    ext                     = System.IO.Path.GetExtension(FileUpload2.PostedFile.FileName);
                    ActualFileName          = FileUpload2.PostedFile.FileName.Substring(FileUpload2.PostedFile.FileName.LastIndexOf(@"\") + 1);
                    FileNameWithoutExt      = ActualFileName.Replace(ext, "");
                    objLeadDoc.LeadId       = LeadID;
                    objLeadDoc.Description  = txtDescriptionDoc.Text;
                    objLeadDoc.DocumentName = ActualFileName;
                    objLeadDoc.Status       = 1;
                    LeadsDocument objld = LeadsUploadManager.SaveDocument(objLeadDoc);
                    if (objld.LeadDocumentId > 0)
                    {
                        if (!Directory.Exists(Server.MapPath("~/LeadsDocument/" + LeadID + "/" + objld.LeadDocumentId)))
                        {
                            Directory.CreateDirectory(Server.MapPath("~/LeadsDocument/" + LeadID + "/" + objld.LeadDocumentId));
                        }

                        FileUpload2.PostedFile.SaveAs(Server.MapPath("~/LeadsDocument/" + LeadID + "/" + objld.LeadDocumentId + "/" + ActualFileName));


                        lblSave.Text           = string.Empty;
                        lblSave.Text           = "Document Uploaded Successfully";
                        lblSave.Visible        = true;
                        txtDescriptionDoc.Text = string.Empty;
                        FillDocument(LeadID);
                    }
                }
            }
            catch (Exception ex) {
                lblError.Text    = string.Empty;
                lblError.Text    = "There is a problem to upload.";
                lblError.Visible = true;
            }
        }
Beispiel #3
0
        protected void gvHistoricalDocuments_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            string appUrl = ConfigurationManager.AppSettings["appURL"].ToString();

            int leadId = Core.SessionHelper.getLeadId();

            LeadsDocument document = e.Row.DataItem as LeadsDocument;

            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                HyperLink hlnkDocument = e.Row.FindControl("hlnkDocument") as HyperLink;

                hlnkDocument.NavigateUrl = string.Format("{0}/LeadsDocument/{1}/{2}/{3}", appUrl, document.LeadId, document.LeadDocumentId, document.DocumentName);
                hlnkDocument.Text        = document.DocumentName;
            }
        }
Beispiel #4
0
        private void updateDocumentLog(string reportPath, int policyTypeID)
        {
            string appPath      = ConfigurationManager.AppSettings["appPath"].ToString();
            string documentPath = null;

            int leadID = Core.SessionHelper.getLeadId();

            LeadsDocument objLeadDoc = new LeadsDocument();

            string ActualFileName = Path.GetFileName(reportPath);

            string FileNameWithoutExt = Path.GetFileNameWithoutExtension(reportPath);

            objLeadDoc.LeadId = leadID;

            objLeadDoc.Description = "Invoice";

            objLeadDoc.DocumentName = ActualFileName;
            objLeadDoc.Status       = 1;
            objLeadDoc.IsPrint      = false;

            objLeadDoc.InsertDate = DateTime.Now;

            objLeadDoc.PolicyTypeID = policyTypeID;

            objLeadDoc = LeadsUploadManager.SaveDocument(objLeadDoc);

            if (objLeadDoc.LeadDocumentId > 0)
            {
                documentPath = appPath + "/LeadsDocument/" + leadID + "/" + objLeadDoc.LeadDocumentId;

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

                File.Copy(reportPath, documentPath + "/" + ActualFileName, true);
            }
        }
Beispiel #5
0
        public static LeadsDocument SaveDocument(LeadsDocument objLeadsDocument)
        {
            if (objLeadsDocument.LeadDocumentId == 0)
            {
                objLeadsDocument.InsertBy = Convert.ToInt32(HttpContext.Current.User.Identity.Name);

                if (objLeadsDocument.InsertDate == null)
                {
                    objLeadsDocument.InsertDate = DateTime.Now;
                }

                objLeadsDocument.InsertMachineInfo = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"].ToString();
                DbContextHelper.DbContext.Add(objLeadsDocument);
            }

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

            return(objLeadsDocument);
        }
        private void updateDocumentLog(string reportPath, int policyTypeID)
        {
            string appPath = ConfigurationManager.AppSettings["appPath"].ToString();
            string documentPath = null;

            int leadID = Core.SessionHelper.getLeadId();

            LeadsDocument objLeadDoc = new LeadsDocument();

            string ActualFileName = Path.GetFileName(reportPath);

            string FileNameWithoutExt = Path.GetFileNameWithoutExtension(reportPath);

            objLeadDoc.LeadId = leadID;

            objLeadDoc.Description = "Invoice";

            objLeadDoc.DocumentName = ActualFileName;
            objLeadDoc.Status = 1;
            objLeadDoc.IsPrint = false;

            objLeadDoc.InsertDate = DateTime.Now;

            objLeadDoc.PolicyTypeID = policyTypeID;

            objLeadDoc = LeadsUploadManager.SaveDocument(objLeadDoc);

            if (objLeadDoc.LeadDocumentId > 0) {
                documentPath = appPath + "/LeadsDocument/" + leadID + "/" + objLeadDoc.LeadDocumentId;

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

                File.Copy(reportPath, documentPath + "/" + ActualFileName, true);
            }
        }
        protected void btnUploadDoc_Click(object sender, EventArgs e)
        {
            string ext;
            string ActualFileName = "", SavedFileName = string.Empty;
            string FileNameWithoutExt = "";
            DateTime fileDate = DateTime.MinValue;
            string OccasionId = string.Empty;
            string Occasion = string.Empty;
            int LeadID = Convert.ToInt32(Session["LeadIds"]);

            Page.Validate("DocUpload");
            if (!Page.IsValid)
                return;

            string policyType = Page.Request.Params["t"].ToString();
            int policyTypeID = (int)Enum.Parse(typeof(PolicyType), policyType);

            try {
                if (FileUpload2.HasFile) {
                    LeadsDocument objLeadDoc = new LeadsDocument();

                    ext = System.IO.Path.GetExtension(FileUpload2.PostedFile.FileName);
                    ActualFileName = FileUpload2.PostedFile.FileName.Substring(FileUpload2.PostedFile.FileName.LastIndexOf(@"\") + 1);
                    FileNameWithoutExt = ActualFileName.Replace(ext, "");
                    objLeadDoc.LeadId = LeadID;
                    objLeadDoc.Description = txtDescriptionDoc.Text;
                    objLeadDoc.DocumentName = ActualFileName;
                    objLeadDoc.Status = 1;

                    DateTime.TryParse(hf_lastModifiedDate.Value, out fileDate);

                    objLeadDoc.InsertDate = fileDate;

                    objLeadDoc.PolicyTypeID = policyTypeID;

                    LeadsDocument objld = LeadsUploadManager.SaveDocument(objLeadDoc);

                    if (objld.LeadDocumentId > 0) {
                        if (!Directory.Exists(appPath + "/LeadsDocument/" + LeadID + "/" + objld.LeadDocumentId)) {
                            Directory.CreateDirectory(appPath + "/LeadsDocument/" + LeadID + "/" + objld.LeadDocumentId);
                        }

                        FileUpload2.PostedFile.SaveAs(appPath + "/LeadsDocument/" + LeadID + "/" + objld.LeadDocumentId + "/" + ActualFileName);

                        //lblSave.Text = string.Empty;
                        //lblSave.Text = "Document Uploaded Successfully";
                        //lblSave.Visible = true;
                        txtDescriptionDoc.Text = string.Empty;
                        //bindDocuments(LeadID);

                        string js = "<script type='text/javascript'>closeRefresh();</script>";

                        ClientScript.RegisterClientScriptBlock(typeof(Page), "commentk", js);
                    }
                }
            }
            catch (Exception ex) {
                Core.EmailHelper.emailError(ex);

                //lblError.Text = string.Empty;
                //lblError.Text = "There is a problem to upload.";
                //lblError.Visible = true;
            }
        }
        protected void btnUploadDoc_Click(object sender, EventArgs e)
        {
            string ext;
            string ActualFileName = "", SavedFileName = string.Empty;
            string FileNameWithoutExt = "";
            string OccasionId = string.Empty;
            string Occasion = string.Empty;
            try {
                LeadsDocument objLeadDoc = new LeadsDocument();
                if (FileUpload2.HasFile) {
                    int LeadID = 0;
                    if (hfLeadsId.Value != null && Convert.ToInt32(hfLeadsId.Value) > 0) {
                        LeadID = Convert.ToInt32(hfLeadsId.Value);
                    }
                    else {
                        lblError.Text = string.Empty;
                        lblError.Text = "There is a problem to upload.";
                        lblError.Visible = true;
                        return;
                    }
                    string Location = "";
                    ext = System.IO.Path.GetExtension(FileUpload2.PostedFile.FileName);
                    ActualFileName = FileUpload2.PostedFile.FileName.Substring(FileUpload2.PostedFile.FileName.LastIndexOf(@"\") + 1);
                    FileNameWithoutExt = ActualFileName.Replace(ext, "");
                    objLeadDoc.LeadId = LeadID;
                    objLeadDoc.Description = txtDescriptionDoc.Text;
                    objLeadDoc.DocumentName = ActualFileName;
                    objLeadDoc.Status = 1;
                    LeadsDocument objld = LeadsUploadManager.SaveDocument(objLeadDoc);
                    if (objld.LeadDocumentId > 0) {
                        if (!Directory.Exists(Server.MapPath("~/LeadsDocument/" + LeadID + "/" + objld.LeadDocumentId))) {
                            Directory.CreateDirectory(Server.MapPath("~/LeadsDocument/" + LeadID + "/" + objld.LeadDocumentId));
                        }

                        FileUpload2.PostedFile.SaveAs(Server.MapPath("~/LeadsDocument/" + LeadID + "/" + objld.LeadDocumentId + "/" + ActualFileName));

                        lblSave.Text = string.Empty;
                        lblSave.Text = "Document Uploaded Successfully";
                        lblSave.Visible = true;
                        txtDescriptionDoc.Text = string.Empty;
                        FillDocument(LeadID);

                    }
                }
            }
            catch (Exception ex) {
                lblError.Text = string.Empty;
                lblError.Text = "There is a problem to upload.";
                lblError.Visible = true;
            }
        }
Beispiel #9
0
        protected void btnUploadDoc_Click(object sender, EventArgs e)
        {
            string   ext;
            string   ActualFileName = "", SavedFileName = string.Empty;
            string   FileNameWithoutExt = "";
            DateTime fileDate           = DateTime.MinValue;
            string   OccasionId         = string.Empty;
            string   Occasion           = string.Empty;
            int      LeadID             = Convert.ToInt32(Session["LeadIds"]);

            Page.Validate("DocUpload");
            if (!Page.IsValid)
            {
                return;
            }

            string policyType   = Page.Request.Params["t"].ToString();
            int    policyTypeID = (int)Enum.Parse(typeof(PolicyType), policyType);

            try {
                if (FileUpload2.HasFile)
                {
                    LeadsDocument objLeadDoc = new LeadsDocument();

                    ext                     = System.IO.Path.GetExtension(FileUpload2.PostedFile.FileName);
                    ActualFileName          = FileUpload2.PostedFile.FileName.Substring(FileUpload2.PostedFile.FileName.LastIndexOf(@"\") + 1);
                    FileNameWithoutExt      = ActualFileName.Replace(ext, "");
                    objLeadDoc.LeadId       = LeadID;
                    objLeadDoc.Description  = txtDescriptionDoc.Text;
                    objLeadDoc.DocumentName = ActualFileName;
                    objLeadDoc.Status       = 1;

                    DateTime.TryParse(hf_lastModifiedDate.Value, out fileDate);

                    objLeadDoc.InsertDate = fileDate;

                    objLeadDoc.PolicyTypeID = policyTypeID;

                    LeadsDocument objld = LeadsUploadManager.SaveDocument(objLeadDoc);

                    if (objld.LeadDocumentId > 0)
                    {
                        if (!Directory.Exists(appPath + "/LeadsDocument/" + LeadID + "/" + objld.LeadDocumentId))
                        {
                            Directory.CreateDirectory(appPath + "/LeadsDocument/" + LeadID + "/" + objld.LeadDocumentId);
                        }

                        FileUpload2.PostedFile.SaveAs(appPath + "/LeadsDocument/" + LeadID + "/" + objld.LeadDocumentId + "/" + ActualFileName);

                        //lblSave.Text = string.Empty;
                        //lblSave.Text = "Document Uploaded Successfully";
                        //lblSave.Visible = true;
                        txtDescriptionDoc.Text = string.Empty;
                        //bindDocuments(LeadID);

                        string js = "<script type='text/javascript'>closeRefresh();</script>";

                        ClientScript.RegisterClientScriptBlock(typeof(Page), "commentk", js);
                    }
                }
            }
            catch (Exception ex) {
                Core.EmailHelper.emailError(ex);

                //lblError.Text = string.Empty;
                //lblError.Text = "There is a problem to upload.";
                //lblError.Visible = true;
            }
        }