/// <summary>
        /// The get milestone categories info list.
        /// </summary>
        /// <returns>
        /// The <see cref="List"/>.
        /// </returns>
        public List <MilestoneCategoriesInfo> GetMilestoneFullCategoriesInfoList()
        {
            this.LastError = string.Empty;
            var milestoneInfoList = new List <MilestoneCategoriesInfo>();
            var milestoneCategoriesInfoDictionary = new Dictionary <int, MilestoneCategoriesInfo>();
            var milestonePointInfoDictionary      = new Dictionary <int, List <MilestonePointInfo> >();

            try
            {
                var queryString = MilestoneReportResource.GetMilestoneFullListSqlReqest;
                using (var connection = new OracleConnection(CosmosConnectionString))
                {
                    using (var command = connection.CreateCommand())
                    {
                        command.CommandText = queryString;
                        connection.Open();
                        using (var rdr = command.ExecuteReader())
                        {
                            while (rdr.Read())
                            {
                                var milestoneCategoriesInfo = new MilestoneCategoriesInfo
                                {
                                    CatId    = rdr["ID_MS_CAT"] == DBNull.Value ? -1 : Convert.ToInt32(rdr["ID_MS_CAT"]),
                                    CatName  = rdr["MS_CAT_NAME"] == DBNull.Value ? string.Empty : rdr["MS_CAT_NAME"].ToString(),
                                    CatOrder = rdr["MS_CAT_ORD"] == DBNull.Value ? -1 : Convert.ToInt32(rdr["MS_CAT_ORD"])
                                };

                                var milestonePointInfo = new MilestonePointInfo
                                {
                                    MilestoneId    = rdr["ID_MILESTONE"] == DBNull.Value ? -1 : Convert.ToInt32(rdr["ID_MILESTONE"]),
                                    MilestoneName  = rdr["MILESTONE_NAME"] == DBNull.Value ? string.Empty : rdr["MILESTONE_NAME"].ToString(),
                                    MilestoneOrder = rdr["ORD"] == DBNull.Value ? -1 : Convert.ToInt32(rdr["ORD"]),
                                };

                                if (!milestoneCategoriesInfoDictionary.ContainsKey(milestoneCategoriesInfo.CatId))
                                {
                                    milestoneCategoriesInfoDictionary.Add(milestoneCategoriesInfo.CatId, milestoneCategoriesInfo);
                                }

                                if (!milestonePointInfoDictionary.ContainsKey(milestoneCategoriesInfo.CatId))
                                {
                                    milestonePointInfoDictionary.Add(milestoneCategoriesInfo.CatId, new List <MilestonePointInfo>());
                                }

                                if (milestonePointInfoDictionary[milestoneCategoriesInfo.CatId].All(c => c.MilestoneId != milestonePointInfo.MilestoneId))
                                {
                                    milestonePointInfoDictionary[milestoneCategoriesInfo.CatId].Add(milestonePointInfo);
                                }
                            }
                        }
                    }
                }

                foreach (var categories in milestoneCategoriesInfoDictionary)
                {
                    milestoneInfoList.Add(categories.Value);
                }

                foreach (var milestoneInfo in milestoneInfoList)
                {
                    milestoneInfo.MilestonePointInfoList = milestonePointInfoDictionary[milestoneInfo.CatId];
                }
            }
            catch (Exception ex)
            {
                this.LastError = ex.Message;
            }

            return(milestoneInfoList);
        }
        /// <summary>
        /// The get milestone for dogovor.
        /// </summary>
        /// <param name="dog">
        /// The dog.
        /// </param>
        /// <param name="dc">
        /// The dc.
        /// </param>
        /// <returns>
        /// Получение контрольных точек для договора
        /// </returns>
        public List <MilestoneCategoriesInfo> GetMilestoneForDogovor(string dog, string dc)
        {
            var start = DateTime.Now;

            this.LastError = string.Empty;
            var milestoneInfoList = new List <MilestoneCategoriesInfo>();
            var milestoneCategoriesInfoDictionary = new Dictionary <int, MilestoneCategoriesInfo>();
            var milestonePointInfoDictionary      = new Dictionary <int, List <MilestonePointInfo> >();

            try
            {
                var queryString = MilestoneReportResource.GetMilestoneForDogovorSqlReqest;
                using (var connection = new OracleConnection(CosmosConnectionString))
                {
                    using (var command = connection.CreateCommand())
                    {
                        command.Parameters.AddWithValue("DOGOVOR", dog);
                        command.Parameters.AddWithValue("DC", dc);
                        command.CommandText = queryString;
                        connection.Open();
                        using (var rdr = command.ExecuteReader())
                        {
                            while (rdr.Read())
                            {
                                var milestoneCategoriesInfo = new MilestoneCategoriesInfo
                                {
                                    CatId    = rdr["ID_MS_CAT"] == DBNull.Value ? -1 : Convert.ToInt32(rdr["ID_MS_CAT"]),
                                    CatName  = rdr["MS_CAT_NAME"] == DBNull.Value ? string.Empty : rdr["MS_CAT_NAME"].ToString(),
                                    CatOrder = rdr["MS_CAT_ORD"] == DBNull.Value ? -1 : Convert.ToInt32(rdr["MS_CAT_ORD"])
                                };

                                var milestonePointInfo = new MilestonePointInfo
                                {
                                    MilestoneId     = rdr["ID_MILESTONE"] == DBNull.Value ? -1 : Convert.ToInt32(rdr["ID_MILESTONE"]),
                                    MilestoneName   = rdr["MILESTONE_NAME"] == DBNull.Value ? string.Empty : rdr["MILESTONE_NAME"].ToString(),
                                    MilestoneIdMsp  = rdr["ID_MSP"] == DBNull.Value ? string.Empty : rdr["ID_MSP"].ToString(),
                                    MilestoneOrder  = rdr["ORD"] == DBNull.Value ? -1 : Convert.ToInt32(rdr["ORD"]),
                                    ProjectUserName = rdr["USER_NAME"] == DBNull.Value ? string.Empty : rdr["USER_NAME"].ToString(),
                                    ProjectFactData = rdr["FACT_DATE"] == DBNull.Value ? string.Empty : Convert.ToDateTime(rdr["FACT_DATE"]).ToShortDateString()
                                };

                                milestonePointInfo.MilestoneDateInfoList = this.GetMilestoneDateList(milestonePointInfo.MilestoneIdMsp);
                                if (milestonePointInfo.MilestoneDateInfoList.Any())
                                {
                                    if (!milestoneCategoriesInfoDictionary.ContainsKey(milestoneCategoriesInfo.CatId))
                                    {
                                        milestoneCategoriesInfoDictionary.Add(milestoneCategoriesInfo.CatId, milestoneCategoriesInfo);
                                    }

                                    if (!milestonePointInfoDictionary.ContainsKey(milestoneCategoriesInfo.CatId))
                                    {
                                        milestonePointInfoDictionary.Add(milestoneCategoriesInfo.CatId, new List <MilestonePointInfo>());
                                    }

                                    if (milestonePointInfoDictionary[milestoneCategoriesInfo.CatId].All(c => c.MilestoneId != milestonePointInfo.MilestoneId))
                                    {
                                        milestonePointInfoDictionary[milestoneCategoriesInfo.CatId].Add(milestonePointInfo);
                                    }
                                }
                            }
                        }
                    }
                }

                foreach (var categories in milestoneCategoriesInfoDictionary)
                {
                    milestoneInfoList.Add(categories.Value);
                }

                foreach (var milestoneInfo in milestoneInfoList)
                {
                    milestoneInfo.MilestonePointInfoList = milestonePointInfoDictionary[milestoneInfo.CatId];
                }
            }
            catch (Exception ex)
            {
                this.LastError = ex.Message;
            }

            var span = (DateTime.Now - start).TotalMilliseconds;

            return(milestoneInfoList);
        }