public override bool Equals(object obj) { if (obj == null) { return(false); } if (!(obj is Group)) { return(false); } if (this == obj) { return(true); } Group g = (Group)obj; if (!Name.Equals(g.Name)) { return(false); } if (!DepartmentName.Equals(g.DepartmentName)) { return(false); } if (!FacultyName.Equals(g.FacultyName)) { return(false); } return(true); }
/// <summary> /// Constructors a department for the provided department name and name. /// </summary> /// <param name="departmentName">The department name for the department.</param> /// <param name="name">The name for the department.</param> public Department(DepartmentName departmentName, string name = null) { Id = (int)departmentName; // If we don't have a name argument, // then use the string representation of the activity type for the name. Name = name ?? Enum.GetName(typeof(DepartmentName), departmentName); }
public void EditDepartmentApplicaiton() { DepartmentEdit.ClickOn(); DepartmentName.Clear(); DepartmentConfirm.ClickOn(); softAssert.VerifyElementIsPresent(DepNameValidationPopup); DepartmentName.EnterClearText(Constant.departmentName + RandomNumber.smallNumber()); DepartmentConfirm.ClickOn(); }
public async Task <ActionResult> DeleteConfirmed(decimal id) { DepartmentName departmentName = await db.DepartmentNames.FindAsync(id); db.DepartmentNames.Remove(departmentName); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public string[] GetFullDetails() { string[] details = new string[5]; details[0] = Quantity.ToString(); details[1] = Price.ToString(); details[2] = restocks.ToString(); details[3] = DepartmentName.ToString(); return(details); }
private DepartmentName SelectDepartmentName() { string departmentName = Entering.EnterString( "Назва відділення"); DepartmentName inst = dataContext.DepartmentNames .FirstOrDefault(e => e.Name == departmentName); return(inst); }
public static HumanResourseDepartment GenerateDepartment(DepartmentName departmentName) { // generate a department with two teams : team A, team B; var department = new HumanResourseDepartment("", departmentName); department.Director = GenerateFutureEmployee(); department.AddTeam(GenerateTeam(departmentName + "Team A")); department.AddTeam(GenerateTeam(departmentName + "Team B")); return(department); }
public bool ValidateDepartment() { DepartmentName = (DepartmentName != null) ? DepartmentName.Trim() : ""; if (DepartmentName == "") { textValidation = "Department Name is empty"; return(false); } return(true); }
public override int GetHashCode() { int hash = 1; if (entityId_ != null) { hash ^= EntityId.GetHashCode(); } if (UserId.Length != 0) { hash ^= UserId.GetHashCode(); } if (Password.Length != 0) { hash ^= Password.GetHashCode(); } if (DisplayName.Length != 0) { hash ^= DisplayName.GetHashCode(); } if (EmergencyContactPhoneNumber.Length != 0) { hash ^= EmergencyContactPhoneNumber.GetHashCode(); } if (IsPhoneDataDisplayable != false) { hash ^= IsPhoneDataDisplayable.GetHashCode(); } if (dateHired_ != null) { hash ^= DateHired.GetHashCode(); } if (IsActive != false) { hash ^= IsActive.GetHashCode(); } if (department_ != null) { hash ^= Department.GetHashCode(); } if (DepartmentName.Length != 0) { hash ^= DepartmentName.GetHashCode(); } if (contactInfo_ != null) { hash ^= ContactInfo.GetHashCode(); } if (IsIncluded != false) { hash ^= IsIncluded.GetHashCode(); } return(hash); }
public async Task <ActionResult> Edit([Bind(Include = "Id,Name")] DepartmentName departmentName) { if (ModelState.IsValid) { db.Entry(departmentName).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(departmentName)); }
public void CreateDepartmentApplication() { Pages.Business_Page.CheckDepartmentIsNull(); Pages.Business_Page.EnterDepaertmentWindow(); DepartmentCreate.ClickOn(); DepartmentConfirm.ClickOn(); softAssert.VerifyElementPresentInsideWindow(DepNameValidationPopup, DepartmentCloseButton); DepartmentName.EnterClearText(Constant.departmentName + RandomNumber.smallNumber()); DepartmentConfirm.ClickOn(); softAssert.VerifyElementPresentInsideWindow(DepartmentDelete, DepartmentCloseButton); softAssert.VerifyElementHasEqual(utility.TableCount(departmentTableCount), Constant.tmpTableCount + 1); }
public async Task <ActionResult> Create([Bind(Include = "Id,Name")] DepartmentName departmentName) { if (ModelState.IsValid) { db.DepartmentNames.Add(departmentName); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(departmentName)); }
void ReadDepartmentName(XmlReader reader, ICollection <DepartmentName> collection) { reader.ReadStartElement("DepartmentName"); int id = reader.ReadElementContentAsInt(); string name = reader.ReadElementContentAsString(); DepartmentName inst = new DepartmentName(name) { Id = id }; collection.Add(inst); }
private void btnAdd_Click(object sender, RoutedEventArgs e) { try { // Get name string name = txtName.Text; // Year and Course Year year = (Year)Enum.Parse(typeof(Year), cbxYear.SelectedItem.ToString()); Course course = (Course)Enum.Parse(typeof(Course), cbxCourse.SelectedItem.ToString()); // Get department and subdepartment details DepartmentName department = (DepartmentName)Enum.Parse(typeof(DepartmentName), cbxDepartment.SelectedItem.ToString()); SubDepartment subdepartment = (SubDepartment)Enum.Parse(typeof(SubDepartment), cbxSubDepartment.SelectedItem.ToString()); // Volunteer type (volunteer, coordi, etc.) WorkForceType type = (WorkForceType)Enum.Parse(typeof(WorkForceType), cbxType.SelectedItem.ToString()); // Validating Name if (name.Length <= 3 || name.Length > 30) { lblLastAdded.Content = "Enter a valid name"; return; } // Create and object and add it to the database lastAdded = new Volunteer(name, year, course, new Department(department, subdepartment), type); // Add the details to the database and commit the changes AppState.VolunteerManager.Add(lastAdded); AppState.VolunteerManager.Save(); // Add the details of the just added volunteers's details StringBuilder sb = new StringBuilder(); sb.Append("Name:\t\t" + name); sb.Append("\nYear:\t\t" + year.ToString()); sb.Append("\nCourse:\t\t" + course.ToString()); sb.Append("\nDepartment:\t" + department.ToString()); sb.Append("\nSubdepartment:\t" + subdepartment.ToString()); sb.Append("\nType:\t\t" + type.ToString()); lblLastAdded.Content = sb.ToString(); // Remove the name from the textbox txtName.Text = string.Empty; } catch (Exception ex) { #if DEBUG MessageBox.Show(ex.Message); #endif lblLastAdded.Content = "Something went wrong"; } }
// GET: DepartmentNames/Delete/5 public async Task <ActionResult> Delete(decimal id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DepartmentName departmentName = await db.DepartmentNames.FindAsync(id); if (departmentName == null) { return(HttpNotFound()); } return(View(departmentName)); }
public ActionResult ViewDepartment(DepartmentName departmentName, FormCollection form) { try { string department = form["Department"].ToString(); List <CourseStatics> courseStaticses = courseStaticsManager.GetCourseStatics(department); ViewBag.CourseStaticses = courseStaticses; } catch (Exception exception) { ViewBag.Message = exception.Message; } ViewBag.Departments = courseStaticsManager.GetDepartmentDropdownList(); return(View()); }
public Group(DepartmentName depName, int groupNumber) { this.groupNumber = groupNumber; this.Department = depName; }
public HttpResponseMessage GetSearchResult(object data) { var db = DbUtils.GetDBConnection(); db.Connection.Open(); IEnumerable <IDictionary <string, object> > response = null; var jsonData = JsonConvert.SerializeObject(data); var dictJson = JsonConvert.DeserializeObject <Dictionary <string, object> >(jsonData); object actionObject; dictJson.TryGetValue("actionName", out actionObject); string Action = actionObject.ToString(); string input_queryapi = ""; object userName; dictJson.TryGetValue("queried_by_username", out userName); if (Action.Equals("GetTableSchema")) { object tableName; dictJson.TryGetValue("TableName", out tableName); input_queryapi = tableName.ToString(); response = db.Query("INFORMATION_SCHEMA.COLUMNS").Select("COLUMN_NAME").WhereRaw("TABLE_NAME = ?", tableName).Get().Cast <IDictionary <string, object> >(); return(Request.CreateResponse(HttpStatusCode.OK, response)); } if (Action.Equals("GetInstructorByName")) { object empName; dictJson.TryGetValue("EmpName", out empName); input_queryapi = empName.ToString(); response = db.Query("Employee").WhereRaw("lower(EmpName) = ?", empName).Get().Cast <IDictionary <string, object> >(); //response = db.Query("Employee").WhereRaw("lower(EmpName) = ?", "dr. abdul aziz").Get().Cast<IDictionary<string, object>>(); } else if (Action.Equals("GetInstructorByEmail")) { object email; dictJson.TryGetValue("Email", out email); input_queryapi = email.ToString(); response = db.Query("Employee").WhereRaw("lower(Email) = ?", email).Get().Cast <IDictionary <string, object> >(); } else if (Action.Equals("GetInstructorByRank")) { object designationTitle; dictJson.TryGetValue("DesignationTitle", out designationTitle); input_queryapi = designationTitle.ToString(); response = db.Query("Employee").Join("Designation", "Employee.DesignationID", "Designation.DesignationID").Where("DesignationTitle", designationTitle).Get().Cast <IDictionary <string, object> >(); //get product by id=1 } else if (Action.Equals("GetInstructorByDepartment")) { object departmentID; dictJson.TryGetValue("DepartmentID", out departmentID); input_queryapi = departmentID.ToString(); response = db.Query("Employee").Join("Department", "Employee.DepartmentID", "Department.DepartmentID").Where("Department.DepartmentID", departmentID).Get().Cast <IDictionary <string, object> >(); //get product by id=1 } else if (Action.Equals("GetInstructorByNameStartsWith")) { object startNamePrefix; dictJson.TryGetValue("EmpName", out startNamePrefix); string prefixString = startNamePrefix.ToString() + "%"; input_queryapi = startNamePrefix.ToString(); response = db.Query("Employee").WhereLike("EmpName", prefixString).Get().Cast <IDictionary <string, object> >(); //get product by id=1 } else if (Action.Equals("GetInstructorByNameContains")) { object startNamePrefix; dictJson.TryGetValue("EmpName", out startNamePrefix); string prefixString = "%" + startNamePrefix.ToString() + "%"; input_queryapi = startNamePrefix.ToString(); response = db.Query("Employee").WhereLike("EmpName", prefixString).Get().Cast <IDictionary <string, object> >(); //get product by id=1 } else if (Action.Equals("GetInstructorByCourseName")) { object courseName; dictJson.TryGetValue("CourseName", out courseName); input_queryapi = courseName.ToString(); response = db.Query("Employee").Join("CourseFaculty", "Employee.EmpID", "CourseFaculty.EmpID").Join("CourseOffered", "CourseOffered.CourseOfferedID", "CourseFaculty.CourseOfferedID").Join("Course", "CourseOffered.CourseID", "Course.CourseID").Where("CourseName", courseName).Get().Cast <IDictionary <string, object> >(); //get product by id=1 } else if (Action.Equals("GetInstructorByCourseCode")) { object courseCode; dictJson.TryGetValue("CourseCode", out courseCode); input_queryapi = courseCode.ToString(); response = db.Query("Employee").Join("CourseFaculty", "Employee.EmpID", "CourseFaculty.EmpID").Join("CourseOffered", "CourseOffered.CourseOfferedID", "CourseFaculty.CourseOfferedID").Join("Course", "CourseOffered.CourseID", "Course.CourseID").Where("CourseCode", courseCode).Get().Cast <IDictionary <string, object> >(); //get product by id=1 } else if (Action.Equals("GetCoursesTaughtByASpecificInstructor")) { object EmpName; dictJson.TryGetValue("EmpName", out EmpName); input_queryapi = EmpName.ToString(); response = db.Query("Semester").Select("CourseName").Join("CourseOffered", "Semester.SemesterID", "CourseOffered.SemesterID").Join("Course", "Course.CourseID", "CourseOffered.CourseID") .Join("CourseFaculty", "CourseFaculty.CourseOfferedID", "CourseOffered.CourseOfferedID") .Join("Employee", "Employee.EmpID", "CourseFaculty.EmpID") .Where("EmpName", EmpName).Get().Cast <IDictionary <string, object> >(); //get product by id=1 } else if (Action.Equals("GetCoursesTaughtByAInstructorInAParticularSemester")) { object semesterName; object empName; dictJson.TryGetValue("EmpName", out empName); dictJson.TryGetValue("SemesterName", out semesterName); input_queryapi = empName.ToString() + " " + semesterName.ToString(); response = db.Query("Semester").Join("CourseOffered", "Semester.SemesterID", "CourseOffered.SemesterID").Join("Course", "Course.CourseID", "CourseOffered.CourseID") .Join("CourseFaculty", "CourseFaculty.CourseOfferedID", "CourseOffered.CourseOfferedID") .Join("Employee", "Employee.EmpID", "CourseFaculty.EmpID") .Where("SemesterName", semesterName) .Where("EmpName", empName).Get().Cast <IDictionary <string, object> >(); //get product by id=1 } // STUDENT QUERIES else if (Action.Equals("GetStudentByName")) { object SName; dictJson.TryGetValue("SName", out SName); input_queryapi = SName.ToString(); response = db.Query("Student").WhereRaw("lower(SName) = ?", SName).Get().Cast <IDictionary <string, object> >(); } else if (Action.Equals("GetStudentByStudentID")) { object RollNumber; dictJson.TryGetValue("RollNumber", out RollNumber); input_queryapi = RollNumber.ToString(); response = db.Query("Student").WhereRaw("lower(RollNumber) = ?", RollNumber).Get().Cast <IDictionary <string, object> >(); } else if (Action.Equals("GetStudentByBatchID")) { object BatchID; dictJson.TryGetValue("BatchID", out BatchID); input_queryapi = BatchID.ToString(); response = db.Query("Student").WhereRaw("BatchID = ?", BatchID).Get().Cast <IDictionary <string, object> >(); } else if (Action.Equals("GetStudentsByDepartment")) { object DepartmentName; dictJson.TryGetValue("DepartmentName", out DepartmentName); input_queryapi = DepartmentName.ToString(); response = db.Query("Student").Join("Programme", "Programme.ProgrammeID", "Student.ProgrammeID").Join("Department", "Department.DepartmentID", "Programme.DepartmentID") .Where("DepartmentName", DepartmentName).Get().Cast <IDictionary <string, object> >(); } else if (Action.Equals("GetStudentsBySection")) { object SectionName; dictJson.TryGetValue("SectionName", out SectionName); input_queryapi = SectionName.ToString(); response = db.Query("Student").Join("Section", "Section.BatchID", "Student.BatchID") .Where("SectionName", SectionName).Get().Cast <IDictionary <string, object> >(); } else if (Action.Equals("GetStudentByNUEmail")) { object Email; dictJson.TryGetValue("Email", out Email); input_queryapi = Email.ToString(); response = db.Query("Student").Join("CandidateStudent", "CandidateStudent.CandidateID", "Student.CandidateID") .Where("Student.Email", Email).Get().Cast <IDictionary <string, object> >(); } else if (Action.Equals("GetStudentByPrimaryEmail")) { object Email; dictJson.TryGetValue("Email", out Email); input_queryapi = Email.ToString(); response = db.Query("Student").Join("CandidateStudent", "CandidateStudent.CandidateID", "Student.CandidateID") .Where("CandidateStudent.Email", Email).Get().Cast <IDictionary <string, object> >(); } else if (Action.Equals("GetStudentsByNameStartsWith")) { object startNamePrefix; dictJson.TryGetValue("Sname", out startNamePrefix); input_queryapi = startNamePrefix.ToString(); string prefixString = startNamePrefix.ToString() + "%"; response = db.Query("Student").WhereLike("Sname", prefixString).Get().Cast <IDictionary <string, object> >(); //get product by id=1 } else if (Action.Equals("GetStudentsByNameContains")) { object startNamePrefix; dictJson.TryGetValue("EmpName", out startNamePrefix); input_queryapi = startNamePrefix.ToString(); string prefixString = "%" + startNamePrefix.ToString() + "%"; response = db.Query("Student").WhereLike("Sname", prefixString).Get().Cast <IDictionary <string, object> >(); //get product by id=1 } else if (Action.Equals("GetStudentsByCourseName")) { object CourseName; dictJson.TryGetValue("CourseName", out CourseName); input_queryapi = CourseName.ToString(); response = db.Query("Student").Join("CourseEnrollment", "CourseEnrollment.StudentID", "Student.StudentID").Join("Course", "Course.CourseID", "CourseEnrollment.CourseID") .Where("CourseName", CourseName).Get().Cast <IDictionary <string, object> >(); } else if (Action.Equals("GetStudentsByCourseCode")) { object CourseCode; dictJson.TryGetValue("CourseCode", out CourseCode); input_queryapi = CourseCode.ToString(); response = db.Query("Student").Join("CourseEnrollment", "CourseEnrollment.StudentID", "Student.StudentID").Join("Course", "Course.CourseID", "CourseEnrollment.CourseID") .Where("CourseCode", CourseCode).Get().Cast <IDictionary <string, object> >(); } else if (Action.Equals("GetStudentsBySkill")) { response = db.Query("StudentSkills").Join("Skill", "Skill.SkillID", "StudentSkills.SkillID").Join("Student", "StudentSkills.StudentID", "Student.StudentID") .Get().Cast <IDictionary <string, object> >(); } else if (Action.Equals("GetStudentsByDomain")) { response = db.Query("Domain").Join("Skill", "Skill.DomainID", "Domain.DomainID").Join("StudentSkills", "StudentSkills.SkillID", "Skill.SkillID").Join("Student", "Student.StudentID", "StudentSkills.StudentID") .Get().Cast <IDictionary <string, object> >(); } //var db1 = DbUtils.GetDBConnection(); //db1.Connection.Open(); SqlConnection dbConnection = new SqlConnection(ConfigurationManager.AppSettings["SqlDBConn"].ToString()); try { /** * db1.Query("dbo.SearchLog").AsInsert(new * { * input_query = input_queryapi, * actionName = Action, * queried_by_username = userName.ToString() * }); **/ string query = "INSERT INTO dbo.SearchLog(input_query, actionName, queried_by_username) VALUES(@input_query,@actionName,@queried_by_username)"; using (SqlCommand command = new SqlCommand(query, dbConnection)) { command.Parameters.AddWithValue("@input_query", input_queryapi); command.Parameters.AddWithValue("@actionName", Action); command.Parameters.AddWithValue("@queried_by_username", userName.ToString()); dbConnection.Open(); int result = command.ExecuteNonQuery(); // Check Error if (result < 0) { Console.WriteLine("Error inserting data into Database!"); } } } catch (Exception e) { } return(Request.CreateResponse(HttpStatusCode.OK, response)); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (EmployeeId != null) { hashCode = hashCode * 59 + EmployeeId.GetHashCode(); } if (EmployeeCode != null) { hashCode = hashCode * 59 + EmployeeCode.GetHashCode(); } if (EmployeeName != null) { hashCode = hashCode * 59 + EmployeeName.GetHashCode(); } hashCode = hashCode * 59 + Gender.GetHashCode(); if (DateOfBirth != null) { hashCode = hashCode * 59 + DateOfBirth.GetHashCode(); } if (PhoneNumber != null) { hashCode = hashCode * 59 + PhoneNumber.GetHashCode(); } if (DepartmentId != null) { hashCode = hashCode * 59 + DepartmentId.GetHashCode(); } if (DepartmentName != null) { hashCode = hashCode * 59 + DepartmentName.GetHashCode(); } if (Email != null) { hashCode = hashCode * 59 + Email.GetHashCode(); } hashCode = hashCode * 59 + Salary.GetHashCode(); hashCode = hashCode * 59 + WorkStatus.GetHashCode(); if (PositionId != null) { hashCode = hashCode * 59 + PositionId.GetHashCode(); } if (PositionName != null) { hashCode = hashCode * 59 + PositionName.GetHashCode(); } if (TaxCode != null) { hashCode = hashCode * 59 + TaxCode.GetHashCode(); } if (JoinDate != null) { hashCode = hashCode * 59 + JoinDate.GetHashCode(); } if (IdentityNumber != null) { hashCode = hashCode * 59 + IdentityNumber.GetHashCode(); } if (IdentityDate != null) { hashCode = hashCode * 59 + IdentityDate.GetHashCode(); } if (IdentityPlace != null) { hashCode = hashCode * 59 + IdentityPlace.GetHashCode(); } return(hashCode); } }
public override int GetHashCode() { return(-0x502B77AC ^ Name.GetHashCode() ^ Address.GetHashCode() ^ DepartmentName.GetHashCode()); }
public void Update() { string strsql = "update Department set " + "DepartmentName= '" + DepartmentName.Replace("'", "''") + "', " + "Status= '" + Status.Replace("'", "''") + "' " + " where ID =" + Id; SqlConnection ObjConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["MyJobPortal"].ConnectionString); ObjConnection.Open(); SqlCommand ObjCommand = new SqlCommand(strsql, ObjConnection); ObjCommand.ExecuteNonQuery(); ObjConnection.Dispose(); ObjCommand.Dispose(); }
public Department(DepartmentName DepartmentName, SubDepartment SubDepartmentName) { this.Name = DepartmentName; this.SubDepartmentName = SubDepartmentName; }
public static List <SubDepartment> GetSubdepartment(DepartmentName dept) { List <SubDepartment> list = new List <SubDepartment>(); switch (dept) { case DepartmentName.Security: list.Add(SubDepartment.All); list.Add(SubDepartment.MnT); list.Add(SubDepartment.AudienceGates); list.Add(SubDepartment.VIPGates); list.Add(SubDepartment.FirstQuad); list.Add(SubDepartment.Woods); break; case DepartmentName.Texxx: list.Add(SubDepartment.All); list.Add(SubDepartment.FirstQuad); list.Add(SubDepartment.Foyer); list.Add(SubDepartment.Halls); list.Add(SubDepartment.Classrooms); list.Add(SubDepartment.VSM); list.Add(SubDepartment.Mobiles); list.Add(SubDepartment.Inventory); break; case DepartmentName.All: list.Add(SubDepartment.All); list.Add(SubDepartment.MnT); list.Add(SubDepartment.AudienceGates); list.Add(SubDepartment.VIPGates); list.Add(SubDepartment.FirstQuad); list.Add(SubDepartment.Woods); list.Add(SubDepartment.Judges); list.Add(SubDepartment.Floors); list.Add(SubDepartment.Halls); list.Add(SubDepartment.Foyer); list.Add(SubDepartment.Classrooms); list.Add(SubDepartment.Events); list.Add(SubDepartment.Constructions); list.Add(SubDepartment.Displays); list.Add(SubDepartment.VSM); list.Add(SubDepartment.Mobiles); list.Add(SubDepartment.Inventory); break; case DepartmentName.Assistance: list.Add(SubDepartment.All); list.Add(SubDepartment.Judges); list.Add(SubDepartment.Floors); list.Add(SubDepartment.Halls); list.Add(SubDepartment.Foyer); break; case DepartmentName.Logistics: list.Add(SubDepartment.All); list.Add(SubDepartment.Classrooms); list.Add(SubDepartment.Events); list.Add(SubDepartment.Constructions); list.Add(SubDepartment.Displays); break; } list.Add(SubDepartment.None); return(list); }
public Department(DepartmentName departmentName, string companyId) : base(departmentName.ToString(), UnitType.Department) { this.companyId = companyId; }
public Department(DepartmentName departmentName) : base(departmentName.ToString(), UnitType.Department) { }
private void RefreshThisForm() { TotalPersonnelRequired.Clear(); DepartmentName.Clear(); }
public HumanResourseDepartment(string companyId, DepartmentName departmentName) : base(DepartmentName.HR) { this.companyId = companyId; }
public override Expression <Func <User, bool> > ToPredicateExpression() { if (String.IsNullOrEmpty(SmgId) && String.IsNullOrEmpty(NameEng) && String.IsNullOrEmpty(FirstNameEng) && String.IsNullOrEmpty(LastNameEng) && String.IsNullOrEmpty(DepartmentName) && String.IsNullOrEmpty(DepartmentCode) && String.IsNullOrEmpty(Room) && String.IsNullOrEmpty(Position)) { return(user => true); } return(user => (String.IsNullOrEmpty(SmgId) || user.SmgUserId.ToString().Contains(SmgId)) && (String.IsNullOrEmpty(NameEng) || (user.UserProfile.FirstNameEng.ToLower() + " " + user.UserProfile.LastNameEng.ToLower()).Contains(NameEng.ToLower())) && (String.IsNullOrEmpty(FirstNameEng) || user.UserProfile.FirstNameEng.ToLower().Contains(FirstNameEng.ToLower())) && (String.IsNullOrEmpty(LastNameEng) || user.UserProfile.LastNameEng.ToLower().Contains(LastNameEng.ToLower())) && (String.IsNullOrEmpty(DepartmentName) || user.Department.Name.ToLower().Contains(DepartmentName.ToLower())) && (String.IsNullOrEmpty(DepartmentCode) || user.Department.DepartmentCode.ToLower().Contains(DepartmentCode.ToLower())) && (String.IsNullOrEmpty(Room) || user.UserProfile.Room.Contains(Room)) && (String.IsNullOrEmpty(Position) || user.UserProfile.Position.ToLower().Contains(Position.ToLower()))); }
public Group(DepartmentName name) { this.Department = name; }
/// <summary> /// Returns true if Employee instances are equal /// </summary> /// <param name="other">Instance of Employee to be compared</param> /// <returns>Boolean</returns> public bool Equals(Employee other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( EmployeeId == other.EmployeeId || EmployeeId != null && EmployeeId.Equals(other.EmployeeId) ) && ( EmployeeCode == other.EmployeeCode || EmployeeCode != null && EmployeeCode.Equals(other.EmployeeCode) ) && ( EmployeeName == other.EmployeeName || EmployeeName != null && EmployeeName.Equals(other.EmployeeName) ) && ( Gender == other.Gender || Gender.Equals(other.Gender) ) && ( DateOfBirth == other.DateOfBirth || DateOfBirth != null && DateOfBirth.Equals(other.DateOfBirth) ) && ( PhoneNumber == other.PhoneNumber || PhoneNumber != null && PhoneNumber.Equals(other.PhoneNumber) ) && ( DepartmentId == other.DepartmentId || DepartmentId != null && DepartmentId.Equals(other.DepartmentId) ) && ( DepartmentName == other.DepartmentName || DepartmentName != null && DepartmentName.Equals(other.DepartmentName) ) && ( Email == other.Email || Email != null && Email.Equals(other.Email) ) && ( Salary == other.Salary || Salary.Equals(other.Salary) ) && ( WorkStatus == other.WorkStatus || WorkStatus.Equals(other.WorkStatus) ) && ( PositionId == other.PositionId || PositionId != null && PositionId.Equals(other.PositionId) ) && ( PositionName == other.PositionName || PositionName != null && PositionName.Equals(other.PositionName) ) && ( TaxCode == other.TaxCode || TaxCode != null && TaxCode.Equals(other.TaxCode) ) && ( JoinDate == other.JoinDate || JoinDate != null && JoinDate.Equals(other.JoinDate) ) && ( IdentityNumber == other.IdentityNumber || IdentityNumber != null && IdentityNumber.Equals(other.IdentityNumber) ) && ( IdentityDate == other.IdentityDate || IdentityDate != null && IdentityDate.Equals(other.IdentityDate) ) && ( IdentityPlace == other.IdentityPlace || IdentityPlace != null && IdentityPlace.Equals(other.IdentityPlace) )); }
public Groups(int groupNumber, DepartmentName departnemnt) { this.GroupNumber = groupNumber; this.Department = departnemnt; }
public void SyncAppWithAD() { string filePath = Path.Combine(HttpRuntime.AppDomainAppPath, "SyncLog.txt"); System.IO.File.AppendAllText(filePath, DateTime.Now.ToString() + Environment.NewLine); using (var context = new PrincipalContext(ContextType.Domain, "intechww.com"))// "tenf.loc")) { byte empFound = 0; int counter = 0; int insertedEmp = 0; int UpdatedEmp = 0; //List<string> loginsList = new List<string>(); var path = @"D:\LeaveON - AD\Intranet\ADUserList.txt"; using (var searcher = new PrincipalSearcher(new UserPrincipal(context))) { /////////////find in app database var AllIntechUsers = searcher.FindAll(); List <AspNetUser> LstAspNetUsers = db.AspNetUsers.ToList <AspNetUser>(); //------- //int cntr = 0; //int non = 0; //int authFalse = 0; //AuthenticablePrincipal auth1; //foreach (var result in AllIntechUsers) //{ // auth1 = result as AuthenticablePrincipal; // if (auth1.UserPrincipalName == null) // { // non += 1; // continue; // } // if (auth1 != null && auth1.Enabled == true) // { // cntr += 1; // } // if (auth1 != null && auth1.Enabled == false) // { // authFalse += 1; // } //} //------- DateTime DateMark = DateTime.ParseExact("30/12/2019", "dd/MM/yyyy", CultureInfo.InvariantCulture); DateTime lastLogonStr; AuthenticablePrincipal auth; List <string> departmentsList = new List <string>(); List <string> countriesList = new List <string>(); foreach (var result in AllIntechUsers) { DirectoryEntry de = result.GetUnderlyingObject() as DirectoryEntry; //Console.WriteLine("First Name: " + de.Properties["givenName"].Value); //Console.WriteLine("Last Name : " + de.Properties["sn"].Value); //Console.WriteLine("SAM account name : " + de.Properties["samAccountName"].Value); //Console.WriteLine("User principal name: " + de.Properties["userPrincipalName"].Value); //Console.WriteLine(); //if (de.Properties["userPrincipalName"].Value == null) //{ // continue; //} //DateTime WhenCreated = DateTime.Parse(de.Properties["whenCreated"].Value.ToString().Trim()); //DateTime LastLogon = DateTime.ParseExact("01/01/2019", "dd/MM/yyyy", CultureInfo.InvariantCulture); //= DateTime.Parse(de.Properties["LastLogon"].Value.ToString().Trim()); auth = result as AuthenticablePrincipal; if (auth == null || auth.UserPrincipalName == null || string.IsNullOrEmpty(auth.UserPrincipalName) || auth.Enabled == false) { continue;//we dont need this. simply move to next } if (auth.UserPrincipalName.ToLower().Contains("usman.shahzad")) { var abc = ""; var abbb = de.Properties["EmployeeId"].Value; } counter += 1; object adsLargeInteger = de.Properties["lastLogon"].Value; if (adsLargeInteger == null) { continue; } else { long highPart = (Int32) adsLargeInteger.GetType() .InvokeMember("HighPart", BindingFlags.GetProperty, null, adsLargeInteger, null); long lowPart = (Int32) adsLargeInteger.GetType() .InvokeMember("LowPart", BindingFlags.GetProperty, null, adsLargeInteger, null); long lastLogonL = (long)((uint)lowPart + (((long)highPart) << 32)); // Get value as long lastLogonStr = DateTime.FromFileTime(lastLogonL); // get value as DateTime string } //TimeSpan TimeDifference = LastLogon - DateMarker; if (lastLogonStr > DateMark && !string.IsNullOrEmpty(Convert.ToString(de.Properties["co"].Value))) { departmentsList.Add(Convert.ToString(de.Properties["department"].Value)); countriesList.Add(Convert.ToString(de.Properties["co"].Value)); AspNetUser aspNetUser = LstAspNetUsers.FirstOrDefault(x => x.UserName.Replace(" ", "").ToUpper() == auth.UserPrincipalName.Replace(" ", "").ToUpper()); if (aspNetUser == null) {//Insert //it means if user is created before "01/01/2019" then totaDays will be in minus. so not add very old users. only add new users. which are after "01/01/2019" //this is just to fast the process //if (TimeDifference.TotalDays < 0) continue; insertedEmp += 1; InsertEmployee(de); } else {//Update if (aspNetUser.IsActive != IsActive(de) || string.IsNullOrEmpty(aspNetUser.DepartmentName) || aspNetUser.DepartmentName != Convert.ToString(de.Properties["department"].Value) || aspNetUser.CntryName != Convert.ToString(de.Properties["co"].Value) || aspNetUser.BioStarEmpNum == 0) { UpdateEmployee(aspNetUser, de); } } } //} //////////////////////////// } //-----------add department name which does not exist in LMS-DB------------ List <string> distinctDepartmentNames = departmentsList.Distinct().ToList(); foreach (string itm in distinctDepartmentNames) { DepartmentName departmentName = db.DepartmentNames.FirstOrDefault(x => x.Name == itm); if (departmentName == null && !string.IsNullOrEmpty(itm.Trim())) { departmentName = new DepartmentName() { Name = itm }; db.DepartmentNames.Add(departmentName); } } //-------------remove department name which does not exist in AD------------- foreach (var itm in db.DepartmentNames.ToList()) { string foundName = distinctDepartmentNames.FirstOrDefault(x => x == itm.Name); if (string.IsNullOrEmpty(foundName)) { db.DepartmentNames.Remove(itm); } } //-----------add country name which does not exist in LMS-DB------------ List <string> distinctCountriesNames = countriesList.Distinct().ToList(); foreach (string itm in distinctCountriesNames) { CountryName countryName = db.CountryNames.FirstOrDefault(x => x.Name == itm); if (countryName == null && !string.IsNullOrEmpty(itm.Trim())) { countryName = new CountryName() { Name = itm }; db.CountryNames.Add(countryName); } } db.SaveChanges(); //System.IO.File.WriteAllLines(path, loginsList); ////////////////////////////now find in AD //foreach (Employee item in _LstEmployees) //{ // foreach (var result in AllIntechUsers) // { // DirectoryEntry de = result.GetUnderlyingObject() as DirectoryEntry; // empFound = false; // if (item.EmployeeName == Convert.ToString(de.Properties["userPrincipalName"].Value)) // { // empFound = true; // break; // } // } // if (empFound == false) // { // DeleteEmployee(item.EmployeeCode); // } //} } //if (insertedEmp > 0 || UpdatedEmp > 0) //{ // MessageBox.Show(insertedEmp + " new user(s) found." + System.Environment.NewLine + UpdatedEmp + " user(s) status updated." + System.Environment.NewLine + "Please close and reopen this form to view updated data"); //} //else //{ // MessageBox.Show("Data is up-to-date"); //} } }