Example #1
0
        public void GenerateTargetList()
        {
            StatisticsFileFormat temptar = new StatisticsFileFormat();

            temptar.ProjectOrder   = mOriFileFormatList[0].ProjectOrder;
            temptar.ProjectID      = mOriFileFormatList[0].ProjectID;
            temptar.ProjectName    = mOriFileFormatList[0].ProjectName;
            temptar.ProjectManager = mOriFileFormatList[0].ProjectManager;


            for (int i = 0; i < mOriFileFormatList.Count; i++)
            {
                StaffOverTimeInfo soti = new StaffOverTimeInfo();
                soti.ProjectStaffName     = mOriFileFormatList[i].ProjectStaffName;
                soti.ProjectStaffDep      = mOriFileFormatList[i].ProjectDep;
                soti.ProjectDurationDays  = mOriFileFormatList[i].ProjectDurationDays;
                soti.ProjectDate          = mOriFileFormatList[i].ProjectDate;
                soti.ProjectQualifiedDays = mOriFileFormatList[i].ProjectQualifiedDays;
                soti.ProjectType          = mOriFileFormatList[i].ProjectType;

                temptar.mStaffOverTimeInfoList.Add(soti);

                if ((i + 1) < mOriFileFormatList.Count)
                {
                    if (mOriFileFormatList[i].ProjectID != mOriFileFormatList[i + 1].ProjectID || (mOriFileFormatList[i].ProjectID == mOriFileFormatList[i + 1].ProjectID && mOriFileFormatList[i].ProjectName != mOriFileFormatList[i + 1].ProjectName))
                    {
                        mTargetFileFormatList.Add(temptar);
                        temptar = new StatisticsFileFormat();
                        temptar.ProjectOrder   = mOriFileFormatList[i + 1].ProjectOrder;
                        temptar.ProjectID      = mOriFileFormatList[i + 1].ProjectID;
                        temptar.ProjectName    = mOriFileFormatList[i + 1].ProjectName;
                        temptar.ProjectManager = mOriFileFormatList[i + 1].ProjectManager;
                    }
                }
                else
                {
                    mTargetFileFormatList.Add(temptar);//if (mOriFileFormatList[i].ProjectID != mOriFileFormatList[i + 1].ProjectID || (mOriFileFormatList[i].ProjectID == mOriFileFormatList[i + 1].ProjectID && mOriFileFormatList[i].ProjectName != mOriFileFormatList[i + 1].ProjectName))
                }
            }
        }
