Example #1
0
        private string AddBackOutput(DataTable dt)
        {
            BackOutput bill = DataTableToEntites.GetEntity <BackOutput>(dt.Rows[0]);

            bill.Record = HandleRecords(dt);
            BackOutputService Service = new BackOutputService();

            Service.SaveData(bill);
            return(bill.BillCode);
        }
Example #2
0
        private string AddGiveBill(DataTable dt)
        {
            GiveBill bill = DataTableToEntites.GetEntity <GiveBill>(dt.Rows[0]);

            bill.Record = HandleRecords(dt);
            GiveBillService Service = new GiveBillService();

            Service.SaveData(bill);
            return(bill.BillCode);
        }
Example #3
0
        /// <summary>
        /// 处理子表数据
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        private ICollection <Record> HandleRecords(DataTable dt)
        {
            ICollection <Record> records = DataTableToEntites.GetEntities <Record>(dt);

            foreach (var record in records)
            {
                var res = CurrentDBSession.GoodItemDal.LoadEntities(a => a.ItemCode == record.ItemCode).FirstOrDefault();
                if (res != null)
                {
                    record.ItemName           = res.ItemName;
                    record.ItemLine           = res.ItemLine;
                    record.ItemSpecifications = res.ItemSpecifications;
                    record.ItemUnit           = res.ItemUnit;
                    record.UnitWeight         = res.UnitWeight;
                    record.Weight             = Math.Round((double)(record.Count * Convert.ToDouble(res.UnitWeight)), 2);
                }
                var res2 = CurrentDBSession.LocationDal.LoadEntities(a => a.Id == record.ItemLocationId).FirstOrDefault();
                if (res2 != null)
                {
                    record.ItemLocation = res2.Name;
                }
            }
            return(records);
        }