Exemplo n.º 1
0
        public bool Save(BillDetail billDetail, out string strResult)
        {
            strResult = string.Empty;
            bool result = false;
            var  b      = BillDetailRepository.GetQueryable().FirstOrDefault(c => c.BillMaster.UUID == billDetail.BillMaster.UUID);

            if (b != null)
            {
                try
                {
                    b.PieceCigarCode = billDetail.PieceCigarCode;
                    b.BoxCigarCode   = billDetail.BoxCigarCode;
                    b.BillQuantity   = billDetail.BillQuantity;
                    b.FixedQuantity  = billDetail.FixedQuantity;
                    b.RealQuantity   = billDetail.RealQuantity;

                    BillDetailRepository.SaveChanges();
                    result = true;
                }
                catch (Exception ex)
                {
                    strResult = "原因:" + ex.Message;
                }
            }
            return(result);
        }
Exemplo n.º 2
0
        public bool Add(BillDetail billDetail, out string strResult)
        {
            strResult = string.Empty;
            bool result = false;
            var  b      = new BillDetail();

            if (b != null)
            {
                try
                {
                    b.ID             = billDetail.ID;
                    b.MasterID       = billDetail.MasterID;
                    b.PieceCigarCode = billDetail.PieceCigarCode;
                    b.BoxCigarCode   = billDetail.BoxCigarCode;
                    b.BillQuantity   = billDetail.BillQuantity;
                    b.FixedQuantity  = billDetail.FixedQuantity;
                    b.RealQuantity   = billDetail.RealQuantity;

                    BillDetailRepository.Add(b);
                    BillDetailRepository.SaveChanges();
                    result = true;
                }
                catch (Exception ex)
                {
                    strResult = "原因:" + ex.ToString();
                    result    = false;
                }
            }
            else
            {
                strResult = "原因:找不到当前登陆用户!请重新登陆!";
                result    = false;
            }
            return(result);
        }