本文整理汇总了C#中Department类的典型用法代码示例。如果您正苦于以下问题:C# Department类的具体用法?C# Department怎么用?C# Department使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Department类属于命名空间,在下文中一共展示了Department类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
}
开发者ID:dipdapdop,项目名称:linqtoxsd,代码行数:25,代码来源:Reorg.cs
示例2: Employee
public Employee(string firstName, string lastName, int id,
decimal salary, Department department)
: base(firstName, lastName, id)
{
this.Salary = salary;
this.Department = department;
}
开发者ID:hristodobrev,项目名称:Software-University,代码行数:7,代码来源:Employee.cs
示例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;
}
开发者ID:Atiq-Mridul,项目名称:UniversityApp,代码行数:25,代码来源:DepartmentGateway.cs
示例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;
}
}
开发者ID:honj51,项目名称:ideacode,代码行数:26,代码来源:AddDepartment.aspx.cs
示例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;
}
}
开发者ID:jvera004,项目名称:Course_Work,代码行数:28,代码来源:Manage.aspx.cs
示例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 );
}
开发者ID:NetUtil,项目名称:Util,代码行数:7,代码来源:StringEntityBaseTest.cs
示例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;
}
开发者ID:Cooker2007,项目名称:EmployeeManagementSystem,代码行数:33,代码来源:ConversionHelper.cs
示例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);
}
}
开发者ID:super860327,项目名称:firstwpftest,代码行数:29,代码来源:WorkTreeView.xaml.cs
示例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);
}
}
开发者ID:fdecaire,项目名称:SmackdownEF6vsLinq2SQL,代码行数:33,代码来源:NHibernatePerformanceTests.cs
示例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");
}
开发者ID:cnporras,项目名称:wilsonormapper,代码行数:7,代码来源:DepartmentTest.cs
示例12: WorkersViewModel
public WorkersViewModel(Department Department)
{
base.Name = "ПЕРСОНАЛ";
}
开发者ID:Dergash,项目名称:TMES,代码行数:7,代码来源:WorkersViewModel.cs
示例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);
}
开发者ID:krasi070,项目名称:OOP,代码行数:7,代码来源:Manager.cs
示例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");
}
}
开发者ID:HrvojeBumber,项目名称:LAB4Comp2007,代码行数:32,代码来源:department.aspx.cs
示例15: DepartmentPoint
public DepartmentPoint(int coord, Department dep)
{
Coord = coord;
Owner = null;
GrowableCoords = new List<int>(4);
Department = dep;
}
开发者ID:HannesR-O,项目名称:PSC2013,代码行数:7,代码来源:DepartmentPoint.cs
示例16: CreateDepartment
public object CreateDepartment(string DPName, string ParentId)
{
IDbTransaction tran = Utility.Database.BeginDbTransaction();
try
{
lock (forlock)
{
string NEW_DPID = Utility.MaxValue<Department>("D", 6, tran);
Department insert_obj = new Department();
insert_obj.DPID = NEW_DPID;//主键
insert_obj.DPName = DPName;//文件名称
insert_obj.PDPID = ParentId;//父类ID
Utility.Database.Insert<Department>(insert_obj, tran);
Utility.Database.Commit(tran);
return new
{
insert_obj = insert_obj
};
}
}
catch (Exception e)
{
Utility.Database.Rollback(tran);
return PackResult.JsonMsg(false, "CreateDepartment失败!" + e.Message);
}
}
开发者ID:hehaiquan,项目名称:OA,代码行数:27,代码来源:B_OA_UserSvc.cs
示例17: BuildQueryOverOfDepartmentMember
/// <summary>
/// 부서-소속원 정보 (<see cref="DepartmentMember"/>)를 검색하기 위한 Criteria를 빌드합니다.
/// </summary>
public QueryOver<DepartmentMember, DepartmentMember> BuildQueryOverOfDepartmentMember(
Department department, User user, EmployeeTitle employeeTitle, bool? isLeader, bool? isActive)
{
if(IsDebugEnabled)
log.Debug(@"부서-소속원 정보 (DepartmentMember)를 검색하기 위한 Criteria를 빌드합니다... " +
@"department={0}, user={1}, employeeTitle={2}, isLeader={3}, isActive={4}",
department, user, employeeTitle, isLeader, isActive);
var query = QueryOver.Of<DepartmentMember>();
if(department != null)
query.AddWhere(dm => dm.Department == department);
if(user != null)
query.AddWhere(dm => dm.User == user);
if(employeeTitle != null)
query.AddWhere(dm => dm.EmployeeTitle == employeeTitle);
if(isLeader.HasValue)
query.AddWhere(dm => dm.IsLeader == isLeader);
if(isActive.HasValue)
query.AddNullAsTrue(dm => dm.IsActive, isActive);
return query;
}
开发者ID:debop,项目名称:NAccess,代码行数:30,代码来源:OrganizationRepository.Department.cs
示例18: getDepartment
public Department getDepartment(int UserId)
{
Department _Department = new Department();
Query = "SELECT department.id, department.name " +
"FROM department INNER JOIN [User] ON [User].departmentid = department.id " +
"WHERE User.Id = " + UserId + " ORDER BY department.name";
try
{
Data.SqlCommand cm = new Data.SqlCommand();
cm.CommandText = Query;
cm.Connection = cn;
Data.SqlDataReader rd = cm.ExecuteReader();
rd.Read();
if(rd.HasRows)
{
_Department.Id = rd.GetInt16(0);
_Department.Name = rd.GetString(1);
}
rd.Close();
cm = null;
}
catch (Exception)
{
throw;
}
return (_Department);
}
开发者ID:christiaandup,项目名称:scn_xxx,代码行数:29,代码来源:User.cs
示例19: Employee
protected Employee(string id, string firstName, string lastName
, decimal salary, Department department)
: base(id, firstName, lastName)
{
this.Salary = salary;
this.Department = department;
}
开发者ID:LPetrova,项目名称:CSharpOPP,代码行数:7,代码来源:Employee.cs
示例20: getDepartments
public List<Department> getDepartments()
{
List<Department> _Departments = new List<Department>();
Query = "SELECT department.id, department.name " +
"FROM department ORDER BY department.name";
try
{
Data.SqlCommand cm = new Data.SqlCommand();
cm.CommandText = Query;
cm.Connection = cn;
Data.SqlDataReader rd = cm.ExecuteReader();
while (rd.Read())
{
Department _Department = new Department();
_Department.Id = rd.GetInt16(0);
_Department.Name = rd.GetString(1);
_Departments.Add(_Department);
}
rd.Close();
cm = null;
}
catch (Exception)
{
throw;
}
return (_Departments);
}
开发者ID:christiaandup,项目名称:scn_xxx,代码行数:29,代码来源:User.cs
注:本文中的Department类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论