public Estimate CreateEstimate() { Estimate temp = new Estimate(); DateTime? nullDate = null; temp.JobName = this.currentProspect.Id; var giggles = DAL.User.GetUserFromLogin(Page.User.Identity.Name); temp.Estimator = giggles.Id; temp.EstimateNumber = Estimate.GetNextEstimateNumberForJob(currentProspect.Id); temp.Received = DateTime.Now; temp.Priority = Estimate.GetNextPriority(); temp.ReadyForEstimating = true; temp.Received = DateTime.Now; temp.CurrentStatus = DateTime.Now.ToString("d") + " - Received by Estimating."; temp.EstimateSent = false; temp.EstimateSentDate = nullDate; temp.EstimatesDirectory = currentProspect.DirectoryPathExec; temp.ProspectDirectory = currentProspect.DirectoryPath; temp.Save(); DAL.User estimator = new DAL.User(temp.Estimator); EstimateTimeline tempStep = new EstimateTimeline(); tempStep.EstimateID = temp.Id; tempStep.WorkflowStepID = 131; tempStep.StepX = 0; tempStep.ResponsibleUserID = temp.Estimator; tempStep.DateTimeStamp = DateTime.Now; tempStep.DisplayText = DateTime.Now.ToString("d") + " - Received by Estimating. Assigned to " + estimator.Name; tempStep.Save(); CreateEstNumberDir(temp.EstimateNumber); BindControls(Estimate.Filter.Active); return temp; }
protected void cmdSubmitEst_Clicked(object sender, EventArgs e) { currentProspect = new DAL.Project(activeSalesQueueItem.JobName); currentEstimator = new DAL.User(activeSalesQueueItem.Estimator); currentSalesperson = new DAL.User(currentProspect.SalespersonID); activeSalesQueueItem.ReadyForEstimating = true; activeSalesQueueItem.StepID = 131; activeSalesQueueItem.CurrentStatus = DateTime.Now.ToString("d") + " - Received by Estimating. Assigned to " + currentEstimator.Name; activeSalesQueueItem.Priority = Estimate.GetNextPriority(); activeSalesQueueItem.Save(); EstimateTimeline newStep = new EstimateTimeline(); newStep.EstimateID = activeSalesQueueItem.Id; newStep.DateTimeStamp = DateTime.Now; newStep.DisplayText = activeSalesQueueItem.CurrentStatus; newStep.ResponsibleUserID = activeSalesQueueItem.Estimator; newStep.StepX = 0; newStep.WorkflowStepID = 131; newStep.Save(); EmailSalesperson(); BindControls(); }
protected void lstEstimateTimeline_SelectedIndexChanged(object sender, EventArgs e) { EstimateTimeline step = new EstimateTimeline(int.Parse(lstTimeline.SelectedValue)); Workflow wf = new Workflow(step.WorkflowStepID); // Populate editing fields with selected timeline step details lblStep.Text = wf.Action; PopulateResponsibleUserList(step.WorkflowStepID, "Edit"); ddlResponsibleEdit.SelectedValue = step.ResponsibleUserID.ToString(); txtDateTimeStampEdit.Text = step.DateTimeStamp.ToString("d"); txtAdditionalInfoEdit.Text = step.Comments; }
protected void cmdEditStep_Click(object sender, EventArgs e) { // Retrieve timeline record int timelineID = int.Parse(lstTimeline.SelectedValue); EstimateTimeline temp = new EstimateTimeline(timelineID); // Make updates to fields based on user entry temp.Comments = txtAdditionalInfoEdit.Text; temp.DateTimeStamp = DateTime.Parse(txtDateTimeStampEdit.Text); temp.ResponsibleUserID = int.Parse(ddlResponsibleEdit.SelectedValue); Workflow step = new Workflow(temp.WorkflowStepID); // Generate displayed status string for timeline step string status = SetEstimateStatus(step, temp.DateTimeStamp, "Edit"); // If this is the current step for the Estimate, apply changes to Displayed status. if (temp.WorkflowStepID == currentEstimate.StepID) { // if additional info present, append to comments field if (step.Id == 126 || step.Id == 132 || step.Id == 134 || step.Id == 133) { status += " - " + txtAdditionalInfoEdit.Text; temp.Comments = txtAdditionalInfoEdit.Text; currentEstimate.CurrentStatus = status; } else { currentEstimate.CurrentStatus = status; } // only save CurrentEstimate if we're updating the current status... currentEstimate.Save(); } temp.DisplayText = status; temp.Save(); lblCurrentStatus.Text = status; // Repopulate the estimate timeline lstTimeline.DataSource = Estimate.GetCurrentEstimateTimeline(currentEstimate.Id); lstTimeline.DataTextField = "DisplayText"; lstTimeline.DataValueField = "Id"; lstTimeline.DataBind(); // RE POPULATE ddlWorkflowStep with remaining steps for estimate ddlWorkflowStep.DataSource = Workflow.GetRemainingStepsForEstimate(currentEstimate.StatusID); ddlWorkflowStep.DataTextField = "Action"; ddlWorkflowStep.DataValueField = "ID"; ddlWorkflowStep.DataBind(); }
protected void cmdDelTimelineStep_Click(object sender, EventArgs e) { // received step cannot be deleted EstimateTimeline step = new EstimateTimeline(int.Parse(lstTimeline.SelectedItem.Value)); if (step.StepX == 0) return; EstimateTimeline.Delete(int.Parse(lstTimeline.SelectedItem.Value)); // Repopulate the estimate timeline lstTimeline.DataSource = Estimate.GetCurrentEstimateTimeline(currentEstimate.Id); lstTimeline.DataTextField = "DisplayText"; lstTimeline.DataValueField = "Id"; lstTimeline.DataBind(); EstimateTimeline temp = EstimateTimeline.GetCurrentTimelineStep(currentEstimate.Id); if (step.WorkflowStepID == 123) { DateTime? nulDate = null; currentEstimate.EstimateSent = false; currentEstimate.EstimateSentDate = nulDate; } currentEstimate.StatusID = int.Parse(temp.StepX.ToString()); currentEstimate.CurrentStatus = temp.DisplayText; lblCurrentStatus.Text = temp.DisplayText; currentEstimate.Save(); // RE POPULATE ddlWorkflowStep with remaining steps for estimate ddlWorkflowStep.DataSource = Workflow.GetRemainingStepsForEstimate(currentEstimate.StatusID); ddlWorkflowStep.DataTextField = "Action"; ddlWorkflowStep.DataValueField = "ID"; ddlWorkflowStep.DataBind(); }
protected void cmdAddStep_Click(object sender, EventArgs e) { // Populate and save step into timeline for this estimate EstimateTimeline newTimelineStep = new EstimateTimeline(); // Retrieve workflow step information Workflow currentWorkflowStep = new Workflow("Action", ddlWorkflowStep.SelectedItem.Text); // Management Review step has no responsible user - at this point DAL.User respUser; if (ddlResponsible.SelectedItem != null) { respUser = new User(int.Parse(ddlResponsible.SelectedItem.Value)); newTimelineStep.ResponsibleUserID = respUser.Id; } // set date and time for occurrence of current step DateTime stamp = DateTime.Now; // write values into new timeline step newTimelineStep.EstimateID = currentEstimate.Id; newTimelineStep.WorkflowStepID = currentWorkflowStep.Id; newTimelineStep.StepX = currentWorkflowStep.StepX; newTimelineStep.DateTimeStamp = stamp; // if user input of additional info is necessary, append to comments field if (currentWorkflowStep.Id == 126 || currentWorkflowStep.Id == 132 || currentWorkflowStep.Id == 134 || currentWorkflowStep.Id == 133) newTimelineStep.Comments = txtAdditionalInformation.Text; newTimelineStep.Save(); // if this is the final "Sent" workflow step remove the Outlook folder and // MoveOutlookFolder(currentProspect.ProjectNumber + " - " + currentProspect.ProjectName, "Sent"); // Perform any associated workflow items for this step WorkflowStep(currentWorkflowStep); // update current estimate fields string status = SetEstimateStatus(currentWorkflowStep, stamp, "Add"); if (currentWorkflowStep.Id == 126 || currentWorkflowStep.Id == 132 || currentWorkflowStep.Id == 133 || currentWorkflowStep.Id == 134) { currentEstimate.CurrentStatus = status + " - " + txtAdditionalInformation.Text; newTimelineStep.DisplayText = status + " - " + txtAdditionalInformation.Text; } else { currentEstimate.CurrentStatus = status; newTimelineStep.DisplayText = status; } if (currentWorkflowStep.Id == 126 || currentWorkflowStep.Id == 133) { currentEstimate.ReadyForEstimating = false; } currentEstimate.StepID = currentWorkflowStep.Id; currentEstimate.StatusID = currentWorkflowStep.StepX; newTimelineStep.Save(); // Save current estimate and clear entry fields SaveEstimate(); txtAdditionalInformation.Text = ""; // Repopulate the estimate timeline lstTimeline.DataSource = Estimate.GetCurrentEstimateTimeline(currentEstimate.Id); lstTimeline.DataTextField = "DisplayText"; lstTimeline.DataValueField = "Id"; lstTimeline.DataBind(); // RE POPULATE ddlWorkflowStep with remaining steps for estimate ddlWorkflowStep.DataSource = Workflow.GetRemainingStepsForEstimate(currentEstimate.StatusID); ddlWorkflowStep.DataTextField = "Action"; ddlWorkflowStep.DataValueField = "ID"; ddlWorkflowStep.DataBind(); lblCurrentStatus.Text = currentEstimate.CurrentStatus; }
public void Insert(int EstimateID,int WorkflowStepID,int StepX,int? ResponsibleUserID,DateTime DateTimeStamp,string DisplayText,string Comments) { EstimateTimeline item = new EstimateTimeline(); item.EstimateID = EstimateID; item.WorkflowStepID = WorkflowStepID; item.StepX = StepX; item.ResponsibleUserID = ResponsibleUserID; item.DateTimeStamp = DateTimeStamp; item.DisplayText = DisplayText; item.Comments = Comments; item.Save(UserName); }
public void Update(int Id,int EstimateID,int WorkflowStepID,int StepX,int? ResponsibleUserID,DateTime DateTimeStamp,string DisplayText,string Comments) { EstimateTimeline item = new EstimateTimeline(); item.MarkOld(); item.IsLoaded = true; item.Id = Id; item.EstimateID = EstimateID; item.WorkflowStepID = WorkflowStepID; item.StepX = StepX; item.ResponsibleUserID = ResponsibleUserID; item.DateTimeStamp = DateTimeStamp; item.DisplayText = DisplayText; item.Comments = Comments; item.Save(UserName); }