Exemple #1
0
        public static PmsProject SelPmsObject(PmsProject _param)
        {
            if (_param.Type == null)
            {
                _param.Type = PmsConstant.TYPE_PROJECT;
            }
            PmsProject pmsProject = DaoFactory.GetData <PmsProject>("Pms.SelPmsProject", _param);

            pmsProject.BPolicy = BPolicyRepository.SelBPolicy(new BPolicy {
                Type = pmsProject.Type, OID = pmsProject.BPolicyOID
            }).First();
            pmsProject.Calendar = CalendarRepository.SelCalendar(new Calendar {
                Type = CommonConstant.TYPE_CALENDAR, OID = pmsProject.CalendarOID
            });
            PmsRelationship Member = PmsRelationshipRepository.SelPmsRelationship(new PmsRelationship {
                Type = PmsConstant.RELATIONSHIP_MEMBER, RootOID = pmsProject.OID, RoleOID = BDefineRepository.SelDefine(new BDefine {
                    Module = PmsConstant.MODULE_PMS, Type = CommonConstant.DEFINE_ROLE, Name = PmsConstant.ROLE_PM
                }).OID
            }).First();

            pmsProject.PMNm = PersonRepository.SelPerson(new Person {
                OID = Member.ToOID
            }).Name;
            return(pmsProject);
        }
 public static int DelPmsRelaionship(PmsRelationship _param)
 {
     _param.DeleteUs = 1;
     if (_param.OID == null)
     {
         return(DaoFactory.SetUpdate("Pms.DelPmsRelationshipByData", _param));
     }
     return(DaoFactory.SetUpdate("Pms.DelPmsRelationship", _param));
 }
        public static PmsRelationship GetObjWbsStructure(int _level, int _fromOID, PmsProject _proj)
        {
            List <DateTime> lHoliday = CalendarDetailRepository.SelCalendarDetails(new CalendarDetail {
                CalendarOID = _proj.OID, IsHoliday = 1
            }).Select(val => DateTime.Parse(val.Year + "-" + val.Month + "-" + val.Day)).ToList();
            string strHoliday = string.Join(",", CalendarDetailRepository.SelCalendarDetails(new CalendarDetail {
                CalendarOID = _proj.OID, IsHoliday = 1
            }).Select(value => value.FullDate.ToString().ToArray()));

            PmsRelationship getStructure = new PmsRelationship();

            getStructure.Level       = _level;
            getStructure.ToOID       = _fromOID;
            getStructure.ToData      = _proj;
            getStructure.ObjName     = _proj.Name;
            getStructure.Description = _proj.Description;
            getStructure.ObjType     = _proj.Type;
            getStructure.EstDuration = _proj.EstDuration;
            getStructure.EstStartDt  = _proj.EstStartDt != null?Convert.ToDateTime(string.Format("{0:yyyy-MM-dd}", _proj.EstStartDt)) : _proj.EstStartDt;

            getStructure.EstEndDt = _proj.EstEndDt != null?Convert.ToDateTime(string.Format("{0:yyyy-MM-dd}", _proj.EstEndDt)) : _proj.EstEndDt;

            getStructure.ActDuration = _proj.ActDuration;
            getStructure.ActStartDt  = _proj.ActStartDt != null?Convert.ToDateTime(string.Format("{0:yyyy-MM-dd}", _proj.ActStartDt)) : _proj.ActStartDt;

            getStructure.ActEndDt = _proj.ActEndDt != null?Convert.ToDateTime(string.Format("{0:yyyy-MM-dd}", _proj.ActEndDt)) : _proj.ActEndDt;

            getStructure.ObjSt      = _proj.BPolicyOID;
            getStructure.ObjStNm    = _proj.BPolicy.StatusNm;
            getStructure.Complete   = _proj.Complete;
            getStructure.WorkingDay = _proj.WorkingDay;
            getStructure.Id         = null;
            getStructure.Dependency = null;
            if (_proj.BPolicy.Name == PmsConstant.POLICY_PROJECT_PREPARE || _proj.BPolicy.Name == PmsConstant.POLICY_PROJECT_PAUSED)
            {
                getStructure.diseditable = PmsConstant.DISEDITABLE;
            }
            else
            {
                getStructure.diseditable = PmsConstant.FLOWEDITABLE;
                if (_proj.ActEndDt != null)
                {
                    getStructure.Delay = PmsUtils.CalculateDelay(Convert.ToDateTime(_proj.EstEndDt), Convert.ToDateTime(_proj.ActEndDt), Convert.ToInt32(_proj.WorkingDay), lHoliday);
                }
                else
                {
                    getStructure.Delay = PmsUtils.CalculateDelay(Convert.ToDateTime(_proj.EstEndDt), DateTime.Now, Convert.ToInt32(_proj.WorkingDay), lHoliday);
                }
            }
            GetWbsStructure(getStructure, _fromOID, Convert.ToInt32(_proj.WorkingDay), strHoliday, _proj, lHoliday);
            return(getStructure);
        }
        public static int InsPmsRelationship(PmsRelationship _param)
        {
            List <PmsRelationship> duplication = PmsRelationshipRepository.SelPmsRelationship(_param);

            if (duplication != null && duplication.Count > 0)
            {
                return(-1);
            }
            _param.CreateUs = 1;

            string query = "";

            if (_param.Ord != null)
            {
                query = "Pms.InsPmsRelationship";
            }
            else
            {
                query = "Pms.InsPmsRelationshipNotOrd";
            }
            return(DaoFactory.SetInsert(query, _param));
        }
 public static void GetWbsStructure(PmsRelationship _relObj, int _projOID, int _workingDay, string _holiday, PmsProject _proj, List <DateTime> _lHoliday)
 {
     _relObj.RootOID  = _projOID;
     _relObj.Children = PmsRelationshipRepository.SelPmsRelationship(new PmsRelationship {
         Type = PmsConstant.RELATIONSHIP_WBS, FromOID = _relObj.ToOID
     });
     _relObj.Children.ForEach(item =>
     {
         item.Level = _relObj.Level + 1;
         //item.FromData = PmsProcessRepository.SelPmsProcess(new PmsProcess { OID = item.FromOID });
         //item.ToData = PmsProcessRepository.SelPmsProcess(new PmsProcess { OID = item.ToOID });
         PmsProcess tmpFromData = PmsProcessRepository.SelPmsProcess(new PmsProcess {
             OID = item.FromOID
         });
         PmsProcess tmpToData = PmsProcessRepository.SelPmsProcess(new PmsProcess {
             OID = item.ToOID
         });
         item.ObjName     = tmpToData.Name;
         item.Description = tmpToData.Description;
         item.ObjType     = tmpToData.Type;
         item.EstDuration = tmpToData.EstDuration;
         item.EstStartDt  = tmpToData.EstStartDt != null ? Convert.ToDateTime(string.Format("{0:yyyy-MM-dd}", tmpToData.EstStartDt)) : tmpToData.EstStartDt;
         item.EstEndDt    = tmpToData.EstEndDt != null ? Convert.ToDateTime(string.Format("{0:yyyy-MM-dd}", tmpToData.EstEndDt)) : tmpToData.EstEndDt;
         item.ActDuration = tmpToData.ActDuration;
         item.ActStartDt  = tmpToData.ActStartDt != null ? Convert.ToDateTime(string.Format("{0:yyyy-MM-dd}", tmpToData.ActStartDt)) : tmpToData.ActStartDt;
         item.ActEndDt    = tmpToData.ActEndDt != null ? Convert.ToDateTime(string.Format("{0:yyyy-MM-dd}", tmpToData.ActEndDt)) : tmpToData.ActEndDt;
         item.ObjSt       = tmpToData.BPolicyOID;
         item.ObjStNm     = tmpToData.BPolicy.StatusNm;
         item.Id          = tmpToData.Id;
         item.Dependency  = tmpToData.Dependency;
         item.Complete    = tmpToData.Complete;
         item.WorkingDay  = _workingDay;
         item.Members     = new List <PmsRelationship>();
         PmsRelationshipRepository.SelPmsRelationship(new PmsRelationship {
             FromOID = item.ToOID, Type = PmsConstant.RELATIONSHIP_MEMBER
         }).ForEach(member =>
         {
             Person person = PersonRepository.SelPerson(new Person {
                 OID = member.ToOID
             });
             item.Members.Add(new PmsRelationship {
                 FromOID = item.ToOID, ToOID = person.OID, PersonNm = person.Name, Thumbnail = person.Thumbnail
             });
             person = null;
         });
         if (_proj.BPolicy.Name == PmsConstant.POLICY_PROJECT_PREPARE || _proj.BPolicy.Name == PmsConstant.POLICY_PROJECT_PAUSED)
         {
         }
         else
         {
             item.diseditable = PmsConstant.DISEDITABLE;
         }
         if (tmpToData.BPolicy.Name == PmsConstant.POLICY_PROCESS_PAUSED)
         {
             if (tmpToData.ActEndDt != null)
             {
                 item.Delay = PmsUtils.CalculateDelay(Convert.ToDateTime(tmpToData.EstEndDt), Convert.ToDateTime(tmpToData.ActEndDt), Convert.ToInt32(_proj.WorkingDay), _lHoliday);
             }
             else
             {
                 item.Delay = PmsUtils.CalculateDelay(Convert.ToDateTime(tmpToData.EstEndDt), DateTime.Now, Convert.ToInt32(_proj.WorkingDay), _lHoliday);
             }
         }
         GetWbsStructure(item, _projOID, _workingDay, _holiday, _proj, _lHoliday);
     });
 }
 public static List <PmsRelationship> SelPmsRelationship(PmsRelationship _param)
 {
     return(DaoFactory.GetList <PmsRelationship>("Pms.SelPmsRelationship", _param));
 }
 public static int UdtPmsRelationship(PmsRelationship _param)
 {
     return(DaoFactory.SetUpdate("Pms.UdtPmsRelationship", _param));
 }