Beispiel #1
0
        protected void grdDetail_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            grdDetail.PageIndex = e.NewPageIndex;
            Hashtable htTopupParams = dataParams();
            DataTable dt            = new DataTable();

            Cls_BLL_ecafstbtransfer objTran = new Cls_BLL_ecafstbtransfer();

            dt = objTran.GetAdminRejectedList(username, htTopupParams);


            if (dt.Rows.Count == 0)
            {
                grdDetail.Visible = false;
                btnExcel.Visible  = false;
                msgbox("No Data Found", txtFrom);
            }
            else
            {
                btnExcel.Visible     = true;
                grdDetail.DataSource = dt;
                grdDetail.DataBind();
                grdDetail.Visible = true;
            }
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                if (ddlState.SelectedValue == "0" || ddlState.SelectedValue == "")
                {
                    lblSearchMsg.Text = "Please select state";
                    return;
                }


                if (ddlDAS.SelectedValue == "")
                {
                    lblSearchMsg.Text = "Please select DAS Area";
                    return;
                }

                if (txtlco.Text == "")
                {
                    lblSearchMsg.Text = "Please enter LCO";
                    return;
                }

                Hashtable ht = new Hashtable();

                ht.Add("in_username", Session["username"].ToString());
                ht.Add("in_state", ddlState.SelectedItem.Text.ToUpper().ToString());
                ht.Add("in_city", ddlCity.SelectedItem.Text.ToUpper().ToString());
                ht.Add("in_DAS", ddlDAS.SelectedItem.Text.ToUpper().ToString());
                ht.Add("in_LCO", txtlco.Text.ToUpper().ToString());
                ht.Add("in_adminlevel", ddlAdminLevel.SelectedValue.ToString());
                ht.Add("in_stateid", ddlState.SelectedValue);
                Cls_BLL_ecafstbtransfer obj = new Cls_BLL_ecafstbtransfer();
                string   response           = obj.InsertLCOConfig(Session["username"].ToString(), ht);
                string[] responseArr        = response.Split('$');



                lblSearchMsg.Text      = responseArr[1].ToString();
                ViewState["ErrorInfo"] = "9999";
            }
            catch (Exception ex)
            {
                lblSearchMsg.Text = ex.Message;
            }
        }
        protected void btncnfmBlck_Click(object sender, EventArgs e)
        {
            try
            {
                string           strCon = ConfigurationSettings.AppSettings["conString"].ToString().Trim();
                OracleConnection con    = new OracleConnection(strCon);



                if (lblstbrate.Text == "0")
                {
                    PopMsgBoxErr.Show();
                    lblInformation.Text = "STB Rate can not be 0";
                    return;
                }
                if (rblType.SelectedValue == "S")
                {
                    string cur_time = DateTime.Now.ToString("dd-MMM-yyyy_hhmmss");
                    Random random   = new Random();
                    string RefId    = "REF" + "_" + cur_time + "_" + random.Next(1000, 9999);
                    if (txtstbno.Text == "")
                    {
                        PopMsgBoxErr.Show();
                        lblInformation.Text = "Please enter STB No.";
                        return;
                    }

                    string Getstb = "select account_no,lco_code from VIEW_HWCAS_BRM_CUST_MASTER  where stb='" + txtstbno.Text.Trim() + "' and connection_type='CHILD' ";

                    OracleCommand     cmd   = new OracleCommand(Getstb, con);
                    OracleDataAdapter DaObj = new OracleDataAdapter(cmd);
                    DataTable         dt    = new DataTable();

                    DaObj.Fill(dt);


                    if (dt.Rows.Count == 0)
                    {
                        PopMsgBoxErr.Show();
                        lblInformation.Text = "No data found";
                        return;
                    }


                    string in_translcoCode = dt.Rows[0]["lco_code"].ToString();

                    if (in_translcoCode == Session["username"].ToString())
                    {
                        PopMsgBoxErr.Show();
                        lblInformation.Text = "STb belongs to same LCO";
                        return;
                    }
                    string    in_translcocity = "";
                    string    in_translcoDAS  = "";
                    Hashtable ht = new Hashtable();
                    ht.Add("in_stb", txtstbno.Text.Trim());
                    ht.Add("in_lcoCode", Session["username"].ToString());
                    ht.Add("in_translcoCode", in_translcoCode);
                    ht.Add("in_translcocity", in_translcocity);
                    ht.Add("in_translcoDAS", in_translcoDAS);
                    ht.Add("in_amount", lblstbrate.Text);
                    ht.Add("in_RefId", RefId);
                    ht.Add("in_operid", Session["operator_id"].ToString());
                    Cls_BLL_ecafstbtransfer obj = new Cls_BLL_ecafstbtransfer();
                    string   response           = obj.InsertDetails(Session["username"].ToString(), ht);
                    string[] responseArr        = response.Split('$');
                    if (responseArr[0].ToString() == "9999")
                    {
                        ViewState["Erorcode"] = "9999";
                    }
                    PopMsgBoxErr.Show();
                    lblInformation.Text = responseArr[1].ToString();
                    return;
                }
                else
                {
                    string cur_time = DateTime.Now.ToString("dd-MMM-yyyy_hhmmss");
                    Random random   = new Random();
                    string RefId    = "REF" + "_" + cur_time + "_" + random.Next(1000, 9999);

                    if (FileUpload1.HasFile == true)
                    {
                        DateTime dd       = DateTime.Now;
                        string   datetime = dd.Day + "" + dd.Month + "" + dd.Year + "" + dd.Hour + "" + dd.Minute + "" + dd.Second;
                        String   Path     = Server.MapPath("~//ImageGarbage") + "\\" + datetime + "STbTransfer";

                        if (FileUpload1.HasFile)
                        {
                            FileUpload1.SaveAs(Path + ".txt");
                        }

                        string[] lines = System.IO.File.ReadAllLines(Path + ".txt");
                        if (lines.Length > 1000)
                        {
                            lblResponseMsg.Text = "Records should not be greater than 1000";
                            return;
                        }

                        DataTable dtResponse = new DataTable();
                        foreach (string STBNo in lines)
                        {
                            if (dtResponse.Columns.Contains("STBNo"))
                            {
                            }
                            else
                            {
                                dtResponse.Columns.Add("STBNo");
                            }

                            dtResponse.Rows.Add(STBNo);
                        }

                        if (dtResponse.Rows.Count > 0)
                        {
                            DataTable distinct = dtResponse.DefaultView.ToTable(true, "STBNo");
                            if (distinct.Rows.Count == dtResponse.Rows.Count)
                            {
                                //there are no duplicates
                            }
                            else
                            {
                                PopMsgBoxErr.Show();
                                lblInformation.Text = "Duplicate STB not allowed";
                                return;
                            }
                        }
                        foreach (string STBNo in lines)
                        {
                            string Getstb = " select account_no,lco_code from VIEW_HWCAS_BRM_CUST_MASTER  where stb='" + STBNo + "'";


                            OracleCommand     cmd   = new OracleCommand(Getstb, con);
                            OracleDataAdapter DaObj = new OracleDataAdapter(cmd);
                            DataTable         dt    = new DataTable();

                            DaObj.Fill(dt);


                            if (dt.Rows.Count == 0)
                            {
                                PopMsgBoxErr.Show();
                                lblInformation.Text = "No data found";
                                return;
                            }

                            else
                            {
                                string in_translcoCode = dt.Rows[0]["lco_code"].ToString();

                                if (in_translcoCode == Session["username"].ToString())
                                {
                                    PopMsgBoxErr.Show();
                                    lblInformation.Text = "LCO belongs to same City";
                                    return;
                                }
                                string in_translcocity = "";
                                string in_translcoDAS  = "";


                                Hashtable ht = new Hashtable();
                                ht.Add("in_stb", STBNo);
                                ht.Add("in_lcoCode", Session["username"].ToString());
                                ht.Add("in_translcoCode", in_translcoCode);
                                ht.Add("in_translcocity", in_translcocity);
                                ht.Add("in_translcoDAS", in_translcoDAS);
                                ht.Add("in_amount", lblstbrate.Text);
                                ht.Add("in_RefId", RefId);
                                ht.Add("in_operid", Session["operator_id"].ToString());
                                Cls_BLL_ecafstbtransfer obj = new Cls_BLL_ecafstbtransfer();
                                string   response           = obj.InsertDetails(Session["username"].ToString(), ht);
                                string[] responseArr        = response.Split('$');
                                PopMsgBoxErr.Show();
                                lblInformation.Text = responseArr[1].ToString();
                            }
                        }
                    }
                    else
                    {
                        PopMsgBoxErr.Show();
                        lblInformation.Text = "Please Upload File";
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                lblResponseMsg.Text = ex.Message;
            }
        }
Beispiel #4
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string username, catid, operator_id;

            if (Session["username"] != null || Session["operator_id"] != null)
            {
                username    = Session["username"].ToString();
                catid       = Convert.ToString(Session["category"]);
                operator_id = Convert.ToString(Session["operator_id"]);
            }
            else
            {
                Session.Abandon();
                Response.Redirect("~/Login.aspx");
                return;
            }

            string   from = txtFrom.Text;
            string   to   = txtTo.Text;
            DateTime fromDt;
            DateTime toDt;

            if (!String.IsNullOrEmpty(from) && !String.IsNullOrEmpty(to))
            {
                fromDt = new DateTime();
                toDt   = new DateTime();
                fromDt = DateTime.ParseExact(from, "dd-MMM-yyyy", null);
                toDt   = DateTime.ParseExact(to, "dd-MMM-yyyy", null);
                if (toDt.CompareTo(fromDt) < 0)
                {
                    msgbox("To date must be later than From date", txtTo);
                    return;
                }
            }
            else
            {
                msgbox("From and To date cannot be blank", txtFrom);
                return;
            }
            Hashtable htdta = dataParams();

            DataTable dt = new DataTable();
            Cls_BLL_ecafstbtransfer objTran = new Cls_BLL_ecafstbtransfer();

            dt = objTran.STBTransferList(username, htdta);

            if (dt != null)
            {
                if (dt.Rows.Count == 0)
                {
                    grdDetail.Visible = false;
                    btnExcel.Visible  = false;
                    msgbox("No Data Found", txtFrom);
                }
                else
                {
                    btnExcel.Visible     = true;
                    grdDetail.DataSource = dt;
                    grdDetail.DataBind();
                    grdDetail.Visible = true;
                    ScriptManager.RegisterStartupScript(Page, this.GetType(), "Key", "<script>MakeStaticHeader('" + grdDetail.ClientID + "', 400, 1200 , 37 ,false); </script>", false);
                    DivRoot.Style.Add("display", "block");
                }
            }
        }
Beispiel #5
0
        protected void btn_genExl_Click(object sender, EventArgs e)
        {
            string    from  = txtFrom.Text;
            string    to    = txtTo.Text;
            Hashtable htdta = dataParams();
            Cls_BLL_ecafstbtransfer objTran = new Cls_BLL_ecafstbtransfer();
            DataTable htResponse            = objTran.STBTransferList(Session["username"].ToString(), htdta);
            DataTable dt = null;

            if (htResponse.Rows.Count != 0)
            {
                dt = (DataTable)htResponse;

                DateTime dd       = DateTime.Now;
                string   datetime = dd.Day + "" + dd.Month + "" + dd.Year + "" + dd.Hour + "" + dd.Minute + "" + dd.Second;

                StreamWriter sw = new StreamWriter(Server.MapPath("../MyExcelFile/") + "STBTransRejected" + datetime + ".xls");
                try
                {
                    int    j         = 0;
                    String strheader = "Sr No" + Convert.ToChar(9)
                                       + "Reference No" + Convert.ToChar(9)
                                       + "STB No" + Convert.ToChar(9)
                                       + "LCO Code" + Convert.ToChar(9)
                                       + "Amount" + Convert.ToChar(9)
                                       + "Status" + Convert.ToChar(9)
                                       + "Admin Remark" + Convert.ToChar(9)
                                       + "Admin Approval By" + Convert.ToChar(9)
                                       + "Admin Approval Date" + Convert.ToChar(9)
                                       + "LCO Remark" + Convert.ToChar(9)
                                       + "LCO Approval By" + Convert.ToChar(9)
                                       + "LCO Approval Date" + Convert.ToChar(9)
                                       + "Inserted By" + Convert.ToChar(9)
                                       + "Inserted Date" + Convert.ToChar(9);

                    while (j < dt.Rows.Count)
                    {
                        sw.WriteLine(strheader);

                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            j = j + 1;
                            string strrow = j.ToString() + Convert.ToChar(9)
                                            + dt.Rows[i]["refid"].ToString() + Convert.ToChar(9)
                                            + dt.Rows[i]["stb"].ToString() + Convert.ToChar(9)
                                            + dt.Rows[i]["var_stbtransfer_lcocode"].ToString() + Convert.ToChar(9)
                                            + dt.Rows[i]["num_stbtransfer_stbamount"].ToString() + Convert.ToChar(9)
                                            + dt.Rows[i]["status"].ToString() + Convert.ToChar(9)
                                            + dt.Rows[i]["adminremark"].ToString() + Convert.ToChar(9)
                                            + dt.Rows[i]["adminapprovlby"].ToString() + Convert.ToChar(9)
                                            + dt.Rows[i]["adminappdate"].ToString() + Convert.ToChar(9)
                                            + dt.Rows[i]["lcoremark"].ToString() + Convert.ToChar(9)
                                            + dt.Rows[i]["lcoapprovedby"].ToString() + Convert.ToChar(9)
                                            + dt.Rows[i]["lcoapproveddate"].ToString() + Convert.ToChar(9)
                                            + dt.Rows[i]["insby"].ToString() + Convert.ToChar(9)
                                            + dt.Rows[i]["insdate"].ToString() + Convert.ToChar(9);


                            sw.WriteLine(strrow);
                        }
                    }
                    sw.Flush();
                    sw.Close();
                }
                catch (Exception ex)
                {
                    sw.Flush();
                    sw.Close();
                    Response.Write("Error : " + ex.Message.Trim());
                    return;
                }
                Response.Redirect("../MyExcelFile/" + "STBTransRejected" + datetime + ".xls");
            }
        }
        protected void btncnfmBlck_Click(object sender, EventArgs e)
        {
            string           strCon = ConfigurationSettings.AppSettings["conString"].ToString().Trim();
            OracleConnection con    = new OracleConnection(strCon);

            if (txtremark.Text.Trim() == "")
            {
                PopMsgBoxErr.Show();
                lblinfo.Text = "Please enter remark";
                return;
            }
            String AccessString = "";

            for (int i = 0; i < grdSTBSwap.Rows.Count; i++)
            {
                String   Status  = "";
                CheckBox ChkMenu = (CheckBox)grdSTBSwap.Rows[i].Cells[0].FindControl("ChkSTB");
                if (ChkMenu.Checked == true)
                {
                    if (grdSTBSwap.Rows.Count == 1)
                    {
                        string STB = grdSTBSwap.Rows[i].Cells[1].Text;

                        string            getaccno    = "select account_no from reports.hwcas_brm_cust_master@caslive_new where stb='" + STB + "' and rownum=1";
                        OracleCommand     cmdGetAccNo = new OracleCommand(getaccno, con);
                        OracleDataAdapter DaObjAccNo  = new OracleDataAdapter(cmdGetAccNo);
                        DataTable         dtAccNo     = new DataTable();
                        string            AccNo       = "";
                        DaObjAccNo.Fill(dtAccNo);
                        if (dtAccNo.Rows.Count > 0)
                        {
                            AccNo = dtAccNo.Rows[0]["account_no"].ToString();
                        }
                        else
                        {
                            PopMsgBoxErr.Show();
                            lblinfo.Text = "Account No not found for STB :" + STB;
                            return;
                        }


                        string response_params = Convert.ToString(Session["user_brmpoid"]) + "$" + AccNo + "$SW";
                        string apiResponse     = callAPI(response_params, "12");//
                        try
                        {
                            if (apiResponse != "")
                            {
                                List <string> lstResponse = new List <string>();
                                lstResponse = apiResponse.Split('$').ToList();
                                ViewState["accountPoid"] = lstResponse[6];
                                string   cust_services = lstResponse[15];
                                string[] service_arr   = cust_services.Split('^');
                                ViewState["Service_Str"] = null;
                                ViewState["Service_Str"] = cust_services.ToString();
                            }
                        }
                        catch (Exception ex)
                        {
                        }
                    }

                    RadioButton RdoAccept = (RadioButton)grdSTBSwap.Rows[i].FindControl("RdoAccept");
                    RadioButton RdoCancel = (RadioButton)grdSTBSwap.Rows[i].FindControl("RdoCancel");
                    string      msgsubid  = ((HiddenField)grdSTBSwap.Rows[i].FindControl("hdntransid")).Value;
                    if (RdoAccept.Checked == true)
                    {
                        Status = "A";
                    }
                    else
                    {
                        Status = "R";
                    }
                    AccessString += msgsubid + "#" + Status + "$";
                }
            }

            if (AccessString != "")
            {
                AccessString = AccessString.Remove(AccessString.Length - 1);
            }
            else
            {
                PopMsgBoxErr.Show();
                lblinfo.Text = "Please select atleast one record";
                return;
            }

            Hashtable ht = new Hashtable();

            ht.Add("in_username", Session["username"].ToString());
            ht.Add("in_AccessString", AccessString);
            ht.Add("in_remark", txtremark.Text.Trim());

            Cls_BLL_ecafstbtransfer obj = new Cls_BLL_ecafstbtransfer();
            string response             = obj.InsertAdminTransfer(Session["username"].ToString(), ht);

            string[] responseArr = response.Split('$');

            PopMsgBoxErr.Show();
            lblinfo.Text           = responseArr[1].ToString();
            ViewState["ErrorInfo"] = "9999";
        }