public ActionResult AssignTask([Bind(Include = "Description, EmployeeId")] GTask task) { if (User.Identity.IsAuthenticated) { Guid userId = Guid.Parse(User.Identity.GetUserId()); var emp = db.Employees.Find(userId); if (emp.IsManager) { if (ModelState.IsValid) { task.DateAssigned = DateTime.Now; task.IsDone = false; db.Tasks.Add(task); db.SaveChanges(); Employee employee = db.Employees.Find(task.EmployeeId); Productivity.TeamProductivity(employee.Team); Productivity.CalculateProductivity(employee); Productivity.TeamProductivity(employee.Team); db.Entry(employee).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Edit", employee)); } return(View(task)); } return(new HttpStatusCodeResult(HttpStatusCode.Unauthorized)); } return(RedirectToAction("Login", "Account")); }
private void button1_Click(object sender, EventArgs e) { try { int billCorrection = Int32.Parse(textBox1.Text); int billCreation = Int32.Parse(textBox2.Text); int monthlyPayment = Int32.Parse(textBox3.Text); int contract = Int32.Parse(textBox4.Text); int meterReading = Int32.Parse(textBox5.Text); int bonus = Int32.Parse(textBox6.Text); int paymentCirculation = Int32.Parse(textBox7.Text); int collection = Int32.Parse(textBox8.Text); int billPlausibility = Int32.Parse(textBox9.Text); int workedTime = Int32.Parse(textBox10.Text); int other = Int32.Parse(textBox11.Text); int masterData = Int32.Parse(textBox12.Text); Productivity prod = new Productivity(billCorrection, billCreation, contract, meterReading, bonus, paymentCirculation, collection, monthlyPayment, billPlausibility, other, workedTime, masterData); label14.Text = (prod.productivity()).ToString() + " %"; } catch (FormatException) { MessageBox.Show("You must enter a number for each case type! Please try again!"); } }
private void ProductivityControl_Load(object sender, EventArgs e) { if (!_unitOfWork.CheckConection(new CasesControlEntities())) { return; } var b = new Productivity(_unitOfWork, IsAdministrationOn) { WindowState = FormWindowState.Maximized, MdiParent = this }; b.Show(); }
private void button10_Click(object sender, EventArgs e) { try { int billCorrection = Int32.Parse(textBox27.Text); int billCreation = Int32.Parse(textBox26.Text); int monthlyPayment = Int32.Parse(textBox25.Text); int contract = Int32.Parse(textBox33.Text); int meterReading = Int32.Parse(textBox34.Text); int bonus = Int32.Parse(textBox31.Text); int paymentCirculation = Int32.Parse(textBox29.Text); int collection = Int32.Parse(textBox30.Text); int billPlausibility = Int32.Parse(textBox35.Text); int workedTime = Int32.Parse(textBox28.Text); int other = Int32.Parse(textBox36.Text); int masterData = Int32.Parse(textBox32.Text); Productivity produc = new Productivity(billCorrection, billCreation, contract, meterReading, bonus, paymentCirculation, collection, monthlyPayment, billPlausibility, other, workedTime, masterData); if (produc.productivity() >= 80) { label62.Text = "Minimum productivity met!"; } else { double percentLeft = 80 - produc.productivity(); double timeLeft = (percentLeft / 100) * 480; textBox27.Text = String.Format("{0:0.0}", timeLeft / 7); textBox26.Text = String.Format("{0:0.0}", timeLeft / 4); textBox25.Text = String.Format("{0:0.0}", timeLeft / 2); textBox33.Text = String.Format("{0:0.0}", timeLeft); textBox34.Text = String.Format("{0:0.0}", timeLeft); textBox31.Text = String.Format("{0:0.0}", timeLeft / 2); textBox29.Text = String.Format("{0:0.0}", timeLeft); textBox30.Text = String.Format("{0:0.0}", timeLeft); textBox35.Text = String.Format("{0:0.0}", timeLeft / 5); textBox36.Text = String.Format("{0:0.0}", timeLeft); textBox32.Text = String.Format("{0:0.0}", timeLeft); label62.Text = "Minimul productivity not met!"; } }catch (FormatException) { MessageBox.Show("You must enter numbers only!Please try again!"); } }
protected async override Task AddAsync(FarmingEntities db, ProductivityViewModel model) { var productivity = new Productivity() { CowId = model.CowId, UchtenoLaktacij = model.UchtenoLaktacij.Value, UdojKg = model.UdojKg.Value, ZhirProz = model.ZhirProz.Value, BelokProz = model.BelokProz.Value, Date = model.Date.Value }; db.Productivities.Add(productivity); await db.SaveChangesAsync(); model.Id = productivity.Id; Models.Add(model); }
public OutProductivity GetProductivity(string executiveID) { string connectionString = DataBaseHelper.GetConnectionString("DLG"); OutProductivity response = new OutProductivity(); var ora = new OracleServer(connectionString); Productivity productivity; List <Productivity> list = new List <Productivity>(); string command = string.Empty; try { command = "SELECT FIGURA,NRO_CREDITOS,MONTO_CREDITOS,PROMEDIO FROM BBS_LIQCOM_V_PROD_JEFE WHERE "; command = command + string.Format(" CEDULA_ASESOR = '{0}' ", executiveID); var rdr = ora.ExecuteCommand(command); while (rdr.Read()) { productivity = new Productivity(); productivity.Figure = DBNull.Value.Equals(rdr["FIGURA"]) ? string.Empty : rdr["FIGURA"].ToString(); productivity.LoanCount = DBNull.Value.Equals(rdr["NRO_CREDITOS"]) ? 0 : double.Parse(rdr["NRO_CREDITOS"].ToString()); productivity.LoanAmount = DBNull.Value.Equals(rdr["MONTO_CREDITOS"]) ? 0 : double.Parse(rdr["MONTO_CREDITOS"].ToString()); productivity.Average = DBNull.Value.Equals(rdr["PROMEDIO"]) ? 0 : double.Parse(rdr["PROMEDIO"].ToString()); list.Add(productivity); } rdr.Close(); response.lstProductivity = list; response.msg = new Response(); response.msg.errorCode = "200"; response.msg.errorMessage = "OK"; } catch (Exception ex) { throw new Exception("ComplianceGoalDAO.GetProductivity", ex); } finally { ora.Dispose(); } return(response); }
// GET: Tasks/MarkAsDone public ActionResult MarkAsDone(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var task = db.Tasks.Find(id); task.IsDone = true; db.Entry(task).State = EntityState.Modified; db.SaveChanges(); Employee employee = db.Employees.Find(task.EmployeeId); Productivity.CalculateProductivity(employee); Productivity.TeamProductivity(employee.Team); db.Entry(employee).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: Tasks/RemoveTask/{id} public ActionResult RemoveTask(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } GTask gTask = db.Tasks.Find(id); if (gTask == null) { return(HttpNotFound()); } db.Tasks.Remove(gTask); db.SaveChanges(); Employee employee = db.Employees.Find(gTask.EmployeeId); Productivity.CalculateProductivity(employee); Productivity.TeamProductivity(employee.Team); db.Entry(employee).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Edit", db.Employees.Find(gTask.EmployeeId)));; }
private void HandleUIGetJSONData(Msg_UIGetJSONData msg) { JsonData += Encoding.ASCII.GetString(Encoding.ASCII.GetBytes(msg.Text)).Replace("?", ""); textBoxJsonData.ScrollToEnd(); if (msg.Text.Contains("prod")) { jsonCounter++; } jsProductivity += Encoding.ASCII.GetString(Encoding.ASCII.GetBytes(msg.Text)).Replace("?", ""); string zipName = String.Empty; string temp = jsProductivity; if (temp.Trim().EndsWith("}")) { try { temp = temp.Trim(); temp = temp.Remove(temp.Length - 1); if (temp.Trim().EndsWith("}")) { var firstIndex = temp.IndexOf("prod"); if (firstIndex == temp.LastIndexOf("prod") && firstIndex != -1) { temp += "}"; var json = "[" + temp + "]"; temp = String.Empty; List <Productivity> prodList = JsonConvert.DeserializeObject <List <Productivity> >(json); productivity = new Productivity(prodList.Last()); jsToSend = jsProductivity; File.AppendAllText(metromDir + "jsonLog.log", jsToSend); jsProductivity = String.Empty; if (productivity.prod.Time != "0000-00-00 00:00:00" && !MainWindow.gotTime) { jsonCounter = 0; MainWindow.gotTime = true; } GetMemoryUsage(); btnDisplayMainLogs.IsEnabled = true; btnDisplayIncidentLogs.IsEnabled = true; btnDisplayRecentMainLogs.IsEnabled = true; btnDisplayRecentIncidentLogs.IsEnabled = true; //string prodLog = logDir + "PD_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".json"; //Thread t = new Thread(() => //{ // lock (locker) // { // try // { // File.WriteAllText(prodLog, jsToSend.TrimStart()); // SendCasLogZip(productivity.prod.Asset, prodLog, LongData.ProductivityLog); // Thread.Sleep(60000); // } // catch { } // } //}); //t.IsBackground = true; //t.Start(); if (!MainWindow.prodTimerRan) { prodDispatcherTimer = new DispatcherTimer(); prodDispatcherTimer.Tick += prodDispatcherTimer_Tick; prodDispatcherTimer.Interval = new TimeSpan(0, machineConfig.ProdReportInterval, 0); MainWindow.prodTimerRan = true; prodDispatcherTimer.Start(); } } else { temp = String.Empty; jsProductivity = String.Empty; } } } catch (Exception e) { temp = String.Empty; jsProductivity = String.Empty; } } }
public void SendRequest() { EstimatedPoints = Productivity.RequestEvaluate(); DateRequest = DateTime.Now; State = "Enviada"; }
public override string ToString() { return(" - Prof: " + Proficiency + " - Prod: " + Productivity.ToString("0.0") + " - Salary: " + Salary); }
private void OpenForm(string form, FormWindowState formWindowState = FormWindowState.Maximized, bool val = false, string value = null) { var fc = Application.OpenForms; var formFound = false; if (ConsulStatusForm(form, fc, formFound)) { return; } switch (form) { case "CreateCases": var a = new CreateCases(_unitOfWork, IsAdministrationOn) { WindowState = formWindowState, MdiParent = this, TopMost = true }; a.Show(); break; case "Productivity": var b = new Productivity(_unitOfWork, IsAdministrationOn) { WindowState = formWindowState, MdiParent = this }; b.Show(); break; case "ConfigurationParams": var c = new ConfigurationParams(_unitOfWork, IsAdministrationOn) { WindowState = formWindowState, MdiParent = this }; c.Show(); break; case "formDataCases": var e = new DataCases(_unitOfWork, IsAdministrationOn) { WindowState = formWindowState, MdiParent = this }; e.Show(); break; case "formAdmin": var f = new Admin(_unitOfWork, IsAdministrationOn) { WindowState = formWindowState, }; f.ShowDialog(); IsAdministrationOn = f.IsLoged; ActivateDeactivateControls(); General.OpenAndCloseForm(Name); break; case "FinishCase": var g = new FinishCase(_unitOfWork, val) { WindowState = formWindowState, }; g.Show(); break; case "FrmReport": var d = new Forms.Reports(value) { WindowState = formWindowState, MdiParent = this }; d.Show(); break; } }