コード例 #1
0
ファイル: CashierManageBIZ.cs プロジェクト: guipaa/PDF.NET
 /// <summary>
 /// 获取所有的收银员
 /// </summary>
 /// <returns></returns>
 public List<Cashier> GetAllCashiers()
 {
     Employee emp = new Employee();
     emp.JobName = "收银员";
     OQL q = OQL.From(emp)
         .Select(emp.WorkNumber,emp.EmployeeName)
         .Where(emp.JobName)
         .OrderBy(emp.EmployeeName, "asc")
         .END;
     List<Employee> list= EntityQuery<Employee>.QueryList(q);
     return list.ConvertAll<Cashier>(p =>
     {
         return new Cashier() { CashierName = p.EmployeeName, WorkNumber = p.WorkNumber };
     }
     ); 
 }
コード例 #2
0
ファイル: GoodsManageBIZ.cs プロジェクト: guipaa/PDF.NET
        /// <summary>
        /// 获取商品销售单视图
        /// </summary>
        /// <returns></returns>
        public IEnumerable<GoodsSellNoteVM> GetGoodsSellNote()
        {
            GoodsSellNote note = new GoodsSellNote();
            Employee emp = new Employee();
            CustomerContactInfo cst=new CustomerContactInfo ();
            OQL joinQ = OQL.From(note)
                .InnerJoin(emp).On(note.SalesmanID, emp.WorkNumber)
                .InnerJoin(cst).On(note.CustomerID, cst.CustomerID)
                .Select(note.NoteID, cst.CustomerName, note.ManchinesNumber, emp.EmployeeName, note.SalesType, note.SellDate)
                .OrderBy(note.NoteID, "desc")
                .END;

            PWMIS.DataProvider.Data.AdoHelper db = PWMIS.DataProvider.Adapter.MyDB.GetDBHelper();
            EntityContainer ec = new EntityContainer(joinQ, db);  
            ec.Execute();
            //可以使用下面的方式获得各个成员元素列表
            //var noteList = ec.Map<GoodsSellNote>().ToList();
            //var empList = ec.Map<Employee>().ToList();
            //var cstList = ec.Map<CustomerContactInfo>().ToList();
            //直接使用下面的方式获得新的视图对象
            var result = ec.Map<GoodsSellNoteVM>(e =>
                {
                    e.NoteID = ec.GetItemValue<int>(0);
                    e.CustomerName = ec.GetItemValue<string>(1);
                    e.ManchinesNumber = ec.GetItemValue<string>(2);
                    e.EmployeeName = ec.GetItemValue<string>(3);
                    e.SalesType = ec.GetItemValue<string>(4);
                    e.SellDate = ec.GetItemValue<DateTime>(5);
                    return e;
                }
            );
            return result;
        }