示例#1
0
        // GET: /Customers/GetCustomerID/:id

        public JsonResult GetCustomerID(int id)
        {
            Customers     cus_info = new Customers();
            CustomersData data3    = new CustomersData();

            cus_info = data3.GetCustomerInfo_ByID(id);

            StaffData     st        = new StaffData();
            DataTable     dt        = new DataTable();
            List <Staffs> staffList = new List <Staffs>();

            dt = st.GetStaffRole(0, 5);
            if (dt.Rows.Count > 0)
            {
                staffList = dt.AsEnumerable().Select(dr => new Staffs()
                {
                    StaffID        = dr.Field <int>("StaffID"),
                    StaffCode      = dr.Field <string>("StaffCode"),
                    StaffTitleName = dr.Field <string>("StaffTitleName"),
                    StaffFirstName = dr.Field <string>("StaffFirstName"),
                    StaffLastName  = dr.Field <string>("StaffLastName"),
                    StaffRoleID    = dr.Field <int>("StaffRoleID"),
                    StaffRoleName  = dr.Field <string>("StaffRoleName"),
                    StaffName      = dr.Field <string>("StaffTitleName") + dr.Field <string>("StaffFirstName") + " "
                                     + dr.Field <string>("StaffLastName"),
                }).ToList();
            }
            return(Json(new
            {
                dataCustomer = cus_info,
                dataZone = staffList,
                success = true
            }, JsonRequestBehavior.AllowGet));
        }