///////////////////////////////////////////////////////////////////////////////////////////////
        //
        // Function Name  : <CheckBillItem>
        // Summary  : <To check if a particular bill item exist in the database or not by caliing its cooresponding DB Function>
        // Input Parameters : <Object of billItem class containing id>
        // Output Parameters : <Integer value isvalid>
        // Return Value  : <0 or 1>
        //
        ///////////////////////////////////////////////////////////////////////////////////////////////

        public int CheckBillItem(IBillItem obj)
        {
            int isvalid = 0;
            IBillItemDB billItemDBobj = BillItemDBFactory.CreateBillItemDB();
            try
            {
                isvalid = billItemDBobj.CheckBillItem(obj);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return isvalid;
        }
        ///////////////////////////////////////////////////////////////////////////////////////////////
        //
        // Function Name  : <ViewBillItem>
        // Summary  : <To view a particular bill item by its id by caliing its cooresponding DB Function>
        // Input Parameters : <Object of billItem class containing id>
        // Output Parameters :<Object of billItem class>
        // Return Value  : <The entire details of the particular bill item>
        //
        ///////////////////////////////////////////////////////////////////////////////////////////////

        public IBillItem ViewBillItem(IBillItem obj)
        {
            IBillItem billItem = null;
            IBillItemDB billItemDBobj = BillItemDBFactory.CreateBillItemDB();
            try
            {
                billItem = billItemDBobj.ViewBillItem(obj);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return billItem;
        }
 ///////////////////////////////////////////////////////////////////////////////////////////////
 //
 // Function Name  : <ViewBillItem>
 // Summary  : <To view a particular bill item by its id by caliing its cooresponding DB Store Procedure>
 // Input Parameters : <Object of billItem class containing id>
 // Output Parameters :<Object of billItem class>
 // Return Value  : <The entire details of the particular bill item>
 //
 ///////////////////////////////////////////////////////////////////////////////////////////////
 public IBillItem ViewBillItem(IBillItem obj)
 {
     IBillItem billItem = null;
     SqlConnection conn = null;
     try
     {
         conn = DBUTILITY.getConnection();
         SqlCommand cmd = new SqlCommand();
         cmd.Connection = conn;
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.CommandText = "view_billitem_teamE_TMS_65";
         conn.Open();
         cmd.Parameters.AddWithValue("@billitem_id", obj.BillItemId);
         SqlDataReader sdr = cmd.ExecuteReader();
         while (sdr.Read())
         {
             Int64 connectionId = Convert.ToInt64(sdr["ConnectionNo"]);
             DateTime dateOfCall = Convert.ToDateTime(sdr["DateofCall"]);
             string duration = sdr["Duration"].ToString();
             Int64 numberCalled = Convert.ToInt64(sdr["Number_called"]);
             CallType type = (CallType)Enum.Parse(typeof(CallType), (sdr["TypeofCall"].ToString()), true);
             double pulseRate = Convert.ToDouble(sdr["Pulse_Rate"]);
             int pulse = Convert.ToInt16(sdr["Pulse"]);
             double amount = Convert.ToDouble(sdr["CostofCall"]);
             billItem = BillItemFactory.CreateBillItem(obj.BillItemId, connectionId, dateOfCall, duration, numberCalled, type, pulse, pulseRate, amount);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         if (conn.State == ConnectionState.Open)
             conn.Close();
     }
     return billItem;
 }
        ///////////////////////////////////////////////////////////////////////////////////////////////
        //
        // Function Name  : <ViewAllBillItemByConnection>
        // Summary  : <To view all the bill items of a particular connection in a particular month by caliing its cooresponding DB Function>
        // Input Parameters : <Object of billItem class containing id and dateofcall>
        // Output Parameters : <Object of billItem class>
        // Return Value  : <Entire details of the bill items of the connection in a month>
        //
        ///////////////////////////////////////////////////////////////////////////////////////////////

        public List<IBillItem> ViewAllBillItemByConnection(IBillItem billitem)
        {
            List<IBillItem> BillItemList = null;
            IBillItemDB billItemDBobj = BillItemDBFactory.CreateBillItemDB();
            try
            {
                BillItemList = new List<IBillItem>();
                BillItemList = billItemDBobj.ViewAllBillItemByConnection(billitem);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return BillItemList;
        }      
 ///////////////////////////////////////////////////////////////////////////////////////////////
 //
 // Function Name  : <CheckBillItem>
 // Summary  : <To check if a particular bill item exist in the database or not by caliing its cooresponding DB Stored Procedure>
 // Input Parameters : <Object of billItem class containing id>
 // Output Parameters : <Integer value isvalid>
 // Return Value  : <0 or 1>
 //
 ///////////////////////////////////////////////////////////////////////////////////////////////
 public int CheckBillItem(IBillItem obj)
 {
     int isValid = 0;
     SqlConnection conn = null;
     try
     {
         conn = DBUTILITY.getConnection();
         SqlCommand cmd = new SqlCommand();
         cmd.Connection = conn;
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.CommandText = "check_billitem_teamE_TMS_65";
         conn.Open();
         cmd.Parameters.AddWithValue("@BillItem_id", obj.BillItemId);
         isValid=Convert.ToInt32(cmd.ExecuteNonQuery());
         
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         if (conn.State == ConnectionState.Open)
             conn.Close();
     }
     return isValid;
 }