Пример #1
0
        public ActionResult SvcAppointmentsGridData(string sidx, string sord, int page, int rows)
        {
            string fromDate = Request.QueryString["fromDate"];
            string todate   = Request.QueryString["toDate"];

            uls_dbDataContext ulsdb_dc = new uls_dbDataContext();
            var svc_days = ulsdb_dc.GetGridSvcAppointments(sidx, sord, fromDate, todate);

            var dataJson = new
            {
                total    =
                    page = 1,
                records  = 10000,
                rows     = (from s in svc_days
                            select new
                {
                    id = Convert.ToString(s.svc_id),
                    cell = new string[] {
                        String.Format("{0:MM/dd/yyyy}", s.svc_date),
                        String.Format("{0:dddd}", s.svc_date),
                        Convert.ToString(s.street_address),
                        Convert.ToString(s.last_name),
//                            String.Format("{0:(###) ###-####}", s.home_phone),
                        Regex.Replace(s.home_phone, @"(\d{3})(\d{3})(\d{4})", "$1-$2-$3"),
                        Convert.ToString(s.crew),
                        Convert.ToString(s.svc_id),
                        s.first_name,
                        s.city,
                        s.state,
                        s.zip,
//                            String.Format("{0:(###) ###-####}", s.other_phone),
                        Regex.Replace(s.other_phone, @"(\d{3})(\d{3})(\d{4})", "$1-$2-$3"),
                        s.email,
                        Convert.ToString(s.reschedule),
                        s.comments
                    }
                }).ToArray()
            };

            return(Json(dataJson, JsonRequestBehavior.AllowGet));
        }