コード例 #1
0
 public List<OtherFeeBill> Query(OtherFeeBillQueryForm form)
 {
     ISqlMapper mapper = MapperHelper.GetMapper();
     OtherFeeBillDao dao = new OtherFeeBillDao(mapper);
     return dao.Query(form);
 }
コード例 #2
0
 public string Add(OtherFeeBill bill)
 {
     ISqlMapper mapper = MapperHelper.GetMapper();
     OtherFeeBillDao dao = new OtherFeeBillDao(mapper);
     return dao.Add(bill);
 }
コード例 #3
0
ファイル: BillBLL.cs プロジェクト: franknew/AnjuManager
        public BillModel QuerySingle(string BillID)
        {
            ISqlMapper mapper = MapperHelper.GetMapper();
            BillDao dao = new BillDao(mapper);
            OtherFeeDao ofdao = new OtherFeeDao(mapper);
            House_OtherFeeDao hodao = new House_OtherFeeDao(mapper);
            OtherFeeBillDao ofbdao = new OtherFeeBillDao(mapper);

            var bill = dao.QueryFullBill(new QueryFullBillServiceForm { ID = BillID }).FirstOrDefault();
            BillModel model = new BillModel
            {
                Bill = bill,
            };
            if (bill == null) return model;
            var house_otherfees = hodao.Query(new House_OtherFeeQueryForm { HouseOrRoomID = bill.HouseOrRoomID });
            var otherfeeids = (from ho in house_otherfees select ho.OtherFeeID).ToList();
            var otherfeebills = ofbdao.Query(new OtherFeeBillQueryForm { BillID = bill.ID, });
            var otherfees = ofdao.Query(new OtherFeeQueryForm { IDs = otherfeeids });
            var fullotherfeebills = new List<FullOtherFeeBill>();
            foreach (var ho in house_otherfees)
            {
                FullOtherFeeBill ofb = new FullOtherFeeBill
                {
                    House_OtherFee = ho,
                    OtherFee = otherfees.Find(t => t.ID.Equals(ho.OtherFeeID)),
                    OtherFeeBill = otherfeebills.Find(t => t.OtherFeeID.Equals(ho.OtherFeeID)),
                };
                fullotherfeebills.Add(ofb);
            }
            model.OtherFeeBill = fullotherfeebills;
            return model;
        }
コード例 #4
0
ファイル: BillBLL.cs プロジェクト: franknew/AnjuManager
 public bool Update(BillModel model)
 {
     if (model == null) throw new Exception("model不能为null");
     if (model.Bill == null) throw new Exception("bill不能为null");
     if (string.IsNullOrEmpty(model.Bill.ID)) throw new Exception("Bill.ID不能为空");
     ISqlMapper mapper = MapperHelper.GetMapper();
     BillDao billdao = new BillDao(mapper);
     OtherFeeBillDao ofbdao = new OtherFeeBillDao(mapper);
     billdao.Update(new BillUpdateForm
     {
         Entity = new Bill
         {
             ShouldPay = model.Bill.ShouldPay,
             Payed = model.Bill.Payed,
         },
         BillQueryForm = new BillQueryForm { ID = model.Bill.ID },
     });
     if (model.OtherFeeBill != null)
     {
         foreach (var ofb in model.OtherFeeBill)
         {
             if (ofb.OtherFeeBill == null || string.IsNullOrEmpty(ofb.OtherFeeBill.ID)) continue;
             ofbdao.Update(new OtherFeeBillUpdateForm
             {
                 Entity = new OtherFeeBill
                 {
                     StartValue = ofb.OtherFeeBill.StartValue,
                     EndValue = ofb.OtherFeeBill.EndValue,
                     Fee = ofb.OtherFeeBill.Fee,
                 },
                 OtherFeeBillQueryForm = new OtherFeeBillQueryForm { ID = ofb.OtherFeeBill.ID },
             });
         }
     }
     return true;
 }
コード例 #5
0
ファイル: BillBLL.cs プロジェクト: franknew/AnjuManager
        public DataTable QueryFullBill(QueryFullBillServiceForm form)
        {
            #region 初始化数据
            ISqlMapper mapper = MapperHelper.GetMapper();
            BillDao dao = new BillDao(mapper);
            OtherFeeDao ofbll = new OtherFeeDao(mapper);
            OtherFeeBillDao ofbbll = new OtherFeeBillDao(mapper);
            var bills = dao.QueryFullBill(form);
            var billids = (from b in bills select b.ID).ToList();
            var houseids = (from b in bills select b.HouseOrRoomID).ToList();
            var otherfee = ofbll.Query(new OtherFeeQueryForm { });
            var otherfeebills = ofbbll.Query(new OtherFeeBillQueryForm { BillIDs = billids });
            var linkedOtherfeeBills = (from b in otherfeebills
                                       join o in otherfee
                                       on b.OtherFeeID equals o.ID
                                       select new { ID = b.ID, Fee = b.Fee, Name = o.Name, BillID = b.BillID, }).ToList();
            #endregion

            #region 设置字段mapping
            List<ToDataTableMapping> list = new List<ToDataTableMapping>
            {
                new ToDataTableMapping { OrignalName = "Name", MappingName = "账单名称" },
                new ToDataTableMapping { OrignalName = "ShouldPay",MappingName = "应收" },
                new ToDataTableMapping { OrignalName = "Payed", MappingName = "已收" },
                new ToDataTableMapping { OrignalName = "PayDay", MappingName="交租日期" },
                new ToDataTableMapping { OrignalName = "HouseOrRoomID", MappingName="房间ID" },
                new ToDataTableMapping { OrignalName = "ID", MappingName="ID" },
                new ToDataTableMapping { OrignalName = "BuildingName", MappingName="楼栋名称" },
                new ToDataTableMapping { OrignalName = "HouseName", MappingName = "房间名称" },
            };
            #endregion

            #region 组装数据
            DataTable table = bills.ToDataTable(list);
            foreach (var of in otherfee)
            {
                if (!table.Columns.Contains(of.Name))
                {
                    DataColumn column = new DataColumn(of.Name, typeof(decimal));
                    column.DefaultValue = 0;
                    table.Columns.Add(column);
                }
            }
            foreach (DataRow row in table.Rows)
            {
                foreach (var ofb in linkedOtherfeeBills)
                {
                    row[ofb.Name] = ofb.Fee;
                }
            }
            #endregion
            return table;
        }