当前位置: 首页>>代码示例>>C#>>正文


C# DataClasses.DbService类代码示例

本文整理汇总了C#中RubezhDAL.DataClasses.DbService的典型用法代码示例。如果您正苦于以下问题:C# RubezhDAL.DataClasses.DbService类的具体用法?C# RubezhDAL.DataClasses.DbService怎么用?C# RubezhDAL.DataClasses.DbService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RubezhDAL.DataClasses.DbService类属于命名空间,在下文中一共展示了RubezhDAL.DataClasses.DbService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetHolidays

		public OperationResult<List<Holiday>> GetHolidays(Guid clientUID, HolidayFilter filter)
		{
			using (var databaseService = new RubezhDAL.DataClasses.DbService())
			{
				return databaseService.HolidayTranslator.Get(filter);
			}
		}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:7,代码来源:FiresecService.SKD.TimeInterval.cs

示例2: CreateDataSet

		protected override DataSet CreateDataSet(DataProvider dataProvider)
		{
			var filter = GetFilter<DepartmentsReportFilter>();
			var databaseService = new RubezhDAL.DataClasses.DbService();
			dataProvider.LoadCache();
			var departments = GetDepartments(dataProvider, filter);
			var uids = departments.Select(item => item.UID).ToList();
			var employees = dataProvider.GetEmployees(departments.Where(item => item.Item.ChiefUID != Guid.Empty).Select(item => item.Item.ChiefUID));
			var ds = new DepartmentsDataSet();
			departments.ForEach(department =>
			{
				var row = ds.Data.NewDataRow();
				row.Organisation = department.Organisation;
				row.Department = department.Name;
				row.Phone = department.Item.Phone;
				row.Chief = employees.Where(item => item.UID == department.Item.ChiefUID).Select(item => item.Name).FirstOrDefault();
				row.ParentDepartment = dataProvider.Departments.ContainsKey(department.Item.ParentDepartmentUID) ?
					dataProvider.Departments[department.Item.ParentDepartmentUID].Name : string.Empty;
				row.Description = department.Item.Description;
				row.IsArchive = department.IsDeleted;
				var parents = GetParents(dataProvider, department);
				row.Level = parents.Count;
				row.Tag = string.Join("/", parents.Select(item => item.UID));
				ds.Data.AddDataRow(row);
			});
			return ds;
		}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:27,代码来源:DepartmentsReport.cs

示例3: GetDayIntervals

		public OperationResult<List<DayInterval>> GetDayIntervals(Guid clientUID, DayIntervalFilter filter)
		{
			using (var databaseService = new RubezhDAL.DataClasses.DbService())
			{
				return databaseService.DayIntervalTranslator.Get(filter);
			}
		}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:7,代码来源:FiresecService.SKD.TimeInterval.cs

示例4: GetEmployeeDetails

		public OperationResult<Employee> GetEmployeeDetails(Guid clientUID, Guid uid)
		{
			using (var databaseService = new RubezhDAL.DataClasses.DbService())
			{
				return databaseService.EmployeeTranslator.GetSingle(uid);
			}
		}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:7,代码来源:RubezhService.SKD.cs

示例5: RewriteAllSchedules

		/// <summary>
		/// Перезаписать вае графики конкретного ГК
		/// </summary>
		/// <param name="device"></param>
		/// <returns></returns>
		public static OperationResult<bool> RewriteAllSchedules(GKDevice device, Guid clientUID)
		{
			var progressCallback = GKProcessorManager.StartProgress("Перезапись графиков в " + device.PresentationName, "Стирание графиков", 1, false, GKProgressClientType.Administrator, clientUID);
			var removeResult = RemoveAllSchedules(device);
			if (removeResult.HasError)
				return OperationResult<bool>.FromError(removeResult.Errors);

			var schedules = new List<GKSchedule>();
			using (var databaseService = new RubezhDAL.DataClasses.DbService())
			{
				var schedulesResult = databaseService.GKScheduleTranslator.Get();
				if (schedulesResult.HasError)
					return OperationResult<bool>.FromError(schedulesResult.Errors);
				schedules = schedulesResult.Result;
			}

			progressCallback = GKProcessorManager.StartProgress("Запись графиков в " + device.PresentationName, "", schedules.Count + 1, false, GKProgressClientType.Administrator, clientUID);
			var emptySchedule = new GKSchedule();
			emptySchedule.Name = "Никогда";
			var setResult = GKSetSchedule(device, emptySchedule);
			if (setResult.HasError)
				return OperationResult<bool>.FromError(setResult.Errors);
			GKProcessorManager.DoProgress("Запись пустого графика ", progressCallback, clientUID);
			int i = 1;
			foreach (var schedule in schedules)
			{
				setResult = GKSetSchedule(device, schedule);
				if (setResult.HasError)
					return OperationResult<bool>.FromError(setResult.Errors);
				GKProcessorManager.DoProgress("Запись графика " + i, progressCallback, clientUID);
				i++;
			}
			GKProcessorManager.StopProgress(progressCallback, clientUID);
			return new OperationResult<bool>(true);
		}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:40,代码来源:GKScheduleHelper.cs

