Ejemplo n.º 1
0
        public void ChangePrjInfo(PTPrjInfoZTB prjInfoZTB, int prjState, int flowState = 1)
        {
            PTPrjInfoZTBDetailService service = new PTPrjInfoZTBDetailService();
            PTPrjInfoZTBDetail        byId    = service.GetById(prjInfoZTB.PrjGuid.ToString());
            PTPrjInfo item    = this.GetById(prjInfoZTB.PrjGuid.ToString());
            PTPrjInfo prjInfo = this.GetPrjInfo(prjInfoZTB, byId);

            if (item != null)
            {
                item.PrjState = new int?(prjState);
                base.Update(item);
            }
            else
            {
                base.Add(prjInfo);
            }
            byId.SetUpFlowState = new int?(flowState);
            service.Update(byId);
            if (!string.IsNullOrEmpty(prjInfoZTB.ParentTypeCode))
            {
                int?      parentCodeCount = this.GetParentCodeCount(prjInfoZTB.ParentTypeCode);
                PTPrjInfo info3           = (from p in this
                                             where p.TypeCode == prjInfoZTB.ParentTypeCode
                                             select p).FirstOrDefault <PTPrjInfo>();
                info3.i_ChildNum = parentCodeCount;
                base.Update(info3);
            }
        }
Ejemplo n.º 2
0
        public void UpdatePrjStateAtStateChange(string prjId, int prjOldState, int prjState)
        {
            Guid         id   = new Guid(prjId);
            PTPrjInfoZTB byId = this.GetById(id);

            if (byId != null)
            {
                byId.PrjStateChangeTime = new DateTime?(DateTime.Now);
                base.Update(byId);
                PTPrjInfoZTBDetailService service = new PTPrjInfoZTBDetailService();
                if (prjOldState == 1)
                {
                    service.ChangeFlowSateByPrjId(prjId, 1);
                }
                PTPrjInfoService service2 = new PTPrjInfoService();
                PTPrjInfo        item     = service2.GetById(prjId);
                if (item != null)
                {
                    item.PrjState = new int?(prjState);
                    service2.Update(item);
                }
                if (prjState == 1)
                {
                    this.ChangeStateAndPrjState(byId, prjState, -1, -1, -1, -1);
                    service.ChangeFlowSateByPrjId(prjId, -1);
                }
                else if (prjState == 2)
                {
                    this.ChangeStateAndPrjState(byId, prjState, -1, -1, -1, -1);
                }
                else if (((prjState == 3) || (prjState == 0x13)) || (prjState == 14))
                {
                    this.ChangeStateAndPrjState(byId, prjState, 1, -1, -1, -1);
                }
                else if (((prjState == 15) || (prjState == 0x10)) || (prjState == 4))
                {
                    this.ChangeStateAndPrjState(byId, prjState, 1, 1, -1, -1);
                }
                else if (prjState == 6)
                {
                    this.ChangeStateAndPrjState(byId, prjState, 1, 1, 1, -1);
                }
                else if (prjState == 5)
                {
                    this.ChangeStateAndPrjState(byId, prjState, 1, 1, 1, -1);
                    service2.ChangePrjInfo(byId, prjState, 1);
                }
                else if (prjState == 0x12)
                {
                    this.ChangeStateAndPrjState(byId, prjState, 1, -1, -1, 1);
                }
            }
        }