Example #1
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            string oper_id      = "";
            string user_brmpoid = "";

            if (Session["operator_id"] != null && Session["username"] != null && Session["user_brmpoid"] != null)
            {
                username     = Convert.ToString(Session["username"]);
                oper_id      = Convert.ToString(Session["operator_id"]);
                user_brmpoid = Convert.ToString(Session["user_brmpoid"]);
            }
            else
            {
                Session.Abandon();
                Response.Redirect("~/Login.aspx");
            }
            string searhParam      = txtSearch.Text;
            string search_type     = RadSearchby.SelectedValue.ToString();
            string response_params = user_brmpoid + "$" + searhParam + "$SW";

            if (search_type == "0")
            {
                //if VC ID
                response_params += "$V";
            }
            // string apiResponse = callAPI(response_params, "6");
            string apiResponse = callAPI(response_params, "12");//

            try
            {
                if (apiResponse != "")
                {
                    List <string> lstResponse = new List <string>();
                    lstResponse = apiResponse.Split('$').ToList();
                    string cust_id = lstResponse[0]; //account_no
                    ViewState["customer_no"] = cust_id;
                    string cust_name = lstResponse[3];
                    ViewState["customer_name"] = cust_name;
                    string cust_addr = lstResponse[4];
                    ViewState["accountPoid"] = lstResponse[6];
                    string lco_poid       = lstResponse[13];
                    string cust_mobile_no = lstResponse[5];
                    ViewState["custemail"] = lstResponse[1].ToString();
                    lblemail.Text          = lstResponse[1].ToString();
                    //DATA ACCESS VALIDATION----------------------------------------------------------------------------------VALIDATION
                    Cls_Validation obj = new Cls_Validation();
                    string         validate_cust_accesslco = obj.CustDataAccess(username, oper_id, lco_poid, Session["category"].ToString());
                    if (validate_cust_accesslco.Length == 0)
                    {
                        popMsg.Show();
                        lblPopupResponse.Text = "You have no privileges to access customer information as s/he belongs to other LCO";
                        return;
                    }
                    else
                    {
                        List <string> lcoidAndCity = new List <string>();
                        lcoidAndCity            = validate_cust_accesslco.Split('$').ToList();
                        Session["lcoid"]        = lcoidAndCity[0];
                        ViewState["cityid"]     = lcoidAndCity[1];
                        Session["lco_username"] = lcoidAndCity[2];
                    }
                    string   cust_services = lstResponse[15];
                    string[] service_arr   = cust_services.Split('^');
                    ViewState["Service_Str"] = null;
                    ViewState["Service_Str"] = cust_services.ToString();
                    string    stb_status = "";
                    DataTable dtStbs     = new DataTable();
                    dtStbs.Columns.Add(new DataColumn("STB_NO"));
                    dtStbs.Columns.Add(new DataColumn("VC_ID"));
                    dtStbs.Columns.Add(new DataColumn("SERVICE_STRING"));
                    dtStbs.Columns.Add(new DataColumn("Status"));
                    dtStbs.Columns.Add(new DataColumn("PARENT_CHILD_FLAG"));
                    dtStbs.Columns.Add(new DataColumn("TAB_FLAG"));
                    dtStbs.Columns.Add(new DataColumn("Last_Status"));
                    dtStbs.Columns.Add(new DataColumn("Pack_Type"));
                    DataTable sortedDT = new DataTable();
                    string    strvcid  = "";
                    int       k        = 1;
                    ViewState["parentsmsg"] = "0";
                    foreach (string service in service_arr)
                    {
                        string stb_no = service.Split('!')[1];
                        string vc_id  = service.Split('!')[2];
                        stb_status = service.Split('!')[4];
                        string Pack_Type         = service.Split('!')[5];
                        string parent_child_flag = service.Split('!')[6];
                        string Last_Status       = service.Split('!')[7];
                        string tab_flag          = "";
                        if (parent_child_flag == null || parent_child_flag == "0")
                        {
                            parent_child_flag = "0";
                            lblStbNo.Text     = service.Split('!')[1];
                            lblVCID.Text      = service.Split('!')[2];
                        }
                        if (parent_child_flag == "1")
                        {
                            k                 = k + 1;
                            tab_flag          = "lnkAddon" + k.ToString();
                            parent_child_flag = "1";
                        }
                        else
                        {
                            tab_flag = "lnkAddon1";
                        }
                        if (stb_status == "10103")
                        {
                            continue; //if status is terminated
                        }
                        if (stb_no == "" || vc_id == "")
                        {
                            continue; //id stan_no or vc_id is blank
                        }
                        DataRow drStbRow = dtStbs.NewRow();
                        drStbRow["STB_NO"]            = stb_no;
                        drStbRow["VC_ID"]             = vc_id;
                        ViewState["vcid"]             = vc_id;
                        strvcid                      += strvcid + vc_id + ",";
                        drStbRow["SERVICE_STRING"]    = service;
                        drStbRow["Status"]            = stb_status;
                        ViewState["stb_status"]       = stb_status;
                        drStbRow["PARENT_CHILD_FLAG"] = parent_child_flag;
                        drStbRow["TAB_FLAG"]          = tab_flag;
                        drStbRow["Last_Status"]       = Last_Status;
                        drStbRow["Pack_Type"]         = Pack_Type;
                        dtStbs.Rows.Add(drStbRow);
                        DataView dv = dtStbs.DefaultView;
                        dv.Sort  = "PARENT_CHILD_FLAG Asc";
                        sortedDT = dv.ToTable();
                    }
                    strvcid = strvcid.TrimEnd(',');
                    if (sortedDT.Rows.Count == 0)
                    {
                        popMsg.Show();
                        lblPopupResponse.Text = "No STB found";
                        return;
                    }
                    ViewState["vcdetail"] = sortedDT;
                    DataTable dtVCinfo = new DataTable();
                    if (sortedDT.Rows.Count > 0)
                    {
                        dtVCinfo.Columns.Add(new DataColumn("TV"));
                        dtVCinfo.Columns.Add(new DataColumn("VC_ID"));
                        dtVCinfo.Columns.Add(new DataColumn("STB_NO"));
                        dtVCinfo.Columns.Add(new DataColumn("STATUS"));
                        dtVCinfo.Columns.Add(new DataColumn("BOX_TYPE"));
                        dtVCinfo.Columns.Add(new DataColumn("SUSPENSION_DATE"));
                        string Parent_Flag     = "";
                        int    parentflagvalue = 0;
                        string ServiceStatus   = "";
                        for (int i = 0; i < sortedDT.Rows.Count; i++)
                        {
                            DataRow drvcinfo = dtVCinfo.NewRow();
                            Parent_Flag     = sortedDT.Rows[i]["TAB_FLAG"].ToString();
                            Parent_Flag     = Parent_Flag.Substring(Parent_Flag.Length - 1);
                            parentflagvalue = Convert.ToInt32(Parent_Flag);
                            parentflagvalue = parentflagvalue - 1;
                            if (parentflagvalue == 0)
                            {
                                drvcinfo["TV"]          = "Main TV";
                                ViewState["VC_IDMAIN"]  = sortedDT.Rows[i]["VC_ID"].ToString();
                                ViewState["STB_NOMAIN"] = sortedDT.Rows[i]["STB_NO"].ToString();
                            }
                            if (parentflagvalue != 0)
                            {
                                drvcinfo["TV"] = "Addon " + parentflagvalue.ToString();
                            }
                            drvcinfo["VC_ID"]  = sortedDT.Rows[i]["VC_ID"].ToString();
                            drvcinfo["STB_NO"] = sortedDT.Rows[i]["STB_NO"].ToString();
                            ServiceStatus      = sortedDT.Rows[i]["Status"].ToString();
                            DateTime dttime = Convert.ToDateTime(sortedDT.Rows[i]["Last_Status"].ToString());
                            drvcinfo["SUSPENSION_DATE"] = dttime.ToString("dd-MMM-yyyy");
                            if (ServiceStatus == "10100")
                            {
                                drvcinfo["SUSPENSION_DATE"] = "";
                                drvcinfo["STATUS"]          = "Active";
                            }
                            else
                            {
                                drvcinfo["SUSPENSION_DATE"] = dttime.ToString("dd-MMM-yyyy");
                                drvcinfo["STATUS"]          = "In-Active";
                            }
                            drvcinfo["BOX_TYPE"] = sortedDT.Rows[i]["Pack_Type"].ToString();
                            dtVCinfo.Rows.Add(drvcinfo);
                        }
                    }
                    GridVC.DataSource = dtVCinfo;
                    GridVC.DataBind();
                    lblCustNo.Text        = cust_id;
                    lblCustName.Text      = cust_name;
                    lblCustAddr.Text      = cust_addr.Replace('|', ',');
                    lbltxtmobno.Text      = cust_mobile_no;
                    ViewState["custaddr"] = lblCustAddr.Text;
                    ViewState["custmob"]  = lbltxtmobno.Text;
                    divdet.Visible        = true;
                }
            }
            catch (Exception ex)
            {
                divdet.Visible = false;
                popMsg.Show();
                lblPopupResponse.Text = "Customer data not found";
            }
        }
