Exemplo n.º 1
0
 public void Delete(AscmUnloadingPointLog ascmUnloadingPointLog)
 {
     try
     {
         YnDaoHelper.GetInstance().nHibernateHelper.Delete <AscmUnloadingPointLog>(ascmUnloadingPointLog);
     }
     catch (Exception ex)
     {
         YnBaseClass2.Helper.LogHelper.GetLog().Error("删除失败(Delete AscmUnloadingPointLog)", ex);
         throw ex;
     }
 }
Exemplo n.º 2
0
 public void Delete(string id)
 {
     try
     {
         AscmUnloadingPointLog ascmUnloadingPointLog = Get(id);
         Delete(ascmUnloadingPointLog);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 3
0
        public void AddLog(int unloadingPointId, string unloadingPointName, string unloadingPointSn, string unloadingPointStatus, DateTime createTime)
        {
            try
            {
                AscmUnloadingPointLog ascmUnloadingPointLog = GetAddLog(unloadingPointId, unloadingPointName, unloadingPointSn, unloadingPointStatus, createTime);

                Save(ascmUnloadingPointLog);
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("增加失败(Add AscmUnloadingPointLog)", ex);
                throw ex;
            }
        }
Exemplo n.º 4
0
        public AscmUnloadingPointLog Get(string id)
        {
            AscmUnloadingPointLog ascmUnloadingPointLog = null;

            try
            {
                ascmUnloadingPointLog = YnDaoHelper.GetInstance().nHibernateHelper.Get <AscmUnloadingPointLog>(id);
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Get AscmUnloadingPointLog)", ex);
                throw ex;
            }
            return(ascmUnloadingPointLog);
        }
Exemplo n.º 5
0
        public void UpdateStatus(int id, string status, string sessionKey)
        {
            try
            {
                AscmUnloadingPoint ascmUnloadingPoint = YnDaoHelper.GetInstance().nHibernateHelper.Get <AscmUnloadingPoint>(id, sessionKey);
                if (ascmUnloadingPoint == null)
                {
                    throw new Exception("找不到卸货点");
                }
                ascmUnloadingPoint.status     = status;
                ascmUnloadingPoint.modifyTime = System.DateTime.Now.ToString("yyyy-MM-dd HH:ss");

                DateTime dtServerTime = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentDate("AscmUnloadingPointLog", sessionKey);

                AscmUnloadingPointLog ascmUnloadingPointLog = new AscmUnloadingPointLog();
                ascmUnloadingPointLog.createTime           = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                ascmUnloadingPointLog.modifyTime           = dtServerTime.ToString("yyyy-MM-dd HH:mm:ss");
                ascmUnloadingPointLog.unloadingPointId     = ascmUnloadingPoint.id;
                ascmUnloadingPointLog.unloadingPointName   = ascmUnloadingPoint.name;
                ascmUnloadingPointLog.unloadingPointSn     = ascmUnloadingPoint.sn;
                ascmUnloadingPointLog.unloadingPointStatus = ascmUnloadingPoint.status;

                using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession(sessionKey).BeginTransaction())
                {
                    try
                    {
                        YnDaoHelper.GetInstance().nHibernateHelper.Update(ascmUnloadingPoint, sessionKey);
                        if (ascmUnloadingPointLog != null)
                        {
                            YnDaoHelper.GetInstance().nHibernateHelper.Save(ascmUnloadingPointLog, sessionKey);
                        }
                        tx.Commit();//正确执行提交
                    }
                    catch (Exception ex)
                    {
                        tx.Rollback();//回滚
                        throw ex;
                    }
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("修改状态失败(Update AscmUnloadingPoint Status)", ex);
                throw ex;
            }
        }
Exemplo n.º 6
0
        public AscmUnloadingPointLog GetAddLog(int unloadingPointId, string unloadingPointName, string unloadingPointSn, string unloadingPointStatus, DateTime createTime)
        {
            try
            {
                DateTime dtServerTime = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentDate("AscmUnloadingPointLog");

                AscmUnloadingPointLog ascmUnloadingPointLog = new AscmUnloadingPointLog();
                ascmUnloadingPointLog.createTime = createTime.ToString("yyyy-MM-dd HH:mm:ss");
                ascmUnloadingPointLog.modifyTime = dtServerTime.ToString("yyyy-MM-dd HH:mm:ss");

                ascmUnloadingPointLog.unloadingPointId     = unloadingPointId;
                ascmUnloadingPointLog.unloadingPointName   = unloadingPointName;
                ascmUnloadingPointLog.unloadingPointSn     = unloadingPointSn;
                ascmUnloadingPointLog.unloadingPointStatus = unloadingPointStatus;

                return(ascmUnloadingPointLog);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 7
0
        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;
            }
        }
Exemplo n.º 8
0
 public void Save(AscmUnloadingPointLog ascmUnloadingPointLog)
 {
     try
     {
         using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession().BeginTransaction())
         {
             try
             {
                 YnDaoHelper.GetInstance().nHibernateHelper.Save(ascmUnloadingPointLog);
                 tx.Commit();//正确执行提交
             }
             catch (Exception ex)
             {
                 tx.Rollback();//回滚
                 throw ex;
             }
         }
     }
     catch (Exception ex)
     {
         YnBaseClass2.Helper.LogHelper.GetLog().Error("保存失败(Save AscmUnloadingPointLog)", ex);
         throw ex;
     }
 }