本文整理汇总了C#中Department类的典型用法代码示例。如果您正苦于以下问题:C# Department类的具体用法?C# Department怎么用?C# Department使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Department类属于命名空间,在下文中一共展示了Department类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PullUpDepartment
static void PullUpDepartment(Department dep)
{
// Locate department one level up
var depAbove =
dep.
Query.
Ancestors<Department>().
First();
//
// Disconnect original department
// In fact, remove the member; cf. ".Parent".
//
dep.Untyped.Parent.Remove();
//
// Move employees one department up.
// Note: the manager does not move.
//
foreach (var m in dep.Member.ToList())
{
m.Untyped.Remove();
depAbove.Member.Add(m);
}
}
示例2: Employee
public Employee(string firstName, string lastName, int id,
decimal salary, Department department)
: base(firstName, lastName, id)
{
this.Salary = salary;
this.Department = department;
}
示例3: GetAllDepartments
public List<Department> GetAllDepartments()
{
SqlConnection connection = new SqlConnection(connectionString);
string query = "SELECT * FROM Departments";
SqlCommand command = new SqlCommand(query, connection);
connection.Open();
SqlDataReader reader = command.ExecuteReader();
List<Department> departments = new List<Department>();
while (reader.Read())
{
Department department = new Department();
department.DepartmentID = (int)reader["DepartmentID"];
department.Code = reader["Code"].ToString();
department.Name = reader["Name"].ToString();
departments.Add(department);
}
reader.Close();
connection.Close();
return departments;
}
示例4: ImageButton1_Click
//添加
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
if (this.txtDepartmentName.Text == "")
{
ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script>alert('部门不能为空');</script>");
return;
}
Department dep = new Department();
dep.DepartmentId = Guid.NewGuid().ToString();
dep.DepartmentName = this.txtDepartmentName.Text;
dep.Account = AccountsManager.GetAccountByAccountId(oepr.Account.AccountId);
dep.IsDefault = false;
dep.AddDate = DateTime.Now.ToString();
bool b = DepartmentManager.AddDepartment(dep);
if (b)
{
ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script>alert('添加成功'); window.location='DepartmentManager.aspx';</script>");
return;
}
else
{
ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script>alert('已经存在此部门');</script>");
return;
}
}
示例5: ButtonAddDepartment_Click
protected void ButtonAddDepartment_Click(object sender, EventArgs e)
{
Page.Validate("wholePage");
//Bypass the add employee validators
RequiredFieldValidatorEmail.IsValid = true;
RequiredFieldValidatorName.IsValid = true;
RequiredFieldValidatorPhoneNumber.IsValid = true;
RequiredFieldValidatorPasscode.IsValid = true;
if (Page.IsValid)
{
//create a temporary department
Department current = new Department();
//set the name to the current department entry from the textbox
current.Name = TextBoxDepartment.Text;
//add the department entry into the database
database.Departments.AddObject(current);
//save changes made to the database and update the drop down list with the departments
database.SaveChanges();
UpdateDepartments();
//clear the department textbox
TextBoxDepartment.Text = null;
}
}
示例6: TestEntityEquals_IdEquals
public void TestEntityEquals_IdEquals() {
_department = new Department( "A" );
_department2 = new Department( "A" );
Assert.IsTrue( _department.Equals( _department2 ) );
Assert.IsTrue( _department == _department2 );
Assert.IsFalse( _department != _department2 );
}
示例7: ConvertToViewModel
public static EmployeeViewModel ConvertToViewModel(this Employee employee, Department department, Employee manager, Salary salary, Title title)
{
var employeeViewModel = new EmployeeViewModel
{
BirthDate = employee.BirthDate.Value.ToShortDateString(),
CurrentManager = string.Empty,
Id = employee.PersistenceId.ToString(),
FirstName = employee.FirstName,
Gender = employee.Gender.DisplayName,
HireDate = employee.HireDate.Value.ToShortDateString(),
LastName = employee.LastName,
};
if (manager != null)
{
employeeViewModel.CurrentManager = manager.FirstName + " " + manager.LastName;
}
if (department != null)
{
employeeViewModel.CurrentDepartment = department.Name;
}
if (salary != null)
{
employeeViewModel.CurrentSalary = salary.Amount.ToString();
}
if (title != null)
{
employeeViewModel.CurrentTitle = title.Name;
}
return employeeViewModel;
}
示例8: loadInfoPreview
private void loadInfoPreview()
{
AB = new AccountBusiness();
account = AB.GetAccount(Page.User.Identity.Name);
EB = new EmployeeBusiness();
employee = EB.GetEmployee(account.Employee_Id);
DB = new DepartmentBusiness();
department = DB.GetDepartment(employee.Department_Id);
imgAvatar.ImageUrl = WebHelper.Instance.GetImageURL(employee.Employee_Avatar, 128, 128, false);
imgAvatar.PostBackUrl = WebHelper.Instance.GetURL() + "Account";
lblUserName.Text = account.Account_UserName;
lblRole.Text = account.Role_Name;
lblFirstName.Text = employee.Employee_FirtName;
lblLastName.Text = employee.Employee_LastName;
lblEmail.Text = employee.Employee_Email;
lblAddress.Text = employee.Employee_Address;
lblPhoneNumber.Text = employee.Employee_PhoneNumber;
if (employee.Employee_DateOfBirth.ToShortDateString().Equals("1/1/1900"))
lblDOB.Text = "";
else
lblDOB.Text = employee.Employee_DateOfBirth.ToShortDateString();
if (employee.Employee_Gender)
lblGender.Text = "Male";
else
lblGender.Text = "Female";
hplnkModifyProfile.NavigateUrl = WebHelper.Instance.GetURL() + "Account";
lblDepartmentName.Text = department.Department_Name;
lblDescription.Text = department.Department_Description;
}
开发者ID:omaralagbary,项目名称:eproject-excell-on-consulting-services,代码行数:30,代码来源:PersonalInfoControl.ascx.cs
示例9: AddDepartment
public void AddDepartment(Department department)
{
TreeViewItem tvi = new TreeViewItem();
TextBlock nameBlock = new TextBlock();
nameBlock.VerticalAlignment = VerticalAlignment.Center;
nameBlock.Text = department.Name;
tvi.Header = new StackPanel
{
Height = 22.0,
Orientation = Orientation.Horizontal,
Children =
{
nameBlock
}
};
tvi.DataContext = department;
if (this.departmentNode.ContainsKey(department.Pid))
{
this.departmentNode[department.Pid].Items.Add(tvi);
}
else
{
this.WorkName.Items.Add(tvi);
}
if (!this.departmentNode.ContainsKey(department.Id))
{
this.departmentNode.Add(department.Id, tvi);
}
}
示例10: NHibernatePerformanceTests
public NHibernatePerformanceTests()
{
using (ISession db = NHibernateHelper.OpenSession())
{
// delete any records from previous run
var deptQuery = (from dept in db.Query<Department>() select dept).ToList();
using (db.BeginTransaction())
{
foreach (var item in deptQuery)
{
db.Delete(item);
}
db.Transaction.Commit();
}
var personQuery = (from pers in db.Query<Person>() select pers).ToList();
using (db.BeginTransaction())
{
foreach (var item in personQuery)
{
db.Delete(item);
}
db.Transaction.Commit();
}
Department myDepartment = new Department()
{
name = "Operations"
};
db.Save(myDepartment);
}
}
示例11: DepartmentCreate
public void DepartmentCreate()
{
Department instance1 = new Department();
Assert.IsNotNull(instance1, "DepartmentTest.DepartmentNew: Unable to create instance using new()");
Department instance2 = DepartmentService.Create();
Assert.IsNotNull(instance2, "DepartmentTest.DepartmentCreate: Unable to create instance");
}
示例12: WorkersViewModel
public WorkersViewModel(Department Department)
{
base.Name = "ПЕРСОНАЛ";
}
示例13: Manager
public Manager(int id, string firstName, string lastName, double salary, Department department,
params Employee[] employees)
: base(id, firstName, lastName, salary, department)
{
this.set = new HashSet<Employee>();
this.AddEmployees(employees);
}
示例14: btnSave_Click
protected void btnSave_Click(object sender, EventArgs e)
{
//connect
using (DefaultConnectionEF conn = new DefaultConnectionEF())
{
//instantiate a new deparment object in memory
Department d = new Department();
//decide if updating or adding, then save
if (Request.QueryString.Count > 0)
{
Int32 DepartmentID = Convert.ToInt32(Request.QueryString["DepartmentID"]);
d = (from dep in conn.Departments
where dep.DepartmentID == DepartmentID
select dep).FirstOrDefault();
}
//fill the properties of our object from the form inputs
d.Name = txtName.Text;
d.Budget = Convert.ToDecimal(txtBudget.Text);
if (Request.QueryString.Count == 0)
{
conn.Departments.Add(d);
}
conn.SaveChanges();
//redirect to updated departments page
Response.Redirect("departments.aspx");
}
}
示例15: DepartmentPoint
public DepartmentPoint(int coord, Department dep)
{
Coord = coord;
Owner = null;
GrowableCoords = new List<int>(4);
Department = dep;
}