示例#1
0
        public ActionResult JsonGrid()
        {
            var books = BookOrderRepo.GetBookOrderRepo().Select(r => r.book).ToList();

            ViewBag.RadioButtonValues = BookOrderRepo.GetBookOrderRepo().Select(r => r.book).ToList();

            List <Employee>        lstemp = new List <Employee>();
            Employee               objemp = new Employee();
            IEnumerable <Employee> ietemp = EmployeeRepo.GetEmployees();

            lstemp = (List <Employee>)ietemp;
            //StringBuilder sbHTML = new StringBuilder();

            //PropertyInfo[] propertyInfos;
            //propertyInfos = typeof(Employee).GetProperties(BindingFlags.Public |
            //                                              BindingFlags.Static);

            //foreach (var prop in lstemp.GetType().GetProperties())
            //{
            //    sbHTML.Append(prop.Name);
            //    sbHTML.Append("<br>");
            //}
            //for (int i = 0; i < lstemp.Count; i++)
            //{
            //    foreach (PropertyInfo Property in lstemp[i].GetType().GetProperties())
            //    {
            //        sbHTML.Append(Property.GetValue(lstemp[i], null));
            //    }
            //}
            //string str = sbHTML.ToString();
            // var employeeValues = GetPropertyValues(lstemp);
            return(View(lstemp));
        }
示例#2
0
        public ActionResult GetData(string address)
        {
            var bookOrderRepo = BookOrderRepo.GetBookOrderRepo();

            return(Json(bookOrderRepo, JsonRequestBehavior.AllowGet));
            //return View(albums);
        }
示例#3
0
        public ActionResult FixedWidthGrid()
        {
            var           rec           = tblRepo.GetRecRepo();
            var           bookOrderRepo = BookOrderRepo.GetBookOrderRepo();
            StringBuilder sb            = new StringBuilder();

            //IList<PropertyInfo> propertyInfos = typeof(Employee).GetProperties();
            //Employee em =new Employee();

            //    //add header line.
            //    foreach (PropertyInfo propertyInfo in propertyInfos)
            //    {
            //        sb.Append(propertyInfo.Name).Append(",");
            //        sb.Append(propertyInfo.GetValue(em, null)).Append(",");
            //    }
            //   // sb.Remove(sb.Length - 1, 1).AppendLine();

            //    string str = sb.ToString();
            ////add value for each property.
            var emp = EmployeeRepo.GetEmployees();
            PropertyDescriptorCollection props = TypeDescriptor.GetProperties(typeof(Employee));

            foreach (PropertyDescriptor prop in props)
            {
                sb.Append(prop.DisplayName); // header
                sb.Append("\t");
            }
            // sb.Append();
            foreach (Employee item in emp)
            {
                foreach (PropertyDescriptor prop in props)
                {
                    sb.Append(prop.Converter.ConvertToString(
                                  prop.GetValue(item)));
                    sb.Append("\t");
                }
                sb.Append("");
            }

            string str = sb.ToString();



            return(View(bookOrderRepo));
        }
示例#4
0
        public ActionResult GetBookDetails(int id)
        {
            var bookslist = BookOrderRepo.GetBooks();

            var    bookdetails = bookslist.Where(b => b.BookID.Equals(id)).ToList();
            string html        = RenderRazorViewToString("PartialPopUp", bookdetails);

            System.Text.StringBuilder sbHtml = new System.Text.StringBuilder();

            sbHtml.Append("Condition 1 Grid");
            sbHtml.Append(RenderRazorViewToString("PartialPopUp", bookdetails).Replace("grid", "grid1"));
            sbHtml.Append("~");
            sbHtml.Append("Condition2");
            sbHtml.Append(RenderRazorViewToString("PartialPopUp", bookdetails).Replace("grid", "grid2"));
            sbHtml.Append("~");
            sbHtml.Append("Condition3  grid");
            sbHtml.Append(RenderRazorViewToString("PartialPopUp", bookdetails).Replace("grid", "grid3"));
            sbHtml.Append("~");
            string str = sbHtml.ToString();

            return(Json(sbHtml.ToString(), JsonRequestBehavior.AllowGet));
            //return View(albums);
        }