public AscmDriverDelivery Add(string driverSn, int batSumMainId, int deliveryOrderBatchId, int materialId, decimal quantity)
        {
            try
            {
                AscmDriverDelivery ascmDriverDelivery = new AscmDriverDelivery();
                ascmDriverDelivery.organizationId = 0;
                ascmDriverDelivery.createUser = "";
                ascmDriverDelivery.createTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm");
                ascmDriverDelivery.modifyUser = "";
                ascmDriverDelivery.modifyTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm");
                ascmDriverDelivery.driverSn = driverSn;
                ascmDriverDelivery.batSumMainId = batSumMainId;
                ascmDriverDelivery.deliveryOrderBatchId = deliveryOrderBatchId;
                ascmDriverDelivery.deliveryOrderId = 0;
                ascmDriverDelivery.materialId = materialId;
                ascmDriverDelivery.quantity = quantity;
                //ascmDriverDelivery.status = "";
                ascmDriverDelivery.memo = "";

                int maxId = YnDaoHelper.GetInstance().nHibernateHelper.GetMaxId("select max(id) from AscmDriverDelivery");
                maxId++;
                ascmDriverDelivery.id = maxId;
                using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession().BeginTransaction())
                {
                    try
                    {
                        YnDaoHelper.GetInstance().nHibernateHelper.Save(ascmDriverDelivery);
                        tx.Commit();//正确执行提交
                    }
                    catch (Exception ex)
                    {
                        tx.Rollback();//回滚
                        throw ex;
                    }
                }
                return ascmDriverDelivery;
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("保存失败(Save AscmDriverDelivery)", ex);
                throw ex;
            }
        }
 public void Update(AscmDriverDelivery ascmDriverDelivery)
 {
     try
     {
         using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession().BeginTransaction())
         {
             try
             {
                 YnDaoHelper.GetInstance().nHibernateHelper.Update<AscmDriverDelivery>(ascmDriverDelivery);
                 tx.Commit();//正确执行提交
             }
             catch (Exception ex)
             {
                 tx.Rollback();//回滚
                 YnBaseClass2.Helper.LogHelper.GetLog().Error("修改失败(Update AscmDriverDelivery)", ex);
                 throw ex;
             }
         }
     }
     catch (Exception ex)
     {
         YnBaseClass2.Helper.LogHelper.GetLog().Error("修改失败(Save AscmDriverDelivery)", ex);
         throw ex;
     }
 }
 //public void Delete(int id)
 //{
 //    try
 //    {
 //        AscmDriverDelivery ascmDriverDelivery = Get(id);
 //        Delete(ascmDriverDelivery);
 //    }
 //    catch (Exception ex)
 //    {
 //        throw ex;
 //    }
 //}
 public void Delete(AscmDriverDelivery ascmDriverDelivery)
 {
     try
     {
         YnDaoHelper.GetInstance().nHibernateHelper.Delete<AscmDriverDelivery>(ascmDriverDelivery);
     }
     catch (Exception ex)
     {
         YnBaseClass2.Helper.LogHelper.GetLog().Error("删除失败(Delete AscmDriverDelivery)", ex);
         throw ex;
     }
 }