public JsonResult DailyPropertyStatistics(string HitCountPeriodID, string StartDate, string EndDate)
        {
            //DateTime dt = DateTime.ParseExact(StartDate, "dd/MM/yyyy", CultureInfo.InvariantCulture);
            //DateTime dt1 = DateTime.ParseExact(EndDate, "dd/MM/yyyy", CultureInfo.InvariantCulture);
            //string Datefromm = Convert.ToString(dt);
            //string Datetoo = Convert.ToString(dt1);
            //string Datefromm = dt.ToString("yyyy-MM-dd");
            //string Datetoo = dt1.ToString("yyyy-MM-dd");
            string startdate = dateconvert(StartDate);
            string Enddate = dateconvert(EndDate);
            var PartID = "1";
            //string HotelID = Convert.ToString(Session["GBAdminBizContext"]);
            BizContext = (BizContext)Session["GBAdminBizContext"];
            int HotelID = BizContext.HotelID;
            Session["GBAdminBizContext"] = BizContext;

            DataTable dts = new DataTable();
            PropertyStatisticsRepository objupdate = new PropertyStatisticsRepository();
            List<PropertyStatisticsExt> list = new List<PropertyStatisticsExt>();
            try{
            dts = objupdate.DisplaydatewisePropertyStatistics(PartID, HitCountPeriodID, startdate, Enddate, HotelID);
            if (dts != null)
            {
                if (dts.Rows.Count > 0)
                {
                    foreach (DataRow dr in dts.Rows)
                    {
                        PropertyStatisticsExt FirmObj = new PropertyStatisticsExt();
                        FirmObj.PartID = dr["PartID"].ToString();
                        FirmObj.RecordID = dr["RecordID"].ToString();
                        FirmObj.ReservationCount = dr["ReservationCount"].ToString();
                        FirmObj.Date = dr["Date"].ToString();
                        FirmObj.HitCount = dr["HitCount"].ToString();
                        FirmObj.Month = dr["Month"].ToString();
                        FirmObj.MonthName = dr["MonthName"].ToString();
                        FirmObj.Day = dr["Day"].ToString();
                        FirmObj.DayName = dr["DayName"].ToString();
                        list.Add(FirmObj);
                    }
                }
            }
            }
            catch (Exception ex)
               {
               string hostName1 = Dns.GetHostName();
               string GetUserIPAddress = Dns.GetHostByName(hostName1).AddressList[0].ToString();
               string PageName = Convert.ToString(Session["PageName"]);
               //string GetUserIPAddress = GetUserIPAddress1();
               using (BaseRepository baseRepo = new BaseRepository())
               {
                   //BizContext BizContext1 = new BizContext();
                   BizApplication.AddError(baseRepo.BizDB, PageName, ex.Message, ex.StackTrace, DateTime.Now, GetUserIPAddress);
               }
               Session["PageName"] = "";
               string error = ErrorHandling.HandleException(ex);
               return this.Json(new DataSourceResult { Errors = error });
               }
            return Json(list, JsonRequestBehavior.AllowGet);
        }
 //public List<PropertyStatisticsExt> MonthlyPropertyStatistics(string PartID, string HotelID,string Year)
 //{
 //    string CultureValue = System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName;
 //    HotelID = "100002";
 //    string HitCountPeriodID = "2";
 //    List<PropertyStatisticsExt> list = new List<PropertyStatisticsExt>();
 //    DataTable dt = new DataTable();
 //    SQLCon.Open();
 //    SqlCommand cmd = new SqlCommand("TB_SP_GetHitCounts", SQLCon);
 //    cmd.Parameters.AddWithValue("@PartID", Convert.ToInt32(PartID));
 //    cmd.Parameters.AddWithValue("@RecordID", Convert.ToInt64(HotelID));
 //    cmd.Parameters.AddWithValue("@HitCountPeriodID", Convert.ToInt32(HitCountPeriodID));
 //    cmd.Parameters.AddWithValue("@Culture", CultureValue);
 //    cmd.Parameters.AddWithValue("@Year", Convert.ToInt32(Year));
 //    cmd.CommandType = CommandType.StoredProcedure;
 //    SqlDataAdapter sda = new SqlDataAdapter(cmd);
 //    sda.Fill(dt);
 //    SQLCon.Close();
 //    // return dt;
 //    if (dt.Rows.Count > 0)
 //    {
 //        foreach (DataRow dr in dt.Rows)
 //        {
 //            PropertyStatisticsExt FirmObj = new PropertyStatisticsExt();
 //            FirmObj.PartID = dr["PartID"].ToString();
 //            FirmObj.RecordID = dr["RecordID"].ToString();
 //            FirmObj.ReservationCount = dr["ReservationCount"].ToString();
 //            FirmObj.HitCount = dr["HitCount"].ToString();
 //            FirmObj.Month = dr["Month"].ToString();
 //            FirmObj.MonthName = dr["MonthName"].ToString();
 //            list.Add(FirmObj);
 //        }
 //    }
 //    return list;
 //}
 public List<PropertyStatisticsExt> YearlyPropertyStatistics(string PartID, int HotelID)
 {
     string CultureValue = System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName;
     //HotelID = "100002";
     string HitCountPeriodID = "1";
     List<PropertyStatisticsExt> list = new List<PropertyStatisticsExt>();
     DataTable dt = new DataTable();
     SQLCon.Open();
     SqlCommand cmd = new SqlCommand("TB_SP_GetHitCounts", SQLCon);
     cmd.Parameters.AddWithValue("@PartID", Convert.ToInt32(PartID));
     cmd.Parameters.AddWithValue("@RecordID", Convert.ToInt64(HotelID));
     cmd.Parameters.AddWithValue("@HitCountPeriodID", Convert.ToInt32(HitCountPeriodID));
     cmd.Parameters.AddWithValue("@Culture", CultureValue);
     cmd.CommandType = CommandType.StoredProcedure;
     SqlDataAdapter sda = new SqlDataAdapter(cmd);
     sda.Fill(dt);
     SQLCon.Close();
     // return dt;
     if (dt.Rows.Count > 0)
     {
         foreach (DataRow dr in dt.Rows)
         {
             PropertyStatisticsExt FirmObj = new PropertyStatisticsExt();
             FirmObj.PartID = dr["PartID"].ToString();
             FirmObj.RecordID = dr["RecordID"].ToString();
             FirmObj.ReservationCount = dr["ReservationCount"].ToString();
             FirmObj.HitCount = dr["HitCount"].ToString();
             FirmObj.Year = dr["Year"].ToString();
             list.Add(FirmObj);
         }
     }
     return list;
 }
        //public List<PropertyStatisticsExt> DisplayPropertyStatistics(string PartID, string RecordID, string HitCountPeriodID, string Year, string StartDate, string EndDate)
        public List<PropertyStatisticsExt> DisplayPropertyStatistics(string PartID, string HitCountPeriodID, string Startdate, string EndDate, int HotelID)
        {
            string CultureValue = System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName;

            List<PropertyStatisticsExt> list = new List<PropertyStatisticsExt>();
            DataTable dt = new DataTable();
            SQLCon.Open();
            SqlCommand cmd = new SqlCommand("TB_SP_GetHitCounts", SQLCon);
            cmd.Parameters.AddWithValue("@PartID", Convert.ToInt32(PartID));
            cmd.Parameters.AddWithValue("@RecordID", Convert.ToInt64(HotelID));
            cmd.Parameters.AddWithValue("@HitCountPeriodID", Convert.ToInt32(HitCountPeriodID));
            cmd.Parameters.AddWithValue("@StartDate", Startdate);
            cmd.Parameters.AddWithValue("@EndDate", EndDate);
            cmd.Parameters.AddWithValue("@OrderBy", "Sort");
            cmd.Parameters.AddWithValue("@Culture", CultureValue);
            cmd.CommandType = CommandType.StoredProcedure;
            SqlDataAdapter sda = new SqlDataAdapter(cmd);
            sda.Fill(dt);

            SQLCon.Close();
            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    PropertyStatisticsExt FirmObj = new PropertyStatisticsExt();
                    FirmObj.PartID = dr["PartID"].ToString();
                    FirmObj.RecordID = dr["RecordID"].ToString();
                    FirmObj.ReservationCount = dr["ReservationCount"].ToString();
                    FirmObj.Date = dr["Date"].ToString();
                    FirmObj.HitCount = dr["HitCount"].ToString();
                    FirmObj.Month = dr["Month"].ToString();
                    FirmObj.MonthName = dr["MonthName"].ToString();
                    FirmObj.Day = dr["Day"].ToString();
                    FirmObj.DayName = dr["DayName"].ToString();
                    list.Add(FirmObj);
                }
            }
            return list;
        }
        public JsonResult MonthlyPropertyStatistics(string Year)
        {
            //  string HotelID = Convert.ToString(Session["GBAdminBizContext"]);
            BizContext = (BizContext)Session["GBAdminBizContext"];
            int HotelID = BizContext.HotelID;
            Session["GBAdminBizContext"] = BizContext;

            var PartID = "1";
            if (Year == "")
            {
                Year = "2015";
            }
            DataTable dt = new DataTable();
            PropertyStatisticsRepository objupdate = new PropertyStatisticsRepository();
            List<PropertyStatisticsExt> list = new List<PropertyStatisticsExt>();
            try
            {
                dt = objupdate.MonthlyPropertyStatistics(PartID, HotelID, Year);
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        PropertyStatisticsExt FirmObj = new PropertyStatisticsExt();
                        FirmObj.PartID = dr["PartID"].ToString();
                        FirmObj.RecordID = dr["RecordID"].ToString();
                        FirmObj.ReservationCount = dr["ReservationCount"].ToString();
                        FirmObj.HitCount = dr["HitCount"].ToString();
                        FirmObj.MonthName = dr["MonthName"].ToString();
                        list.Add(FirmObj);
                    }
                }
            }
            catch (Exception ex)
            {
                string hostName1 = Dns.GetHostName();
                string GetUserIPAddress = Dns.GetHostByName(hostName1).AddressList[0].ToString();
                string PageName = Convert.ToString(Session["PageName"]);
                //string GetUserIPAddress = GetUserIPAddress1();
                using (BaseRepository baseRepo = new BaseRepository())
                {
                    //BizContext BizContext1 = new BizContext();
                    BizApplication.AddError(baseRepo.BizDB, PageName, ex.Message, ex.StackTrace, DateTime.Now, GetUserIPAddress);
                }
                Session["PageName"] = "";
                string error = ErrorHandling.HandleException(ex);
                return this.Json(new DataSourceResult { Errors = error });
            }
            return Json(list, JsonRequestBehavior.AllowGet);
        }