Example #2
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            resetAllGrids();
            lblSearchResponse.Text = "";
            string searhParam  = txtSearchParam.Text;
            string search_type = rdoSearchParamType.SelectedValue.ToString();
            // string username = "";
            string oper_id      = "";
            string user_brmpoid = "";
            string category     = "";

            if (Session["operator_id"] != null && Session["username"] != null && Session["category"] != null && Session["user_brmpoid"] != null)
            {
                username     = Convert.ToString(Session["username"]);
                oper_id      = Convert.ToString(Session["operator_id"]);
                user_brmpoid = Convert.ToString(Session["user_brmpoid"]);
                category     = Convert.ToString(Session["category"]);
            }
            else
            {
                Session.Abandon();
                Response.Redirect("~/Login.aspx");
            }
            // string response_params = username + "$" + searhParam + "$SW";
            string response_params = user_brmpoid + "$" + searhParam + "$SW";

            if (search_type == "0")
            {
                //if VC ID
                response_params += "$V";
            }

            string apiResponse = callAPI(response_params, "12");

            //string apiResponse = callAPI(response_params, "6");

            try
            {
                if (apiResponse != "")
                {
                    List <string> lstResponse = new List <string>();
                    lstResponse = apiResponse.Split('$').ToList();
                    string cust_id = lstResponse[0]; //account_no
                    ViewState["customer_no"] = cust_id;
                    string cust_name = lstResponse[3];
                    ViewState["customer_name"] = cust_name;
                    string cust_addr = lstResponse[4];
                    ViewState["accountPoid"] = lstResponse[6];
                    string lco_poid       = lstResponse[13];
                    string cust_mobile_no = lstResponse[5];

                    //DATA ACCESS VALIDATION----------------------------------------------------------------------------------VALIDATION
                    if (category != "10") //No validation for national level user
                    {
                        Cls_Validation obj = new Cls_Validation();
                        string         validate_cust_access = obj.CustDataAccess(username, oper_id, lco_poid, category);
                        if (validate_cust_access.Length == 0)
                        {
                            resetAllGrids();
                            resetSearchBox();
                            pnlCustDetails.Visible = false;
                            pnlGridHolder.Visible  = false;
                            lblSearchResponse.Text = "You have no privileges to access customer information as s/he belongs to other LCO";
                            return;
                        }
                    }
                    else
                    {   //if user is not a LCO, then get city using brmpoid
                        Cls_Business_TxnAssignPlan objCity = new Cls_Business_TxnAssignPlan();
                        string city = objCity.GetCityFromBrmPoid(Session["username"].ToString(), lco_poid);
                        ViewState["cityid"] = city;
                    }


                    string    cust_services = lstResponse[15];
                    string[]  service_arr   = cust_services.Split('^');
                    DataTable dtStbs        = new DataTable();
                    dtStbs.Columns.Add(new DataColumn("STB_NO"));
                    dtStbs.Columns.Add(new DataColumn("VC_ID"));
                    dtStbs.Columns.Add(new DataColumn("SERVICE_STRING"));
                    dtStbs.Columns.Add(new DataColumn("Status"));

                    DataTable sortedDT = new DataTable();

                    foreach (string service in service_arr)
                    {
                        string stb_no     = service.Split('!')[1];
                        string vc_id      = service.Split('!')[2];
                        string stb_status = service.Split('!')[4];
                        if (stb_status == "10103")
                        {
                            continue; //if status is terminated
                        }
                        if (stb_no == "" || vc_id == "")
                        {
                            continue;
                        }
                        DataRow drStbRow = dtStbs.NewRow();
                        drStbRow["STB_NO"]         = stb_no;
                        drStbRow["VC_ID"]          = vc_id;
                        drStbRow["SERVICE_STRING"] = service;
                        drStbRow["Status"]         = stb_status;
                        dtStbs.Rows.Add(drStbRow);

                        DataView dv = dtStbs.DefaultView;
                        dv.Sort  = "Status Asc";
                        sortedDT = dv.ToTable();
                    }
                    if (sortedDT.Rows.Count == 0)
                    {
                        btnReset_Click(sender, e);
                        lblSearchResponse.Text = "No STB found";
                        return;
                    }
                    grdStb.DataSource = sortedDT;
                    grdStb.DataBind();

                    //ticking first stb value and bind all fields with details
                    ((CheckBox)(grdStb.Rows[0].FindControl("chkStb"))).Checked = true;
                    HiddenField hdnDefaultService = ((HiddenField)(grdStb.Rows[0].FindControl("hdnServiceStr")));
                    bindAllGrids(hdnDefaultService.Value);

                    //show last five transactions of customer
                    showLastTransaction(username, cust_id);

                    lblCustNo.Text   = cust_id;
                    lblCustName.Text = cust_name;
                    lblCustAddr.Text = cust_addr.Replace('|', ',');
                    lbltxtmobno.Text = cust_mobile_no;
                    //--------------------------------------------------------comented on 10-Jan-2015
                    //setSearchBox();
                    //pnlCustDetails.Visible = true;
                    //pnlGridHolder.Visible = true;
                    //btnReset.Visible = true;
                }
                else
                {
                    resetSearchBox();
                    lblSearchResponse.Text = "Failed to receive customer data";
                    pnlCustDetails.Visible = false;
                    pnlGridHolder.Visible  = false;
                    btnReset.Visible       = false;
                }
            }
            catch (Exception)
            {
                resetSearchBox();
                lblSearchResponse.Text = "Customer data not found";
                pnlCustDetails.Visible = false;
                pnlGridHolder.Visible  = false;
                btnReset.Visible       = false;
            }
        }