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

                int maxId = YnDaoHelper.GetInstance().nHibernateHelper.GetMaxId("select max(id) from AscmContainerDelivery");
                maxId++;
                ascmContainerDelivery.id = maxId;
                using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession().BeginTransaction())
                {
                    try
                    {
                        YnDaoHelper.GetInstance().nHibernateHelper.Save(ascmContainerDelivery);
                        tx.Commit();//正确执行提交
                    }
                    catch (Exception ex)
                    {
                        tx.Rollback();//回滚
                        throw ex;
                    }
                }
                return ascmContainerDelivery;
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("保存失败(Save AscmContainerDelivery)", ex);
                throw ex;
            }
        }
        public void Update(AscmContainerDelivery ascmContainerDelivery, int readingHeadId, string sessionKey)
        {
            try
            {
                AscmContainer ascmContainer = null;
                if (!string.IsNullOrEmpty(ascmContainerDelivery.containerSn))
                {
                    ascmContainer = YnDaoHelper.GetInstance().nHibernateHelper.Get<AscmContainer>(ascmContainerDelivery.containerSn, sessionKey);
                    if (ascmContainer != null)
                    {
                        ascmContainer.place = readingHeadId.ToString();
                        ascmContainer.storeInTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    }
                }

                using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession(sessionKey).BeginTransaction())
                {
                    try
                    {
                        YnDaoHelper.GetInstance().nHibernateHelper.Update<AscmContainerDelivery>(ascmContainerDelivery, sessionKey);

                        if (ascmContainer != null)
                            YnDaoHelper.GetInstance().nHibernateHelper.Update<AscmContainer>(ascmContainer, sessionKey);

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