Ejemplo n.º 1
0
        public static LeadSourceMaster Save(LeadSourceMaster objleadSource)
        {
            if (objleadSource.LeadSourceId == 0)
            {
                //objProducer.InsertBy = Convert.ToInt32(HttpContext.Current.User.Identity.Name);
                objleadSource.InsertDate        = DateTime.Now;
                objleadSource.InsertMachineInfo = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"].ToString();
                DbContextHelper.DbContext.Add(objleadSource);
            }

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

            return(objleadSource);
        }
Ejemplo n.º 2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            lblError.Text      = string.Empty;
            lblError.Visible   = false;
            lblSave.Text       = string.Empty;
            lblSave.Visible    = false;
            lblMessage.Visible = false;
            lblMessage.Text    = string.Empty;

            int clientID = Core.SessionHelper.getClientId();

            try {
                using (TransactionScope scope = new TransactionScope()) {
                    bool exists = LeadSourceManager.IsExist(txtLeadSource.Text.Trim(), Convert.ToInt32(hdId.Value));
                    if (exists)
                    {
                        lblMessage.Text    = "Lead Source already exists!";
                        lblMessage.Visible = true;
                        txtLeadSource.Focus();
                        return;
                    }

                    LeadSourceMaster lSource = LeadSourceManager.GetLeadSourceId(Convert.ToInt32(hdId.Value));
                    lSource.LeadSourceName = txtLeadSource.Text;
                    lSource.ClientId       = clientID;
                    lSource.Status         = true;

                    LeadSourceManager.Save(lSource);

                    lblSave.Text = hdId.Value == "0" ? "Lead Source saved successfully." : "Lead Source updated successfully.";
                    btnCancel_Click(null, null);
                    lblSave.Visible = true;
                    scope.Complete();
                }
                clearFields();
            }
            catch (Exception ex) {
                lblError.Visible = true;
                lblError.Text    = "Lead Source not saved!";

                Core.EmailHelper.emailError(ex);
            }
        }
Ejemplo n.º 3
0
        private void copyLeadSource(int sourceClientID, int targetClientID, int userID)
        {
            List <LeadSourceMaster> sources   = LeadSourceManager.GetAll(sourceClientID);
            LeadSourceMaster        newSource = null;

            if (sources != null)
            {
                foreach (LeadSourceMaster source in sources)
                {
                    newSource                = new LeadSourceMaster();
                    newSource.ClientId       = targetClientID;
                    newSource.InsertBy       = userID;
                    newSource.InsertDate     = DateTime.Now;
                    newSource.LeadSourceName = source.LeadSourceName;
                    newSource.Status         = source.Status;

                    LeadSourceManager.Save(newSource);
                }
            }
        }
Ejemplo n.º 4
0
        protected void gv_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            lblError.Text      = string.Empty;
            lblSave.Text       = string.Empty;
            lblMessage.Text    = string.Empty;
            lblMessage.Visible = false;
            lblError.Visible   = false;
            lblSave.Visible    = false;
            if (e.CommandName.Equals("DoEdit"))
            {
                int leadSourceId = Convert.ToInt32(e.CommandArgument);
                hdId.Value = leadSourceId.ToString();

                LeadSourceMaster leadSource = LeadSourceManager.GetLeadSourceId(leadSourceId);
                if (leadSource != null)
                {
                    txtLeadSource.Text = leadSource.LeadSourceName;
                }
            }
            else if (e.CommandName.Equals("DoDelete"))
            {
                // In Case of delete
                try {
                    var lSource = LeadSourceManager.GetLeadSourceId(Convert.ToInt32(e.CommandArgument));
                    lSource.Status = false;
                    LeadSourceManager.Save(lSource);
                    btnCancel_Click(null, null);
                    lblSave.Text    = "Lead Source deleted successfully.";
                    lblSave.Visible = true;
                }
                catch (Exception ex) {
                    lblError.Text    = "Lead Source not deleted!";
                    lblError.Visible = true;

                    Core.EmailHelper.emailError(ex);
                }
            }
        }
