コード例 #1
0
    //protected override void OnInit(EventArgs e)
    //{
    //    base.OnInit(e);
    //    //TextBox search = (TextBox)Accordion1.FindControl("txtSearch");
    //    GridSource.SelectParameters.Add(new CookieParameter("connection", "Company"));
    //    //DropDownList dropDown = (DropDownList)Accordion1.FindControl("ddCriteria");
    //    GridSource.SelectParameters.Add(new ControlParameter("txtSearch", TypeCode.String, txtSearch.UniqueID, "Text"));
    //    GridSource.SelectParameters.Add(new ControlParameter("dropDown", TypeCode.String, ddCriteria.UniqueID, "SelectedValue"));
    //}


    private void BindGrid(string textSearch, string dropDown)
    {
        string connection = Request.Cookies["Company"].Value;

        DataSet           ds = new DataSet();
        LeadBusinessLogic bl = new LeadBusinessLogic(sDataSource);

        object usernam = Session["LoggedUserName"];

        ds = bl.ListLeadMaster(connection, textSearch, dropDown);

        if (ds != null)
        {
            if (ds.Tables[0].Rows.Count > 0)
            {
                GrdViewLead.DataSource = ds.Tables[0].DefaultView;
                GrdViewLead.DataBind();
            }
        }
        else
        {
            GrdViewLead.DataSource = null;
            GrdViewLead.DataBind();
        }
    }
コード例 #2
0
    protected void AddButton_Click(object sender, EventArgs e)
    {
        DateTime creationDate;
        int      LeadID              = 0;
        string   prospectCustomer    = string.Empty;
        string   address             = string.Empty;
        string   mobile              = string.Empty;
        string   landline            = string.Empty;
        string   email               = string.Empty;
        string   modeOfContact       = string.Empty;
        string   personalResponsible = string.Empty;
        string   businessType        = string.Empty;
        string   branch              = string.Empty;
        string   status              = string.Empty;
        string   LastCompletedAction = string.Empty;
        //string creationDate = string.Empty;
        string  nextAction = string.Empty;
        string  category   = string.Empty;
        DataSet dsContact;

        string info1 = string.Empty;
        string info2 = string.Empty;
        string info3 = string.Empty;

        string info4 = string.Empty;
        string info5 = string.Empty;

        try
        {
            if (Session["contactDs"] == null || ((DataSet)Session["contactDs"]).Tables[0].Rows.Count < 1)
            {
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Please enter atleast one Lead Contact and try again.')", true);
                return;
            }

            if (Page.IsValid)
            {
                //if(txtLeadNo.Text != string.Empty)
                //LeadID = int.Parse(txtLeadNo.Text);

                creationDate = DateTime.Parse(txtCreationDate.Text);
                //creationDate = txtCreationDate.Text.Trim();
                prospectCustomer    = txtProspCustName.Text;
                address             = txtAddress.Text;
                mobile              = txtMobile.Text;
                landline            = txtLandline.Text;
                email               = txtEmail.Text;
                modeOfContact       = cmbModeOfContact.SelectedValue;
                personalResponsible = cmbPersonalResp.Text;
                businessType        = cmbBussType.SelectedValue;
                branch              = cmbBranch.SelectedValue;
                if (cmbnewstatus.SelectedValue == "0")
                {
                    status = cmbStatus.SelectedValue;
                }
                else
                {
                    status = cmbnewstatus.SelectedValue;
                }
                if (cmblastaction.SelectedValue == "0")
                {
                    LastCompletedAction = cmbLastCompAction.SelectedValue;
                }
                else
                {
                    LastCompletedAction = cmblastaction.SelectedValue;
                }
                if (cmbnxtaction.SelectedValue == "0")
                {
                    nextAction = cmbNextAction.SelectedValue;
                }
                else
                {
                    nextAction = cmbnxtaction.SelectedValue;
                }
                category = cmbCategory.SelectedValue;

                info1 = txtInfo1.Text;
                info2 = txtInfo2.Text;

                info3 = ddlinfo3.SelectedValue;
                info4 = ddlinfo4.SelectedValue;
                info5 = ddlinfo5.SelectedValue;

                string callbackflag = DropDownList1.SelectedItem.Text;
                string callbackdate = TextBox1.Text;

                dsContact = (DataSet)Session["contactDs"];

                string connStr = GetConnectionString();

                LeadBusinessLogic bl = new LeadBusinessLogic(connStr);

                //bl.AddUpdateLeadMaster(LeadID, creationDate, prospectCustomer, address, mobile, landline, email, modeOfContact, personalResponsible, businessType, branch, status, LastCompletedAction, nextAction, category, dsContact, info1, info2, info3, info4, info5);
                bl.AddUpdateLeadMaster(LeadID, creationDate, prospectCustomer, address, mobile, landline, email, modeOfContact, personalResponsible, businessType, branch, status, LastCompletedAction, nextAction, category, dsContact, info1, info2, info3, info4, info5, callbackflag, callbackdate);


                GrdViewLead.DataBind();

                ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Lead Details saved successfully.')", true);

                BindGrid("", "");
                UpdatePanelPage.Update();


                ModalPopupExtender2.Hide();


                //return;
            }
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
            return;
        }
    }