Esempio n. 1
0
        public void Update(int id, decimal quantity)
        {
            try
            {
                AscmPalletDelivery ascmPalletDelivery = Get(id);
                if (ascmPalletDelivery == null)
                {
                    throw new Exception("编号错误,没有此编号托盘!");
                }
                ascmPalletDelivery.modifyUser = "";
                ascmPalletDelivery.modifyTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm");
                ascmPalletDelivery.quantity   = quantity;

                using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession().BeginTransaction())
                {
                    try
                    {
                        YnDaoHelper.GetInstance().nHibernateHelper.Save(ascmPalletDelivery);
                        tx.Commit();//正确执行提交
                    }
                    catch (Exception ex)
                    {
                        tx.Rollback();//回滚
                        throw ex;
                    }
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("保存失败(Save AscmPalletDelivery)", ex);
                throw ex;
            }
        }
Esempio n. 2
0
        public void Delete(int id)
        {
            try
            {
                AscmPalletDelivery ascmPalletDelivery = Get(id);
                if (ascmPalletDelivery == null)
                {
                    throw new Exception("编号错误,没有此编号托盘!");
                }

                using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession().BeginTransaction())
                {
                    try
                    {
                        YnDaoHelper.GetInstance().nHibernateHelper.Delete(ascmPalletDelivery);
                        tx.Commit();//正确执行提交
                    }
                    catch (Exception ex)
                    {
                        tx.Rollback();//回滚
                        throw ex;
                    }
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("保存失败(Save AscmPalletDelivery)", ex);
                throw ex;
            }
        }
Esempio n. 3
0
 public void Update(AscmPalletDelivery ascmPalletDelivery, string sessionKey = null)
 {
     try
     {
         using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession(sessionKey).BeginTransaction())
         {
             try
             {
                 YnDaoHelper.GetInstance().nHibernateHelper.Update <AscmPalletDelivery>(ascmPalletDelivery, sessionKey);
                 tx.Commit();//正确执行提交
             }
             catch (Exception ex)
             {
                 tx.Rollback();//回滚
                 YnBaseClass2.Helper.LogHelper.GetLog().Error("修改失败(Update AscmPalletDelivery)", ex);
                 throw ex;
             }
         }
     }
     catch (Exception ex)
     {
         YnBaseClass2.Helper.LogHelper.GetLog().Error("修改失败(Save AscmPalletDelivery)", ex);
         throw ex;
     }
 }
Esempio n. 4
0
 //public void Delete(int id)
 //{
 //    try
 //    {
 //        AscmPalletDelivery ascmPalletDelivery = Get(id);
 //        Delete(ascmPalletDelivery);
 //    }
 //    catch (Exception ex)
 //    {
 //        throw ex;
 //    }
 //}
 public void Delete(AscmPalletDelivery ascmPalletDelivery)
 {
     try
     {
         YnDaoHelper.GetInstance().nHibernateHelper.Delete <AscmPalletDelivery>(ascmPalletDelivery);
     }
     catch (Exception ex)
     {
         YnBaseClass2.Helper.LogHelper.GetLog().Error("删除失败(Delete AscmPalletDelivery)", ex);
         throw ex;
     }
 }
Esempio n. 5
0
        public AscmPalletDelivery Get(int id)
        {
            AscmPalletDelivery ascmPalletDelivery = null;

            try
            {
                ascmPalletDelivery = YnDaoHelper.GetInstance().nHibernateHelper.Get <AscmPalletDelivery>(id);
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Get AscmPalletDelivery)", ex);
                throw ex;
            }
            return(ascmPalletDelivery);
        }
Esempio n. 6
0
        public AscmPalletDelivery Add(string palletSn, int batSumMainId, int deliveryOrderBatchId, int materialId, decimal quantity)
        {
            try
            {
                AscmPalletDelivery ascmPalletDelivery = new AscmPalletDelivery();
                ascmPalletDelivery.organizationId       = 0;
                ascmPalletDelivery.createUser           = "";
                ascmPalletDelivery.createTime           = DateTime.Now.ToString("yyyy-MM-dd HH:mm");
                ascmPalletDelivery.modifyUser           = "";
                ascmPalletDelivery.modifyTime           = DateTime.Now.ToString("yyyy-MM-dd HH:mm");
                ascmPalletDelivery.palletSn             = palletSn;
                ascmPalletDelivery.batSumMainId         = batSumMainId;
                ascmPalletDelivery.deliveryOrderBatchId = deliveryOrderBatchId;
                ascmPalletDelivery.deliveryOrderId      = 0;
                ascmPalletDelivery.materialId           = materialId;
                ascmPalletDelivery.quantity             = quantity;
                //ascmPalletDelivery.status = "";
                ascmPalletDelivery.memo = "";

                int maxId = YnDaoHelper.GetInstance().nHibernateHelper.GetMaxId("select max(id) from AscmPalletDelivery");
                maxId++;
                ascmPalletDelivery.id = maxId;
                using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession().BeginTransaction())
                {
                    try
                    {
                        YnDaoHelper.GetInstance().nHibernateHelper.Save(ascmPalletDelivery);
                        tx.Commit();//正确执行提交
                    }
                    catch (Exception ex)
                    {
                        tx.Rollback();//回滚
                        throw ex;
                    }
                }
                return(ascmPalletDelivery);
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("保存失败(Save AscmPalletDelivery)", ex);
                throw ex;
            }
        }
Esempio n. 7
0
 public void Save(AscmPalletDelivery ascmPalletDelivery)
 {
     try
     {
         using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession().BeginTransaction())
         {
             try
             {
                 YnDaoHelper.GetInstance().nHibernateHelper.Save(ascmPalletDelivery);
                 tx.Commit();//正确执行提交
             }
             catch (Exception ex)
             {
                 tx.Rollback();//回滚
                 throw ex;
             }
         }
     }
     catch (Exception ex)
     {
         YnBaseClass2.Helper.LogHelper.GetLog().Error("保存失败(Save AscmPalletDelivery)", ex);
         throw ex;
     }
 }