public void ProceedCancel()
        {
            string    CustId   = "";
            string    VcId     = "";
            string    PlanName = "";
            DataTable dt       = new DataTable();

            dt.Columns.Add("CustId");
            dt.Columns.Add("VcId");
            dt.Columns.Add("PlanName");

            foreach (GridViewRow row in grdLcoCustEcsDetails.Rows)
            {
                if (row.RowType == DataControlRowType.DataRow)
                {
                    CheckBox chkRow = (row.Cells[0].FindControl("chkautorenew") as CheckBox);
                    if (chkRow.Checked)
                    {
                        CustId   = row.Cells[1].Text;
                        VcId     = row.Cells[2].Text;
                        PlanName = row.Cells[7].Text;

                        dt.Rows.Add(CustId, VcId, PlanName);
                    }
                }
            }

            /* string str = "";
             * for (int i = 0; i < dt.Rows.Count; i++)
             * {
             *   str += dt.Rows[i][0].ToString() + "$"+ dt.Rows[i][1].ToString() + "$" + dt.Rows[i][2].ToString() + "$";
             * }
             * string strvalue = str.TrimEnd('$');
             *
             * Hashtable ht = new Hashtable();
             * ht.Add("username", username);
             * ht.Add("strvalue", strvalue);
             *
             * Cls_BLL_AutoRenewCancel obj = new Cls_BLL_AutoRenewCancel();
             * string msg = obj.AutoRenewCancel(username, ht);*/

            int cnt = 0;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string str = " update aoup_lcopre_ecs_det set  var_ecs_isactive ='C' ";
                str += " where var_ecs_vcid ='" + dt.Rows[i][1].ToString() + "'";
                str += " and var_ecs_planname ='" + dt.Rows[i][2].ToString() + "'";
                str += " and var_ecs_isactive ='" + "Y" + "'";
                cnt++;
                Cls_Helper obj       = new Cls_Helper();
                int        returnval = obj.insertQry(str);
            }

            BindData();
        }
        public void proceedRenewals()
        {
            string username, catid, operator_id;

            if (Session["username"] != null || Session["operator_id"] != null)
            {
                catid = Convert.ToString(Session["category"]);
                if (catid == "11")
                {
                    Session["lco_username"] = ddllco.SelectedValue.Split('$')[1].ToString();
                    username = ddllco.SelectedValue.Split('$')[0].ToString();// Session["username"].ToString();
                }
                else
                {
                    Session["lco_username"] = Convert.ToString(Session["operator_id"]);
                    username = Session["username"].ToString();
                }
                operator_id = Convert.ToString(Session["operator_id"]);
            }
            else
            {
                Session.Abandon();
                Response.Redirect("~/Login.aspx");
                return;
            }
            string   file_name              = "";
            string   upload_id              = "";
            DateTime date                   = DateTime.Now;
            string   cur_timestamp          = DateTime.Now.ToString("dd-MMM-yyyy hh:mm:ss");
            string   cur_time               = DateTime.Now.ToString("dd-MMM-yyyy_hh:mm:ss");
            string   cur_time_filename_part = DateTime.Now.ToString("dd-MMM-yyyy_hhmmss");
            Random   random                 = new Random();

            upload_id = username + "_" + cur_time + "_" + random.Next(1000, 9999);
            file_name = "Renew_" + username + "_" + cur_time_filename_part;
            StringBuilder sb = new StringBuilder();

            if (((CheckBox)grdExpiry.HeaderRow.FindControl("cbAllrenew")).Checked)
            {
                //---------------------------------------------------------------

                string plan_type = "";
                if (rbAD.Checked)
                {
                    plan_type = "AD";
                }
                else if (rbAL.Checked)
                {
                    plan_type = "AL";
                }
                else if (rbHSP.Checked)
                {
                    plan_type = "HSP";
                }
                else if (rbB.Checked)
                {
                    plan_type = "B";
                }
                else
                {
                    plan_type = "ALL";
                }
                string vcid = "";
                if (chkVCID.Checked == true)
                {
                    vcid = txtvcid.Text;
                }
                string plan_name = ddlPlanname.SelectedValue.ToString();
                //---------------------------------------------------------------


                try
                {
                    Cls_BLL_TransHwayBulkRenewal objrenew = new Cls_BLL_TransHwayBulkRenewal();
                    string returnval = objrenew.GetBulkRenewData(username, upload_id, file_name, txtFrom.Text, txtTo.Text, plan_name, plan_type, vcid);
                    if (returnval.Split('$')[0] == "9999")
                    {
                        Session["upload_id"] = upload_id;

                        // Response.Redirect("../Transaction/TransHwayBulkRenewConf.aspx");
                        Response.Redirect("../Reports/rptBulkTransactionProc.aspx?uniqueid=" + upload_id);
                    }
                    else
                    {
                        lblSearchMsg.Text = returnval.Split('$')[1];
                        return;
                    }
                }
                catch (Exception ex)
                {
                    FileLogText1(ex.ToString(), "proceedRenewals", "", "", "");
                }
                //validated_data_arr = validated_data.Split('#');
            }
            else
            {
                int    cnt          = 0;
                string autorenwflag = "";
                foreach (GridViewRow item in grdExpiry.Rows)
                {
                    if (item.RowType == DataControlRowType.DataRow && (item.Cells[10].FindControl("cbRenew") as CheckBox).Checked)
                    {
                        //if (item.RowType == DataControlRowType.DataRow && (item.Cells[11].FindControl("cbAutoRenew") as CheckBox).Checked)
                        //CheckBox childchks = item.Cells[10].FindControl("cbRenew") as CheckBox;
                        CheckBox childchk = item.Cells[11].FindControl("cbAutoRenew") as CheckBox;
                        childchk.Attributes.Add("onclick", "Check_CbAuto(this);");
                        if (item.RowType == DataControlRowType.DataRow && (item.Cells[11].FindControl("cbAutoRenew") as CheckBox).Checked)
                        {
                            autorenwflag = "Y";
                        }
                        else if (HidChRenewalValue.Value == "N")
                        {
                            autorenwflag = "N";
                        }
                        string str = "Insert into aoup_lcopre_bulk_temp values (seq_lcopre_bulk_temp.nextval,'" + item.Cells[1].Text + "', '" + ((LinkButton)item.FindControl("LBvc")).Text + "', " +
                                     " '" + item.Cells[6].Text + "','" + item.Cells[8].Text + "','R','" + username + "','" + upload_id + "','" + cur_timestamp + "','" + ((HiddenField)item.FindControl("hdnBrmpoid")).Value + "','','',SYSDATE,'N','" + file_name + "','N','" + autorenwflag + "' ,'Y','N','" + username + "','','','','','1','')";
                        cnt++;
                        Cls_Helper obj       = new Cls_Helper();
                        int        returnval = obj.insertQry(str);
                    }
                }
                if (cnt == 0)
                {
                    string msg = "<script type=\"text/javascript\">alert(\"Please Select Atleast One Plan To Renew\");</script>";
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "msg", msg);
                    return;
                }

                Session["upload_id"] = upload_id;
                string     strs       = "Insert into aoup_lcopre_bulk_temp_summary values ('" + upload_id + "','" + username + "', " + cnt + ", " + 0 + "," + 0 + ",'" + username + "',SYSDATE,'" + file_name + "')";
                Cls_Helper objk       = new Cls_Helper();
                int        returnvals = objk.insertQry(strs);
                if (returnvals >= 1)
                {
                    Response.Redirect("../Reports/rptBulkTransactionProc.aspx?uniqueid=" + upload_id);
                }
                else
                {
                    return;
                }
            }
        }