コード例 #1
0
        //public DataTable GetCafedra() =>  new BaseCore(ConnectionStringManger.CampusBd,
        //    "SELECT distinct [ID_Subdivision],[SubdivName] FROM [eEmployees1]").LocalTable;
        public void UpdateCampusDatabase(string[] g)
        {
            var Campus = new BaseCore(ConnectionStringManger.CampusBd, String.Format("SELECT * FROM {0}", g[1]));
            var Vkd    = new BaseCore(ConnectionStringManger.VkdBd, String.Format("SELECT * FROM {0}", g[0]));

            UpdateDatabase(Campus, Vkd);
        }
コード例 #2
0
        public SearchResult GetBySearchCondition(SearchFilters searchFilters)
        {
            //var getCampusInfo = new BaseCore(ConnectionStringManger.CampusBd, SQLFileProvider.SelectByConditionFromCampusTable, new SqlParameter[]
            //    {
            //        new SqlParameter("@Surname","N'%'" + searchFilters.LastName + "'%'"),
            //        new SqlParameter("@Name","N'%'" + searchFilters.FirstName + "'%'"),
            //        new SqlParameter("@DutiesName","N'%'" + searchFilters.Position + "'%'"),
            //    }).LocalTable;
            //var getVKDInfo = new BaseCore(ConnectionStringManger.VkdBd, SQLFileProvider.SelectByConditionFromViewVKD, new SqlParameter[]
            //{
            //    new SqlParameter("@Surname","N'%'" + searchFilters.LastName + "'%'"),
            //    new SqlParameter("@Name","N'%'" + searchFilters.FirstName + "'%"),
            //    new SqlParameter("@DutiesName","N'%'" + searchFilters.Position + "'%'"),
            //}).LocalTable;
            var getCampusInfo = new BaseCore(ConnectionStringManger.CampusBd,
                                             string.Format(SQLFileProvider.SelectByConditionFromCampusTable, searchFilters.LastName, searchFilters.FirstName, searchFilters.Position, searchFilters.TableName)).LocalTable;
            var getVKDInfo = new BaseCore(ConnectionStringManger.VkdBd,
                                          string.Format(SQLFileProvider.SelectByConditionFromViewVKD, searchFilters.LastName, searchFilters.FirstName, searchFilters.Position, searchFilters.ViewName)).LocalTable;

            var result = new SearchResult
            {
                CampusResult = getCampusInfo,
                ViewResult   = getVKDInfo
            };

            return(result);
        }
コード例 #3
0
        protected void DeleteCheck(ref DataTable campus, ref DataTable Vkd, BaseCore campusBaseCore)
        {
            var employeesId = campus.AsEnumerable().Select(o => new
            {
                EmpId = o["ID_employee"],
                SubId = o["ID_Subdivision"]
            }).Distinct();

            foreach (var ident in employeesId)
            {
                var empl = Vkd.AsEnumerable().Where(p => p["ID_employee"].ToString() == ident.EmpId.ToString() &&
                                                    p["ID_Subdivision"].ToString() == ident.SubId.ToString())
                           .Select(u => u["Surname"]).ToList();

                if (!empl.Any())
                {
                    var employees = campus.Select("ID_employee=" + ident.EmpId.ToString());

                    foreach (var row in employees)
                    {
                        if (row["vcChangeStatus"].ToString() != "Видалено")
                        {
                            row["vcChangeStatus"] = "Видалено";
                            row["vcChangeDate"]   = DateTime.Now;

                            NLogCore.LogStatusAplication("Запис з ідентифікатором eEmployees1Id=" + row["eEmployees1Id"] + " видалено");
                        }
                    }
                    campusBaseCore.UpdateDataBase(campus);
                }
            }
        }
コード例 #4
0
        public void PartialyUpdateCampusDatabase(DataToConvert dataToConvert)
        {
            var Campus = new BaseCore(ConnectionStringManger.CampusBd,
                                      String.Format(SQLFileProvider.SelectRangeFromCampusTable, dataToConvert.TableName, string.Join(",", dataToConvert.CampusRows)));
            var Vkd = new BaseCore(ConnectionStringManger.VkdBd,
                                   String.Format(SQLFileProvider.SelectRangeFromViewVKD, dataToConvert.ViewName, string.Join(",", dataToConvert.VkdRows)));

            UpdateDatabase(Campus, Vkd);
        }
コード例 #5
0
        private void UpdateDatabase(BaseCore campus, BaseCore vkd)
        {
            var t = campus.LocalTable;
            var y = vkd.LocalTable;

            DataCheck(ref t, ref y);
            campus.UpdateDataBase(t);
            DeleteCheck(ref t, ref y, campus);
            campus.UpdateDataBase(t);
        }
コード例 #6
0
        public Dictionary <string, DataTable> GetAllTables()
        {
            var Campus = new BaseCore(ConnectionStringManger.CampusBd,
                                      "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES where TABLE_TYPE = 'BASE TABLE' order by TABLE_NAME");
            var Vkd = new BaseCore(ConnectionStringManger.VkdBd,
                                   "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES where TABLE_TYPE = 'View' order by TABLE_NAME");

            return(new Dictionary <string, DataTable>
            {
                ["Список Представлень:"] = Vkd.LocalTable,
                ["Список Таблиц:"] = Campus.LocalTable
            });
        }
コード例 #7
0
        public int GetProgressBarCount(string t)
        {
            var Vkd = new BaseCore(ConnectionStringManger.VkdBd, String.Format("SELECT Count( distinct ID_Employee) as cou FROM {0}", t));

            return(Convert.ToInt32(Vkd.LocalTable.AsEnumerable().Select(o => o["cou"]).ElementAt(0)));
        }