Ejemplo n.º 5
0
        private void copyLeadSource(int sourceClientID, int targetClientID, int userID)
        {
            List<LeadSourceMaster> sources = LeadSourceManager.GetAll(sourceClientID);
            LeadSourceMaster newSource = null;

            if (sources != null) {
                foreach(LeadSourceMaster source in sources){
                    newSource = new LeadSourceMaster();
                    newSource.ClientId = targetClientID;
                    newSource.InsertBy = userID;
                    newSource.InsertDate = DateTime.Now;
                    newSource.LeadSourceName = source.LeadSourceName;
                    newSource.Status = source.Status;

                    LeadSourceManager.Save(newSource);
                }
            }
        }
Ejemplo n.º 6
0
        protected void UploadTemplate1()
        {
            // original format designed by Vivek
            int adjusterID = 0;
            lblSave.Text = string.Empty;
            lblSave.Visible = false;
            lblError.Text = string.Empty;
            lblError.Visible = false;
            lblMessage.Text = string.Empty;
            lblMessage.Visible = false;
            // 2013-02-09 tortega -- Added data validation prior to import. File is not aborted in the event of incorrect data.
            string str = null;

            int clientID = Core.SessionHelper.getClientId();

            // assume homeowner
            int policyType = 1;
            DateTime DateSubmitted = DateTime.Now;

            try {
                if (FileUpload1.HasFile) {

                    string ext = System.IO.Path.GetExtension(FileUpload1.PostedFile.FileName);
                    string ActualFileName = FileUpload1.PostedFile.FileName.Substring(FileUpload1.PostedFile.FileName.LastIndexOf(@"\") + 1);
                    string FileNameWithoutExt = ActualFileName.Replace(ext, "");
                    if (ext == ".csv") {

                        if (!Directory.Exists(Server.MapPath("~//CSVLoad//"))) {
                            Directory.CreateDirectory(Server.MapPath("~//CSVLoad//"));
                        }
                        FileUpload1.SaveAs(Server.MapPath("~//CSVLoad//" + FileUpload1.FileName));
                        DataTable table = CSVReader.ReadCSVFile(Server.MapPath("~//CSVLoad//" + FileUpload1.FileName), true);
                        using (TransactionScope scope = new TransactionScope()) {
                            Leads objLead = null;
                            for (int i = 0; i < table.Rows.Count; i++) {

                                objLead = new Leads();

                                objLead.OriginalLeadDate = DateTime.Now;
                                objLead.UserId = Convert.ToInt32(Session["UserId"]);

                                if (table.Rows[i]["DateSubmitted"] != string.Empty) {

                                    DateTime.TryParse(table.Rows[i]["DateSubmitted"].ToString(), out DateSubmitted);

                                    objLead.DateSubmitted = DateSubmitted;
                                }

                                str = table.Rows[i]["LFUUID"].ToString();
                                if (str.Length > 50)
                                    objLead.LFUUID = table.Rows[i]["LFUUID"].ToString().Substring(0, 50);
                                else
                                    objLead.LFUUID = table.Rows[i]["LFUUID"].ToString();

                                if (table.Rows[i]["Original Lead Date"] != string.Empty) {
                                    objLead.OriginalLeadDate = Convert.ToDateTime(table.Rows[i]["Original Lead Date"]);
                                }

                                if (table.Rows[i]["Last Name"] != string.Empty) {
                                    str = table.Rows[i]["Last Name"].ToString();
                                    if (str.Length > 50)
                                        objLead.ClaimantLastName = table.Rows[i]["Last Name"].ToString().Substring(0, 50);
                                    else
                                        objLead.ClaimantLastName = table.Rows[i]["Last Name"].ToString();
                                }

                                if (table.Rows[i]["First Name"] != string.Empty) {
                                    str = table.Rows[i]["First Name"].ToString();
                                    if (str.Length > 50)
                                        objLead.ClaimantFirstName = table.Rows[i]["First Name"].ToString().Substring(0, 50);
                                    else
                                        objLead.ClaimantFirstName = table.Rows[i]["First Name"].ToString();
                                }

                                if (table.Rows[i]["Email Address"] != string.Empty) {
                                    str = table.Rows[i]["Email Address"].ToString();
                                    if (str.Length > 100)
                                        objLead.EmailAddress = str.Substring(0, 100);
                                    else
                                        objLead.EmailAddress = str;
                                }
                                if (table.Rows[i]["Secondary Email"] != string.Empty) {
                                    str = table.Rows[i]["Secondary Email"].ToString();
                                    if (str.Length > 100)
                                        objLead.SecondaryEmail = str.Substring(0, 100);
                                    else
                                        objLead.SecondaryEmail = str;
                                }

                                if (table.Rows[i]["Adjuster"] != string.Empty) {
                                    string adjusterName = table.Rows[i]["Adjuster"].ToString();
                                    AdjusterMaster adjuster = null;

                                    if (!string.IsNullOrEmpty(adjusterName)) {
                                        adjuster = AdjusterManager.GetByAdjusterName(adjusterName.Trim());
                                        if (adjuster.AdjusterId == 0) {
                                            // add adjuster
                                            adjuster = new AdjusterMaster();
                                            adjuster.Status = true;
                                            adjuster.AdjusterName = adjusterName.Trim();
                                            adjuster.ClientId = clientID;
                                            adjuster.InsertBy = objLead.UserId;
                                            adjuster.InsertDate = DateTime.Now;
                                            adjuster.isEmailNotification = true;

                                            adjuster = AdjusterManager.Save(adjuster);
                                        }

                                        adjusterID = adjuster.AdjusterId;
                                    }

                                }
                                if (table.Rows[i]["Lead Source"] != string.Empty) {

                                    string sourceName = table.Rows[i]["Lead Source"].ToString();

                                    var id = LeadSourceManager.GetByLeadSourceName(sourceName);
                                    if (id.LeadSourceId > 0)
                                        objLead.LeadSource = id.LeadSourceId;
                                    else {
                                        // add source
                                        LeadSourceMaster leadSource = new LeadSourceMaster();
                                        if (clientID > 0)
                                            leadSource.ClientId = clientID;

                                        leadSource.InsertBy = Core.SessionHelper.getUserId();
                                        leadSource.InsertDate = DateTime.Now;
                                        leadSource.LeadSourceName = sourceName.Length > 100 ? sourceName.Substring(0, 100) : sourceName;
                                        leadSource.Status = true;

                                        LeadSourceMaster newLeadSource = LeadSourceManager.Save(leadSource);

                                        objLead.LeadSource = newLeadSource.LeadSourceId;
                                    }
                                }
                                if (table.Rows[i]["Primary Producer"] != string.Empty) {
                                    var id = ProducerManager.GetByProducerName(table.Rows[i]["Primary Producer"].ToString());
                                    if (id != null && id.ProducerId > 0)
                                        objLead.PrimaryProducerId = id.ProducerId;
                                    else {
                                        ProducerMaster producer = AddProducer(objLead, table.Rows[i]["Primary Producer"].ToString());
                                        objLead.PrimaryProducerId = producer.ProducerId;
                                    }
                                }
                                if (table.Rows[i]["Secondary Producer"] != string.Empty) {
                                    var id = SecondaryProducerManager.GetBySecondaryProducerName(table.Rows[i]["Secondary Producer"].ToString());
                                    if (id != null && id.SecondaryProduceId > 0)
                                        objLead.SecondaryProducerId = id.SecondaryProduceId;
                                    else {
                                        ProducerMaster producer = AddProducer(objLead, table.Rows[i]["Secondary Producer"].ToString());
                                        objLead.SecondaryProducerId = producer.ProducerId;
                                    }
                                }
                                if (table.Rows[i]["Inspector Name"] != string.Empty) {
                                    var id = InspectorManager.GetByName(table.Rows[i]["Inspector Name"].ToString());
                                    if (id != null && id.InspectorId > 0)
                                        objLead.InspectorName = id.InspectorId;
                                    else {
                                        InspectorMaster inspector = AddInspector(objLead, table.Rows[i]["Inspector Name"].ToString());
                                        objLead.InspectorName = inspector.InspectorId;
                                    }
                                }
                                if (table.Rows[i]["Inspector Cell"] != string.Empty) {
                                    str = table.Rows[i]["Inspector Cell"].ToString();
                                    if (str.Length > 20)
                                        str = objLead.InspectorCell = table.Rows[i]["Inspector Cell"].ToString().Substring(0, 20);
                                    else
                                        objLead.InspectorCell = table.Rows[i]["Inspector Cell"].ToString();
                                }
                                if (table.Rows[i]["Inspector Email"] != string.Empty) {
                                    str = table.Rows[i]["Inspector Email"].ToString(); ;
                                    if (str.Length > 100)
                                        objLead.InspectorEmail = table.Rows[i]["Inspector Email"].ToString().Substring(0, 100);
                                    else
                                        objLead.InspectorEmail = table.Rows[i]["Inspector Email"].ToString();
                                }

                                if (table.Rows[i]["Phone Number"] != string.Empty) {
                                    str = table.Rows[i]["Phone Number"].ToString();
                                    if (str.Length > 20)
                                        objLead.PhoneNumber = table.Rows[i]["Phone Number"].ToString().Substring(0, 20);
                                    else
                                        objLead.PhoneNumber = table.Rows[i]["Phone Number"].ToString();
                                }
                                if (table.Rows[i]["Secondary Phone"] != string.Empty) {
                                    str = table.Rows[i]["Secondary Phone"].ToString();
                                    if (str.Length > 20)
                                        objLead.SecondaryPhone = str.Substring(0, 20);
                                    else
                                        objLead.SecondaryPhone = str;
                                }
                                //if (table.Rows[i]["Webform Source"] != string.Empty) {
                                //	//objLead.WebformSource = table.Rows[i]["Webform Source"].ToString();
                                //	var id = WebFormSourceManager.GetByName(table.Rows[i]["Webform Source"].ToString());

                                //	if (id != null && id.WebformSourceId > 0)
                                //		objLead.WebformSource = id.WebformSourceId;
                                //}

                                if (!string.IsNullOrEmpty(table.Rows[i]["Type of Damage"].ToString())) {
                                    //objLead.TypeOfDamage = table.Rows[i]["Type of Damage"].ToString();
                                    var id = TypeofDamageManager.getbyTypeOfDamage(table.Rows[i]["Type of Damage"].ToString());
                                    objLead.TypeOfDamage = id.TypeOfDamage;

                                    //string dmgid = string.Empty;
                                    //string[] dmg = table.Rows[i]["Type of Damage"].ToString().Split(',');
                                    //for (int d = 0; d < dmg.Length; d++) {
                                    //     string dmgtext = dmg[d];
                                    //     var dmgdata = TypeofDamageManager.getbyTypeOfDamage(dmgtext);
                                    //     if (dmgdata != null && dmgdata.TypeOfDamage != null && dmgdata.TypeOfDamage.ToString() != string.Empty) {
                                    //          dmgid += dmgdata.TypeOfDamageId + ",";
                                    //     }
                                    //     else {
                                    //          TypeOfDamageMaster objdmg = new TypeOfDamageMaster();
                                    //          objdmg.TypeOfDamage = dmgtext.Length > 100 ? dmgtext.Substring(0, 100) : dmgtext;
                                    //          objdmg.Status = true;
                                    //          TypeOfDamageMaster sv = TypeofDamageManager.Save(objdmg);
                                    //          dmgid += sv.TypeOfDamageId + ",";
                                    //     }
                                    //}

                                    //objLead.TypeOfDamage = dmgid;

                                    str = table.Rows[i]["Type of Damage"].ToString();
                                    if (str.Length > 250)
                                        objLead.TypeofDamageText = table.Rows[i]["Type of Damage"].ToString().Substring(0, 250);
                                    else
                                        objLead.TypeofDamageText = table.Rows[i]["Type of Damage"].ToString();

                                    //string Damagetxt = string.Empty;
                                    //string DamageId = string.Empty;
                                    //for (int j = 0; j < chkTypeOfDamage.Items.Count; j++)
                                    //{
                                    //    if (chkTypeOfDamage.Items[j].Selected == true)
                                    //    {
                                    //        Damagetxt += chkTypeOfDamage.Items[j].Text + ',';
                                    //        DamageId += chkTypeOfDamage.Items[j].Value + ',';
                                    //    }
                                    //}
                                }
                                if (!string.IsNullOrEmpty(table.Rows[i]["Type of Property"].ToString())) {
                                    var id = PropertyTypeManager.GetByPropertyName(table.Rows[i]["Type of Property"].ToString());

                                    if (id != null && id.TypeOfPropertyId > 0) {
                                        objLead.TypeOfProperty = id.TypeOfPropertyId;

                                        if (id.TypeOfProperty.Contains("Home"))
                                            policyType = 1;

                                        if (id.TypeOfProperty.Contains("Commercial"))
                                            policyType = 2;

                                        if (id.TypeOfProperty.Contains("Flood"))
                                            policyType = 3;

                                        if (id.TypeOfProperty.Contains("Earthquake"))
                                            policyType = 4;
                                    }
                                }
                                if (table.Rows[i]["Market Value"] != string.Empty) {
                                    decimal MarketValue = 0;
                                    decimal.TryParse(table.Rows[i]["Market Value"].ToString(), out MarketValue);

                                    objLead.MarketValue = MarketValue;	//Convert.ToDecimal(table.Rows[i]["Market Value"]);
                                }
                                if (table.Rows[i]["Loss Address"] != string.Empty) {
                                    str = table.Rows[i]["Loss Address"].ToString();
                                    if (str.Length > 100)
                                        objLead.LossAddress = str.Substring(0, 100);
                                    else
                                        objLead.LossAddress = str;
                                }

                                if (table.Rows[i]["City"] != string.Empty)
                                    objLead.CityName = table.Rows[i]["City"].ToString();

                                if (table.Rows[i]["State"] != string.Empty)
                                    objLead.StateName = table.Rows[i]["State"].ToString();

                                if (table.Rows[i]["Zip"] != string.Empty)
                                    objLead.Zip = table.Rows[i]["Zip"].ToString();

                                if (table.Rows[i]["Property Damage Estimate"] != string.Empty) {
                                    decimal PropertyDamageEstimate = 0;
                                    decimal.TryParse(table.Rows[i]["Property Damage Estimate"].ToString(), out PropertyDamageEstimate);

                                    objLead.PropertyDamageEstimate = PropertyDamageEstimate;// Convert.ToDecimal(table.Rows[i]["Property Damage Estimate"]);
                                }
                                //if (table.Rows[i]["Habitable"] != string.Empty) {
                                //	//objLead.Habitable = table.Rows[i]["Habitable"].ToString();
                                //	var id = HabitableManager.GetbyHabitable(table.Rows[i]["Habitable"].ToString());
                                //	if (id != null && id.HabitableId > 0)
                                //		objLead.Habitable = id.HabitableId;
                                //}
                                //if (table.Rows[i]["Wind Policy"] != string.Empty) {
                                //	//objLead.WindPolicy = table.Rows[i]["Wind Policy"].ToString();
                                //	//var id = WindPolicyManager.getbyWindPolicy(table.Rows[i]["Habitable"].ToString());
                                //	var id = WindPolicyManager.getbyWindPolicy(table.Rows[i]["Wind Policy"].ToString());
                                //	if (id != null && id.WindPolicyId > 0)
                                //		objLead.WindPolicy = id.WindPolicyId;
                                //}
                                //if (table.Rows[i]["Flood Policy"] != string.Empty) {
                                //	//objLead.FloodPolicy = table.Rows[i]["Flood Policy"].ToString();
                                //	var id = FloodPolicyManager.GetByFloodPolicy(table.Rows[i]["Flood Policy"].ToString());
                                //	if (id != null && id.FloodPolicyId > 0)
                                //		objLead.FloodPolicy = id.FloodPolicyId;
                                //}

                                if (table.Rows[i]["Owner First Name"] != string.Empty)
                                    if (table.Rows[i]["Owner First Name"].ToString().Length > 50)
                                        objLead.OwnerFirstName = table.Rows[i]["Owner First Name"].ToString().Substring(0, 50);
                                    else
                                        objLead.OwnerFirstName = table.Rows[i]["Owner First Name"].ToString();

                                if (table.Rows[i]["Owner Last Name"] != string.Empty) {
                                    str = table.Rows[i]["Owner Last Name"].ToString();
                                    objLead.OwnerLastName = str.Length > 50 ? str.Substring(0, 50) : str;
                                }

                                if (table.Rows[i]["Owner Phone Number"] != string.Empty) {
                                    str = table.Rows[i]["Owner Phone Number"].ToString();
                                    objLead.OwnerPhone = str.Length > 15 ? str.Substring(0, 15) : str;
                                }

                                if (table.Rows[i]["Last Contact Date"] != string.Empty)
                                    objLead.LastContactDate = Convert.ToDateTime(table.Rows[i]["Last Contact Date"].ToString());

                                if (table.Rows[i]["Personal Referral"] != string.Empty) {
                                    str = table.Rows[i]["Personal Referral"].ToString();
                                    objLead.HearAboutUsDetail = str.Length > 250 ? str.Substring(0, 250) : str;
                                }

                                StatusMaster statusMaster = null;

                                if (table.Rows[i]["Status"] != string.Empty) {
                                    string statusName = table.Rows[i]["Status"].ToString();
                                    statusName = statusName.Length > 100 ? statusName.Substring(0, 100) : statusName;
                                    statusMaster = StatusManager.GetByStatusName(statusName);

                                    if (statusMaster.StatusId == 0) {
                                        statusMaster = new StatusMaster();
                                        statusMaster.clientID = clientID;
                                        statusMaster.InsertBy = objLead.UserId;
                                        statusMaster.InsertDate = DateTime.Now;
                                        statusMaster.isCountable = true;
                                        statusMaster.isCountAsOpen = true;
                                        statusMaster.Status = true;
                                        statusMaster.StatusName = statusName;

                                        statusMaster = StatusManager.Save(statusMaster);
                                    }
                                }

                                objLead.Status = 1;
                                objLead.InsertBy = objLead.UserId;

                                // 2013-08-29 tortega
                                if (clientID > 0)
                                    objLead.ClientID = clientID;

                                Leads newLead = LeadsManager.Save(objLead);

                                if (newLead != null) {
                                    LeadComment objLeadComment = null;

                                    // add policy
                                    CRM.Data.Entities.LeadPolicy policy = new CRM.Data.Entities.LeadPolicy();
                                    policy.PolicyType = 1;
                                    policy.LeadId = newLead.LeadId;
                                    policy.IsActive = true;
                                    policy.isAllDocumentUploaded = false;

                                    if (statusMaster != null)
                                        policy.LeadStatus = statusMaster.StatusId;

                                    if (adjusterID > 0)
                                        policy.AdjusterID = adjusterID;

                                    if (table.Rows[i]["Claims Number"] != string.Empty)
                                        policy.ClaimNumber = table.Rows[i]["Claims Number"].ToString();

                                    if (table.Rows[i]["Site Survey Date"] != string.Empty)
                                        policy.SiteSurveyDate = Convert.ToDateTime(table.Rows[i]["Site Survey Date"].ToString());

                                    LeadPolicyManager.Save(policy);

                                    if (!string.IsNullOrEmpty(table.Rows[i]["Reported to Insurer"].ToString())) {
                                        objLeadComment = new LeadComment();
                                        int LeadID = objLead.LeadId;

                                        objLeadComment.LeadId = LeadID;

                                        objLeadComment.UserId = objLead.UserId;

                                        objLeadComment.Status = 1;

                                        // 2013-08-29 tortega
                                        objLeadComment.PolicyType = policyType;

                                        str = table.Rows[i]["Reported to Insurer"].ToString();
                                        if (str.Length > 8000)
                                            objLeadComment.CommentText = "Reported to Insurer " + str.Substring(0, 8000);
                                        else
                                            objLeadComment.CommentText = "Reported to Insurer " + str;

                                        LeadComment objld = LeadCommentManager.Save(objLeadComment);
                                    }

                                    if (!string.IsNullOrEmpty(table.Rows[i]["Claimant Comments"].ToString())) {
                                        objLeadComment = new LeadComment();
                                        int LeadID = objLead.LeadId;

                                        objLeadComment.LeadId = LeadID;

                                        objLeadComment.UserId = objLead.UserId;

                                        objLeadComment.Status = 1;

                                        // 2013-08-29 tortega
                                        objLeadComment.PolicyType = policyType;

                                        str = table.Rows[i]["Claimant Comments"].ToString();
                                        if (str.Length > 8000)
                                            objLeadComment.CommentText = str.Substring(0, 8000);
                                        else
                                            objLeadComment.CommentText = str;

                                        LeadComment objld = LeadCommentManager.Save(objLeadComment);
                                    }
                                }

                            }	//for (int i = 0; i < table.Rows.Count; i++) {

                            scope.Complete();

                        }
                        string rootFolderPath = Server.MapPath("~//CSVLoad//");
                        string filesToDelete = FileUpload1.FileName;
                        string[] fileList = System.IO.Directory.GetFiles(rootFolderPath, filesToDelete);
                        foreach (string file in fileList) {
                            System.IO.File.Delete(file);
                        }
                        lblSave.Text = "Data Saved Successfully !!!";
                        lblSave.Visible = true;
                    }
                }
            }
            catch (Exception ex) {
                lblError.Text = "There Is a problem in  data save  !!!";
                lblError.Visible = true;

                Core.EmailHelper.emailError(ex);
            }
        }