public void RemoveStaffType(int id) { StaffType temp = context.StaffTypes.Find(id); context.StaffTypes.Remove(temp); context.SaveChanges(); }
public void CallCreateFilmStaff_WithStaffTypeParameter(StaffType type) { //Arrange var fistName = "firstName"; var lastName = "lastName"; var date = "10/10/1980"; var countryId = "1"; var validParameters = new List <string>() { fistName, lastName, date, countryId, type.ToString() }; var dbMock = new Mock <IDatabase>(); var factoryMock = new Mock <IModelsFactory>(); var countryMock = new Mock <Country>(); var countryRepositoryMock = new Mock <ICountryRepository>(); countryRepositoryMock.Setup(c => c.SingleOrDefault(It.IsAny <Expression <Func <Country, bool> > >())).Returns(countryMock.Object); dbMock.Setup(d => d.Countries).Returns(countryRepositoryMock.Object); var filmStaffRepositoryMock = new Mock <IFilmStaffRepository>(); dbMock.Setup(d => d.FilmStaffs).Returns(filmStaffRepositoryMock.Object); var sut = new CreateFilmStaffCommand(dbMock.Object, factoryMock.Object); //Act var result = sut.Execute(validParameters); //Assert factoryMock.Verify(f => f.CreateFilmStaff(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <DateTime>(), It.IsAny <Country>(), type), Times.Once); }
private static DataTable ReturnStaffTable(List <Staffs> StaffList) { DataTable StaffTable = new DataTable(); StaffTable.Columns.Add("staffid", typeof(int)); StaffTable.Columns.Add("typeno", typeof(int)); StaffTable.Columns.Add("name", typeof(string)); StaffTable.Columns.Add("phone", typeof(string)); StaffTable.Columns.Add("email", typeof(string)); StaffTable.Columns.Add("designation_a", typeof(string)); StaffTable.Columns.Add("designation_s", typeof(string)); StaffTable.Columns.Add("classname", typeof(string)); StaffTable.Columns.Add("subject", typeof(string)); foreach (Staffs staff in StaffList) { StaffType stafftype = staff.StaffType; int stype = (int)stafftype; switch (stafftype) { case StaffType.ADMINISTRATIVESTAFF: StaffTable.Rows.Add(staff.Id, stype, staff.Name, staff.Phone, staff.Email, ((AdministrativeStaff)staff).Designation, null, null, null); break; case StaffType.TEACHINGSTAFF: StaffTable.Rows.Add(staff.Id, stype, staff.Name, staff.Phone, staff.Email, null, null, ((TeachingStaffs)staff).ClassName, ((TeachingStaffs)staff).Subject); break; case StaffType.SUPPORTSTAFF: StaffTable.Rows.Add(staff.Id, stype, staff.Name, staff.Phone, staff.Email, null, ((SupportStaffs)staff).Designation, null, null); break; } } return(StaffTable); }
public void UpdateSalary(int Id, int salary) { StaffType staffType = context.StaffTypes.Find(Id); staffType.Salary = salary; context.SaveChanges(); }
public void Test_CreateStaffType() { IStaffTypeService service = new StaffTypeService(Settings.Default.connString); StaffType st1 = new StaffType() { name = "实习员工", remark = "实习员工" }; Assert.IsTrue(service.Create(st1)); StaffType st2 = new StaffType() { name = "在职员工", remark = "在职员工" }; Assert.IsTrue(service.Create(st2)); StaffType st3 = new StaffType() { name = "离职员工", remark = "离职员工" }; Assert.IsTrue(service.Create(st3)); }
public static String GetHeadLineFromStaffType(StaffType staffType) { //Common Fields String headLine = "ID\t\tName\t\t{0}\t\tStaff Type"; //Staff Type Specific Fields switch (staffType) { case StaffType.teachingStaff: headLine = String.Format(headLine, "Subject Type"); break; case StaffType.administrativeStaff: headLine = String.Format(headLine, "Position"); break; case StaffType.supportStaff: headLine = String.Format(headLine, "Role"); break; default: return(null); } return(headLine); }
public Staff(String name, String email, int empCode, StaffType type) { this.Name = name; this.Email = email; this.EmpCode = empCode; this.Type = type; }
public void AddStaff(StaffType type, string name, string email, int empCode, string extra) { using (SqlConnection conn = new SqlConnection(connectionString)) { conn.Open(); using (SqlCommand cmd = new SqlCommand("Proc_AddStaff", conn)) { cmd.Connection = conn; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@EmpCode", SqlDbType.Int, 0)); cmd.Parameters.Add(new SqlParameter("@Name", SqlDbType.VarChar, 50)); cmd.Parameters.Add(new SqlParameter("@Email", SqlDbType.VarChar, 50)); cmd.Parameters.Add(new SqlParameter("@Type", SqlDbType.Int, 0)); cmd.Parameters.Add(new SqlParameter("@Extra", SqlDbType.VarChar, 50)); cmd.Parameters[0].Value = empCode; cmd.Parameters[1].Value = name; cmd.Parameters[2].Value = email; cmd.Parameters[3].Value = (int)type; cmd.Parameters[4].Value = extra; SqlDataReader dr = cmd.ExecuteReader(); dr.Close(); } } }
public void AddStaff(StaffType type, string name, string email, int empCode, string extra) { //getting the entire info from json var staffs = (List <dynamic>) this.storageManager.Deserialize(); //teacher if (type == StaffType.teacher) { staffs.Add(new Teacher(name, email, empCode, extra)); } //admin else if (type == StaffType.administrator) { staffs.Add(new Administrator(name, email, empCode, extra)); } //support else if (type == StaffType.support) { staffs.Add(new Support(name, email, empCode, extra)); } //saving it back to json this.storageManager.Serialize(staffs); }
//we must show the first staff type details void ShowFirstStaffDetails(StaffType st) { switch (st) { case StaffType.Cthuluburse: if (index == 0) { ShowCthulburseDetails(); } break; case StaffType.Octodoctor: if (index == 0) { ShowOctoDoctorDetails(); } break; case StaffType.Yetitor: if (index == 0) { ShowYetitorDetails(); } break; } }
public Staff(EndianBinaryReader reader, List <Cut> cuts) { Name = new string(reader.ReadChars(32)).Trim('\0'); m_DuplicateID = reader.ReadInt32(); reader.SkipInt32(); m_Flag = reader.ReadInt32(); m_StaffType = (StaffType)reader.ReadInt32(); m_FirstCutIndex = reader.ReadInt32(); reader.Skip(28); Cuts = new ObservableCollection <Cut>(); if (m_FirstCutIndex != -1) { FirstCut = cuts[m_FirstCutIndex]; FirstCut.ParentActor = this; Cuts.Add(FirstCut); Cut next_cut = FirstCut.NextCut; while (next_cut != null) { Cuts.Add(next_cut); next_cut.ParentActor = this; next_cut = next_cut.NextCut; } } }
private static Staffs GetStaff(SqlDataReader dreader) { int id = Convert.ToInt32(dreader["staffid"]); int stype = Convert.ToInt32(dreader["typeno"]); StaffType stafftype = (StaffType)stype; string name = Convert.ToString(dreader["name"]); string phone = Convert.ToString(dreader["phone"]); string email = Convert.ToString(dreader["email"]); if (stafftype == StaffType.TEACHINGSTAFF) { string classname = Convert.ToString(dreader["classname"]); string subject = Convert.ToString(dreader["subject"]); Staffs Staff = new TeachingStaffs(stafftype, name, phone, email, classname, subject, id); return(Staff); } else if (stafftype == StaffType.ADMINISTRATIVESTAFF) { string designation_a = Convert.ToString(dreader["designation_a"]); Staffs staff = new AdministrativeStaff(stafftype, name, phone, email, id, designation_a); return(staff); } else if (stafftype == StaffType.SUPPORTSTAFF) { string designation_s = Convert.ToString(dreader["designation_s"]); Staffs staff = new SupportStaffs(stafftype, name, phone, email, id, designation_s); return(staff); } else { return(null); } }
// Use this for initialization void Start () { ///make the octodoctor the first staff type currentStaffType = StaffType.Octodoctor; ShowOctoDoctorName(); ShowFirstStaffDetails(StaffType.Octodoctor); }
public JsonResult Create([Bind(Include = "Name, remark")] StaffType staffType) { ResultMessage msg = new ResultMessage(); try { msg = DoValidation(staffType); if (!msg.Success) { return(Json(msg, JsonRequestBehavior.AllowGet)); } else { IStaffTypeService cs = new StaffTypeService(Settings.Default.db); bool isSucceed = cs.Create(staffType); msg.Success = isSucceed; msg.Content = isSucceed ? "" : "添加失败"; return(Json(msg, JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { return(Json(new ResultMessage() { Success = false, Content = ex.Message }, JsonRequestBehavior.AllowGet)); } }
// andler for staff type delegate void HandleChooseStaffTypeshowStaffType (StaffType st) { switch(st) { case StaffType.Cthuluburse: currentStaffType = StaffType.Cthuluburse; ShowCthuluburseName(); ShowFirstStaffDetails(StaffType.Cthuluburse); break; case StaffType.Octodoctor: currentStaffType = StaffType.Octodoctor; ShowOctoDoctorName(); ShowFirstStaffDetails(StaffType.Octodoctor); break; case StaffType.Yetitor: currentStaffType = StaffType.Yetitor; ShowYetitorName(); ShowFirstStaffDetails(StaffType.Yetitor); break; case StaffType.None: print ("ERROR NO STAFF TYPE"); break; } }
public static Staff CreateStaff(StaffType staffType) { switch (staffType) { case StaffType.teachingStaff: TeachingStaff teachingStaff = new TeachingStaff(); AskCommonDetails(teachingStaff); teachingStaff.Subject = InputStaffProperties.AskSubject(); teachingStaff.AssignedClass = InputStaffProperties.AskClass(); return(teachingStaff); case StaffType.administrativeStaff: AdminstrativeStaff adminStaff = new AdminstrativeStaff(); AskCommonDetails(adminStaff); adminStaff.Post = InputStaffProperties.AskPost(); return(adminStaff); case StaffType.supportStaff: SupportStaff supportStaff = new SupportStaff(); AskCommonDetails(supportStaff); supportStaff.Post = InputStaffProperties.AskPost(); return(supportStaff); default: return(null); } }
public Staff(int sid, int?salary, StaffType designation, string institutename) { this.StaffID = sid; this.Salary = salary; this.Designation = designation; this.Institute = institutename; }
public void GivenAPayRollFileFormatThenAListOFStaffIsCreated() { var name1 = "Joe"; var typeName1 = "Manager"; var name2 = "Sue"; var typeName2 = "Admin"; var exampleData = $"{name1}, {typeName1}" + Environment.NewLine + $"{name2}, {typeName2}"; var expectedStaff = new Mock <IStaff>(); var fakeFactoryStaff = new Mock <IFactoryStaff>(); fakeFactoryStaff .Setup(f => f.Create(It.IsAny <string>(), It.IsAny <string>())) .Returns(expectedStaff.Object); var staffType = new StaffType(fakeFactoryStaff.Object); var staff = staffType.ReadFromStream(GenerateStreamFromString(exampleData)); fakeFactoryStaff .Verify(f => f.Create(typeName1, name1)); fakeFactoryStaff .Verify(f => f.Create(typeName2, name2)); Assert.That(staff.Count, Is.EqualTo(2)); Assert.That(staff, Has.Member(expectedStaff.Object)); }
// andler for staff type delegate void HandleChooseStaffTypeshowStaffType(StaffType st) { switch (st) { case StaffType.Cthuluburse: currentStaffType = StaffType.Cthuluburse; ShowCthuluburseName(); ShowFirstStaffDetails(StaffType.Cthuluburse); break; case StaffType.Octodoctor: currentStaffType = StaffType.Octodoctor; ShowOctoDoctorName(); ShowFirstStaffDetails(StaffType.Octodoctor); break; case StaffType.Yetitor: currentStaffType = StaffType.Yetitor; ShowYetitorName(); ShowFirstStaffDetails(StaffType.Yetitor); break; case StaffType.None: print("ERROR NO STAFF TYPE"); break; } }
// Use this for initialization void Start() { ///make the octodoctor the first staff type currentStaffType = StaffType.Octodoctor; ShowOctoDoctorName(); ShowFirstStaffDetails(StaffType.Octodoctor); }
// GET: StaffType/Delete/5 public ActionResult Delete(int id) { IStaffTypeService cs = new StaffTypeService(Settings.Default.db); StaffType dgt = cs.FindById(id); return(View(dgt)); }
public Staffs(StaffType staffType, string name, string phone, string email, int id) { StaffType = staffType; Name = name; Phone = phone; Email = email; Id = id; }
private StaffType GetEntity(StaffTypeViewModel staffViewModel) { StaffType staffType = new StaffType() { Id = staffViewModel.Id, TypeDescription = staffViewModel.TypeDescription }; return(staffType); }
private StaffTypeViewModel GetModel(StaffType stafftype) { StaffTypeViewModel staffViewModel = new StaffTypeViewModel() { Id = stafftype.Id, TypeDescription = stafftype.TypeDescription }; return(staffViewModel); }
public Staff(StaffType staffType, string name, string phone, string email, string classname, string subject, int id) { StaffType = staffType; Name = name; Phone = phone; Email = email; ClassName = classname; Subject = subject; Id = id; }
public void EnterData(StaffType j, string z, string y, string x, string w, string v, int u) { StaffType = j; Name = z; Phone = y; Email = x; ClassName = w; Subject = v; Id = u; }
/// <summary> /// Get a staff type /// </summary> /// <param name="source">Source Class</param> /// <returns>Mapped Staff Type</returns> private StaffType GetStaffType(SR.Staff source) { StaffType staffType = new StaffType(); if (source.StaffType != null) { staffType.ID = source.StaffType.ID; staffType.Name = source.StaffType.Name; } return(staffType); }
public void Test_UpdateStaffType() { IStaffTypeService service = new StaffTypeService(Settings.Default.connString); StaffType st1 = service.FindAll().FirstOrDefault(); if (st1 != null) { st1.name = "name@" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); st1.remark = "remark@" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); } Assert.IsTrue(service.Update(st1)); }
/// <summary> /// Will return all of the staff of a given type...or all /// </summary> /// <param name="staffType">The staff type of the given staff</param> /// <returns>Returns the staff of that type</returns> public List <Staff> GetStaff(StaffType staffType = StaffType.all) { if (staffType == StaffType.all) { List <Staff> allStaff = new List <Staff>(); allStaff.AddRange(staff[StaffType.research]); allStaff.AddRange(staff[StaffType.security]); return(allStaff); } return(staff[staffType]); }
public void Verify_EditAction_with_Role_Sales_Returns_Edit_View(StaffType staffType) { mockUserAccountResolver.Setup(x => x.GetCurrentUserRole()).Returns((int)staffType); PropertyController controller = new PropertyController(mockAppUriResolver.Object, mockUserAccountResolver.Object); var resultTask = controller.Edit(2); resultTask.Wait(); var viewResult = resultTask.Result as ViewResult; Assert.IsNotNull(viewResult); Assert.AreEqual("Edit", viewResult.ViewName); }
public Staff(Event parent) { m_Name = "new_staff"; m_Flag = 0; m_StaffType = StaffType.Normal; m_FirstCutIndex = -1; m_ParentEvent = parent; m_FirstCut = null; Cuts = new ObservableCollection <Cut>(); }
public Staff(int sid, int eid, int?salary, StaffType designation, string institutename) { if (string.IsNullOrEmpty(institutename)) { throw new ArgumentException($"'{nameof(institutename)}' cannot be null or empty", nameof(institutename)); } this.StaffID = sid; this.EmployeeID = eid; this.Salary = salary ?? throw new ArgumentNullException(nameof(salary)); this.Designation = designation; this.Institute = institutename; }
public IEnumerable<StaffType> FetchAll() { List<StaffType> staffs = new List<StaffType>(); EntityCollection collection = FetchEntity(EntityName, TargetFields, FieldToSort); foreach (Entity item in collection.Entities) { StaffType staff = new StaffType(); staff.StaffTypeID = item["gsc_stafftypeid"].ToString(); staff.StaffTypeName = item["gsc_name"].ToString(); staffs.Add(staff); } return staffs; }
//we must show the first staff type details void ShowFirstStaffDetails(StaffType st) { switch(st) { case StaffType.Cthuluburse: if(index == 0) ShowCthulburseDetails(); break; case StaffType.Octodoctor: if(index == 0) ShowOctoDoctorDetails(); break; case StaffType.Yetitor: if(index == 0) ShowYetitorDetails(); break; } }