Esempio n. 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);
        }
Esempio n. 2
0
        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));
        }
Esempio n. 3
0
        public static void GetGanttSturcture(Dictionary <string, object> _dParent, List <Dictionary <string, object> > _ldStructure, int _iWorkingDay, List <DateTime> _lHoliday)
        {
            List <PmsRelationship> children = PmsRelationshipRepository.SelPmsRelationship(new PmsRelationship {
                FromOID = Convert.ToInt32(_dParent["oid"]), Type = PmsConstant.RELATIONSHIP_WBS
            });

            if (children != null && children.Count > 0)
            {
                _dParent.Add("hasChild", true);
            }
            else
            {
                _dParent.Add("hasChild", false);
            }
            PmsProcess tmpProcess = null;

            children.ForEach(item =>
            {
                if (tmpProcess != null)
                {
                    tmpProcess = null;
                }
                tmpProcess = PmsProcessRepository.SelPmsProcess(new PmsProcess {
                    OID = item.ToOID
                });
                Dictionary <string, object> tmpChildren = new Dictionary <string, object>();
                tmpChildren.Add("oid", tmpProcess.OID);
                tmpChildren.Add("id", tmpProcess.Id);
                tmpChildren.Add("name", tmpProcess.Name);
                tmpChildren.Add("progress", 0);
                tmpChildren.Add("progressByWorklog", false);
                tmpChildren.Add("relevance", 0);
                tmpChildren.Add("type", "");
                tmpChildren.Add("typeId", "");
                tmpChildren.Add("description", tmpProcess.Description);
                tmpChildren.Add("code", Convert.ToInt32(_dParent["level"]) + 1);
                tmpChildren.Add("level", Convert.ToInt32(_dParent["level"]) + 1);
                if (tmpProcess.BPolicy.Name != PmsConstant.POLICY_PROCESS_PREPARE)
                {
                    if (tmpProcess.ActEndDt != null)
                    {
                        tmpChildren.Add("status", "STATUS_DONE");
                    }
                    else
                    {
                        int delay = PmsUtils.CalculateDelay(Convert.ToDateTime(tmpProcess.EstEndDt), DateTime.Now, _iWorkingDay, _lHoliday);
                        if (delay > 1 && delay <= PmsConstant.DELAY)
                        {
                            tmpChildren.Add("status", "STATUS_WAITING");
                        }
                        else if (delay > PmsConstant.DELAY)
                        {
                            tmpChildren.Add("status", "STATUS_FAILED");
                        }
                        else
                        {
                            tmpChildren.Add("status", "STATUS_ACTIVE");
                        }
                    }
                }
                else
                {
                    tmpChildren.Add("status", "STATUS_SUSPENDED");
                }
                tmpChildren.Add("depends", tmpProcess.Dependency != "" && tmpProcess.Dependency != null ? tmpProcess.Dependency : "");
                tmpChildren.Add("canWrite", true);
                tmpChildren.Add("start", tmpProcess.EstStartDt);
                tmpChildren.Add("duration", tmpProcess.EstDuration);
                tmpChildren.Add("end", tmpProcess.EstEndDt);
                tmpChildren.Add("ActStart", tmpProcess.ActStartDt != null ? string.Format("{0:yyyy-MM-dd}", tmpProcess.ActStartDt) : "");
                tmpChildren.Add("ActDuration", tmpProcess.ActDuration);
                tmpChildren.Add("ActEnd", tmpProcess.ActEndDt != null ? string.Format("{0:yyyy-MM-dd}", tmpProcess.ActEndDt) : "");
                tmpChildren.Add("startIsMilestone", false);
                tmpChildren.Add("endIsMilestone", false);
                tmpChildren.Add("collapsed", false);

                List <Dictionary <string, object> > lPerson = new List <Dictionary <string, object> >();
                PmsRelationshipRepository.SelPmsRelationship(new PmsRelationship {
                    FromOID = tmpProcess.OID, Type = PmsConstant.RELATIONSHIP_MEMBER
                }).ForEach(member =>
                {
                    Person personData = PersonRepository.SelPerson(new Person {
                        OID = member.ToOID
                    });
                    Dictionary <string, object> person = new Dictionary <string, object>();
                    person.Add("resourceId", Convert.ToInt32(personData.OID));
                    person.Add("id", Convert.ToInt32(personData.OID));
                    person.Add("name", personData.Name);
                    person.Add("Thumbnail", personData.Thumbnail);
                    lPerson.Add(person);
                    personData = null;
                });

                tmpChildren.Add("assigs", lPerson);
                _ldStructure.Add(tmpChildren);
                GetGanttSturcture(tmpChildren, _ldStructure, _iWorkingDay, _lHoliday);
            });
        }
Esempio n. 4
0
 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);
     });
 }