예제 #1
0
        public AscmDeliveryOrderMain Get(string id)
        {
            AscmDeliveryOrderMain ascmDeliveryNotify = null;

            try
            {
                ascmDeliveryNotify = YnDaoHelper.GetInstance().nHibernateHelper.Get <AscmDeliveryOrderMain>(id);
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Get AscmDeliveryOrderMain)", ex);
                throw ex;
            }
            return(ascmDeliveryNotify);
        }
예제 #2
0
        public void SetWipEntities(List <AscmDeliBatOrderLink> list)
        {
            if (list == null && list.Count == 0)
            {
                return;
            }

            var    mainIds = list.Select(P => P.mainId).Distinct();
            var    count   = mainIds.Count();
            string ids     = string.Empty;

            for (int i = 0; i < count; i++)
            {
                if (!string.IsNullOrEmpty(ids))
                {
                    ids += ",";
                }
                ids += mainIds.ElementAt(i);
                if ((i + 1) % 500 == 0 || (i + 1) == count)
                {
                    if (!string.IsNullOrEmpty(ids))
                    {
                        string hql = "select new AscmDeliveryOrderMain(m.id,m.wipEntityId,e.name,j.statusType) from AscmDeliveryOrderMain m,AscmWipEntities e,AscmWipDiscreteJobs j "
                                     + "where m.wipEntityId=e.wipEntityId "
                                     + "and m.wipEntityId=j.wipEntityId "
                                     + "and m.id in(" + ids + ")";
                        IList <AscmDeliveryOrderMain> ilistDeliveryOrderMain = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmDeliveryOrderMain>(hql);
                        if (ilistDeliveryOrderMain != null && ilistDeliveryOrderMain.Count > 0)
                        {
                            List <AscmDeliveryOrderMain> listDeliveryOrderMain = ilistDeliveryOrderMain.ToList();
                            foreach (AscmDeliBatOrderLink deliBatOrderLink in list)
                            {
                                AscmDeliveryOrderMain deliveryOrderMain = listDeliveryOrderMain.Find(P => P.id == deliBatOrderLink.mainId);
                                if (deliveryOrderMain != null)
                                {
                                    deliBatOrderLink.wipEntityId     = deliveryOrderMain.wipEntityId;
                                    deliBatOrderLink.wipEntityName   = deliveryOrderMain.wipEntity;
                                    deliBatOrderLink.wipEntityStatus = deliveryOrderMain.wipEntityStatus;
                                }
                            }
                        }
                    }
                    ids = string.Empty;
                }
            }
        }
예제 #3
0
 public void Update(AscmDeliveryOrderMain ascmDeliveryNotify)
 {
     using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession().BeginTransaction())
     {
         try
         {
             YnDaoHelper.GetInstance().nHibernateHelper.Update <AscmDeliveryOrderMain>(ascmDeliveryNotify);
             tx.Commit();//正确执行提交
         }
         catch (Exception ex)
         {
             tx.Rollback();//回滚
             YnBaseClass2.Helper.LogHelper.GetLog().Error("修改失败(Update AscmDeliveryOrderMain)", ex);
             throw ex;
         }
     }
 }