コード例 #1
0
		public OperationResult<bool> EditTimeTrackDocumentType(API.TimeTrackDocumentType timeTrackDocumentType)
		{
			return DbServiceHelper.InTryCatch(() =>
			{
				var tableItem = (from x in Context.TimeTrackDocumentTypes where x.UID.Equals(timeTrackDocumentType.UID) select x).FirstOrDefault();
				if (tableItem != null)
				{
					tableItem.Name = timeTrackDocumentType.Name;
					tableItem.ShortName = timeTrackDocumentType.ShortName;
					tableItem.DocumentCode = timeTrackDocumentType.Code;
					tableItem.DocumentType = (int)timeTrackDocumentType.DocumentType;
					Context.SaveChanges();
				}
				return true;
			});
		}
コード例 #2
0
		public OperationResult<bool> AddTimeTrackDocumentType(API.TimeTrackDocumentType timeTrackDocumentType)
		{
			return DbServiceHelper.InTryCatch(() =>
			{
				var tableItem = new TimeTrackDocumentType();
				tableItem.UID = timeTrackDocumentType.UID;
				tableItem.OrganisationUID = timeTrackDocumentType.OrganisationUID;
				tableItem.Name = timeTrackDocumentType.Name;
				tableItem.ShortName = timeTrackDocumentType.ShortName;
				tableItem.DocumentCode = timeTrackDocumentType.Code;
				tableItem.DocumentType = (int)timeTrackDocumentType.DocumentType;
				Context.TimeTrackDocumentTypes.Add(tableItem);
				Context.SaveChanges();
				return true;
			});
		}
コード例 #3
0
		public OperationResult<bool> AddTimeTrackDocument(API.TimeTrackDocument timeTrackDocument)
		{
			return DbServiceHelper.InTryCatch(() =>
			{
				var tableItem = new TimeTrackDocument();
				tableItem.UID = timeTrackDocument.UID;
				tableItem.EmployeeUID = timeTrackDocument.EmployeeUID;
				tableItem.StartDateTime = timeTrackDocument.StartDateTime.CheckDate();
				tableItem.EndDateTime = timeTrackDocument.EndDateTime.CheckDate();
				tableItem.DocumentCode = timeTrackDocument.DocumentCode;
				tableItem.Comment = timeTrackDocument.Comment;
				tableItem.DocumentDateTime = timeTrackDocument.DocumentDateTime.CheckDate();
				tableItem.DocumentNumber = timeTrackDocument.DocumentNumber;
				Context.TimeTrackDocuments.Add(tableItem);
				tableItem.FileName = timeTrackDocument.FileName;
				Context.SaveChanges();
				return true;
			});
		}
コード例 #4
0
		public OperationResult<bool> EditTimeTrackDocument(API.TimeTrackDocument timeTrackDocument)
		{
			return DbServiceHelper.InTryCatch(() =>
			{
				var tableItem = (from x in Context.TimeTrackDocuments where x.UID.Equals(timeTrackDocument.UID) select x).FirstOrDefault();
				if (tableItem != null)
				{
					tableItem.EmployeeUID = timeTrackDocument.EmployeeUID;
					tableItem.StartDateTime = timeTrackDocument.StartDateTime.CheckDate();
					tableItem.EndDateTime = timeTrackDocument.EndDateTime.CheckDate();
					tableItem.DocumentCode = timeTrackDocument.DocumentCode;
					tableItem.Comment = timeTrackDocument.Comment;
					tableItem.DocumentDateTime = timeTrackDocument.DocumentDateTime.CheckDate();
					tableItem.DocumentNumber = timeTrackDocument.DocumentNumber;
					tableItem.FileName = timeTrackDocument.FileName;
					Context.SaveChanges();
				}
				return true;
			});
		}
コード例 #5
0
		public OperationResult<bool> Save(API.NightSettings item)
		{
			return DbServiceHelper.InTryCatch(() =>
			{
				bool isNew = false;
				var tableItem = Context.NightSettings.FirstOrDefault(x => x.UID == item.UID);
				if (tableItem == null)
				{
					tableItem = new NightSetting { UID = item.UID };
					isNew = true;
				}
				tableItem.NightStartTime = (int)item.NightStartTime.TotalMinutes;
				tableItem.NightEndTime = (int)item.NightEndTime.TotalMinutes;
				tableItem.OrganisationUID = item.OrganisationUID.EmptyToNull();
				if (isNew)
					Context.NightSettings.Add(tableItem);
				Context.SaveChanges();
				return true;
			});
		}