private void SkinDataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (skinDataGridView1.Columns[e.ColumnIndex].Name == "colBtn_drop") { Staff model = new Staff(); model.Id = Convert.ToInt32(skinDataGridView1.Rows[e.RowIndex].Cells["staff_id"].Value); if (StaffDAL.Drop(model, new List <string>() { "id" })) { ShowDataGird(); MessageBoxEx.Show("删除成功", "", MessageBoxButtons.OK, MessageBoxIcon.Information); } } if (skinDataGridView1.Columns[e.ColumnIndex].Name == "colBtn_alter") { Staff model = new Staff(); model.Id = Convert.ToInt32(skinDataGridView1.Rows[e.RowIndex].Cells["staff_id"].Value); model.StaffName = skinDataGridView1.Rows[e.RowIndex].Cells["staff_name"].Value.ToString(); model.Store_Id = Convert.ToInt32(skinDataGridView1.Rows[e.RowIndex].Cells["Store_Id"].Value); model.Gender = skinDataGridView1.Rows[e.RowIndex].Cells["staff_Gender"].Value.ToString(); if (StoreDAL.FindModel(new Store(model.Store_Id), new List <string>() { "id" }) == null) { MessageBoxEx.Show("修改失败,不存在此门店", "", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (StaffDAL.AlterByPK(model, "id")) { ShowDataGird(); MessageBoxEx.Show("修改成功", "", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
public StaffDTO(StaffDAL staffDAL) { Id = staffDAL.Id; Name = staffDAL.Name; SubordinatesId = new List <int>(staffDAL.SubordinatesId); MentorId = staffDAL.MentorId; }
protected void ButSave_Click(object sender, EventArgs e) { StaffDAL stdal = new StaffDAL(); tab = 3; string selected = Request.QueryString["studentID"]; int staffID = (int)(Session["accountID"]); Business.ScsBO sbo = new Business.ScsBO(); if (FileUploadSave.HasFile) { string imagefile = Path.GetFileName(FileUploadSave.PostedFile.FileName); if (sbo.canUpfile(imagefile)) { FileUploadSave.SaveAs(Server.MapPath("~/Images/") + FileUploadSave.PostedFile.FileName); //sbo.insertFile(imagefile, "Images/" + imagefile, selected, staffID); stdal.insertComment(selected, "", staffID.ToString(), imagefile); upLabel.Text = "Tải lên thành công!"; grMyComment.DataBind(); } else { Label1.Text = "File tải lên trùng tên !"; } } else { Label1.Text = "Lỗi "; } }
/// <summary> /// 保存员工档案 /// </summary> /// <param name="staff">需要保存的员工档案</param> /// <returns>是否成功</returns> public bool SaveStaff(Staff staff) { //throw new NotImplementedException(); IStaffDAL dAL = new StaffDAL(); if (dAL.QueryById(staff.Id) != null) { if (dAL.Update(staff) > 0) { return(true); } else { return(false); } } else { if (dAL.Add(staff) > 0) { return(true); } else { return(false); } } }
// After refactoring to not hold some stuff like staff inside of // itself, we're taking them as arguments (since you often need // to change the others too). We could also make it so setting them // to null doesn't change them as well. // XXX: Not sure this is the best solution. We'll see if it works though. public static bool UpdateCourse(Course c, Staff leadStaff, Staff supportStaff, IEnumerable <Prerequisite> prerequisites) { bool result = false; using (var connection = DbConn.GetConnection()) { connection.Open(); var transaction = connection.BeginTransaction("UpdateCourse for " + c.Id); try { SqlCommand updateCommand = new SqlCommand("mcftacademics.dbo.UpdateCourseById", connection); updateCommand.Transaction = transaction; updateCommand.CommandType = System.Data.CommandType.StoredProcedure; updateCommand.Parameters.AddWithValue("@id", c.Id); updateCommand.Parameters.AddWithValue("@name", c.Name); updateCommand.Parameters.AddWithValue("@credit", c.Credit); updateCommand.Parameters.AddWithValue("@description", c.Description); updateCommand.Parameters.AddWithValue("@lectureHours", c.LectureHours); updateCommand.Parameters.AddWithValue("@labHours", c.LabHours); updateCommand.Parameters.AddWithValue("@examHours", c.ExamHours); updateCommand.Parameters.AddWithValue("@revisionNumber", c.RevisionNumber); updateCommand.Parameters.AddWithValue("@program", c.Program); updateCommand.Parameters.AddWithValue("@accreditation", c.Accreditation); int rows = updateCommand.ExecuteNonQuery(); if (rows > 0) { //Drop existing staff (so they're not multiple instructors) //and add back the lead staff and support if there is one StaffDAL.DropStaff(connection, c.Id, transaction); StaffDAL.AddStaff(connection, c.Id, leadStaff, transaction); if (supportStaff != null) { StaffDAL.AddStaff(connection, c.Id, supportStaff, transaction); } PrerequisiteDAL.DropPrereqs(connection, c.Id, transaction); foreach (Prerequisite prereq in prerequisites) { PrerequisiteDAL.AddPrereq(connection, prereq, transaction); } transaction.Commit(); result = true; } } catch (Exception) { try { transaction.Rollback(); } catch { // if THAT fails throw; } throw; } } return(result); }
public List <Staff> GetAllStaffByTOrgId(int tOrgId) { //throw new NotImplementedException(); IStaffDAL dAL = new StaffDAL(); return(dAL.GetAllStaffByTOrgId(tOrgId)); }
public List <Staff> GetAllStaffWaitCheck() { //throw new NotImplementedException(); IStaffDAL dAL = new StaffDAL(); return(dAL.GetAllStaffWaitCheck()); }
public Staff GetStaffById(int id) { //throw new NotImplementedException(); IStaffDAL dAL = new StaffDAL(); return(dAL.QueryById(id)); }
public Form1(int UserId) { this.UserId = UserId; InitializeComponent(); GetEmployees = StaffDAL.GetEmployees(); bindingSource = new BindingSource(GetEmployees, null); dataGridView1.DataSource = bindingSource; this.dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect; }
public static List <DTO.Staff> Staff_Search_SelectList(Staff.BLDAL.DTO.Staff _StaffLine) { List <Staff.BLDAL.DTO.Staff> StaffList = new List <Staff.BLDAL.DTO.Staff>(); try { StaffDAL IO = new StaffDAL(); SqlDataReader myReader = IO.Staff_Search_SelectList(_StaffLine); while (myReader.Read()) { Staff.BLDAL.DTO.Staff StaffLine = new Staff.BLDAL.DTO.Staff(); if (myReader["StaffID"] != DBNull.Value) { StaffLine.StaffID = (int)myReader["StaffID"]; } if (myReader["LastName"] != DBNull.Value) { StaffLine.LastName = (string)myReader["CompanyName"]; } if (myReader["MiddleName"] != DBNull.Value) { StaffLine.MiddleName = (string)myReader["Address"]; } if (myReader["FirstName"] != DBNull.Value) { StaffLine.FirstName = (string)myReader["FirstName"]; } if (myReader["Gender"] != DBNull.Value) { StaffLine.Gender = (string)myReader["Gender"]; } if (myReader["Position"] != DBNull.Value) { StaffLine.Position = (string)myReader["Position"]; } if (myReader["HiredDate"] != DBNull.Value) { StaffLine.HiredDate = (string)myReader["HiredDate"]; } if (myReader["Salary"] != DBNull.Value) { StaffLine.Salary = (string)myReader["Salary"]; } StaffList.Add(StaffLine); } myReader.Close(); } catch (Exception ex) { if (ConfigurationManager.AppSettings["RethrowErrors"] == "true") { throw ex; } return(new List <Staff.BLDAL.DTO.Staff>()); } return(StaffList); }
public static IList <Staff> ListStaffsInGroup(int groupId) { return(StaffDAL.Get( s => s.Assignments.Any(a => a.GroupId == groupId), null, new List <Expression <Func <Staff, object> > > { s => s.Assignments, } ).ToList()); }
protected void btnUpdateStaff_Click(object sender, EventArgs e) { StaffDAL stdal = new StaffDAL(); tab = 3; string selected = Request.QueryString["studentID"]; Business.ScsBO sbo = new Business.ScsBO(); stdal.isUpdateStaffName(selected, drpStaff.SelectedValue); lbResult.Text = "Cập nhật thành công"; }
private void btnUpate_Click(object sender, EventArgs e) { if (StaffDAL.UpdateEmployeeDetails(int.Parse(employee[0].ToString()), txtLastName.Text, txtFirstName.Text, txtNickname.Text, txtUsername.Text, txtTelephoneExtension.Text, bool.Parse(txtFlagDeleted.Text))) { this.Close(); } else { MessageBox.Show("Update Failed"); } }
public DataTable getStaff() { try { StaffDAL obj = new StaffDAL();//calling from the data access return(obj.readStaff()); } catch (Exception) { throw; } }
public ActionResult Amend(Models.Staff smodel) { if (ModelState.IsValid) { StaffDAL.UpdateEmployeeDetails(smodel); return(Redirect("Home")); } else { return(Redirect("Home")); } }
public Staff Login(Staff staff) { byte[] hashedBytes = md5.ComputeHash(Encoding.ASCII.GetBytes(staff.Password)); string hashedPassword = Encoding.ASCII.GetString(hashedBytes); Staff information = StaffDAL.GetByEmail(staff.Email); if (information != null && information.Password == hashedPassword) { return(information); } return(null); }
private void btnLogin_Click(object sender, EventArgs e) { DatabaseDataSet.GetEmployeeListDataTable getEmployeeListRows = StaffDAL.getEmployeeList(); foreach (DatabaseDataSet.GetEmployeeListRow item in getEmployeeListRows.Rows) { if (item.Username == txtUsername.Text) { Form1 form = new Form1(item.StaffID); form.Show(); this.Hide(); } } }
protected void rdComment_SelectedIndexChanged(object sender, EventArgs e) { StaffDAL stdal = new StaffDAL(); tab = 3; string selected = Request.QueryString["studentID"]; int staffID = (int)(Session["accountID"]); Business.ScsBO sb = new Business.ScsBO(); stdal.insertComment(selected, rdComment.SelectedValue, staffID.ToString(), ""); Label10.Text = "Thêm nhận xét thành công!"; grMyComment.DataBind(); }
public Form3(object[] values, int UserId) { InitializeComponent(); GetEmployees = StaffDAL.getEmployeeDetails(int.Parse(values[0].ToString())); employee = GetEmployees.Rows[0].ItemArray; txtFirstName.Text = employee[2].ToString(); txtLastName.Text = employee[1].ToString(); txtNickname.Text = employee[3].ToString(); txtTelephoneExtension.Text = employee[6].ToString(); txtUsername.Text = employee[4].ToString(); txtFlagDeleted.Text = employee[7].ToString(); }
public int Create(Staff staff) { byte[] hashedBytes = md5.ComputeHash(Encoding.ASCII.GetBytes(staff.Password)); string hashedPassword = Encoding.ASCII.GetString(hashedBytes); staff.Password = hashedPassword; if (StaffDAL.GetByEmail(staff.Email) != null) { return(-1); } return(StaffDAL.Create(staff)); }
protected void cbRemove_CheckedChanged(object sender, EventArgs e) { StaffDAL stdal = new StaffDAL(); string selected = Request.QueryString["studentID"]; Business.ScsBO sbo = new Business.ScsBO(); if (cbRemove.Checked == false) { stdal.insertTakecareStatus(selected, 0); } else { stdal.insertTakecareStatus(selected, 1); } }
/// <summary> /// 逻辑删除员工档案 /// </summary> /// <param name="id">主键id</param> /// <returns>是否成功</returns> public bool LoginDeleteStaff(int id) { //throw new NotImplementedException(); IStaffDAL dAL = new StaffDAL(); if (dAL.LoginDeleteStaff(id) > 0) { return(true); } else { return(false); } }
protected void btnRecomment_Click(object sender, EventArgs e) { Business.ScsBO sbo = new Business.ScsBO(); StaffDAL stal = new StaffDAL(); List <TakeCare> listTakeCare = stal.listStaff(); if (listTakeCare.Count != 0) { sbo.autoDistribution(); btnRecomment.Enabled = false; Response.Redirect("~/UI/distribution.aspx"); } lbError.Text = "Hiện tại chưa có nhân viên chăm sóc !"; }
public static Staff GetDetail(int id) { Staff staff = new Staff(); DatabaseDataSet.getEmployeeDetailsDataTable getEmployeeDetails = StaffDAL.getEmployeeDetails(id); if (getEmployeeDetails[0].ManagerID == null) { staff = new Staff(getEmployeeDetails[0].StaffID, getEmployeeDetails[0].Lastname, getEmployeeDetails[0].Firstname, getEmployeeDetails[0].Nickname, getEmployeeDetails[0].Username, getEmployeeDetails[0].InOutStatusID, getEmployeeDetails[0].TelephoneExtension, getEmployeeDetails[0].FlagDeleted); } else { staff = new Staff(getEmployeeDetails[0].StaffID, getEmployeeDetails[0].Lastname, getEmployeeDetails[0].Firstname, getEmployeeDetails[0].Nickname, getEmployeeDetails[0].Username, getEmployeeDetails[0].InOutStatusID, getEmployeeDetails[0].TelephoneExtension, getEmployeeDetails[0].FlagDeleted, getEmployeeDetails[0].ManagerID); } return(staff); }
private void btnDelete_Click(object sender, EventArgs e) { if (this.dataGridView1.SelectedRows.Count > 0) { object[] values = GetEmployees[dataGridView1.SelectedRows[0].Index].ItemArray; bindingSource.RemoveAt(this.dataGridView1.SelectedRows[0].Index); StaffDAL.DeleteEmployee(int.Parse(values[0].ToString())); } else { MessageBox.Show("Please select one row"); } }
public Form2(object[] values, int UserId) { InitializeComponent(); GetEmployees = StaffDAL.getEmployeeDetails(int.Parse(values[0].ToString())); employee = GetEmployees.Rows[0].ItemArray; txtFirstName.Text = employee[1].ToString(); txtLastName.Text = employee[2].ToString(); txtNickname.Text = employee[3].ToString(); txtTelephoneExtension.Text = employee[6].ToString(); txtUsername.Text = employee[4].ToString(); txtFlagDeleted.Text = employee[7].ToString(); bindingSource = new BindingSource(StaffInOutHistoryDAL.GetEmployeeHistories(int.Parse(employee[0].ToString())), null); dataGridView1.DataSource = bindingSource; dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect; }
public static void ExportReports() { try { using (StreamWriter writer = new StreamWriter("E:\\Projects\\EmployeeStatusTest\\EmployeeStatusTest\\Reports\\Report.csv")) { DatabaseDataSet.GetEmployeeListDataTable GetEmployees = StaffDAL.getEmployeeList(); writer.WriteLine("StaffID|FirstName|LastName|Username|Nickname|FlagDeleted|Extension|Status"); foreach (var item in GetEmployees) { writer.WriteLine(item.StaffID + "|" + item.Firstname + "|" + item.Lastname + "|" + item.Username + "|" + item.Nickname + "|" + item.FlagDeleted + "|" + item.TelephoneExtension + "|" + item.Description); } } } catch (Exception) { } }
public ActionResult DeleteStaff(int IntStaffID) { Staff remStaff = new Staff { IntStaffID = IntStaffID }; bool success = StaffDAL.DeleteStaff(remStaff); StaffVM model = new StaffVM() { LstStaff = StaffDAL.GetAllStaff(), LstAllMembers = MembersDAL.GetAllMembers(), LstAllShows = ShowsDAL.GetAllShows() }; return(PartialView("CRUDPartials/_Staff", model)); }
/// <summary> /// 点击录入员工 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnAbout_Click(object sender, EventArgs e) { if (textBox1.Text == "") { MessageBoxEx.Show("请填写员工姓名", "", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } Staff model = new Staff(); model.StaffName = textBox1.Text; model.Gender = comboBox1.Text; model.Store_Id = StoreDAL.FindModel(new Store(comboBox2.Text.ToString(), null, null), new List <string>() { "StoreName" }).Id; if (StaffDAL.Add(model)) { ShowDataGird(); MessageBoxEx.Show("新增员工成功", "", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public ActionResult Crud() { ViewBag.Message = "Create, Read, Update, and Delete table info here"; CRUDVM model = new CRUDVM(); IEnumerable <Cast> allCasts = CastsDAL.GetAllCasts(); IEnumerable <Club> allClubs = ClubsDAL.GetAllClubs(); IEnumerable <Date> allDates = DatesDAL.GetAllDates(); IEnumerable <Exec> allExec = ExecDAL.GetAllExec(); IEnumerable <Member> allMembers = MembersDAL.GetAllMembers(); IEnumerable <Pit> allPits = PitsDAL.GetAllPits(); IEnumerable <Show> allShows = ShowsDAL.GetAllShows(); IEnumerable <Staff> allStaff = StaffDAL.GetAllStaff(); model._shows_vm.LstShows = allShows; model._shows_vm.LstAllClubs = allClubs; model._shows_vm.LstAllDates = allDates; model._casts_vm.LstCasts = allCasts; model._casts_vm.LstAllMembers = allMembers; model._casts_vm.LstAllShows = allShows; model._exec_vm.LstExec = allExec; model._exec_vm.LstAllMembers = allMembers; model._exec_vm.LstAllClubs = allClubs; model._exec_vm.LstAllDates = allDates; model._members_vm.LstMembers = allMembers; model._pits_vm.LstPits = allPits; model._pits_vm.LstAllMembers = allMembers; model._pits_vm.LstAllShows = allShows; model._staff_vm.LstStaff = allStaff; model._staff_vm.LstAllMembers = allMembers; model._staff_vm.LstAllShows = allShows; return(View(model)); }