コード例 #1
0
ファイル: CustomerManageBIZ.cs プロジェクト: guipaa/PDF.NET
 /// <summary>
 /// 获取一个顾客信息,如果没有则返回空对象
 /// </summary>
 /// <param name="customerID"></param>
 /// <returns></returns>
 public CustomerContactInfo GetCustomerContactInfo(string customerID)
 {
     CustomerContactInfo info = new CustomerContactInfo() { CustomerID = customerID };
     if (EntityQuery<CustomerContactInfo>.Fill(info))
         return info;
     else
         return null;
 }
コード例 #2
0
ファイル: CustomerManageBIZ.cs プロジェクト: guipaa/PDF.NET
 /// <summary>
 /// 获取联系人信息记录数量
 /// </summary>
 /// <returns></returns>
 public int GetContactInfoCount()
 {
     CustomerContactInfo info = new CustomerContactInfo();
     OQL q = OQL.From(info)
         .Select()
         .Count(info.CustomerID, "tempField").END;
     CustomerContactInfo infoCount = EntityQuery<CustomerContactInfo>.QueryObject(q);
     return Convert.ToInt32(infoCount.PropertyList("tempField"));
 }
コード例 #3
0
ファイル: CustomerManageBIZ.cs プロジェクト: guipaa/PDF.NET
        /// <summary>
        /// 获取指定页的联系人信息
        /// </summary>
        /// <param name="pageSize"></param>
        /// <param name="pageNumber"></param>
        /// <param name="allCount"></param>
        /// <returns></returns>
        public List<CustomerContactInfo> GetContactInfoList(int pageSize, int pageNumber, int allCount)
        {
            CustomerContactInfo info = new CustomerContactInfo();
            OQL q = new OQL(info);
            q.Select().OrderBy(info.CustomerName, "asc");
            q.Limit(pageSize, pageNumber);
            q.PageWithAllRecordCount = allCount;

            return EntityQuery<CustomerContactInfo>.QueryList(q);
        }
コード例 #4
0
ファイル: Index.aspx.cs プロジェクト: guipaa/PDF.NET
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            if (GridView1.SelectedIndex >= 0)
            {
                string customerId = GridView1.SelectedRow.Cells[1].Text;
                CustomerContactInfo info = new CustomerContactInfo() { CustomerID = customerId };

                CustomerManageBIZ biz = new CustomerManageBIZ();
                if (biz.RemoveContactInfo(info))
                {
                    this.tbCustomerInfo.Visible = false;
                    lblMsg.Text = "删除成功!";
                    bindGrid();
                }
            }
            else
            {
                lblMsg.Text = "请先选择一行有效的记录!";
            }
           
        }
コード例 #5
0
ファイル: CashierRegisterBIZ.cs プロジェクト: guipaa/PDF.NET
        /// <summary>
        /// 保存销售信息
        /// </summary>
        /// <param name="customer">客户信息</param>
        /// <param name="integral">要增加的积分</param>
        /// <returns></returns>
        private GoodsSellNote SaveSalesInfo(Customer customer, int integral)
        {
            GoodsSellNote note = new GoodsSellNote();
            note.CustomerID = customer.CustomerID;
            note.ManchinesNumber = this.CurrCRManchines.CashRegisterNo;
            note.SalesmanID = this.CurrCashier.WorkNumber;
            note.SalesType = "店内销售";
            note.SellDate = DateTime.Now;
            note.GoodsSellDetails = new List<GoodsSellDetail>();

            AdoHelper db = MyDB.GetDBHelper();
            db.BeginTransaction();
            try
            {
                EntityQuery<GoodsSellNote> query = new EntityQuery<GoodsSellNote>(db);
                if (query.Insert(note) > 0)
                {
                    foreach (Goods goods in customer.Goodss)
                    {
                        if (goods.GoodsNumber > 0)
                        {
                            //处理详单
                            GoodsSellDetail detail = new GoodsSellDetail();
                            detail.GoodsPrice = goods.GoodsPrice;
                            detail.NoteID = note.NoteID;
                            detail.SellNumber = goods.GoodsNumber;
                            detail.SerialNumber = goods.SerialNumber;

                            note.GoodsSellDetails.Add(detail);

                            //更新库存
                            SuperMarketDAL.Entitys.GoodsStock stock = new SuperMarketDAL.Entitys.GoodsStock();
                            stock.GoodsID = goods.GoodsID;
                            stock.Stocks = goods.GoodsNumber;
                            
                            OQL q = OQL.From(stock)
                                .UpdateSelf ('-', stock.Stocks)
                                .Where(stock.GoodsID)
                                .END;
                            EntityQuery<SuperMarketDAL.Entitys.GoodsStock>.ExecuteOql(q, db);

                        }
                    }

                    EntityQuery<GoodsSellDetail> queryDetail = new EntityQuery<GoodsSellDetail>(db);
                    queryDetail.Insert(note.GoodsSellDetails);

                    //更新会员的积分
                    if (integral > 0)
                    {
                        SuperMarketDAL.Entitys.CustomerContactInfo ccInfo = new CustomerContactInfo();
                        ccInfo.CustomerID = customer.CustomerID;
                        ccInfo.Integral = integral;
                        OQL qc = OQL.From(ccInfo)
                                .UpdateSelf('+', ccInfo.Integral )
                                .Where(ccInfo.CustomerID )
                                .END;
                        EntityQuery<SuperMarketDAL.Entitys.GoodsStock>.ExecuteOql(qc, db);
                    }
                }
                db.Commit();
            }
            catch (Exception ex)
            {
                db.Rollback();
                throw new Exception("插入销售记录失败,内部错误原因:" + ex.Message);
            }
            return note;
        }
コード例 #6
0
ファイル: CustomerManageBIZ.cs プロジェクト: guipaa/PDF.NET
 public bool RemoveContactInfo(CustomerContactInfo info)
 {
     return EntityQuery<CustomerContactInfo>.Instance.Delete (info) > 0;
 }
コード例 #7
0
ファイル: CustomerManageBIZ.cs プロジェクト: guipaa/PDF.NET
 public bool UpdateContactInfo(CustomerContactInfo info)
 {
     return EntityQuery<CustomerContactInfo>.Instance.Update (info) > 0;
 }
コード例 #8
0
ファイル: CustomerManageBIZ.cs プロジェクト: guipaa/PDF.NET
 public bool AddContactInfo(CustomerContactInfo info)
 {
     return EntityQuery<CustomerContactInfo>.Instance.Insert(info)>0;
 }
コード例 #9
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;
        }