Exemplo n.º 1
0
    //protected void GrdViewLeadContact_RowCreated(object sender, GridViewRowEventArgs e)
    //{
    //    if (e.Row.RowType == DataControlRowType.Pager)
    //    {
    //        PresentationUtils.SetPagerButtonStates(GrdViewLeadContact, e.Row, this);
    //    }
    //}

    //protected void GrdViewLeadContact_RowDataBound(object sender, GridViewRowEventArgs e)
    //{
    //    if (e.Row.RowType == DataControlRowType.DataRow)
    //    {
    //        DataRow product = ((System.Data.DataRowView)e.Row.DataItem).Row;
    //    }
    //}


    protected void GrdViewLeadContact_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        try
        {
            if (Session["contactDs"] != null)
            {
                string  connStr = string.Empty;
                DataSet ds;

                /*
                 * if (Request.Cookies["Company"] != null)
                 *  connStr = System.Configuration.ConfigurationManager.ConnectionStrings[Request.Cookies["Company"].Value].ToString();
                 * else
                 *  Response.Redirect("~/Login.aspx");
                 *
                 * GridViewRow row = GrdViewLeadContact.Rows[e.RowIndex];
                 * string refID = row.Cells[0].Text;
                 * LeadBusinessLogic bl = new LeadBusinessLogic(connStr);
                 * bl.DeleteLeadContact(refID);*/

                ds = (DataSet)Session["contactDs"];
                ds.Tables[0].Rows[GrdViewLeadContact.Rows[e.RowIndex].DataItemIndex].Delete();
                ds.Tables[0].AcceptChanges();
                GrdViewLeadContact.DataSource = ds;
                GrdViewLeadContact.DataBind();
                Session["contactDs"] = ds;
            }
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }
Exemplo n.º 2
0
    protected void cmdUpdateContact_Click(object sender, EventArgs e)
    {
        try
        {
            var ds         = (DataSet)Session["contactDs"];
            int currentRow = int.Parse(hdCurrentRow.Value);

            ds.Tables[0].Rows[currentRow]["ContactedDate"]  = txtContactedDate.Text;
            ds.Tables[0].Rows[currentRow]["ContactSummary"] = txtContactSummary.Text;
            ds.Tables[0].Rows[currentRow]["CallBackFlag"]   = ComboBox2.SelectedItem.Text;
            if (ComboBox2.SelectedItem.Text == "NO")
            {
                ds.Tables[0].Rows[currentRow]["CallBackDate"] = "";
                TextBox1.Text = "";
                DropDownList1.SelectedItem.Text = "NO";
            }
            else
            {
                ds.Tables[0].Rows[currentRow]["CallBackDate"] = txtcallback.Text;
                TextBox1.Text = txtcallback.Text;
                DropDownList1.SelectedItem.Text = "YES";
            }

            if (cmbnewstatus.SelectedValue == "0")
            {
            }
            else
            {
                cmbStatus.SelectedValue = cmbnewstatus.SelectedValue;
            }
            if (cmblastaction.SelectedValue == "0")
            {
            }
            else
            {
                cmbLastCompAction.SelectedValue = cmblastaction.SelectedValue;
            }
            if (cmbnxtaction.SelectedValue == "0")
            {
            }
            else
            {
                cmbNextAction.SelectedValue = cmbnxtaction.SelectedValue;
            }

            ds.Tables[0].Rows[currentRow].EndEdit();
            ds.Tables[0].Rows[currentRow].AcceptChanges();

            GrdViewLeadContact.DataSource = ds.Tables[0];
            GrdViewLeadContact.DataBind();
            ModalPopupContact.Hide();
            Session["contactDs"] = ds;
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }
Exemplo n.º 3
0
    private void ShowLeadContactInfo()
    {
        string connStr = GetConnectionString();

        if (Session["LeadID"] != null && Session["LeadID"].ToString() != "0")
        {
            LeadBusinessLogic bl = new LeadBusinessLogic(connStr);
            DataSet           ds = bl.ListLeadContact(Session["LeadID"].ToString());

            if (ds != null)
            {
                GrdViewLeadContact.DataSource = ds.Tables[0];
                GrdViewLeadContact.DataBind();
            }
        }
        else
        {
            GrdViewLeadContact.DataSource = null;
            GrdViewLeadContact.DataBind();
        }
    }
Exemplo n.º 4
0
    protected void GrdViewLead_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            GridViewRow       row    = GrdViewLead.SelectedRow;
            var               leadID = GrdViewLead.SelectedDataKey.Value.ToString();
            LeadBusinessLogic bl     = new LeadBusinessLogic(GetConnectionString());

            DataSet dsDetails = bl.GetLeadMasterDetails(leadID);

            if (dsDetails != null && dsDetails.Tables[0].Rows.Count > 0)
            {
                txtLeadNo.Text = dsDetails.Tables[0].Rows[0]["LeadID"].ToString();
                //txtCreationDate.Text = DateTime.Parse(dsDetails.Tables[0].Rows[0]["CreationDate"].ToString()).ToShortDateString();
                txtCreationDate.Text  = Convert.ToDateTime(dsDetails.Tables[0].Rows[0]["CreationDate"]).ToString("dd/MM/yyyy");
                txtProspCustName.Text = dsDetails.Tables[0].Rows[0]["ProspectCustName"].ToString();
                txtMobile.Text        = dsDetails.Tables[0].Rows[0]["Mobile"].ToString();
                txtAddress.Text       = dsDetails.Tables[0].Rows[0]["Address"].ToString();
                txtEmail.Text         = dsDetails.Tables[0].Rows[0]["Email"].ToString();
                txtLandline.Text      = dsDetails.Tables[0].Rows[0]["Landline"].ToString();

                if (cmbModeOfContact.Items.FindByValue(dsDetails.Tables[0].Rows[0]["ModeOfContact"].ToString().Trim()) != null)
                {
                    cmbModeOfContact.SelectedValue = Convert.ToString(dsDetails.Tables[0].Rows[0]["ModeOfContact"]);
                }
                if (cmbPersonalResp.Items.FindByValue(dsDetails.Tables[0].Rows[0]["PersonalResponsible"].ToString().Trim()) != null)
                {
                    cmbPersonalResp.SelectedValue = Convert.ToString(dsDetails.Tables[0].Rows[0]["PersonalResponsible"]);
                }
                if (cmbBussType.Items.FindByValue(dsDetails.Tables[0].Rows[0]["BusinessType"].ToString().Trim()) != null)
                {
                    cmbBussType.SelectedValue = Convert.ToString(dsDetails.Tables[0].Rows[0]["BusinessType"]);
                }
                if (cmbBranch.Items.FindByValue(dsDetails.Tables[0].Rows[0]["Branch"].ToString().Trim()) != null)
                {
                    cmbBranch.SelectedValue = Convert.ToString(dsDetails.Tables[0].Rows[0]["Branch"]);
                }
                if (cmbStatus.Items.FindByValue(dsDetails.Tables[0].Rows[0]["Status"].ToString().Trim()) != null)
                {
                    cmbStatus.SelectedValue = Convert.ToString(dsDetails.Tables[0].Rows[0]["Status"]);
                }
                if (cmbLastCompAction.Items.FindByValue(dsDetails.Tables[0].Rows[0]["LastCompletedAction"].ToString().Trim()) != null)
                {
                    cmbLastCompAction.SelectedValue = Convert.ToString(dsDetails.Tables[0].Rows[0]["LastCompletedAction"]);
                }
                if (cmbNextAction.Items.FindByValue(dsDetails.Tables[0].Rows[0]["NextAction"].ToString().Trim()) != null)
                {
                    cmbNextAction.SelectedValue = Convert.ToString(dsDetails.Tables[0].Rows[0]["NextAction"]);
                }
                if (cmbCategory.Items.FindByValue(dsDetails.Tables[0].Rows[0]["Category"].ToString().Trim()) != null)
                {
                    cmbCategory.SelectedValue = Convert.ToString(dsDetails.Tables[0].Rows[0]["Category"]);
                }


                if (cmblastaction.Items.FindByValue(dsDetails.Tables[0].Rows[0]["LastCompletedAction"].ToString().Trim()) != null)
                {
                    cmblastaction.SelectedValue = Convert.ToString(dsDetails.Tables[0].Rows[0]["LastCompletedAction"]);
                }
                if (cmbnxtaction.Items.FindByValue(dsDetails.Tables[0].Rows[0]["NextAction"].ToString().Trim()) != null)
                {
                    cmbnxtaction.SelectedValue = Convert.ToString(dsDetails.Tables[0].Rows[0]["NextAction"]);
                }
                if (cmbnewstatus.Items.FindByValue(dsDetails.Tables[0].Rows[0]["Status"].ToString().Trim()) != null)
                {
                    cmbnewstatus.SelectedValue = Convert.ToString(dsDetails.Tables[0].Rows[0]["Status"]);
                }


                txtInfo1.Text = dsDetails.Tables[0].Rows[0]["Information1"].ToString();
                txtInfo2.Text = dsDetails.Tables[0].Rows[0]["Information2"].ToString();
                if (ddlinfo3.Items.FindByValue(dsDetails.Tables[0].Rows[0]["Information3"].ToString().Trim()) != null)
                {
                    ddlinfo3.SelectedValue = Convert.ToString(dsDetails.Tables[0].Rows[0]["Information3"]);
                }

                if (ddlinfo4.Items.FindByValue(dsDetails.Tables[0].Rows[0]["Information4"].ToString().Trim()) != null)
                {
                    ddlinfo4.SelectedValue = Convert.ToString(dsDetails.Tables[0].Rows[0]["Information4"]);
                }
                if (ddlinfo5.Items.FindByValue(dsDetails.Tables[0].Rows[0]["Information5"].ToString().Trim()) != null)
                {
                    ddlinfo5.SelectedValue = Convert.ToString(dsDetails.Tables[0].Rows[0]["Information5"]);
                }


                //if (DropDownList1.Items.FindByValue(dsDetails.Tables[0].Rows[0]["callbackflag"].ToString().Trim()) != null)

                string tt = Convert.ToString(dsDetails.Tables[0].Rows[0]["callbackflag"]);
                if (tt == "NO")
                {
                    DropDownList1.SelectedItem.Text = "NO";
                    //DropDownList1.SelectedValue = Convert.ToString(dsDetails.Tables[0].Rows[0]["callbackflag"]);
                }
                else
                {
                    DropDownList1.SelectedItem.Text = "YES";
                }

                TextBox1.Text = Convert.ToString(dsDetails.Tables[0].Rows[0]["Callbackdate"]);

                dsDetails = bl.GetLeadContacts(leadID);

                if (dsDetails != null && dsDetails.Tables[0].Rows.Count > 0)
                {
                    GrdViewLeadContact.DataSource = dsDetails.Tables[0];
                    GrdViewLeadContact.DataBind();
                    Session["contactDs"] = dsDetails;
                }

                UpdateButton.Visible = true;
                AddButton.Visible    = false;
                ModalPopupExtender2.Show();
            }
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }
Exemplo n.º 5
0
    protected void cmdSaveContact_Click(object sender, EventArgs e)
    {
        try
        {
            DataSet    ds;
            DataTable  dt;
            DataRow    drNew;
            DataColumn dc;
            ds = new DataSet();

            if (Session["contactDs"] == null)
            {
                dt = new DataTable();

                dc = new DataColumn("ContactRefID");
                dt.Columns.Add(dc);

                dc = new DataColumn("ContactedDate");
                dt.Columns.Add(dc);

                dc = new DataColumn("ContactSummary");
                dt.Columns.Add(dc);

                dc = new DataColumn("CallBackFlag");
                dt.Columns.Add(dc);

                dc = new DataColumn("CallBackDate");
                dt.Columns.Add(dc);

                ds.Tables.Add(dt);

                drNew = dt.NewRow();

                drNew["ContactRefID"]           = 1;
                drNew["ContactedDate"]          = txtContactedDate.Text;
                drNew["ContactSummary"]         = txtContactSummary.Text;
                drNew["CallBackFlag"]           = ComboBox2.SelectedItem.Text;
                DropDownList1.SelectedItem.Text = ComboBox2.SelectedItem.Text;

                if (cmbnewstatus.SelectedValue == "0")
                {
                }
                else
                {
                    cmbStatus.SelectedValue = cmbnewstatus.SelectedValue;
                }
                if (cmblastaction.SelectedValue == "0")
                {
                }
                else
                {
                    cmbLastCompAction.SelectedValue = cmblastaction.SelectedValue;
                }
                if (cmbnxtaction.SelectedValue == "0")
                {
                }
                else
                {
                    cmbNextAction.SelectedValue = cmbnxtaction.SelectedValue;
                }

                if (ComboBox2.SelectedItem.Text == "NO")
                {
                    drNew["CallBackDate"]       = "";
                    TextBox1.Text               = "";
                    DropDownList1.SelectedValue = "1";
                }
                else
                {
                    drNew["CallBackDate"]       = txtcallback.Text;
                    TextBox1.Text               = txtcallback.Text;
                    DropDownList1.SelectedValue = "2";
                }
                ds.Tables[0].Rows.Add(drNew);
                Session["contactDs"] = ds;
            }
            else
            {
                ds = (DataSet)Session["contactDs"];

                int maxID = 0;

                if (ds.Tables[0].Rows.Count > 0)
                {
                    maxID = int.Parse(ds.Tables[0].Rows[ds.Tables[0].Rows.Count - 1]["ContactRefID"].ToString());
                }

                drNew = ds.Tables[0].NewRow();
                drNew["ContactRefID"]           = maxID + 1;
                drNew["ContactedDate"]          = txtContactedDate.Text;
                drNew["ContactSummary"]         = txtContactSummary.Text;
                drNew["CallBackFlag"]           = ComboBox2.SelectedItem.Text;
                DropDownList1.SelectedItem.Text = ComboBox2.SelectedItem.Text;

                if (cmbnewstatus.SelectedValue == "0")
                {
                }
                else
                {
                    cmbStatus.SelectedValue = cmbnewstatus.SelectedValue;
                }
                if (cmblastaction.SelectedValue == "0")
                {
                }
                else
                {
                    cmbLastCompAction.SelectedValue = cmblastaction.SelectedValue;
                }
                if (cmbnxtaction.SelectedValue == "0")
                {
                }
                else
                {
                    cmbNextAction.SelectedValue = cmbnxtaction.SelectedValue;
                }

                if (ComboBox2.SelectedItem.Text == "NO")
                {
                    drNew["CallBackDate"]       = "";
                    TextBox1.Text               = "";
                    DropDownList1.SelectedValue = "1";
                }
                else
                {
                    drNew["CallBackDate"]       = txtcallback.Text;
                    TextBox1.Text               = txtcallback.Text;
                    DropDownList1.SelectedValue = "2";
                }
                ds.Tables[0].Rows.Add(drNew);
                Session["contactDs"] = ds;
            }


            //this.GrdViewLeadContact.Visible = true;

            GrdViewLeadContact.DataSource = ds.Tables[0];
            GrdViewLeadContact.DataBind();

            ModalPopupContact.Hide();
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }