public void OverwritePlanStatus(PlanStatus s) { if (s == planStatus) { return; } planStatus = s; planStatusLabel.Text = PlanStatusDic[s]; }
public ActionResult Edit([Bind(Include = "Id,Name,IsCompleted")] PlanStatus planStatus) { if (ModelState.IsValid) { db.Entry(planStatus).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(planStatus)); }
public Plan(Task root, string planName) { this.planName = planName; var tasks = root.DecomposeTask(); rootTask = root; nextTask = new Queue <Task>(tasks); currentTask = nextTask.Dequeue(); planStatus = PlanStatus.InProgress; }
public async Task <IActionResult> Create([Bind("Id,PlanStatusName")] PlanStatus planStatus) { if (ModelState.IsValid) { _context.Add(planStatus); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(planStatus)); }
public ActionResult Create([Bind(Include = "Id,Name,IsCompleted")] PlanStatus planStatus) { if (ModelState.IsValid) { db.PlanStatus.Add(planStatus); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(planStatus)); }
public IActionResult Insert([Bind("Name")] PlanStatus status) { if (ModelState.IsValid) { var result = _planStatusRepository.Insert(status); var lastPlan = result ? _planStatusRepository.GetLastInserted() : null; var uri = Url.Action("Get", new { Id = lastPlan.Id, Version = "1.0" }); return(Created(uri, lastPlan)); } return(BadRequest()); }
public void ParsePlanStatusTest() { //arrange string s = "In force"; string u = "fjg9odjfgd"; //act PlanStatus status = MLFSPlan.ParsePlanStatus(s); PlanStatus status2 = MLFSPlan.ParsePlanStatus(u); //assert Assert.AreEqual(PlanStatus.InForce, status, "Status not in force"); Assert.AreEqual(PlanStatus.Unknown, status2, "Status not set to unknown where no match"); }
// GET: PlanStatus/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PlanStatus planStatus = db.PlanStatus.Find(id); if (planStatus == null) { return(HttpNotFound()); } return(View(planStatus)); }
static void CreatePlanStatus() { PlanStatus planStatus = new PlanStatus(); Console.Write("Nome do novo status: "); planStatus.Name = Console.ReadLine(); PlanStatus insertedStatus = _planModuleDB.DataPlanStatus.Save(planStatus); if (insertedStatus != null) { Console.WriteLine("Inserido com sucesso!"); _listPlanStatus.Add(insertedStatus); } }
/// <summary> /// Convert a string into PlanStatus handles nulls/blanks and no match using Unknown /// </summary> /// <param name="s">The string to convert</param> /// <returns></returns> public static PlanStatus ParsePlanStatus(string s) { PlanStatus status = PlanStatus.Unknown; s = s.Replace(" ", string.Empty); try { status = (PlanStatus)Enum.Parse(typeof(PlanStatus), s, true); } catch (Exception) { status = PlanStatus.Unknown; } return(status); }
public Task OnTrialStateChangedAsync(PlanStatus status) { switch (status) { case PlanStatus.TrialStarted: Start(); break; case PlanStatus.Expired: case PlanStatus.Paid: Stop(); break; } return(Task.CompletedTask); }
protected void HistoryGridView_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { var plan = new InvestmentPlatformPlan(int.Parse(e.Row.Cells[2].Text)); e.Row.Cells[2].Text = plan.Name; //Money Returned var returnedMoney = Money.Parse(e.Row.Cells[3].Text); e.Row.Cells[3].Text = returnedMoney.ToString(); //Money to Return var moneyToReturn = Money.Parse(e.Row.Cells[4].Text); e.Row.Cells[4].Text = moneyToReturn.ToString(); //Money in System e.Row.Cells[5].Text = Money.Parse(e.Row.Cells[5].Text).ToString(); if (returnedMoney >= moneyToReturn) { e.Row.Cells[3].ForeColor = System.Drawing.Color.Green; } else { e.Row.Cells[3].ForeColor = System.Drawing.Color.DarkRed; } var Type = (PurchaseBalances)Convert.ToInt32(e.Row.Cells[6].Text); switch (Type) { case PurchaseBalances.Purchase: e.Row.Cells[6].Text = U6012.PURCHASEBALANCE; break; case PurchaseBalances.Cash: e.Row.Cells[6].Text = U5008.CASHBALANCE; break; default: break; } PlanStatus status = (PlanStatus)Convert.ToInt32(e.Row.Cells[7].Text); e.Row.Cells[7].Text = HtmlCreator.GetColoredStatus(status); } }
public IList <PlanHistory> getHistory() { string connectionString = "Data Source=FORLOGIC357;Initial Catalog=PLANNER;" + "Integrated Security=True"; string sqlQuery = "SELECT * FROM plan_history"; PlanStatusDAO psDAO = new PlanStatusDAO(); PlanDAO planDAO = new PlanDAO(); using (SqlConnection connection = new SqlConnection(connectionString)) { SqlCommand command = new SqlCommand(sqlQuery, connection); try { connection.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { Plan p = planDAO.getOnePlan((int)reader[1]); PlanStatus ps = psDAO.getOneStatus((int)reader[2]); PlanHistory ph = new PlanHistory((int)reader[0], p, ps, (DateTime)reader[3]); this.planHistoryList.Add(ph); } reader.Close(); return(this.planHistoryList); } catch (Exception ex) { Console.WriteLine(ex.Message); return(this.planHistoryList); } finally { connection.Close(); } } }
static void UpdatePlanStatus() { Console.Write("Id do status: "); int id = int.Parse(Console.ReadLine()); PlanStatus status = _listPlanStatus.Find(s => s.Id == id); Console.WriteLine(status); Console.Write("Nome: "); status.Name = Console.ReadLine(); PlanStatus updatedPlanStatus = _planModuleDB.DataPlanStatus.Save(status); if (updatedPlanStatus != null) { Console.WriteLine("Editado com sucesso!"); PlanStatus planStatusLocal = _listPlanStatus.ToList().Find(s => s.Id == id); planStatusLocal.Name = updatedPlanStatus.Name; } }
public IActionResult Create([FromBody] PlanStatus plan) { try { if (ModelState.IsValid) { plan.Id = 0; var createdPlanStatus = ConnectionDB.PlansModule.DataPlanStatus.Save(plan); if (createdPlanStatus != null) { return(Ok(new { createdPlanStatus.Id })); } } return(BadRequest("The plan'status object received isn't valid")); } catch (Exception e) { ErrorResponse errorResponse = ErrorResponse.From(e); return(StatusCode(500, errorResponse)); } }
public IList <PlanStatus> getStatus() { string connectionString = "Data Source=FORLOGIC357;Initial Catalog=PLANNER;" + "Integrated Security=True"; string sqlQuery = "SELECT * FROM plan_status"; PlanStatus ps = null; using (SqlConnection connection = new SqlConnection(connectionString)) { SqlCommand command = new SqlCommand(sqlQuery, connection); try { connection.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { ps = new PlanStatus((string)reader[1], (int)reader[0]); this.statusList.Add(ps); } reader.Close(); return(this.statusList); } catch (Exception ex) { Console.WriteLine(ex.Message); return(this.statusList); } finally { connection.Close(); } } }
public PlanStatus getOneStatus(int id) { string connectionString = "Data Source=FORLOGIC357;Initial Catalog=PLANNER;" + "Integrated Security=True"; string sqlQuery = "SELECT * FROM plan_status WHERE id = @id"; PlanStatus ps = null; using (SqlConnection connection = new SqlConnection(connectionString)) { SqlCommand command = new SqlCommand(sqlQuery, connection); command.Parameters.AddWithValue("@id", id); try { connection.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { ps = new PlanStatus((string)reader[1], (int)reader[0]); } reader.Close(); return(ps); } catch (Exception ex) { Console.WriteLine(ex.Message); return(ps); } finally { connection.Close(); } } }
public List <PlanStatus> GetAllPlansStatus() { List <PlanStatus> list = null; _data.ExecuteCmd("dbo.InsurancePlansStatus_SelectAll", null, delegate(IDataReader reader, short set) { PlanStatus plan = new PlanStatus(); int index = 0; plan.Id = reader.GetSafeInt32(index++); plan.Name = reader.GetSafeString(index++); if (list == null) { list = new List <PlanStatus>(); } list.Add(plan); }); return(list); }
public IActionResult Update([FromBody] PlanStatus planStatus) { try { if (ModelState.IsValid) { if (planStatus.Id <= 0) { return(BadRequest($"The plan'status id is required or is invalid: {planStatus.Id}")); } var updatedPlanStatus = ConnectionDB.PlansModule.DataPlanStatus.Save(planStatus); if (updatedPlanStatus != null) { return(Ok()); } } return(BadRequest()); } catch (Exception e) { ErrorResponse errorResponse = ErrorResponse.From(e); return(StatusCode(500, errorResponse)); } }
public static string GetColoredStatus(PlanStatus status) { if (status == PlanStatus.Active) { return("<span style=\"color:#519a06\">" + L1.ACTIVE + "</span>"); } if (status == PlanStatus.Paused) { return("<span style=\"color:#CC9933\">" + L1.PAUSED + "</span>"); } if (status == PlanStatus.Removed) { return("<span style=\"color:#CC0000\">" + U6010.REMOVED + "</span>"); } if (status == PlanStatus.Finished) { return("<span style=\"color:#660099\">" + L1.FINISHED + "</span>"); } return(""); //for compilator }
public void TrialStatus_ShouldBe_MappedFromVpnPlan_AndExpirationTime(string vpnPlan, int expirationTime, PlanStatus expected) { // Arrange var user = new Core.Models.User { VpnPlan = vpnPlan, ExpirationTime = expirationTime }; // Act var result = user.TrialStatus(); // Assert result.Should().Be(expected); }
internal void ReadData(System.IO.StreamReader Reader) { string curLine = Reader.ReadLine(); while (curLine != null) { int tmpIndex = curLine.IndexOf('#'); if (tmpIndex > -1) { curLine = curLine.Substring(tmpIndex); } curLine = curLine.Trim(); if (curLine.ToUpper().StartsWith("NAME=")) { name = curLine.Substring("NAME=".Length); } if (curLine.ToUpper().StartsWith("SOURCE=")) { source = curLine.Substring("SOURCE=".Length); } if (curLine.ToUpper().StartsWith("DESTINATION=")) { dest = curLine.Substring("DESTINATION=".Length); } if (curLine.ToUpper().StartsWith("ALLOWFILE=")) { AddAllowFile(curLine.Substring("ALLOWFILE=".Length)); } if (curLine.ToUpper().StartsWith("BLOCKFILE=")) { AddBlockFile(curLine.Substring("BLOCKFILE=".Length)); } if (curLine.ToUpper().StartsWith("ALLOWDIRECTORY=")) { AddAllowDir(curLine.Substring("ALLOWDIRECTORY=".Length)); } if (curLine.ToUpper().StartsWith("BLOCKDIRECTORY=")) { AddBlockDir(curLine.Substring("BLOCKDIRECTORY=".Length)); } if (curLine.ToUpper().StartsWith("PROJECTFILE=")) { AddProjectFile(curLine.Substring("PROJECTFILE=".Length)); } if (curLine.ToUpper().StartsWith("LASTRUN=")) { lastRun = DateTime.Parse(curLine.Substring("LASTRUN=".Length)); } if (curLine.ToUpper().StartsWith("LASTATTEMPT=")) { lastAttempt = DateTime.Parse(curLine.Substring("LASTATTEMPT=".Length)); } if (curLine.ToUpper().StartsWith("TIMESPAN=")) { timeSpan = int.Parse(curLine.Substring("TIMESPAN=".Length)); } if (curLine.ToUpper().StartsWith("RETRYTIMESPAN=")) { retryTimeSpan = int.Parse(curLine.Substring("RETRYTIMESPAN=".Length)); } if (curLine.ToUpper().StartsWith("TIMESPANTYPE=")) { timeSpanType = (DPend_Backup.TimeSpanType) int.Parse(curLine.Substring("TIMESPANTYPE=".Length)); } if (curLine.ToUpper().StartsWith("RETRYTIMESPANTYPE=")) { retryTimeSpanType = (DPend_Backup.TimeSpanType) int.Parse(curLine.Substring("RETRYTIMESPANTYPE=".Length)); } if (curLine.ToUpper().StartsWith("LASTFILECOUNT=")) { lastFileCount = long.Parse(curLine.Substring("LASTFILECOUNT=".Length)); } if (curLine.ToUpper().StartsWith("LASTFILESIZE=")) { lastFileSize = long.Parse(curLine.Substring("LASTFILESIZE=".Length)); } if (curLine.ToUpper().StartsWith("FILESTOKEEP=")) { filesToKeep = int.Parse(curLine.Substring("FILESTOKEEP=".Length)); } if (curLine.ToUpper().StartsWith("WORKERS=")) { numWorkers = int.Parse(curLine.Substring("WORKERS=".Length)); } if (curLine.ToUpper().StartsWith("STATUS=")) { status = (PlanStatus)int.Parse(curLine.Substring("STATUS=".Length)); } if (curLine.ToUpper().StartsWith("SOURCETYPE=")) { sourceType = (LocationType)int.Parse(curLine.Substring("SOURCETYPE=".Length)); } if (curLine.ToUpper().StartsWith("DESTINATIONTYPE=")) { destType = (LocationType)int.Parse(curLine.Substring("DESTINATIONTYPE=".Length)); } if (curLine.ToUpper() == "[END PLAN]") { curLine = null; } else { curLine = Reader.ReadLine(); } } }
public void OverwritePlanStatusOther(string s) { planStatus = PlanStatus.Other; planStatusLabel.Text = s; }
/// <summary> /// 设置计划编辑处理状态 /// </summary> /// <param name="status">计划编辑处理状态</param> public void SetPlanStatus(PlanStatus status) { switch (status) { case PlanStatus.草稿: Status = PlanStatus.草稿; break; case PlanStatus.待审核: Status = PlanStatus.待审核; break; case PlanStatus.已审核: Status = PlanStatus.已审核; IsValid = true; break; case PlanStatus.已提交: Status = PlanStatus.已提交; IsFinished = true; SubmitDate = DateTime.Now; break; case PlanStatus.退回: Status = PlanStatus.退回; break; default: throw new ArgumentOutOfRangeException("status"); } }
private void InvokeStateChange(PlanStatus status) { StateChanged?.Invoke(this, status); }
private List <PlanStatus> getData() { StringBuilder oBuild = new StringBuilder(); Msg msg = PlanStatusModel.GetUnFillPlans();//获取未完成的项目 List <PlanStatus> list = new List <PlanStatus>(); if (msg.Status) { List <Tbl_Plan> lPlans = msg.UserData as List <Tbl_Plan>;//项目署 for (int i = 0; i < lPlans.Count; i++) { PlanStatus status = new PlanStatus(); status.PlanName = lPlans[i].ProjectName; status.PlanAdm = "已确认"; status.Design = "已确认"; int PlanCount = PlanStatusModel.NGetMateriesCountById(lPlans[i].PlanID);//获取项目的数量 if (PlanCount != 0) { List <Tbl_ProductStorage> lProduct = PlanStatusModel.GetPlanPercentById(lPlans[i].PlanID, (int)TableType.加工中心).UserData as List <Tbl_ProductStorage>; List <Tbl_CenterStorage> lCenter = PlanStatusModel.GetPlanPercentById(lPlans[i].PlanID, (int)TableType.中心仓储).UserData as List <Tbl_CenterStorage>; List <Tbl_SiteStorage> lSite = PlanStatusModel.GetPlanPercentById(lPlans[i].PlanID, (int)TableType.现场仓储).UserData as List <Tbl_SiteStorage>; int iPCount = 0; int iCCount = 0; int iSCount = 0; foreach (Tbl_ProductStorage oPro in lProduct) { iPCount += oPro.InCount == null ? 0 : (int)oPro.InCount; } foreach (Tbl_CenterStorage oPro in lCenter) { iCCount += oPro.InCount == null ? 0 : (int)oPro.InCount; } foreach (Tbl_SiteStorage oPro in lSite) { iSCount += oPro.InCount == null ? 0 : (int)oPro.InCount; } string sProduct = (((float)iPCount / PlanCount) * 100).ToString(); string sCenter = (((float)iCCount / PlanCount) * 100).ToString(); string sSite = (((float)iSCount / PlanCount) * 100).ToString(); if (iPCount == 0) { status.Produnt = "加工中心已完成: " + sProduct + "%"; // oBuild.Append("<spam>项目:" + lPlans[i].PlanID + "></span><span >项目主管确定-></span><span >设计主管确定-></span><span >加工中心已完成: " + sProduct + "%-></span>"); } else if (iCCount == 0) { status.Produnt = "加工中心已完成: " + sProduct + "%"; status.Center = "中心仓储已完成: " + sCenter + "%"; } // oBuild.Append("<spam>项目:" + lPlans[i].PlanID + "></span><span >项目主管确定-></span><span >设计主管确定-></span><span>加工中心已完成: " + sProduct + "%-></span> <span>中心仓储已完成: " + sCenter + "%-></span>"); else if (iSCount == 0) { status.Produnt = "加工中心已完成: " + sProduct + "%"; status.Center = "中心仓储已完成: " + sCenter + "%"; status.Site = "现场仓储已完成: " + sSite + "%"; } else { } } else { status.Produnt = "加工中心已完成: " + 0 + "%"; status.Center = "中心仓储已完成: " + 0 + "%"; status.Site = "现场仓储已完成: " + 0 + "%"; } list.Add(status); } } return(list); }