コード例 #1
0
 public void Update(Employee employee, int id)
 {
     string str = "UPDATE employees SET department = '" + employee.Department + "', " +
                      "firstname = '" + employee.FirstName + "', lastname = '" + employee.LastName + "', " +
                      "salary = " + (int)employee.Salary + " WHERE employeeid = " + id + ";";
     _session.Execute(str);
 }
コード例 #2
0
 public void Add(Employee employee)
 {
     if (!_employees.TryAdd(employee.EmployeeId, employee))
     {
         throw new Exception("ERROR: Couldn't add Employee to the dictionary.");
     }
 }
コード例 #3
0
ファイル: ServerProgram.cs プロジェクト: gontcaliuba/WebProxy
        private static async Task SendEmployee(Employee employee, string dataFormat, int portNumber)
        {
            using (var httpClient = new HttpClient())
            {
                httpClient.DefaultRequestHeaders.Clear();
                httpClient.DefaultRequestHeaders.TryAddWithoutValidation("DataUpdatePort", portNumber.ToString());
                httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", dataFormat);

                // Construct the request.
                string url = "http://*****:*****@"Employee with ID = " + employee.EmployeeId + "was sent to the DataWarehouse.");
                }
                else
                {
                    Console.WriteLine(@"Warning: Unable to send employee with ID = " + employee.EmployeeId + " to the DataWarehouse.");
                }
            }
        }
コード例 #4
0
 public void Update(Employee employee)
 {
     Employee employeeToUpdate = null;
     if (_employees.TryGetValue(employee.EmployeeId, out employeeToUpdate))
     {
         employeeToUpdate = employee;
     }
     else
     {
         throw new Exception("ERROR: Couldn't find the Employee to update.");
     }
 }
コード例 #5
0
 /// <summary>
 /// 添加修改视图
 /// </summary>
 /// <param name="employeename">如果是添加:当前查看的页面的员工的等级,如果是修改:员工的帐号</param>
 /// <returns></returns>
 public ActionResult EditEmployee(string parameter, string edit)
 {
     string employeeRankName = "";//当前对哪个等级下的员工进行操作
     string action = "";//动作描述
     Models.Employee emp = new Models.Employee();
     if (parameter == null && edit == null)//修改密码
     {
         action = "修改帳號";
         ViewBag.action = "修改";
         ViewData["Pwd"] = "Pwd";
         emp = _IEmployeeService.GetEmployeeByName(_IUser.UserName);
     }
     else
     {
         //修改视图返回一条员工信息
         if (edit == "update")
         {
             emp = _IEmployeeService.GetEmployeeByName(parameter);
             employeeRankName = AppData.GetEmployeeRankName(emp.Rank);
             action = "修改帳號";
             ViewBag.action = "修改";
         }
         else
         {
             employeeRankName = AppData.GetEmployeeRankName(parameter);
             action = "新增帳號";
             ViewBag.action = "添加";
             ViewBag.Rank = parameter;
         }
     }
     ViewBag.navigation = new Navigation
     {
         Level = new List<string> { AppData.GetGameTypeName("AcMa"), employeeRankName, action },
         HaveButton = false
     };
     return View(emp);
 }
コード例 #6
0
 public void Update(Employee employee, int id)
 {
     _session.Execute($"UPDATE employees SET department = '{employee.Department}', " +
                      $"firstname = '{employee.FirstName}', lastname = '{employee.LastName}', " +
                      $"salary = {employee.Salary} WHERE employeeid = {id};");
 }
コード例 #7
0
 public void Add(Employee employee)
 {
     _session.Execute("INSERT INTO employees (EmployeeId, Department, FirstName, LastName, salary) " +
                      $"VALUES ({employee.EmployeeId}, '{employee.Department}', " +
                      $"'{employee.FirstName}', '{employee.LastName}', {employee.Salary});");
 }
コード例 #8
0
 public ActionResult EditEmployee(string NewName, string Pwd, string Rank, string OldName, string edit)
 {
     Models.Employee emp = new Models.Employee(){EmployeeName=NewName,Password = Pwd,Rank=Rank};
     return Json(_IEmployeeService.UpdateEmployee(emp, OldName, edit));
 }
コード例 #9
0
 public IHttpActionResult Post(Employee employee, int id)
 {
     _repository.Update(employee, id);
     return Ok();
 }
コード例 #10
0
 public IHttpActionResult Put(Employee employee)
 {
     _repository.Add(employee);
     string uri = Url.Route("DefaultApi", new { id = employee.EmployeeId });
     return Created(uri, employee);
 }