示例6: RestoreDayInterval

		public OperationResult<bool> RestoreDayInterval(Guid clientUID, Guid uid, string name)
		{
			AddJournalMessage(JournalEventNameType.Редактирование_дневного_графика, name, uid, clientUID, JournalEventDescriptionType.Восстановление_дневной_график, JournalObjectType.DayInterval);
			using (var databaseService = new RubezhDAL.DataClasses.DbService())
			{
				return databaseService.DayIntervalTranslator.Restore(uid);
			}
		}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:8,代码来源:FiresecService.SKD.TimeInterval.cs

示例7: GetScheduleSchemes

		public OperationResult<List<ScheduleScheme>> GetScheduleSchemes(Guid clientUID, ScheduleSchemeFilter filter)
		{
			using (var databaseService = new RubezhDAL.DataClasses.DbService())
			{
				var result = databaseService.ScheduleSchemeTranslator.Get(filter);
				return result;
			}
		}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:8,代码来源:FiresecService.SKD.TimeInterval.cs

示例8: RestoreHoliday

		public OperationResult<bool> RestoreHoliday(Guid clientUID, Guid uid, string name)
		{
			AddJournalMessage(JournalEventNameType.Редактирование_праздничного_дня, name, uid, clientUID, JournalEventDescriptionType.Восстановление_праздничный_день, JournalObjectType.Holiday);
			using (var databaseService = new RubezhDAL.DataClasses.DbService())
			{
				return databaseService.HolidayTranslator.Restore(uid);
			}
		}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:8,代码来源:FiresecService.SKD.TimeInterval.cs

示例9: ReadMissingJournalItems

		public bool ReadMissingJournalItems()
		{
			var gkIpAddress = GKManager.GetIpAddress(GkDatabase.RootDevice);
			var localLastDBNo = -1;
			using (var skdDatabaseService = new RubezhDAL.DataClasses.DbService())
			{
				localLastDBNo = skdDatabaseService.GKMetadataTranslator.GetLastJournalNo(gkIpAddress);
			}
			if (localLastDBNo == -1)
			{
				return true;
			}
			var remoteLastId = GetLastId();
			if (remoteLastId == -1)
			{
				return false;
			}
			using (var skdDatabaseService = new RubezhDAL.DataClasses.DbService())
			{
				skdDatabaseService.GKMetadataTranslator.SetLastJournalNo(gkIpAddress, remoteLastId);
			}
			if (remoteLastId > localLastDBNo)
			{
				if (remoteLastId - localLastDBNo > 1000)
					localLastDBNo = remoteLastId - 1000;

				var progressCallback = GKProcessorManager.StartProgress("Синхронизация журнала ГК " + gkIpAddress, "", remoteLastId - localLastDBNo, true, GKProgressClientType.Monitor);

				using (var gkLifecycleManager = new GKLifecycleManager(GkDatabase.RootDevice, "Синхронизация журнала"))
				{
					for (int index = localLastDBNo; index <= remoteLastId; index++)
					{
						gkLifecycleManager.Progress(index - localLastDBNo + 1, remoteLastId - localLastDBNo);

						LastUpdateTime = DateTime.Now;
						if (progressCallback.IsCanceled)
							break;

						WaitIfSuspending();
						if (IsStopping)
						{
							break;
						}

						var journaParser = ReadJournal(index);
						if (journaParser != null)
						{
							GKProcessorManager.DoProgress((index - localLastDBNo).ToString() + " из " + (remoteLastId - localLastDBNo).ToString(), progressCallback);
							AddJournalItem(journaParser.JournalItem);
						}
					}
				}

				GKProcessorManager.StopProgress(progressCallback);
				LastId = remoteLastId;
			}
			return true;
		}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:58,代码来源:Watcher.JournalSynchronisation.cs

示例10: GetEmployeeList

		public OperationResult<List<ShortEmployee>> GetEmployeeList(Guid clientUID, EmployeeFilter filter)
		{
			OperationResult<List<ShortEmployee>> result;
			using (var databaseService = new RubezhDAL.DataClasses.DbService())
			{
				result = databaseService.EmployeeTranslator.ShortTranslator.Get(filter);
			}
			return result;
		}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:9,代码来源:RubezhService.SKD.cs

示例11: CheckKAUMeasure

		void CheckKAUMeasure()
		{
			foreach (var device in GkDatabase.RootDevice.Children.Where(x => x.DriverType == GKDriverType.RSR2_KAU))
			{
				using (var skdDatabaseService = new RubezhDAL.DataClasses.DbService())
				{
					skdDatabaseService.CurrentConsumptionTranslator.SaveMany(GetKAUMeasure(device));
				}
			}
		}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:10,代码来源:Watcher.Measure.cs

