Exemplo n.º 1
0
        public void AddProductUPHInfo(UPHInfo itemui)
        {
            string methodName = MethodBase.GetCurrentMethod().Name;
            BaseLog.LoggingBegin(logger, methodName);
            try
            {

                Entity.Repository.Meta.IMESSKU.UPH items = new Entity.Repository.Meta.IMESSKU.UPH
                {
                    Process = itemui.Process,
                    Attend_normal = itemui.Attend_normal,
                    Family = itemui.Family,
                    ST = itemui.ST,
                    NormalUPH = itemui.NormalUPH,
                    Cycle = itemui.Cycle,
                    Remark = itemui.Remark,
                    Special = itemui.Special,
                    Editor = itemui.Editor,
                    Cdt = itemui.Cdt,
                    Udt = itemui.Udt

                };
                using (UnitOfWork uow = new UnitOfWork())
                {
                    IRepository<Entity.Repository.Meta.IMESSKU.UPH> ecoModelRep = new Repository<Entity.Repository.Meta.IMESSKU.UPH>("UPHDBServer");
                    ecoModelRep.Insert(items);
                    uow.Commit();
                }



            }
            catch (Exception e)
            {
                BaseLog.LoggingError(logger, MethodBase.GetCurrentMethod(), e);
                throw;
            }
            finally
            {
                BaseLog.LoggingEnd(logger, methodName);
            }

        }
Exemplo n.º 2
0
        public void DelProductUPHInfo(UPHInfo itemui)
        {

            string methodName = MethodBase.GetCurrentMethod().Name;
            BaseLog.LoggingBegin(logger, methodName);
            try
            {
                Entity.Repository.Meta.IMESSKU.UPH items = new Entity.Repository.Meta.IMESSKU.UPH
                {
                    Process = itemui.Process,
                    Family = itemui.Family,
                    Special = itemui.Remark,


                };


                using (UnitOfWork uow = new UnitOfWork())
                {
                    IRepository<Entity.Repository.Meta.IMESSKU.UPH> ecoModelRep = new Repository<Entity.Repository.Meta.IMESSKU.UPH>("UPHDBServer");
                    var ret = from q in ecoModelRep.Query()
                              where q.Process == itemui.Process
                          && q.Family == itemui.Family
                          && q.Special == itemui.Special
                              select new UPHInfo
                              {
                                  ID = q.ID,
                                  Process = q.Process,
                                  Attend_normal = q.Attend_normal,
                                  Family = q.Family,
                                  ST = q.ST.ToString(),
                                  NormalUPH = q.NormalUPH,
                                  Cycle = q.Cycle.ToString(),
                                  Remark = q.Remark,
                                  Special = q.Special,
                                  Editor = q.Editor,
                                  Cdt = q.Cdt,
                                  Udt = q.Udt
                              };
                    var first = ret.First();
                    items.ID = first.ID;
                    items.Process = first.Process;
                    items.Attend_normal = first.Attend_normal;
                    items.ST = first.ST;
                    items.NormalUPH = first.NormalUPH;
                    items.Cycle = first.Cycle;
                    items.Remark = first.Remark;
                    items.Special = first.Special;
                    items.Editor = first.Editor;
                    items.Cdt = first.Cdt;
                    items.Udt = first.Udt;


                    //IRepository<Entity.Repository.Meta.IMESSKU.UPH> ecoModelRep = new Repository<Entity.Repository.Meta.IMESSKU.UPH>("UPHDBServer");
                    ecoModelRep.Delete(items, true);//删掉记录 根据设置的条件

                    uow.Commit();
                }

            }
            catch (Exception e)
            {
                BaseLog.LoggingError(logger, MethodBase.GetCurrentMethod(), e);
                throw;
            }
            finally
            {
                BaseLog.LoggingEnd(logger, methodName);
            }
        }
Exemplo n.º 3
0
        public void UpdateProductUPHInfo(UPHInfo itemui)
        {
            string methodName = MethodBase.GetCurrentMethod().Name;
            BaseLog.LoggingBegin(logger, methodName);
            try
            {
                IRepository<Entity.Repository.Meta.IMESSKU.UPH> ecoModelRep = new Repository<Entity.Repository.Meta.IMESSKU.UPH>("UPHDBServer");

                var ret = from q in ecoModelRep.Query()
                          where q.Process == itemui.Process
                      && q.Family == itemui.Family
                      && q.Special == itemui.Special
                          select new UPHInfo
                          {
                              ID = q.ID,
                              Process = q.Process,
                              Attend_normal = q.Attend_normal,
                              Family = q.Family,
                              ST = q.ST.ToString(),
                              NormalUPH = q.NormalUPH,
                              Cycle = q.Cycle.ToString(),
                              Remark = q.Remark,
                              Special = q.Remark,
                              Editor = q.Editor,
                              Cdt = q.Cdt,
                              Udt = q.Udt
                          };
                var first = ret.First();

                Entity.Repository.Meta.IMESSKU.UPH items = new Entity.Repository.Meta.IMESSKU.UPH
                {
                    ID = first.ID,
                    Process = itemui.Process,
                    Attend_normal = itemui.Attend_normal,
                    Family = itemui.Family,
                    ST = itemui.ST,
                    NormalUPH = itemui.NormalUPH,
                    Cycle = itemui.Cycle,
                    Remark = itemui.Remark,
                    Special = itemui.Special,
                    Editor = itemui.Editor,
                    Cdt = first.Cdt,
                    Udt = itemui.Udt

                };
                using (UnitOfWork uow = new UnitOfWork())
                {
                    ecoModelRep.Update(items);
                    uow.Commit();
                }

            }
            catch (Exception e)
            {
                BaseLog.LoggingError(logger, MethodBase.GetCurrentMethod(), e);
                throw;
            }
            finally
            {
                BaseLog.LoggingEnd(logger, methodName);
            }
        }