public string Batchstr(string str, string Agentcode, string option)
    {
        string output = "";

        if (option.Equals("0"))
        {
            output = "Please Select Batch Type";
        }
        else if (str.Equals(""))
        {
            output = "Please Select Transactions to Batch";
        }
        else
        {
            string   createdby    = HttpContext.Current.Session["Username"].ToString();
            int      recordid     = 0;
            string[] arr          = str.Split(',');
            int      i            = 0;
            int      Transactions = arr.Length;
            string   BatchNo      = datapay.SavePayBatch(Agentcode, Transactions, option, createdby);
            if (BatchNo.Equals(""))
            {
                output = "Failed to generate batch Number";
            }
            else
            {
                for (i = 0; i < arr.Length; i++)
                {
                    recordid = int.Parse(arr[i].ToString());
                    datapay.BatchPayment(recordid, BatchNo);
                }
                output = i + " Payments have been batched Successfully";
            }
        }
        return(output);
    }