示例12: SaveHoliday

		public OperationResult<bool> SaveHoliday(Guid clientUID, Holiday item, bool isNew)
		{
			if (isNew)
				AddJournalMessage(JournalEventNameType.Редактирование_праздничного_дня, item.Name, item.UID, clientUID, JournalEventDescriptionType.Добавление_праздничный_день, JournalObjectType.Holiday);
			else
				AddJournalMessage(JournalEventNameType.Редактирование_праздничного_дня, item.Name, item.UID, clientUID, JournalEventDescriptionType.Редактирование_праздничный_день, JournalObjectType.Holiday);
			using (var databaseService = new RubezhDAL.DataClasses.DbService())
			{
				return databaseService.HolidayTranslator.Save(item);
			}
		}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:11,代码来源:FiresecService.SKD.TimeInterval.cs

示例13: SaveDayInterval

		public OperationResult<bool> SaveDayInterval(Guid clientUID, DayInterval item, bool isNew)
		{
			if (isNew)
				AddJournalMessage(JournalEventNameType.Редактирование_дневного_графика, item.Name, item.UID, clientUID, JournalEventDescriptionType.Добавление_дневной_график, JournalObjectType.DayInterval);
			else
				AddJournalMessage(JournalEventNameType.Редактирование_дневного_графика, item.Name, item.UID, clientUID, JournalEventDescriptionType.Редактирование_дневной_график, JournalObjectType.DayInterval);
			using (var databaseService = new RubezhDAL.DataClasses.DbService())
			{
				return databaseService.DayIntervalTranslator.Save(item);
			}
		}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:11,代码来源:FiresecService.SKD.TimeInterval.cs

示例14: PingJournal

		void PingJournal()
		{
			JournalParser journalParser;
			if (IsFirstTimeReadJournal && !String.IsNullOrEmpty(GkDatabase.RootDevice.GetReservedIpAddress())) // Находим последнее событие на КАУ первый раз (при запуске сервера)
			{
				journalParser = GetKauJournalById(-1);
				if (journalParser != null)
					LastKauId = journalParser.KauJournalRecordNo;
				IsFirstTimeReadJournal = false;
			}
			using (var gkLifecycleManager = new GKLifecycleManager(GkDatabase.RootDevice, "Проверка журнала"))
			{
				if (IpAddress != GkDatabase.RootDevice.GetGKIpAddress())
				{
					if (!String.IsNullOrEmpty(IpAddress))
					{
						var lastKauJournal = GetKauJournalById(LastKauId);
						if (lastKauJournal != null)
							LastId = lastKauJournal.GKJournalRecordNo;
					}
					IpAddress = GkDatabase.RootDevice.GetGKIpAddress();
				}
				var newLastId = GetLastId();
				if (newLastId == -1)
					return;
				if (LastId == -1)
					LastId = newLastId;
				if (newLastId > LastId)
				{
					for (int index = LastId + 1; index <= newLastId; index++)
					{
						gkLifecycleManager.Progress(index - LastId, newLastId - LastId);
						journalParser = ReadAndPublish(index);
						if (journalParser != null && journalParser.KauJournalRecordNo != 0)
							LastKauId = journalParser.KauJournalRecordNo;
					}
					LastId = newLastId;

					gkLifecycleManager.AddItem("Изменение индекса в БД");
					using (var skdDatabaseService = new RubezhDAL.DataClasses.DbService())
					{
						var gkIpAddress = GKManager.GetIpAddress(GkDatabase.RootDevice);
						skdDatabaseService.GKMetadataTranslator.SetLastJournalNo(gkIpAddress, LastId);
					}
				}
			}
		}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:47,代码来源:Watcher.Journal.cs

示例15: SaveEmployee

		public OperationResult<bool> SaveEmployee(Guid clientUID, Employee item, bool isNew)
		{
			if (isNew)
			{
				if (item.Type == PersonType.Employee)
					AddJournalMessage(JournalEventNameType.Редактирование_сотрудника, item.Name, item.UID, clientUID, JournalEventDescriptionType.Добавление_сотрудник, JournalObjectType.Employee);
				else if (item.Type == PersonType.Guest)
					AddJournalMessage(JournalEventNameType.Редактирование_посетителя, item.Name, item.UID, clientUID, JournalEventDescriptionType.Добавление_посетитель, JournalObjectType.Employee);
			}
			else
			{
				if (item.Type == PersonType.Employee)
					AddJournalMessage(JournalEventNameType.Редактирование_сотрудника, item.Name, item.UID, clientUID, JournalEventDescriptionType.Редактирование_сотрудник, JournalObjectType.Employee);
				else if (item.Type == PersonType.Guest)
					AddJournalMessage(JournalEventNameType.Редактирование_посетителя, item.Name, item.UID, clientUID, JournalEventDescriptionType.Редактирование_посетитель, JournalObjectType.Employee);
			}
			using (var databaseService = new RubezhDAL.DataClasses.DbService())
			{
				return databaseService.EmployeeTranslator.Save(item);
			}
		}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:21,代码来源:RubezhService.SKD.cs


注:本文中的RubezhDAL.DataClasses.DbService类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。