public ActionResult Admindashboard()
        {
            admintimesheet adminmonthlydashboard = new admintimesheet();
            Business.ApplicationService.AppServiceClient appclient = new Business.ApplicationService.AppServiceClient();

            adminmonthlydashboard.year = DateTime.Now.Year;
            adminmonthlydashboard.month = DateTime.Now.Month;
            adminmonthlydashboard.monthname = UI.Utilities.DateTimeUtility.ToLongMonthName(DateTime.Now.Month);
            adminmonthlydashboard.monthstarts = DateTime.Now;
            adminmonthlydashboard.monthends = DateTime.Now;
            adminmonthlydashboard.weekcollection = UI.Utilities.DateTimeUtility.GetWeeks(DateTime.Now.Month, DateTime.Now.Year);
            adminmonthlydashboard.numberofweeks = adminmonthlydashboard.weekcollection.Count;

            adminmonthlydashboard.usertimesheets = new List<userdashboardtimesheet>();

            List<Business.ApplicationService.appuser> consultants = new List<Business.ApplicationService.appuser>();
            consultants = appclient.GetAdmins(Session["companyid"].ToString(), "consultant", Session["usertoken"].ToString()).ToList();

            foreach (Business.ApplicationService.appuser consultant in consultants)
            {
                userdashboardtimesheet usermonthlydashboardtimesheet = new userdashboardtimesheet();

                //Retrieving Consultant Information
                usermonthlydashboardtimesheet.User = consultant;

                usermonthlydashboardtimesheet.timesheetmonth = UI.Utilities.DateTimeUtility.ToLongMonthName(DateTime.Now.Month);
                usermonthlydashboardtimesheet.timesheetsstartdate = "";
                usermonthlydashboardtimesheet.timesheetenddate = "";

                List<AppWeekTimeSheet> weektimesheetscollection = new List<AppWeekTimeSheet>();

                foreach (customweek custweek in adminmonthlydashboard.weekcollection)
                {
                    AppWeekTimeSheet dashboarddata = new AppWeekTimeSheet();

                    dashboarddata.timesheetweek = custweek;

                    Business.ApplicationService.timesheet[] timesheets = appclient.Gettimesheets(Session["companyid"].ToString(), consultant.Id, "", "", custweek.startdate.ToString("yyyy-MM-dd hh:mm:ss"), custweek.enddate.ToString("yyyy-MM-dd hh:mm:ss"));
                    UI.testmodel.timesheet singletimesheet = new UI.testmodel.timesheet();
                    if (timesheets.Length > 0)
                    {
                        UI.testmodel.timesheet objsheet = Newtonsoft.Json.JsonConvert.DeserializeObject<UI.testmodel.timesheet>(timesheets[0].data);
                        dashboarddata.weektimesheetdata = objsheet;
                        dashboarddata.hasTimeSheet = true;
                    }
                    else
                    {
                        dashboarddata.hasTimeSheet = false;
                    }

                    weektimesheetscollection.Add(dashboarddata);
                }

                usermonthlydashboardtimesheet.weektimesheets = weektimesheetscollection;

                adminmonthlydashboard.usertimesheets.Add(usermonthlydashboardtimesheet);
            }

            return View(adminmonthlydashboard);
        }
        public ActionResult Admindashboard(FormCollection collection)
        {
            int selectedmonth = Convert.ToInt32(collection["selectedmonth"]);
            int selectedyear  = Convert.ToInt32(collection["selectedyear"]);

            admintimesheet adminmonthlydashboard = new admintimesheet();

            Business.ApplicationService.AppServiceClient appclient = new Business.ApplicationService.AppServiceClient();

            adminmonthlydashboard.year           = selectedyear;
            adminmonthlydashboard.month          = selectedmonth;
            adminmonthlydashboard.monthname      = UI.Utilities.DateTimeUtility.ToLongMonthName(selectedmonth);
            adminmonthlydashboard.monthstarts    = new DateTime(selectedyear, selectedmonth, 1);
            adminmonthlydashboard.monthends      = new DateTime(selectedyear, selectedmonth, 1);
            adminmonthlydashboard.weekcollection = UI.Utilities.DateTimeUtility.GetWeeks(selectedmonth, selectedyear);
            adminmonthlydashboard.numberofweeks  = adminmonthlydashboard.weekcollection.Count;


            adminmonthlydashboard.usertimesheets = new List <userdashboardtimesheet>();

            List <Business.ApplicationService.appuser> consultants = new List <Business.ApplicationService.appuser>();

            consultants = appclient.GetAdmins(Session["companyid"].ToString(), "consultant", Session["usertoken"].ToString()).ToList();

            foreach (Business.ApplicationService.appuser consultant in consultants)
            {
                userdashboardtimesheet usermonthlydashboardtimesheet = new userdashboardtimesheet();

                //Retrieving Consultant Information
                usermonthlydashboardtimesheet.User = consultant;

                usermonthlydashboardtimesheet.timesheetmonth      = UI.Utilities.DateTimeUtility.ToLongMonthName(selectedmonth);
                usermonthlydashboardtimesheet.timesheetsstartdate = "";
                usermonthlydashboardtimesheet.timesheetenddate    = "";

                List <AppWeekTimeSheet> weektimesheetscollection = new List <AppWeekTimeSheet>();

                foreach (customweek custweek in adminmonthlydashboard.weekcollection)
                {
                    AppWeekTimeSheet dashboarddata = new AppWeekTimeSheet();

                    dashboarddata.timesheetweek = custweek;

                    Business.ApplicationService.timesheet[] timesheets = appclient.Gettimesheets(Session["companyid"].ToString(), consultant.Id, "", "", custweek.startdate.ToString("yyyy-MM-dd hh:mm:ss"), custweek.enddate.ToString("yyyy-MM-dd hh:mm:ss"));
                    UI.testmodel.timesheet singletimesheet             = new UI.testmodel.timesheet();
                    if (timesheets.Length > 0)
                    {
                        UI.testmodel.timesheet objsheet = Newtonsoft.Json.JsonConvert.DeserializeObject <UI.testmodel.timesheet>(timesheets[0].data);
                        dashboarddata.weektimesheetdata = objsheet;
                        dashboarddata.hasTimeSheet      = true;
                    }
                    else
                    {
                        dashboarddata.hasTimeSheet = false;
                    }

                    weektimesheetscollection.Add(dashboarddata);
                }

                usermonthlydashboardtimesheet.weektimesheets = weektimesheetscollection;

                adminmonthlydashboard.usertimesheets.Add(usermonthlydashboardtimesheet);
            }

            return(View(adminmonthlydashboard));
        }