本文整理汇总了C#中Employee类的典型用法代码示例。如果您正苦于以下问题:C# Employee类的具体用法?C# Employee怎么用?C# Employee使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Employee类属于命名空间,在下文中一共展示了Employee类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Given_employee_is_risk_assessor_then_return_task
public void Given_employee_is_risk_assessor_then_return_task()
{
//GIVEN
var employee = new Employee() { Id = Guid.NewGuid(), NotificationType = NotificationType.Daily};
var riskAssessor = new RiskAssessor() { Id = 5596870, Employee = employee };
var riskAssessement = new HazardousSubstanceRiskAssessment() { RiskAssessor = riskAssessor, Status = RiskAssessmentStatus.Live};
var hazardousSubstanceRiskAssessmentFurtherControlMeasureTask =
new HazardousSubstanceRiskAssessmentFurtherControlMeasureTask()
{
HazardousSubstanceRiskAssessment = riskAssessement,
TaskCompletedDate = DateTime.Now,
TaskStatus = TaskStatus.Completed
};
riskAssessement.FurtherControlMeasureTasks.Add(hazardousSubstanceRiskAssessmentFurtherControlMeasureTask);
_hsRiskAssessments.Add(riskAssessement);
var target = new GetCompletedHazardousSubstanceRiskAssessmentFurtherControlMeasureTasksForEmployeeQuery(null);
//WHEN
var result = target.Execute(employee.Id, null);
//THEN
Assert.That(result.Count, Is.EqualTo(1));
}
开发者ID:mnasif786,项目名称:Business-Safe,代码行数:26,代码来源:GetCompletedHazardousSubstancesRiskAssessmentFurtherControlMeasuresTasksForEmployeeQueryTest.cs
示例2: Save
protected void Save(object sender, EventArgs e)
{
Employee emp = new Employee();
if (hdn.Value == "Edit")
{
if (ViewState["_idEdit"] != "")
emp._id = ObjectId.Parse(ViewState["_idEdit"].ToString());
emp.empName = txtEmployeeName.Text;
emp.empId = txtID.Text;
emp.salary = Convert.ToDouble(txtSal.Text);
emp.address = txtAddress.Text;
emp.phone = txtPhn.Text;
//dal.insert(emp);
// emp._id = Xid;
dal.updateEmployee(emp);
LoadEMployee();
}
else
{
//Employee emp = new Employee();
emp.empName = txtEmployeeName.Text;
emp.empId = txtID.Text;
emp.salary = Convert.ToDouble(txtSal.Text);
emp.address = txtAddress.Text;
emp.phone = txtPhn.Text;
dal.insert(emp);
LoadEMployee();
}
}
示例3: ShouldGetByNumber
public void ShouldGetByNumber()
{
new DatabaseTester().Clean();
var creator = new Employee("1", "1", "1", "1");
var order1 = new ExpenseReport();
order1.Submitter = creator;
order1.Number = "123";
var report = new ExpenseReport();
report.Submitter = creator;
report.Number = "456";
using (ISession session = DataContext.GetTransactedSession())
{
session.SaveOrUpdate(creator);
session.SaveOrUpdate(order1);
session.SaveOrUpdate(report);
session.Transaction.Commit();
}
IContainer container = DependencyRegistrarModule.EnsureDependenciesRegistered();
var bus = container.GetInstance<Bus>();
ExpenseReport order123 = bus.Send(new ExpenseReportByNumberQuery {ExpenseReportNumber = "123"}).Result;
ExpenseReport order456 = bus.Send(new ExpenseReportByNumberQuery {ExpenseReportNumber = "456"}).Result;
Assert.That(order123.Id, Is.EqualTo(order1.Id));
Assert.That(order456.Id, Is.EqualTo(report.Id));
}
示例4: Example
public void Example()
{
#region Usage
Employee joe = new Employee();
joe.Name = "Joe Employee";
Employee mike = new Employee();
mike.Name = "Mike Manager";
joe.Manager = mike;
// mike is his own manager
// ShouldSerialize will skip this property
mike.Manager = mike;
string json = JsonConvert.SerializeObject(new[] { joe, mike }, Formatting.Indented);
Console.WriteLine(json);
// [
// {
// "Name": "Joe Employee",
// "Manager": {
// "Name": "Mike Manager"
// }
// },
// {
// "Name": "Mike Manager"
// }
// ]
#endregion
}
示例5: btnSubmit_Click
protected void btnSubmit_Click(object sender, EventArgs e)
{
Employee e1 = new Employee();
e1.FirstName = txtFname.Text;
e1.MiddleName = txtMname.Text;
e1.LastName = txtLname.Text;
e1.Leaves = Convert.ToInt32(txtLeaves.Text);
e1.PhoneNumber = txtPhoneNo.Text;
e1.Position = txtPos.Text;
e1.ZipCode = txtZip1.Text + "-" + txtZip2.Text;
e1.State = txtState.Text;
e1.Salary = Convert.ToDecimal(txtSal.Text);
e1.Addreee = txtAdd.Text;
e1.City = txtCity.Text;
e1.Department = ddlDept.SelectedItem.Text;
e1.EmailId = txtEmailId.Text;
if (picUpload.HasFile)
{
string fileName = Path.GetFileName(picUpload.PostedFile.FileName);
picUpload.PostedFile.SaveAs(Server.MapPath("Images/") + fileName);
e1.Picture = fileName;
}
EmpBusiness eba = new EmpBusiness();
eba.insertNewEmployee(e1);
string text2disp = "Emp Id "+x+" created successfully";
// string script = text2disp;
Label2.Visible = true;
Label2.Text = text2disp;
clearst();
}
示例6: ShouldExecuteDraftTransition
public void ShouldExecuteDraftTransition()
{
new DatabaseTester().Clean();
var report = new ExpenseReport();
report.Number = "123";
report.Status = ExpenseReportStatus.Draft;
var employee = new Employee("jpalermo", "Jeffrey", "Palermo", "jeffrey @ clear dash measure.com");
report.Submitter = employee;
report.Approver = employee;
using (ISession session = DataContext.GetTransactedSession())
{
session.SaveOrUpdate(employee);
session.SaveOrUpdate(report);
session.Transaction.Commit();
}
var command = new ExecuteTransitionCommand(report, "Save", employee, new DateTime(2001, 1, 1));
IContainer container = DependencyRegistrarModule.EnsureDependenciesRegistered();
var bus = container.GetInstance<Bus>();
ExecuteTransitionResult result = bus.Send(command);
result.NewStatus.ShouldEqual("Drafting");
}
开发者ID:4ROOT,项目名称:ClearMeasureBootcamp,代码行数:26,代码来源:ExecuteTransitionCommandHandlerIntegratedTester.cs
示例7: Delete
public static void Delete(Employee employee)
{
context.Employees.Remove(employee);
context.SaveChanges();
//var projects = employee.Projects;
//var departments = employee.Departments;
//var managedEmployees = employee.Employees1;
//var managedDepartments = Context.Departments
// .Where(d => d.ManagerID == employee.ManagerID);
//foreach (var managedDepartment in managedDepartments)
//{
// managedDepartment.ManagerID = 0;
//}
//foreach (var managedEmployee in managedEmployees)
//{
// managedEmployee.ManagerID = null;
//}
//foreach (var project in projects)
//{
// project.Employees.Remove(employee);
//}
//foreach (var department in departments)
//{
// department.Employees1.Remove(employee);
//}
//Context.Employees.Remove(employee);
//Context.SaveChanges();
}
示例8: Main
public static void Main()
{
const char DELIM = ',';
const string FILENAME = "EmployeeData.txt";
Employee emp = new Employee();
FileStream inFile = new FileStream(FILENAME,
FileMode.Open, FileAccess.Read);
StreamReader reader = new StreamReader(inFile);
string recordIn;
string[] fields;
Console.WriteLine("\n{0,-5}{1,-12}{2,8}\n",
"Num", "Name", "Salary");
recordIn = reader.ReadLine();
while(recordIn != null)
{
fields = recordIn.Split(DELIM);
emp.EmpNum = Convert.ToInt32(fields[0]);
emp.Name = fields[1];
emp.Salary = Convert.ToDouble(fields[2]);
Console.WriteLine("{0,-5}{1,-12}{2,8}",
emp.EmpNum, emp.Name, emp.Salary.ToString("C"));
recordIn = reader.ReadLine();
}
reader.Close();
inFile.Close();
}
示例9: testArray
private void testArray()
{
Int32[] myIntegers; // Объявление ссылки на массив, myIntegers = null
myIntegers = new Int32[100]; // Создание массива типа Int32 из 100 элементов, равных 0
Employee[] myEmployees; // Объявление ссылки на массивб myEmployees = null
myEmployees = new Employee[50]; // Создание массива из 50 ссылок на переменную Control, равных null
// Создание двухмерного массива типа Doubles
Double[,] myDoubles = new Double[10, 20];
// Создание трехмерного массива ссылок на строки
String[,,] myStrings = new String[5, 3, 10];
// Создание одномерного массива из массивов типа Point
Point[][] myPolygons = new Point[3][];
// myPolygons[0] ссылается на массив из 10 экземпляров типа Point
myPolygons[0] = new Point[10];
// myPolygons[1] ссылается на массив из 20 экземпляров типа Point
myPolygons[1] = new Point[20];
// myPolygons[2] ссылается на массив из 30 экземпляров типа Point
myPolygons[2] = new Point[30];
// вывод точек первого многоугольника
// for (Int32 x = 0; x < myPolygons[0].Length; x++)
// Console.WriteLine(myPolygons[0][x]);
}
示例10: GetWeeklySalary
private double GetWeeklySalary(Employee employee)
{
double weeklySalary = employee.YearlySalary/52;
weeklySalary -= weeklySalary * 0.065;
return weeklySalary;
}
示例11: Given_FCM_is_reocurring_weekly_Then_when_it_is_completed_Then_following_task_should_be_created_with_due_date_a_week_later
public void Given_FCM_is_reocurring_weekly_Then_when_it_is_completed_Then_following_task_should_be_created_with_due_date_a_week_later()
{
var assignedTo = new Employee { Id = Guid.NewGuid() };
var user1= new UserForAuditing { Id = Guid.NewGuid() };
var user2= new UserForAuditing { Id = Guid.NewGuid() };
var furtherControlMeasureTask = HazardousSubstanceRiskAssessmentFurtherControlMeasureTask.Create(
"FCM",
"Test FCM",
"Description",
new DateTime(2012, 09, 13),
TaskStatus.Outstanding,
assignedTo,
user1,
new System.Collections.Generic.List<CreateDocumentParameters>
{
new CreateDocumentParameters
{
DocumentLibraryId = 2000L,
Description = "Test File 1",
DocumentType = new DocumentType {Id = 5L},
Filename = "Test File 1.txt"
}
},
new TaskCategory {Id = 9L},
(int) TaskReoccurringType.Weekly,
new DateTime(2013, 09, 13),
false,
false,
false,
false,
Guid.NewGuid());
furtherControlMeasureTask.Complete("Test Comments", new List<CreateDocumentParameters>(), new List<long>(), user2, null, DateTime.Now);
Assert.IsNotNull(furtherControlMeasureTask.FollowingTask);
Assert.AreEqual(furtherControlMeasureTask,
furtherControlMeasureTask.FollowingTask.
PrecedingTask);
Assert.AreEqual(furtherControlMeasureTask.Reference,
furtherControlMeasureTask.FollowingTask.Reference);
Assert.AreEqual(furtherControlMeasureTask.Title,
furtherControlMeasureTask.FollowingTask.Title);
Assert.AreEqual(furtherControlMeasureTask.Description,
furtherControlMeasureTask.FollowingTask.Description);
Assert.AreEqual(new DateTime(2012, 09, 20),
furtherControlMeasureTask.FollowingTask.TaskCompletionDueDate);
Assert.AreEqual(furtherControlMeasureTask.TaskAssignedTo.Id,
furtherControlMeasureTask.FollowingTask.TaskAssignedTo.Id);
Assert.AreEqual(user2.Id,
furtherControlMeasureTask.FollowingTask.CreatedBy.Id);
Assert.AreEqual(1, furtherControlMeasureTask.FollowingTask.Documents.Count);
Assert.AreEqual(furtherControlMeasureTask.Documents[0].DocumentLibraryId, furtherControlMeasureTask.FollowingTask.Documents[0].DocumentLibraryId);
Assert.AreEqual(furtherControlMeasureTask.Documents[0].Description, furtherControlMeasureTask.FollowingTask.Documents[0].Description);
Assert.AreEqual(furtherControlMeasureTask.Documents[0].DocumentType.Id, furtherControlMeasureTask.FollowingTask.Documents[0].DocumentType.Id);
Assert.AreEqual(furtherControlMeasureTask.Documents[0].Filename, furtherControlMeasureTask.FollowingTask.Documents[0].Filename);
Assert.AreEqual(furtherControlMeasureTask.Category.Id, furtherControlMeasureTask.FollowingTask.Category.Id);
Assert.AreEqual(furtherControlMeasureTask.TaskReoccurringType, furtherControlMeasureTask.FollowingTask.TaskReoccurringType);
Assert.AreEqual(furtherControlMeasureTask.TaskReoccurringEndDate, furtherControlMeasureTask.FollowingTask.TaskReoccurringEndDate);
}
示例12: StartUp
public void StartUp()
{
// add prices to the dictionary, prices
prices.Add("Dog", 120);
prices.Add("Cat", 60);
prices.Add("Snake", 40);
prices.Add("Guinea pig", 20);
prices.Add("Canary", 15);
// create customers
Customer c1 = new Customer(1001, "Susan", "Peterson", "Borgergade 45", "8000", "Aarhus", "[email protected]", "211a212121");
Customer c2 = new Customer(1002, "Brian", "Smith", "Allegade 108", "8000", "Aarhus", "[email protected]", "45454545");
//opret Employees
Employee e1 = new Employee("Gitte", "Svendsen", "GIT", "234234234");
Employee e2 = new Employee("Mads", "Juul", "MUL", "911112112");
Pet p1 = new Pet("Dog", "Hamlet", new DateTime(2011, 9, 2),
new DateTime(2011,9,20), c1, e1);
Pet p2 = new Pet("Dog", "Samson", new DateTime(2011, 9, 14),
new DateTime(2011, 9, 21), c1, e1);
Pet p3 = new Pet("Cat", "Darla", new DateTime(2011, 9, 7),
new DateTime(2011, 9, 10), c2, e2);
// add Pets to list of Pet, pets
pets.Add(p1);
pets.Add(p2);
pets.Add(p3);
// add customers to list
customer.Add(c1);
customer.Add(c2);
}
示例13: SendToWork
private bool SendToWork(Building build, Employee emplo)
{
if (emplo == null) return false;
EmployeeManager.Share(emplo, build.Employees);
return true;
}
示例14: EmployeeView
public EmployeeView(Employee input)
{
Mapper.CreateMap<Employee, EmployeeView>();
Mapper.Map<Employee, EmployeeView>(input, this);
this.updated = input.updated.ToString().Replace('T', ' ');
}
示例15: RunToDraft
private static void RunToDraft(string number, Employee employee, int total, DateTime startingDate, params string[] commandsToRun)
{
var report = new ExpenseReport();
report.Number = number;
report.Status = ExpenseReportStatus.Draft;
report.Submitter = employee;
report.Approver = employee;
report.Total = total;
using (ISession session = DataContext.GetTransactedSession())
{
session.SaveOrUpdate(report);
session.Transaction.Commit();
}
IContainer container = DependencyRegistrarModule.EnsureDependenciesRegistered();
var bus = container.GetInstance<Bus>();
for (int j = 0; j < commandsToRun.Length; j++)
{
DateTime timestamp = startingDate.AddSeconds(j);
var command = new ExecuteTransitionCommand(report, commandsToRun[j], employee, timestamp);
bus.Send(command);
}
}
开发者ID:ClearMeasureLabs,项目名称:ClearMeasureBootcamp,代码行数:25,代码来源:MostRecentExpenseReportFactViewIntegratedTester.cs