/// <summary> /// Add Customer Detail /// </summary> /// <param name="customerMaster"></param> /// <returns></returns> public int AddTaskDetails(TaskMaster taskMaster, int TenantID, int UserID) { // MySqlCommand cmd = new MySqlCommand(); int taskId = 0; try { conn = Db.Connection; MySqlCommand cmd1 = new MySqlCommand("SP_createTask", conn); cmd1.Connection = conn; cmd1.Parameters.AddWithValue("@Ticket_ID", taskMaster.TicketID); cmd1.Parameters.AddWithValue("@TaskTitle", taskMaster.TaskTitle); cmd1.Parameters.AddWithValue("@TaskDescription", taskMaster.TaskDescription); cmd1.Parameters.AddWithValue("@DepartmentId", taskMaster.DepartmentId); cmd1.Parameters.AddWithValue("@FunctionID", taskMaster.FunctionID); cmd1.Parameters.AddWithValue("@AssignTo_ID", taskMaster.AssignToID); cmd1.Parameters.AddWithValue("@PriorityID", taskMaster.PriorityID); cmd1.Parameters.AddWithValue("@Tenant_Id", TenantID); cmd1.Parameters.AddWithValue("@Created_By", UserID); cmd1.CommandType = CommandType.StoredProcedure; taskId = Convert.ToInt32(cmd1.ExecuteNonQuery()); } catch (MySql.Data.MySqlClient.MySqlException ex) { //Console.WriteLine("Error " + ex.Number + " has occurred: " + ex.Message); } return(taskId); }
internal static void Start(object obj) { var token = (CancellationToken)obj; try { CustomConsole.WriteLine("Starting..." + Environment.NewLine); var max = MaxN ?? BigInteger.Parse("999999999999999999999999999999"); ThreadMaster.Max = TaskMaster.Max = max; if (ShouldOverride) { TaskMaster.StartSieve(BigInteger.Min(max, MaxSieveValue), token); } if (Task) { TaskMaster.Start(token); } else { ThreadMaster.Start(ThreadCount ?? 0, token); } } finally { FileHelper.Dispose(); MainWindow.Finished = true; } }
public ResponseModel createTask([FromBody] TaskMaster taskMaster) { TaskCaller taskCaller = new TaskCaller(); ResponseModel objResponseModel = new ResponseModel(); int statusCode = 0; string statusMessage = ""; try { string token = Convert.ToString(Request.Headers["X-Authorized-Token"]); Authenticate authenticate = new Authenticate(); authenticate = SecurityService.GetAuthenticateDataFromTokenCache(Cache, SecurityService.DecryptStringAES(token)); int result = taskCaller.AddTask(new TaskServices(Cache, Db), taskMaster, authenticate.TenantId, authenticate.UserMasterID); statusCode = result == 0 ? (int)EnumMaster.StatusCode.RecordNotFound : (int)EnumMaster.StatusCode.Success; statusMessage = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)statusCode); objResponseModel.Status = true; objResponseModel.StatusCode = statusCode; objResponseModel.Message = statusMessage; objResponseModel.ResponseData = result; } catch (Exception) { throw; } return(objResponseModel); }
/// <summary> /// Add Comment ON task /// <param name="TaskMaster"></param> /// </summary> /// <returns></returns> public int AddCommentOnTask(TaskMaster taskMaster) { int i = 0; try { conn.Open(); MySqlCommand cmd1 = new MySqlCommand("SP_AddCommentOnTask", conn); cmd1.Connection = conn; cmd1.Parameters.AddWithValue("@Task_title", taskMaster.TaskTitle); cmd1.Parameters.AddWithValue("@Department_ID", taskMaster.DepartmentId); cmd1.Parameters.AddWithValue("@Function_ID", taskMaster.FunctionID); cmd1.Parameters.AddWithValue("@Task_Description", taskMaster.TaskDescription); cmd1.Parameters.AddWithValue("@Task_Comments", taskMaster.TaskComments); cmd1.Parameters.AddWithValue("@CreatedBy", taskMaster.CreatedBy); cmd1.CommandType = CommandType.StoredProcedure; i = Convert.ToInt32(cmd1.ExecuteNonQuery()); } catch (Exception) { throw; } finally { if (conn != null) { conn.Close(); } } return(i); }
/// <summary> /// Add Comment ON task /// </summary> /// <returns></returns> public int AddCommentOnTask(TaskMaster taskMaster) { int i = 0; try { conn = Db.Connection; MySqlCommand cmd1 = new MySqlCommand("SP_AddCommentOnTask", conn); cmd1.Connection = conn; cmd1.Parameters.AddWithValue("@Task_title", taskMaster.TaskTitle); cmd1.Parameters.AddWithValue("@Department_ID", taskMaster.DepartmentId); cmd1.Parameters.AddWithValue("@Function_ID", taskMaster.FunctionID); cmd1.Parameters.AddWithValue("@Task_Description", taskMaster.TaskDescription); cmd1.Parameters.AddWithValue("@Task_Comments", taskMaster.TaskComments); cmd1.Parameters.AddWithValue("@CreatedBy", taskMaster.CreatedBy); cmd1.CommandType = CommandType.StoredProcedure; i = Convert.ToInt32(cmd1.ExecuteNonQuery()); } catch (MySql.Data.MySqlClient.MySqlException ex) { } return(i); }
protected override void OnCreate (Bundle savedInstanceState) { base.OnCreate (savedInstanceState); SetContentView (Resource.Layout.Main); // Create a new taskMaster, or restore a saved one if (savedInstanceState == null) { taskMaster = new TaskMaster ("testing"); } else { // Deserialized the saved object state string xmlTasks = savedInstanceState.GetString("Tasks"); XmlSerializer x = new XmlSerializer(typeof(TaskMaster)); taskMaster = (TaskMaster)x.Deserialize(new StringReader(xmlTasks)); } // Display all the tasks var taskTextView = FindViewById<TextView> (Resource.Id.taskTextView); taskTextView.Text = taskMaster.GetTaskDescriptions (); // Add a new task to the taskMaster list Button enterButton = FindViewById<Button> (Resource.Id.enterButton); var taskEditText = FindViewById<EditText>(Resource.Id.taskEditText); enterButton.Click += delegate { taskMaster.AddTask(taskEditText.Text); taskTextView.Text = taskMaster.GetTaskDescriptions (); taskEditText.Text = ""; }; }
public async Task <IActionResult> Edit(long id, [Bind("TaskMasterId,TaskMasterName,TaskTypeId,TaskGroupId,ScheduleMasterId,SourceSystemId,TargetSystemId,DegreeOfCopyParallelism,AllowMultipleActiveInstances,TaskDatafactoryIr,TaskMasterJson,ActiveYn,DependencyChainTag,DataFactoryId")] TaskMaster taskMaster) { if (id != taskMaster.TaskMasterId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(taskMaster); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TaskMasterExists(taskMaster.TaskMasterId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(IndexDataTable))); } ViewData["ScheduleMasterId"] = new SelectList(_context.ScheduleMaster.OrderBy(x => x.ScheduleDesciption), "ScheduleMasterId", "ScheduleDesciption", taskMaster.ScheduleMasterId); ViewData["SourceSystemId"] = new SelectList(_context.SourceAndTargetSystems.OrderBy(x => x.SystemName), "SystemId", "SystemName", taskMaster.SourceSystemId); ViewData["TargetSystemId"] = new SelectList(_context.SourceAndTargetSystems.OrderBy(x => x.SystemName), "SystemId", "SystemName", taskMaster.TargetSystemId); ViewData["TaskGroupId"] = new SelectList(_context.TaskGroup.OrderBy(x => x.TaskGroupName), "TaskGroupId", "TaskGroupName", taskMaster.TaskGroupId); ViewData["TaskTypeId"] = new SelectList(_context.TaskType.OrderBy(x => x.TaskTypeName), "TaskTypeId", "TaskTypeName", taskMaster.TaskTypeId); return(View(taskMaster)); }
public BaseTime(TaskMaster task_master, SourceReference source_ref, Context context, Frame self, Frame container) : base(task_master) { this.source_reference = source_ref; this.context = context; this.container = self; }
public CharacterCategory(TaskMaster task_master, SourceReference source_ref, Context context, Frame self, Frame container) : base(task_master) { this.source_reference = source_ref; this.context = context; this.container = self; }
public DbQuery(TaskMaster task_master, SourceReference source_ref, Context context, Frame self, Frame container) : base(task_master) { this.source_ref = source_ref; this.context = context; this.self = self; }
public ActionResult DeleteConfirmed(int id) { TaskMaster taskMaster = db.TaskMasters.Find(id); db.TaskMasters.Remove(taskMaster); db.SaveChanges(); return(RedirectToAction("Index")); }
public void CreateTaskMaster(TaskMaster taskMaster) { using (var unitOfWork = new UnitOfWork()) { unitOfWork.TaskMastersRepository.Insert(taskMaster); unitOfWork.TaskMastersRepository.Save(); } }
public ActionResult Edit([Bind(Include = "MTaskID,TaskName,description,Duration")] TaskMaster taskMaster) { if (ModelState.IsValid) { db.Entry(taskMaster).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(taskMaster)); }
public ActionResult Create([Bind(Include = "MTaskID,TaskName,description,Duration")] TaskMaster taskMaster) { if (ModelState.IsValid) { db.TaskMasters.Add(taskMaster); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(taskMaster)); }
/// <summary> /// Called after we have detected that the sync task has completed /// </summary> /// <param name="taskMaster"></param> void AsyncTaskDone_Reporting(TaskMaster taskMaster) { //Get the status from the backtround task string statusText = taskMaster.StatusLog.StatusText; string errorCountText = ""; int errorCount = taskMaster.StatusLog.ErrorCount; if (errorCount > 0) { errorCountText = " " + errorCount.ToString() + " errors"; } statusText = statusText + "\r\n\r\n" + DateTime.Now.ToString() + " Done." + errorCountText + "\r\n"; textBoxStatus.Text = statusText; ScrollToEndOfTextbox(textBoxStatus); textBoxErrors.Text = taskMaster.StatusLog.ErrorText; //If there is a manual steps file, shell it var manualStepsFile = taskMaster.PathToManualStepsReport; if (!string.IsNullOrWhiteSpace(manualStepsFile)) { AttemptToShellFile(manualStepsFile); } //If the job was to take a site inventory,show the report if (taskMaster.JobName == TaskMaster.JobName_SiteInventory) { //First, see if we have a generated *.twb file string inventoryFile = taskMaster.PathToSiteInventoryReportTwb; //Second, if we don't have a *.twb file, see if we have a *.csv file of the raw data if (string.IsNullOrWhiteSpace(inventoryFile)) { inventoryFile = taskMaster.PathToSiteInventoryReportCsv; } //If we have either file, shell it if (!string.IsNullOrWhiteSpace(inventoryFile)) { AttemptToShellFile(inventoryFile); } } else if (taskMaster.JobName == TaskMaster.JobName_SiteExport) { //We want to shell the file explorer to show the path we have just exported to string exportDirectory = taskMaster.PathToExportTo; if (!string.IsNullOrWhiteSpace(exportDirectory)) { AttemptToShellFile(Path.Combine(exportDirectory, ".")); } } }
// GET: TaskMaster/Create public IActionResult Create() { ViewData["ScheduleMasterId"] = new SelectList(_context.ScheduleMaster.OrderBy(x => x.ScheduleDesciption), "ScheduleMasterId", "ScheduleDesciption"); ViewData["SourceSystemId"] = new SelectList(_context.SourceAndTargetSystems.OrderBy(x => x.SystemName), "SystemId", "SystemName"); ViewData["TargetSystemId"] = new SelectList(_context.SourceAndTargetSystems.OrderBy(x => x.SystemName), "SystemId", "SystemName"); ViewData["TaskGroupId"] = new SelectList(_context.TaskGroup.OrderBy(x => x.TaskGroupName), "TaskGroupId", "TaskGroupName"); ViewData["TaskTypeId"] = new SelectList(_context.TaskType.OrderBy(x => x.TaskTypeName), "TaskTypeId", "TaskTypeName"); TaskMaster taskMaster = new TaskMaster(); taskMaster.ActiveYn = true; return(View(taskMaster)); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Form1_FormClosing(object sender, FormClosingEventArgs e) { //Quit the work if its running... var task = _onlineTaskMaster; if (task != null) { task.Abort(); _onlineTaskMaster = null; } Application.Exit(); }
//[Authorize(Roles = "Admin, Employee")] public ActionResult Task(TaskMaster task, string StartDate, string[] ItemId, string[] ItemType, string[] ItemDescription, string[] Unit, string[] UnitPrice, string[] ItemDuration, string[] Actions, string fileName, bool Status = false, string State = "", string City = "") { string body = " has assigned you a Task: "; string TaskId = null; if (!string.IsNullOrEmpty(task.TaskId)) { body = " has modified Task: "; } if (string.IsNullOrEmpty(task.TaskId)) { TaskId = admin.GetTaskId(); task.TaskId = TaskId; task.TaskStatus = 1; } task.UpdatedBy = User.Identity.GetUserId(); task.CreatedBy = User.Identity.GetUserId(); task.StartDate = null; if (!String.IsNullOrEmpty(StartDate)) { task.StartDate = DateTime.ParseExact(StartDate, "dd-MM-yyyy", CultureInfo.InvariantCulture); } var userDetails = generic.GetUserDetail(User.Identity.GetUserId()); task.SubscriberId = userDetails.SubscriberId; task.City = City; task.State = State; string mobile = admin.GetUserDetailsWithPhone(task.AssignedTo).PhoneNumber; bool result = admin.AddTaskMasters(task, ItemId, ItemType, ItemDescription, Unit, UnitPrice, ItemDuration, Actions, userDetails.DepartmentId); if (!string.IsNullOrEmpty(task.TaskId)) { foreach (string file in Request.Files) { HttpPostedFileBase attachment = Request.Files[file] as HttpPostedFileBase; admin.uploadFile(task.TaskId, attachment); } } string message1 = "A task (" + task.TaskId + ") has been assigned to you by " + generic.GetUserDetail(task.SubscriberId).Name; //eg "message hello "; // generic.sendSMSMessage(message1, mobile); generic.sendSMS(message1, mobile); admin.AddNotification(task.AssignedTo, task.CreatedBy, body + task.TaskId, "Task", task.TaskId, Status, DateTime.Now); return(RedirectToAction("Task", "Task", new { Area = "CMS", result })); }
// GET: TaskMasters/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TaskMaster taskMaster = db.TaskMasters.Find(id); if (taskMaster == null) { return(HttpNotFound()); } return(View(taskMaster)); }
private static async Task PerformDispatcherSwitch(Dispatcher dispatcher) { Assert.True(dispatcher.CheckAccess()); // Switch thread. await TaskMaster.AwaitBackgroundThread(); Assert.False(dispatcher.CheckAccess()); // Switch back to UI thread. await TaskMaster.AwaitThread(dispatcher); Assert.True(dispatcher.CheckAccess()); }
public async Task <IActionResult> Create([Bind("TaskMasterId,TaskMasterName,TaskTypeId,TaskGroupId,ScheduleMasterId,SourceSystemId,TargetSystemId,DegreeOfCopyParallelism,AllowMultipleActiveInstances,TaskDatafactoryIr,TaskMasterJson,ActiveYn,DependencyChainTag,DataFactoryId")] TaskMaster taskMaster) { if (ModelState.IsValid) { _context.Add(taskMaster); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(IndexDataTable))); } ViewData["ScheduleMasterId"] = new SelectList(_context.ScheduleMaster.OrderBy(x => x.ScheduleDesciption), "ScheduleMasterId", "ScheduleDesciption", taskMaster.ScheduleMasterId); ViewData["SourceSystemId"] = new SelectList(_context.SourceAndTargetSystems.OrderBy(x => x.SystemName), "SystemId", "SystemName", taskMaster.SourceSystemId); ViewData["TargetSystemId"] = new SelectList(_context.SourceAndTargetSystems.OrderBy(x => x.SystemName), "SystemId", "SystemName", taskMaster.TargetSystemId); ViewData["TaskGroupId"] = new SelectList(_context.TaskGroup.OrderBy(x => x.TaskGroupName), "TaskGroupId", "TaskGroupName", taskMaster.TaskGroupId); ViewData["TaskTypeId"] = new SelectList(_context.TaskType.OrderBy(x => x.TaskTypeName), "TaskTypeId", "TaskTypeName", taskMaster.TaskTypeId); return(View(taskMaster)); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnRunExportAsync_Click(object sender, EventArgs e) { _onlineTaskMaster = null; try { var asyncTask = CreateAsyncExportTask(false); if (asyncTask != null) { _onlineTaskMaster = asyncTask; //Start the work running StartRunningAsyncTask(); } } catch (Exception ex) { MessageBox.Show("Error conifiguring export:" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void buttonRunInventorySite_Click(object sender, EventArgs e) { _onlineTaskMaster = null; try { var asyncTask = CreateAsyncInventoryTask(false); if (asyncTask != null) { _onlineTaskMaster = asyncTask; //Start the work running StartRunningAsyncTask(); } } catch (Exception ex) { MessageBox.Show("Error conifiguring inventory:" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public ActionResult SearchTaskMaster(string fromDate, string toDate, int?page) { List <TaskMaster> listitem = new List <TaskMaster>(); TaskMaster task = new TaskMaster(); if (fromDate != "" && fromDate != null) { task.fromDate = Convert.ToDateTime(fromDate); } if (toDate != "" && toDate != null) { task.toDate = Convert.ToDateTime(toDate); } listitem = task.SearchTaskMaster(); ViewData["Searchresult"] = listitem.ToPagedList(page ?? 1, 10); return(View()); }
public List <SelectListItem> GETDROPDOWNMEDICINE() { TaskMaster obj = new TaskMaster(); List <SelectListItem> symlist = new List <SelectListItem>(); if (obj.ProjectDropdowndata() != null) { foreach (DataRow dr in obj.dtresult.Rows) { SelectListItem slctitem = new SelectListItem(); slctitem.Value = dr["ProjectId"].ToString(); slctitem.Text = dr["Title"].ToString(); symlist.Add(slctitem); } } return(symlist); }
public ActionResult TaskDetails(string Id, string Comment, string Reply, Int64 TaskCommentId = 0) { TaskMaster task = new TaskMaster(); string UserId = User.Identity.GetUserId(); task = userContext.TaskMaster.Find(Id); var user = generic.GetUserDetail(UserId); string body = " has commented for the Task: "; bool Status = false; string CommentOrReplyBy = UserId; var result = false; if (!string.IsNullOrEmpty(Id) && !string.IsNullOrEmpty(Comment)) { result = emsMgr.AddTaskComments(Id, Comment, DateTime.Now, UserId); if (user.Role == "Admin") { admin.AddNotification(task.AssignedTo, CommentOrReplyBy, body + task.TaskId, "Task", task.TaskId, Status, DateTime.Now); } else { admin.AddNotification(task.CreatedBy, CommentOrReplyBy, body + task.TaskId, "Task", task.TaskId, Status, DateTime.Now); } } if (TaskCommentId != 0 && !string.IsNullOrEmpty(Reply)) { body = " has replied for the comment of Task: "; result = emsMgr.AddTaskReplies(TaskCommentId, Reply, DateTime.Now, UserId); if (user.Role == "Admin") { admin.AddNotification(task.AssignedTo, CommentOrReplyBy, body + task.TaskId, "Task", task.TaskId, Status, DateTime.Now); } else { admin.AddNotification(task.CreatedBy, CommentOrReplyBy, body + task.TaskId, "Task", task.TaskId, Status, DateTime.Now); } } return(RedirectToAction("TaskDetails", "Task", new { area = "CMS", Id = Id, AssignedTo = "", TaskStatus = 0 })); }
public ActionResult TaskMaster(TaskMaster objtskmaster) { string result = string.Empty; TaskMaster obj = new TaskMaster(); DateTime date = Convert.ToDateTime(objtskmaster.Date); obj.ProjectId = objtskmaster.ProjectId; obj.EmployeeId = Convert.ToInt32(User.Identity.Name.Split('|')[0]); obj.TaskTitle = objtskmaster.TaskTitle; obj.Date = date; obj.Duration = objtskmaster.Duration; obj.Reamrk = objtskmaster.Reamrk; result = obj.TaskMasterUID(); if (result != null && result != "") { return(Content("<script language='javascript' type='text/javascript'>alert('Task Added Successfully');window.location='/Task/TaskMaster';</script>")); } else { return(Content("<script language='javascript' type='text/javascript'>alert('Failed! Please try again later.');window.location='/Marketing/CreateLead';</script>")); } }
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { Label lblid = ((Label)GridView1.Rows[e.RowIndex].FindControl("Label2")); TextBox txtpname = (TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBox1"); //TextBox txttsname = (TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBox5"); //DropDownList ddle = ((DropDownList)GridView1.Rows[e.RowIndex].FindControl("DropDownList2")); TextBox txtSdate = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBox3")); TextBox txtEdate = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBox4")); int tid = Convert.ToInt16(lblid.Text); TaskMaster data = db.TaskMasters.Where(d => d.TaskId == tid).FirstOrDefault(); data.TaskName = txtpname.Text; data.StartDate = Convert.ToDateTime(txtSdate.Text); data.EndDate = Convert.ToDateTime(txtEdate.Text); db.SubmitChanges(); GridView1.EditIndex = -1; bindgrid(); //TextBox txtTdate = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBox6")); //DropDownList ddlp = ((DropDownList)GridView1.Rows[e.RowIndex].FindControl("DropDownList4")); //db.manage_taskmaster11(Convert.ToInt16(lblid.Text), txtpname.Text, Convert.ToInt16(ddle.SelectedValue), Convert.ToDateTime(txtSdate.Text), Convert.ToDateTime(txtEdate.Text), txttsname.Text, Convert.ToDateTime(txtTdate.Text), Convert.ToInt16(ddlp.SelectedValue), 2); //GridView1.EditIndex = -1; //bindgrid(); }
/// <summary> /// Add Task Detail /// </summary> /// <param name="taskMaster"></param> /// <param name="TenantID"></param> /// <param name="UserID"></param> /// <returns></returns> public int AddTaskDetails(TaskMaster taskMaster, int TenantID, int UserID) { int taskId = 0; try { conn.Open(); MySqlCommand cmd1 = new MySqlCommand("SP_createTask", conn); cmd1.Connection = conn; cmd1.Parameters.AddWithValue("@Ticket_ID", taskMaster.TicketID); cmd1.Parameters.AddWithValue("@TaskTitle", taskMaster.TaskTitle); cmd1.Parameters.AddWithValue("@TaskDescription", taskMaster.TaskDescription); cmd1.Parameters.AddWithValue("@DepartmentId", taskMaster.DepartmentId); cmd1.Parameters.AddWithValue("@FunctionID", taskMaster.FunctionID); cmd1.Parameters.AddWithValue("@AssignTo_ID", taskMaster.AssignToID); cmd1.Parameters.AddWithValue("@PriorityID", taskMaster.PriorityID); cmd1.Parameters.AddWithValue("@Tenant_Id", TenantID); cmd1.Parameters.AddWithValue("@Created_By", UserID); cmd1.CommandType = CommandType.StoredProcedure; taskId = Convert.ToInt32(cmd1.ExecuteNonQuery()); } catch (Exception) { throw; } finally { if (conn != null) { conn.Close(); } } return(taskId); }
/// <summary> /// Called to run us in commandn line mode /// </summary> /// <param name="commandLine"></param> internal void RunStartupCommandLine() { //Set up the UI to indicate we are going to run a commandl ine ShowSinglePanelHideOthers(panelRunCommandLine); textBoxErrors.Text = ""; textBoxStatus.Text = ""; TaskMaster task = null; //Parse the details from the command line try { task = TaskMaster.FromCommandLine(_startupCommandLine); } catch (Exception exParseCommandLine) { textBoxErrors.Text = "Error parsing command line: " + exParseCommandLine; } _onlineTaskMaster = task; //Set the work running StartRunningAsyncTask(); }
static public TaskMaster GetInstance() { if (instance == null){ if ( Brain.GetInstance() != null ) { instance = Brain.GetInstance().gameObject.GetComponent<TaskMaster>(); if (instance == null) instance = Brain.GetInstance().gameObject.AddComponent<TaskMaster>(); } } return instance; }
// Use this for initialization void Start () { tm = GameObject.Find ("Brain").GetComponent<TaskMaster>() as TaskMaster; }
public Computation ResolveUri(TaskMaster task_master, string uri, out LibraryFailure reason) { if (!uri.StartsWith("sql:")) { reason = LibraryFailure.Missing; return null; } reason = LibraryFailure.None; try { var param = new Dictionary<string, string>(); int first_colon = 5; while (first_colon < uri.Length && uri[first_colon] != ':') first_colon++; if (first_colon >= uri.Length) { return new FailureComputation(task_master, new ClrSourceReference(), "Bad provider in URI “" + uri + "”."); } var provider = uri.Substring(4, first_colon - 4); int question_mark = first_colon; while (question_mark < uri.Length && uri[question_mark] != '?') question_mark++; var uri_fragment = uri.Substring(first_colon + 1, question_mark - first_colon - 1); if (question_mark < uri.Length - 1) { foreach (var param_str in uri.Substring(question_mark + 1).Split(new []{'&'})) { if (param_str.Length == 0) continue; var parts = param_str.Split(new []{'='}, 2); if (parts.Length != 2) { return new FailureComputation(task_master, new ClrSourceReference(), "Bad parameter “" + param_str + "”."); } param[parts[0]] = parts[1]; } } string error; var connection = DbParser.Parse(provider, uri_fragment, param, out error); if (connection == null) { return new FailureComputation(task_master, new ClrSourceReference(), error ?? "Bad URI."); } connection.Open(); var connection_proxy = ReflectedFrame.Create(task_master, connection, connection_hooks); connection_proxy.Set("provider", new SimpleStringish(provider)); return new Precomputation(connection_proxy); } catch (Exception e) { return new FailureComputation(task_master, new ClrSourceReference(e), e.Message); } }
public Escape(TaskMaster master, SourceReference source_ref, Context context, Frame self, Frame container) { this.master = master; this.source_ref = source_ref; this.context = context; this.self = self; }
public ParseDouble(TaskMaster master, SourceReference source_ref, Context context, Frame self, Frame container) { this.master = master; this.source_reference = source_ref; this.context = context; }
public ParseInt(TaskMaster task_master, SourceReference source_ref, Context context, Frame self, Frame container) : base(task_master) { this.source_reference = source_ref; this.context = context; }
/// <summary> /// Creates the task we use to export a Tableau Server sites content to the local file system /// </summary> /// <returns></returns> private TaskMaster CreateAsyncImportTask(bool showPasswordInUi) { string siteUrl = txtUrlImportTo.Text; bool useAccessToken = (comboBoxAuthMethodImportTo.SelectedIndex == 1); string signInUser = txtIdImportTo.Text; string signInPassword = txtPasswordImportTo.Text; bool isSiteAdmin = chkImportIsSiteAdmin.Checked; string localPathImportFrom = txtSiteImportContentPath.Text; bool remapContentOwnership = chkImportRemapContentOwnership.Checked; //Check that this contains Workbooks or Data Sources; otherwise it's not a valid path with content if (!TaskMaster.IsValidImportFromDirectory(localPathImportFrom)) { throw new Exception("The import directory specified does not contain datasources/workbooks sub directories. Import aborted."); } //If there is a DB credentials file path make sure it actually points to a file string pathDBCredentials = GetDBCredentialsImportPath(); if (!string.IsNullOrWhiteSpace(pathDBCredentials)) { if (!File.Exists(pathDBCredentials)) { throw new Exception("The path to the db credentials file does not exist, " + pathDBCredentials); } } //---------------------------------------------------------------------- //Sanity test the sign in. If this fails, then there is no point in //moving forward //---------------------------------------------------------------------- bool signInTest = ValidateSignInPossible(siteUrl, useAccessToken, signInUser, signInPassword); if (!signInTest) { return(null); } var onlineUrls = TableauServerUrls.FromContentUrl(siteUrl, TaskMasterOptions.RestApiReponsePageSizeDefault); //Local path string localPathForSiteOutput = GeneratePathFromSiteUrl(onlineUrls); //Output file var nowTime = DateTime.Now; string localPathForOutputFile = Path.Combine(localPathForSiteOutput, FileIOHelper.FilenameWithDateTimeUnique("siteImport.csv", nowTime)); //Log file string localPathForLogFile = Path.Combine(localPathForSiteOutput, FileIOHelper.FilenameWithDateTimeUnique("siteImport_log.txt", nowTime)); //Errors file string localPathForErrorsFile = Path.Combine(localPathForSiteOutput, FileIOHelper.FilenameWithDateTimeUnique("siteImport_errors.txt", nowTime)); //Manual steps file string localPathForManualStepsFile = Path.Combine(localPathForSiteOutput, FileIOHelper.FilenameWithDateTimeUnique("siteImport_manualSteps.csv", nowTime)); //----------------------------------------------------------------- //Generate a command line //----------------------------------------------------------------- string commandLineAsText; CommandLineParser commandLineParsed; CommandLineParser.GenerateCommandLine_SiteImport( showPasswordInUi, localPathImportFrom, siteUrl, useAccessToken, signInUser, signInPassword, isSiteAdmin, chkRemapWorkbookDataserverReferences.Checked, pathDBCredentials, localPathForLogFile, localPathForErrorsFile, localPathForManualStepsFile, remapContentOwnership, chkVerboseLog.Checked, out commandLineAsText, out commandLineParsed); //Show the user the command line, so that they can copy/paste and run it txtSiteImportCommandLineExample.Text = PathHelper.GetApplicaitonPath() + " " + commandLineAsText; //===================================================================== //Create the task //===================================================================== return(TaskMaster.FromCommandLine(commandLineParsed)); }
public UtcNow(TaskMaster task_master, SourceReference source_ref, Context context, Frame self, Frame container) : base(task_master, source_ref, context, self, container) { }
public StringToCodepoints(TaskMaster task_master, SourceReference source_ref, Context context, Frame self, Frame container) : base(task_master) { this.source_reference = source_ref; this.context = context; this.container = self; }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Form1_FormClosing(object sender, FormClosingEventArgs e) { //Quit the work if its running... var task = _onlineTaskMaster; if(task != null) { task.Abort(); _onlineTaskMaster = null; } Application.Exit(); }
public static Frame Through(TaskMaster task_master, long id, SourceReference source_ref, long start, long end, Context context, Frame container) { var result = new Frame(task_master, id, source_ref, context, container); if (end < start) return result; for (long it = 0; it <= (end - start); it++) { result[TaskMaster.OrdinalNameStr(it + 1)] = start + it; } return result; }
/// <summary> /// Get an inventory of content on the specified server /// </summary> private TaskMaster CreateAsyncInventoryTask(bool showPasswordInUi) { string siteUrl = txtUrlInventoryFrom.Text; bool useAccessToken = (comboBoxAuthMethodInventoryFrom.SelectedIndex == 1); string signInUser = txtIdInventoryFromUserId.Text; string signInPassword = txtPasswordInventoryFrom.Text; bool isSystemAdmin = chkInventoryUserIsAdmin.Checked; var nowTime = DateTime.Now; //---------------------------------------------------------------------- //Sanity test the sign in. If this fails, then there is no point in //moving forward //---------------------------------------------------------------------- bool signInTest = ValidateSignInPossible(siteUrl, useAccessToken, signInUser, signInPassword); if (!signInTest) { return(null); } var onlineUrls = TableauServerUrls.FromContentUrl(siteUrl, TaskMasterOptions.RestApiReponsePageSizeDefault); //Local path string localPathForSiteOutput = GeneratePathFromSiteUrl(onlineUrls); //Output file string localPathForOutputFile = Path.Combine(localPathForSiteOutput, FileIOHelper.FilenameWithDateTimeUnique("siteInventory.csv", nowTime)); //Log file string localPathForLogFile = Path.Combine(localPathForSiteOutput, FileIOHelper.FilenameWithDateTimeUnique("siteInventory_log.txt", nowTime)); //Errors file string localPathForErrorsFile = Path.Combine(localPathForSiteOutput, FileIOHelper.FilenameWithDateTimeUnique("siteInventory_errors.txt", nowTime)); //----------------------------------------------------------------- //Generate a command line //----------------------------------------------------------------- string commandLineAsText; CommandLineParser commandLineParsed; CommandLineParser.GenerateCommandLine_SiteInventory( showPasswordInUi, localPathForOutputFile, siteUrl, useAccessToken, signInUser, signInPassword, isSystemAdmin, localPathForLogFile, localPathForErrorsFile, chkGenerateInventoryTwb.Checked, chkVerboseLog.Checked, out commandLineAsText, out commandLineParsed); //Show the user the command line, so that they can copy/paste and run it txtInventoryExampleCommandLine.Text = PathHelper.GetApplicaitonPath() + " " + commandLineAsText; //===================================================================== //Create the task //===================================================================== return(TaskMaster.FromCommandLine(commandLineParsed)); }
public static Frame MakeTime(DateTime time, TaskMaster task_master) { return(ReflectedFrame.Create <DateTime>(task_master, time, time_accessors)); }
public PrintResult(TaskMaster task_master, Computation source, string output_filename) { this.task_master = task_master; this.source = source; this.output_filename = output_filename; }
public CheckResult(TaskMaster task_master, System.Type test_target) : base(task_master) { this.test_target = test_target; }
/// <summary> /// Called after we have detected that the sync task has completed /// </summary> /// <param name="taskMaster"></param> void AsyncTaskDone_Reporting(TaskMaster taskMaster) { //Get the status from the backtround task string statusText = taskMaster.StatusLog.StatusText; string errorCountText = ""; int errorCount = taskMaster.StatusLog.ErrorCount; if (errorCount > 0) { errorCountText = " " + errorCount.ToString() + " errors"; } statusText = statusText + "\r\n\r\n" + DateTime.Now.ToString() + " Done." + errorCountText + "\r\n"; textBoxStatus.Text = statusText; ScrollToEndOfTextbox(textBoxStatus); textBoxErrors.Text = taskMaster.StatusLog.ErrorText; //If there is a manual steps file, shell it var manualStepsFile = taskMaster.PathToManualStepsReport; if(!string.IsNullOrWhiteSpace(manualStepsFile)) { AttemptToShellFile(manualStepsFile); } //If the job was to take a site inventory,show the report if (taskMaster.JobName == TaskMaster.JobName_SiteInventory) { //First, see if we have a generated *.twb file string inventoryFile = taskMaster.PathToSiteInventoryReportTwb; //Second, if we don't have a *.twb file, see if we have a *.csv file of the raw data if(string.IsNullOrWhiteSpace(inventoryFile)) { inventoryFile = taskMaster.PathToSiteInventoryReportCsv; } //If we have either file, shell it if (!string.IsNullOrWhiteSpace(inventoryFile)) { AttemptToShellFile(inventoryFile); } } else if(taskMaster.JobName == TaskMaster.JobName_SiteExport) { //We want to shell the file explorer to show the path we have just exported to string exportDirectory = taskMaster.PathToExportTo; if(!string.IsNullOrWhiteSpace(exportDirectory)) { AttemptToShellFile(Path.Combine(exportDirectory, ".")); } } }
public CheckResult(TaskMaster task_master, System.Type test_target) { this.task_master = task_master; this.test_target = test_target; }
/// <summary> /// Called to run us in commandn line mode /// </summary> /// <param name="commandLine"></param> internal void RunStartupCommandLine() { //Set up the UI to indicate we are going to run a commandl ine ShowSinglePanelHideOthers(panelRunCommandLine); textBoxErrors.Text = ""; textBoxStatus.Text = ""; TaskMaster task = null; //Parse the details from the command line try { task = TaskMaster.FromCommandLine(_startupCommandLine); } catch(Exception exParseCommandLine) { textBoxErrors.Text = "Error parsing command line: " + exParseCommandLine; } _onlineTaskMaster = task; //Set the work running StartRunningAsyncTask(); }
public Frame(TaskMaster task_master, long id, SourceReference source_ref, Context context, Frame container) { this.task_master = task_master; SourceReference = source_ref; Context = Context.Prepend(this, context); Container = container ?? this; Id = TaskMaster.OrdinalName(id); }