Example #2
0
        public StatisticsFileFormat GetMergedData(StatisticsFileFormat tempsff)
        {
            StatisticsFileFormat result = new StatisticsFileFormat();

            result.ProjectOrder   = tempsff.ProjectOrder;
            result.ProjectID      = tempsff.ProjectID;
            result.ProjectName    = tempsff.ProjectName;
            result.ProjectManager = tempsff.ProjectManager;

            bool flag             = false;
            StaffOverTimeInfo stt = new StaffOverTimeInfo();

            for (int i = 0; i < tempsff.mStaffOverTimeInfoList.Count; i++)
            {
                if ((i + 1) < tempsff.mStaffOverTimeInfoList.Count)
                {
                    string curstaffname  = tempsff.mStaffOverTimeInfoList[i].ProjectStaffName;
                    string nextstaffname = tempsff.mStaffOverTimeInfoList[i + 1].ProjectStaffName;
                    string curOTtype     = GetProjectTpye(tempsff.mStaffOverTimeInfoList[i].ProjectDate);
                    string nextOTtype    = GetProjectTpye(tempsff.mStaffOverTimeInfoList[i + 1].ProjectDate);



                    if (mUiqueNameList.Contains(curstaffname))
                    {
                        //重名者 不合并  直接 添加

                        stt = new StaffOverTimeInfo();
                        stt.ProjectStaffName        = tempsff.mStaffOverTimeInfoList[i].ProjectStaffName;
                        stt.ProjectStaffDep         = tempsff.mStaffOverTimeInfoList[i].ProjectStaffDep;
                        stt.ProjectQualifiedDays    = tempsff.mStaffOverTimeInfoList[i].ProjectDurationDays;
                        stt.ProjectType             = GetProjectTpye(tempsff.mStaffOverTimeInfoList[i].ProjectDate);
                        stt.ProjectDate             = tempsff.mStaffOverTimeInfoList[i].ProjectDate + GetOTdate(tempsff.mStaffOverTimeInfoList[i].ProjectDurationDays);
                        stt.IntProjectDurationDays += GetProjectDurationDays(tempsff.mStaffOverTimeInfoList[i].ProjectDurationDays);
                        stt.ProjectStaffName        = stt.ProjectStaffName + "**重名的人**";
                        result.mStaffOverTimeInfoList.Add(stt);
                        stt = new StaffOverTimeInfo();
                        stt.ProjectStaffName        = tempsff.mStaffOverTimeInfoList[i + 1].ProjectStaffName;
                        stt.ProjectStaffDep         = tempsff.mStaffOverTimeInfoList[i + 1].ProjectStaffDep;
                        stt.ProjectQualifiedDays    = tempsff.mStaffOverTimeInfoList[i + 1].ProjectDurationDays;
                        stt.ProjectType             = GetProjectTpye(tempsff.mStaffOverTimeInfoList[i + 1].ProjectDate);
                        stt.ProjectDate             = tempsff.mStaffOverTimeInfoList[i + 1].ProjectDate + GetOTdate(tempsff.mStaffOverTimeInfoList[i + 1].ProjectDurationDays);
                        stt.IntProjectDurationDays += GetProjectDurationDays(tempsff.mStaffOverTimeInfoList[i + 1].ProjectDurationDays);
                    }
                    else
                    {
                        if (curstaffname == nextstaffname && curOTtype == nextOTtype)
                        {
                            stt.IntProjectDurationDays += GetProjectDurationDays(tempsff.mStaffOverTimeInfoList[i + 1].ProjectDurationDays);
                            string tempdate = GetOTDay(tempsff.mStaffOverTimeInfoList[i + 1].ProjectDate) + GetOTdate(tempsff.mStaffOverTimeInfoList[i + 1].ProjectDurationDays);
                            stt.ProjectDate += "、" + tempdate;
                            flag             = true;
                            continue;
                        }
                        else
                        {
                            if (flag == false)
                            {
                                stt.ProjectStaffName        = tempsff.mStaffOverTimeInfoList[i].ProjectStaffName;
                                stt.ProjectStaffDep         = tempsff.mStaffOverTimeInfoList[i].ProjectStaffDep;
                                stt.ProjectQualifiedDays    = tempsff.mStaffOverTimeInfoList[i].ProjectDurationDays;
                                stt.ProjectType             = GetProjectTpye(tempsff.mStaffOverTimeInfoList[i].ProjectDate);
                                stt.ProjectDate             = tempsff.mStaffOverTimeInfoList[i].ProjectDate + GetOTdate(tempsff.mStaffOverTimeInfoList[i].ProjectDurationDays);
                                stt.IntProjectDurationDays += GetProjectDurationDays(tempsff.mStaffOverTimeInfoList[i].ProjectDurationDays);
                            }
                            flag = true;
                            result.mStaffOverTimeInfoList.Add(stt);
                            stt = new StaffOverTimeInfo();
                            stt.ProjectStaffName        = tempsff.mStaffOverTimeInfoList[i + 1].ProjectStaffName;
                            stt.ProjectStaffDep         = tempsff.mStaffOverTimeInfoList[i + 1].ProjectStaffDep;
                            stt.ProjectQualifiedDays    = tempsff.mStaffOverTimeInfoList[i + 1].ProjectDurationDays;
                            stt.ProjectType             = GetProjectTpye(tempsff.mStaffOverTimeInfoList[i + 1].ProjectDate);
                            stt.ProjectDate             = tempsff.mStaffOverTimeInfoList[i + 1].ProjectDate + GetOTdate(tempsff.mStaffOverTimeInfoList[i + 1].ProjectDurationDays);
                            stt.IntProjectDurationDays += GetProjectDurationDays(tempsff.mStaffOverTimeInfoList[i + 1].ProjectDurationDays);


                            continue; //不同的人;
                        }
                    }
                }

                else
                {
                    //last staff;

                    //stt.ProjectStaffName = tempsff.mStaffOverTimeInfoList[i].ProjectStaffName;
                    //stt.ProjectStaffDep = tempsff.mStaffOverTimeInfoList[i].ProjectStaffDep;
                    //stt.ProjectQualifiedDays = tempsff.mStaffOverTimeInfoList[i].ProjectDurationDays;
                    //stt.ProjectType = GetProjectTpye(tempsff.mStaffOverTimeInfoList[i].ProjectDate);
                    //stt.ProjectDate = tempsff.mStaffOverTimeInfoList[i].ProjectDate + GetOTdate(tempsff.mStaffOverTimeInfoList[i].ProjectDurationDays);
                    //stt.IntProjectDurationDays += GetProjectDurationDays(tempsff.mStaffOverTimeInfoList[i].ProjectDurationDays);

                    result.mStaffOverTimeInfoList.Add(stt);
                }
            }
            return(result);
        }