private void showLeadSourceData()
    {
        LeadSource leadSource = new LeadSource();

        leadSource             = LeadSourceManager.GetLeadSourceByLeadSourceID(Int32.Parse(Request.QueryString["ID"]));
        txtLeadSourceName.Text = leadSource.LeadSourceName.ToString();
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         LeadSourceManager.LoadLeadSourcePage(gvLeadSource, rptPager, 1, ddlPageSize);
     }
 }
    protected void lbDelete_Click(object sender, EventArgs e)
    {
        ImageButton linkButton = new ImageButton();

        linkButton = (ImageButton)sender;
        bool result = LeadSourceManager.DeleteLeadSource(Convert.ToInt32(linkButton.CommandArgument));

        LeadSourceManager.LoadLeadSourcePage(gvLeadSource, rptPager, 1, ddlPageSize);
    }
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        LeadSource leadSource = new LeadSource();

        leadSource.LeadSourceID   = int.Parse(Request.QueryString["ID"].ToString());
        leadSource.LeadSourceName = txtLeadSourceName.Text;
        bool resutl = LeadSourceManager.UpdateLeadSource(leadSource);

        Response.Redirect("AdminDisplayLeadSource.aspx");
    }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        LeadSource leadSource = new LeadSource();

//	leadSource.LeadSourceID=  int.Parse(ddlLeadSourceID.SelectedValue);
        leadSource.LeadSourceName = txtLeadSourceName.Text;
        int resutl = LeadSourceManager.InsertLeadSource(leadSource);

        Response.Redirect("AdminDisplayLeadSource.aspx");
    }
Exemple #6
0
 private void LeadSourceIDLoad()
 {
     try {
         DataSet ds = LeadSourceManager.GetDropDownListAllLeadSource();
         ddlLeadSourceID.DataValueField = "LeadSourceID";
         ddlLeadSourceID.DataTextField  = "LeadSourceName";
         ddlLeadSourceID.DataSource     = ds.Tables[0];
         ddlLeadSourceID.DataBind();
         ddlLeadSourceID.Items.Insert(0, new ListItem("Select LeadSource >>", "0"));
     }
     catch (Exception ex) {
         ex.Message.ToString();
     }
 }
Exemple #7
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);
            }
        }
Exemple #8
0
        private void DoBind()
        {
            List <LeadSourceMaster> lstLeadSource = null;
            // 2013-10-25 tortega
            int clientID = Core.SessionHelper.getClientId();
            int roleID   = Core.SessionHelper.getUserRoleId();

            // 2013-10-25 tortega
            if (roleID == (int)UserRole.Administrator)
            {
                lstLeadSource = LeadSourceManager.GetAll();
            }
            else
            {
                lstLeadSource = LeadSourceManager.GetAll(clientID);
            }

            gvSources.DataSource = lstLeadSource;
            gvSources.DataBind();
        }
Exemple #9
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);
                }
            }
        }
Exemple #10
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);
                }
            }
        }
Exemple #11
0
        protected void gv_onSorting(object sender, GridViewSortEventArgs e)
        {
            List <LeadSourceMaster> sources = null;
            int clientID = Core.SessionHelper.getClientId();

            sources = LeadSourceManager.GetAll(clientID);

            bool descending = false;

            if (ViewState[e.SortExpression] == null)
            {
                descending = false;
            }
            else
            {
                descending = !(bool)ViewState[e.SortExpression];
            }

            ViewState[e.SortExpression] = descending;

            gvSources.DataSource = sources.AsQueryable().orderByExtension(e.SortExpression, descending);

            gvSources.DataBind();
        }
    protected void Page_Changed(object sender, EventArgs e)
    {
        int pageIndex = int.Parse((sender as LinkButton).CommandArgument);

        LeadSourceManager.LoadLeadSourcePage(gvLeadSource, rptPager, pageIndex, ddlPageSize);
    }
 protected void PageSize_Changed(object sender, EventArgs e)
 {
     LeadSourceManager.LoadLeadSourcePage(gvLeadSource, rptPager, 1, ddlPageSize);
 }
        private void bindDDL()
        {
            //IQueryable<AdjusterMaster> adjusters = null;
            IQueryable <ContractorMaster> contractors = null;
            IQueryable <AppraiserMaster>  appraisers  = null;
            IQueryable <UmpireMaster>     umpires     = null;
            List <LeadSourceMaster>       sources     = null;


            int clientID = SessionHelper.getClientId();

            if (clientID > 0)
            {
                //	adjusters = AdjusterManager.GetAll(clientID);
                contractors = ContractorManager.GetAll(clientID);
                appraisers  = AppraiserManager.GetAll(clientID);
                umpires     = UmpireManager.GetAll(clientID);

                sources = LeadSourceManager.GetAll(clientID);
            }
            else
            {
                //	adjusters = AdjusterManager.GetAll();
                contractors = ContractorManager.GetAll();
                appraisers  = AppraiserManager.GetAll();
                umpires     = UmpireManager.GetAll();
                sources     = LeadSourceManager.GetAll();
            }



            if (appraisers != null)
            {
                CollectionManager.FillCollection(ddlAppraiser, "AppraiserId", "AppraiserName", appraisers.ToList());
            }

            CollectionManager.FillCollection(ddlContractor, "ContractorId", "ContractorName", contractors.ToList());
            CollectionManager.FillCollection(ddlUmpire, "UmpireId", "UmpireName", umpires.ToList());


            //CollectionManager.FillCollection(ddlLeadStatus, "StatusId", "StatusName", StatusManager.GetAll());

            //CollectionManager.FillCollection(ddlSubStatus, "SubStatusId", "SubStatusName", SubStatusManager.GetAll());

            //CollectionManager.FillCollection(ddlAdjuster, "AdjusterId", "AdjusterName", adjusters);

            CollectionManager.FillCollection(ddlLeadSource, "LeadSourceId", "LeadSourceName", sources);
            //CollectionManager.FillCollection(ddlInspectorName, "InspectorId", "InspectorName", InspectorManager.GetAll());

            //CollectionManager.FillCollection(ddlSiteInspection, "SiteInspectionCompleteId", "SiteInspectionCompleteName", SiteInspectionManager.GetAll());

            CollectionManager.FillCollection(ddlOwnerSame, "OwnerSameId", "OwnerSame", OwnerSameManager.GetAll());
            //CollectionManager.FillCollection(ddlWebFormSource, "WebformSourceId", "WebformSource", WebFormSourceManager.GetAll());
            //CollectionManager.FillCollection(ddlOtherSource, "OtherSourceId", "OtherSource", OtherSourceManager.GetAll());

            //Fillchk(chkTypeOfDamage, "TypeOfDamageId", "TypeOfDamage", TypeofDamageManager.GetAll());


            ///CollectionManager.FillCollection(ddlTypeOfProperty, "TypeOfPropertyId", "TypeOfProperty", TypeOfPropertyManager.GetAll());
            //CollectionManager.FillCollection(ddlHabitable, "HabitableId", "Habitable", HabitableManager.GetAll());
            //CollectionManager.FillCollection(ddlWindPolicy, "WindPolicyId", "WindPolicy", WindPolicyManager.GetAll());
            //CollectionManager.FillCollection(ddlFloodPolicy, "FloodPolicyId", "FloodPolicy", FloodPolicyManager.GetAll());
            //CollectionManager.FillCollection(ddlRepotedInsurer, "ReportedToInsurerId", "ReportedToInsurer", ReportedToInsurerManager.GetAll());
        }