Esempio n. 1
0
 public static AscmUnloadingPointLogService GetInstance()
 {
     if (ascmUnloadingPointLogServices == null)
     {
         ascmUnloadingPointLogServices = new AscmUnloadingPointLogService();
     }
     return(ascmUnloadingPointLogServices);
 }
        public void UpdateStatus(int id, string status)
        {
            try
            {
                AscmUnloadingPoint ascmUnloadingPoint = Get(id);
                if (ascmUnloadingPoint == null)
                {
                    throw new Exception("找不到卸货点");
                }
                ascmUnloadingPoint.status     = status;
                ascmUnloadingPoint.modifyTime = System.DateTime.Now.ToString("yyyy-MM-dd HH:ss");

                AscmUnloadingPointLog ascmUnloadingPointLog =
                    AscmUnloadingPointLogService.GetInstance().GetAddLog(ascmUnloadingPoint.id, ascmUnloadingPoint.name, ascmUnloadingPoint.sn, ascmUnloadingPoint.status, DateTime.Now);

                using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession().BeginTransaction())
                {
                    try
                    {
                        YnDaoHelper.GetInstance().nHibernateHelper.Update(ascmUnloadingPoint);
                        if (ascmUnloadingPointLog != null)
                        {
                            YnDaoHelper.GetInstance().nHibernateHelper.Save(ascmUnloadingPointLog);
                        }
                        tx.Commit();//正确执行提交
                    }
                    catch (Exception ex)
                    {
                        tx.Rollback();//回滚
                        throw ex;
                    }
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("修改状态失败(Update AscmUnloadingPoint Status)", ex);
                throw ex;
            }
        }
 public static AscmUnloadingPointLogService GetInstance()
 {
     if (ascmUnloadingPointLogServices == null)
         ascmUnloadingPointLogServices = new AscmUnloadingPointLogService();
     return ascmUnloadingPointLogServices;
 }