public FarmecallHistory GetFarmerCallHistory(string apiKey, string MobileNo)
        {
            FarmecallHistory fr = new FarmecallHistory();

            if (apiKey == ConfigurationManager.AppSettings["reasonkey"])
            {
                try
                {
                    fr = _agentbal.GetFarmerCallHistory(MobileNo);
                }
                catch (Exception ex)
                {
                    LogBal.ErrorLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message, 0);
                }
            }
            return(fr);
        }
        public FarmecallHistory GetFarmerCallHistory(string MobileNo)
        {
            DataSet ds = _Apdal.GetFarmerCallHistory(MobileNo);

            FarmecallHistory a = new FarmecallHistory();

            if (ds != null && ds.Tables[0] != null)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    List <FarmerCall> p = new List <FarmerCall>();
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        FarmerCall Reason = new FarmerCall();
                        Reason.FarmerId        = ds.Tables[0].Rows[i]["FarmerId"].ToString();
                        Reason.FarmerName      = ds.Tables[0].Rows[i]["FarmerName"].ToString();
                        Reason.FatherName      = ds.Tables[0].Rows[i]["FatherName"].ToString();
                        Reason.MobileNo        = ds.Tables[0].Rows[i]["MobileNo"].ToString();
                        Reason.StateId         = Convert.ToInt32(ds.Tables[0].Rows[i]["StateID"].ToString());
                        Reason.StateName       = ds.Tables[0].Rows[i]["StateName"].ToString();
                        Reason.DistrictId      = Convert.ToInt32(ds.Tables[0].Rows[i]["DistrictID"].ToString());
                        Reason.DistrictName    = ds.Tables[0].Rows[i]["DistrictName"].ToString();
                        Reason.BlockID         = Convert.ToInt32(ds.Tables[0].Rows[i]["BlockID"].ToString());
                        Reason.BlockName       = ds.Tables[0].Rows[i]["BlockName"].ToString();
                        Reason.VillageID       = Convert.ToInt32(ds.Tables[0].Rows[i]["VillageID"].ToString());
                        Reason.VillageName     = ds.Tables[0].Rows[i]["VillageName"].ToString();
                        Reason.Address         = ds.Tables[0].Rows[i]["Address"].ToString();
                        Reason.NearByVillage   = ds.Tables[0].Rows[i]["NearByVillage"].ToString();
                        Reason.CallDate        = ds.Tables[0].Rows[i]["CallDate"].ToString();
                        Reason.CallDuration    = ds.Tables[0].Rows[i]["CallDuration"].ToString();
                        Reason.CallStatus      = ds.Tables[0].Rows[i]["CallStatus"].ToString();
                        Reason.RescheduledDate = ds.Tables[0].Rows[i]["RescheduledDate"].ToString();
                        Reason.Message         = ds.Tables[0].Rows[i]["Message"].ToString();
                        p.Add(Reason);
                    }
                    a.Farmerc = p;
                }
            }
            return(a);
        }