/// <summary> /// وارد کردن داده های فعالیت یک پروژه مشخص از PWA /// </summary> internal void Sync(Guid projectID) { try { string commandText = string.Format(@" Select ProjectUID, TaskUID, TaskName, TaskParentUID From dbo.MSP_EpmTask_UserView Where ProjectUID = '{0}'", projectID); SqlCommand sqlCommand = new SqlCommand(commandText, new SqlConnection(_PWAConnString)); var dataTable = SqlQueryExecute.GetDataTable(commandText, _PWAConnString); List <Task> tasks = PWATranslator.ToTasks(dataTable); tasks.ForEach(entity => { if (IsExistById(entity.ID)) { Edit(entity); } else { Add(entity); } }); } catch { } }
public void Sync() { string commandText = string.Format(@" delete [ProjectWebApp].[pub].[MSP_RESOURCES] where WRES_ACCOUNT is null and RES_NAME<>'unknown'; Select ResourceUID, ResourceName, ResourceNTAccount,EmployeeCode From ProjectWebApp..MSP_EpmResource_UserView where ResourceNTAccount is not null" ); SqlCommand sqlCommand = new SqlCommand(commandText, new SqlConnection(_PWAConnString)); var dataTable = SqlQueryExecute.GetDataTable(commandText, _PWAConnString); List <User> users = PWATranslator.ToUsers(dataTable, _RASContext.Users.ToList()); users.ForEach(entity => { if (IsExistById(entity.ID)) { Edit(entity); } else { Add(entity); } }); }
/// <summary> /// وارد کردن داده های پروژه از PWA /// </summary> internal void Sync() { string commandText = @" update [Assignments] set isdeactivated=1 where id not in ( Select AssignmentUID From ProjectWebApp.dbo.MSP_EpmAssignment_UserView ); Select AssignmentUID, ProjectUID, ResourceUID, TaskUID From ProjectWebApp.dbo.MSP_EpmAssignment_UserView" ; SqlCommand sqlCommand = new SqlCommand(commandText, new SqlConnection(_PWAConnString)); var dataTable = SqlQueryExecute.GetDataTable(commandText, _PWAConnString); List <Assignment> assignments = PWATranslator.ToAssignments(dataTable); assignments.ForEach(entity => { if (IsExistById(entity.ID)) { Edit(entity); } else { Add(entity); } }); //IsDeactivated }
/// <summary> /// وارد کردن داده های پروژه از PWA /// </summary> public void Sync() { UserRepository userRepository = new UserRepository(this._PWAConnString, this._RASContext); TaskRepository taskRepository = new TaskRepository(this._PWAConnString, this._RASContext); AssignmentRepository assignRepository = new AssignmentRepository(this._PWAConnString, this._RASContext); string commandText = @" Select ProjectUID, ProjectName, Case When ProjectOwnerName is not null Then ProjectOwnerName Else null End as OwnerName, Case When ProjectOwnerName is not null Then ProjectOwnerResourceUID Else null End as ResourceID, Case When ProjectOwnerName is not null Then LTable.ResourceNTAccount Else null End as UserName From MSP_EpmProject_UserView RTable Left Join MSP_EpmResource_UserView LTable On RTable.ProjectOwnerResourceUID = LTable.ResourceUID" ; SqlCommand sqlCommand = new SqlCommand(commandText, new SqlConnection(_PWAConnString)); var dataTable = SqlQueryExecute.GetDataTable(commandText, _PWAConnString); List <Project> projects = PWATranslator.ToProjects(dataTable); projects.ForEach(entity => { if (IsExistById(entity.ID)) { Edit(entity); } else { Add(entity); } }); //Sync Users(Resources) userRepository.Sync(); //Sync Tasks taskRepository.Sync(); //Sync Assignment assignRepository.Sync(); }
public void Sync() { string commandText = string.Format(@" Select ResourceUID, ResourceName, ResourceNTAccount,EmployeeCode From MSP_EpmResource_UserView" ); SqlCommand sqlCommand = new SqlCommand(commandText, new SqlConnection(_PWAConnString)); var dataTable = SqlQueryExecute.GetDataTable(commandText, _PWAConnString); List <User> users = PWATranslator.ToUsers(dataTable, _RASContext.Users.ToList()); users.ForEach(entity => { if (IsExistById(entity.ID)) { Edit(entity); } else { Add(entity); } }); }
/// <summary> /// وارد کردن داده های فعالیت از PWA /// </summary> internal void Sync() { string commandText = @" Select ProjectUID, TaskUID, TaskName, TaskParentUID From ProjectWebApp.dbo.MSP_EpmTask_UserView" ; SqlCommand sqlCommand = new SqlCommand(commandText, new SqlConnection(_PWAConnString)); var dataTable = SqlQueryExecute.GetDataTable(commandText, _PWAConnString); List <Task> tasks = PWATranslator.ToTasks(dataTable); tasks.ForEach(entity => { if (IsExistById(entity.ID)) { Edit(entity); } else { Add(entity); } }); }