/// <summary> /// Change a non approved registered activity. /// </summary> /// <param name="activity">Activity information</param> /// <returns>Registered activity information.</returns> public T ChangeActivity <T>(long activityID, SOFTTEK.SCMS.Entity.SRA.Activity activity) where T : SOFTTEK.SCMS.Entity.SRA.Activity, new() { T changedActivity = context.Execute(() => { T targetActivity = new T(); using (dataSource = new SRADataContext(context.SecurityContext)) { dataSource.ConnectionString = "SRA"; dataSource.DefaultUser = System.Configuration.ConfigurationManager.AppSettings["S_APP_UID"]; dataSource.Initialize(); var result = dataSource.GetActivityByID(activityID); targetActivity = new T { ActivityCode = result.ActivityCode, ApprovedAt = result.ApprovedAt, ApprovedBy = result.ApprovedBy, ApprovedComments = result.ApprovedComments, Details = result.Details, Effort = result.Effort, Employee = result.Employee, ExecutedAt = result.ExecutedAt, Identifier = result.Identifier, Jornade = result.Jornade, Project = result.Project, ReportedAt = result.ReportedAt, State = result.State }; } return(targetActivity); }, "Retrieve information for an activity to be updated"); ValidateModifiableActivityState(changedActivity); changedActivity.Effort = activity.Effort; changedActivity.Details = activity.Details; changedActivity.ActivityCode = activity.ActivityCode; changedActivity.Project = activity.Project; changedActivity.Details = activity.Details; changedActivity = UpdateActivity <T>(activity); return(changedActivity); }
public List <SOFTTEK.SCMS.Entity.Shared.Parameter <string> > GetParametersForCategory(string category) { List <SOFTTEK.SCMS.Entity.Shared.Parameter <string> > parameters = new List <SOFTTEK.SCMS.Entity.Shared.Parameter <string> >(); return(context.Execute(() => { using (dataSource = new SRADataContext(context.SecurityContext)) { dataSource.ConnectionString = "SRA"; dataSource.DefaultUser = new System.Configuration.AppSettingsReader().GetValue("S_APP_UID", typeof(string)).ToString(); dataSource.Initialize(); parameters = dataSource.GetParametersForCategory <string>(category); } return parameters; }, "Get parameters for the provided category identifier.")); }
/// <summary> /// Register an activity for approval. /// </summary> /// <param name="permitsAndAbsences">permitsAndAbsences Insert Model information Permits and Absences</param> /// <returns>Registered activity information.</returns> public List <SOFTTEK.SCMS.Entity.SRA.PermitsAndAbsences> RegisterPermitsAnsAbsences(SOFTTEK.SCMS.Entity.SRA.PermitsAndAbsences permitsAndAbsences) { List <SOFTTEK.SCMS.Entity.SRA.PermitsAndAbsences> activities = new List <SOFTTEK.SCMS.Entity.SRA.PermitsAndAbsences>(); ValidatePermitsAndAAbsences(permitsAndAbsences); return(context.Execute(() => { using (dataSource = new SRADataContext(context.SecurityContext)) { dataSource.ConnectionString = "SRA"; dataSource.DefaultUser = System.Configuration.ConfigurationManager.AppSettings["S_APP_UID"]; dataSource.Initialize(); var result = dataSource.RegisterPermitsAndAbsences(permitsAndAbsences); activities = result; } return activities; }, "Register an Permits and absences for aprov")); }
/// <summary> /// Get all the activities reported by an employee in a period. /// </summary> /// <param name="employeeId">Employee Identifier</param> /// <returns></returns> public List <SOFTTEK.SCMS.Entity.SRA.PermitsAndAbsences> GetPermitsAndAbsencesForEmployeeId(int employeeId) { List <SOFTTEK.SCMS.Entity.SRA.PermitsAndAbsences> activities = new List <SOFTTEK.SCMS.Entity.SRA.PermitsAndAbsences>(); return(context.Execute(() => { using (dataSource = new SRADataContext(context.SecurityContext)) { dataSource.ConnectionString = "SRA"; dataSource.DefaultUser = System.Configuration.ConfigurationManager.AppSettings["S_APP_UID"]; dataSource.Initialize(); var results = dataSource.GetPermitsAndAbsences(employeeId); activities = results; } return activities; }, "Retrieve the registered activities for the employee corresponding to the provided employee identifier.")); }
public SOFTTEK.SCMS.Entity.Security.Token Authorize(SOFTTEK.SCMS.Entity.Security.User user) { SOFTTEK.SCMS.Entity.Security.Token authorizationToken = null; return(context.Execute(() => { using (dataSource = new SRADataContext(context.SecurityContext)) { Entity.User decryptedUser = new Entity.User(user, SCMS.Foundation.Security.EncryptionStatus.EncryptionStatusDecrypted, symmetricCipherProvider); dataSource.ConnectionString = "SCMS"; dataSource.DefaultUser = new System.Configuration.AppSettingsReader().GetValue("S_APP_UID", typeof(string)).ToString(); dataSource.Initialize(); authorizationToken = dataSource.AuthenticateUser(decryptedUser); } if (authorizationToken != null) { Business.Entity.Token encryptedToken = new Entity.Token(authorizationToken, SCMS.Foundation.Security.EncryptionStatus.EncryptionStatusEncrypted, symmetricCipherProvider); return encryptedToken; } return null; }, "Authenticate the provided user credentials with the security provider, and identify authenticated user authorization profile.")); }
/// <summary> /// Register an activity for approval. /// </summary> /// <param name="activity">Activity information</param> /// <returns>Registered activity information.</returns> public T RegisterActivity <T>(SOFTTEK.SCMS.Entity.SRA.Activity activity) where T : SOFTTEK.SCMS.Entity.SRA.Activity, new() { T registeredActivity = new T(); ValidateReportedActivityEffort(activity); ValidateReportedActivityInformation(activity); return(context.Execute(() => { using (dataSource = new SRADataContext(context.SecurityContext)) { dataSource.ConnectionString = "SRA"; dataSource.DefaultUser = System.Configuration.ConfigurationManager.AppSettings["S_APP_UID"]; dataSource.Initialize(); var result = dataSource.RegisterActivity(activity); registeredActivity = new T { ActivityCode = result.ActivityCode, ApprovedAt = result.ApprovedAt, ApprovedBy = result.ApprovedBy, ApprovedComments = result.ApprovedComments, Details = result.Details, Effort = result.Effort, Employee = result.Employee, ExecutedAt = result.ExecutedAt, Identifier = result.Identifier, Jornade = result.Jornade, Project = result.Project, ReportedAt = result.ReportedAt, State = result.State }; } return registeredActivity; }, "Register an activity for approval")); }
public SOFTTEK.SCMS.Entity.Security.Token GetToken() { SOFTTEK.SCMS.Entity.Security.Token authorizationToken = null; return(context.Execute(() => { using (dataSource = new SRADataContext(context.SecurityContext)) { dataSource.ConnectionString = "SCMS"; dataSource.DefaultUser = new System.Configuration.AppSettingsReader().GetValue("S_APP_UID", typeof(string)).ToString(); dataSource.Initialize(); authorizationToken = dataSource.GetToken(); } if (authorizationToken != null) { Business.Entity.Token encryptedToken = new Entity.Token(authorizationToken, SCMS.Foundation.Security.EncryptionStatus.EncryptionStatusEncrypted, symmetricCipherProvider); return encryptedToken; } return null; }, "Retrieve the authorization token information for the provided token identifier and device identifier.")); }
/// <summary> /// Get all the activities reported by an employee in a period. /// </summary> /// <param name="employeeId">Employee Identifier</param> /// <param name="from">Period start date</param> /// <param name="to">Period end date</param> /// <returns></returns> public List <T> GetActivitiesForEmployeeIdInPeriod <T>(int employeeId, DateTime from, DateTime to) where T : SOFTTEK.SCMS.Entity.SRA.Activity, new() { List <T> activities = new List <T>(); return(context.Execute(() => { using (dataSource = new SRADataContext(context.SecurityContext)) { dataSource.ConnectionString = "SRA"; dataSource.DefaultUser = System.Configuration.ConfigurationManager.AppSettings["S_APP_UID"]; dataSource.Initialize(); var results = dataSource.GetActivities(employeeId, from, to); results.ForEach(a => activities.Add(new T { ActivityCode = a.ActivityCode, ApprovedAt = a.ApprovedAt, ApprovedBy = a.ApprovedBy, ApprovedComments = a.ApprovedComments, Details = a.Details, Effort = a.Effort, Employee = a.Employee, ExecutedAt = a.ExecutedAt, Identifier = a.Identifier, Jornade = a.Jornade, Project = a.Project, ReportedAt = a.ReportedAt, State = a.State })); } return activities; }, "Retrieve the registered activities for the employee corresponding to the provided employee identifier.")); }
public bool SetEmployeeImage(string ftpURL, int employeeID) { bool result = false; return(context.Execute(() => { using (dataSource = new SRADataContext(context.SecurityContext)) { dataSource.ConnectionString = "SRA"; dataSource.DefaultUser = new System.Configuration.AppSettingsReader().GetValue("S_APP_UID", typeof(string)).ToString(); dataSource.Initialize(); SOFTTEK.SCMS.Entity.Shared.Employee employee = dataSource.GetEmployeeById(employeeID); if (employee != null) { employee.ImageURL = ftpURL; result = dataSource.UpdateEmployee(employee); } ; return result; } }, "Upload to the images repository, the provided binary image file.")); }