protected void EditButton_Click(object sender, EventArgs e) { try { EmployeeModel model = new EmployeeModel() { EmployeeID = Convert.ToInt32(EmployeeIDDropDownList.SelectedValue), First_Name = First_NameTextBox.Text, Last_Name = Last_NameTextBox.Text, Email = EmailTextBox.Text, Mobile_Number = Convert.ToInt64(Mobile_NumberTextBox.Text), AlternateMobileNumber = Convert.ToInt64(AlternateMobileNumberTextBox.Text), Address1 = Address1TextBox.Text, Address2 = Address2TextBox.Text, Current_Country = Current_CountryTextBox.Text, Home_Country = Home_CountryTextBox.Text, ZipCode = Convert.ToInt64(ZipCodeTextBox.Text) }; EmployeeAccess access = new EmployeeAccess(); string EditEmp = access.EditEmployee(model); if (EditEmp.Equals("Success")) { Response.Write("<script>alert('Details have been Updated successfully');</script>"); } } catch (Exception ex) { Response.Write("<script>alert('Please enter the values: '" + ex.Message + "</script>"); } }
protected void rgUserAccess_InsertCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e) { //Grab the values form the item to be inserted var values = (GridBatchEditingEventArgument)e.CommandArgument; //Create a new User Access Item var access = new EmployeeAccess(); //Assign Values access.OrgCode = center.OrgCode; access.CanViewAdminPortal = Convert.ToBoolean(values.NewValues["CanViewAdminPortal"]); access.CanInsertRecords = Convert.ToBoolean(values.NewValues["CanInsertRecords"]); access.CanUpdateRecords = Convert.ToBoolean(values.NewValues["CanUpdateRecords"]); access.CanDeleteRecords = Convert.ToBoolean(values.NewValues["CanDeleteRecords"]); access.EmployeeID = values.NewValues["EmployeeID"].ObjToString(); //Tries to validate the employeeid and add it to be tracked access.EmployeeID.ValidEmployeeID(); //Add to database siftaDB.EmployeeAccesses.InsertOnSubmit(access); //Try to submit changes to the database try { siftaDB.SubmitChanges(); } catch (Exception ex) { //If there was a problem with the database it was because the user didn't enter a real customerContact's ID add the warning text ltlUserAccessErrors.Text += String.Format("*{0} was unable to be added because this is not a valid Employee User ID <br />", access.EmployeeID); } }
public MainPage() { InitializeComponent(); var handler = new ModelHandler <Employee>() .BindErrors(commonErr) .Bind(e => e.FirstName, fname, fnameErr) .Bind(e => e.LastName, lname) .Bind(e => e.Age, age, ageErr) .Bind(e => e.IsDead, deadSwitch) .Bind(e => e.ToBeFiredOn, fireDate, fireTime); postBtn.Clicked += async delegate { await handler.SubmitAsync( e => EmployeeAccess.Post(e), async s => await DisplayAlert("Success", $"Success with message {s}", "Ok"), onError : async e => await DisplayAlert("Failed", $"Failed with status: '{e.StatusCode}' and error '{e.TextResponse}'", "Cancel") ); }; flawButton.Clicked += async delegate { await handler.SubmitAsync( e => EmployeeAccess.Post(null), async s => await DisplayAlert("Success", $"Success with message {s}", "Ok"), onError : async e => await DisplayAlert("Failed", $"Failed with status: '{e.StatusCode}' and error '{e.TextResponse}'", "Cancel") ); }; }
protected void SaveButton_Click(object sender, EventArgs e) { try { EmployeeModel employee = new EmployeeModel() { First_Name = First_NameTextBox.Text, Last_Name = Last_NameTextBox.Text, Email = EmailTextBox.Text, Mobile_Number = Convert.ToInt64(Mobile_NumberTextBox.Text), AlternateMobileNumber = Convert.ToInt64(AlternateMobileNumberTextBox.Text), Address1 = Address1TextBox.Text, Address2 = Address2TextBox.Text, Current_Country = Current_CountryTextBox.Text, Home_Country = Home_CountryTextBox.Text, ZipCode = Convert.ToInt64(ZipCodeTextBox.Text), }; EmployeeAccess employeedata = new EmployeeAccess(); string SaveEmp = employeedata.SaveEmployee(employee); if (SaveEmp.Equals("Success")) { Response.Write("<script>alert('Details have been saved successfully');</script>"); } } catch (Exception ex) { Response.Write("<script>alert(('Please enter the values: '" + ex.Message + ");</script>"); } }
/// <summary> /// Refreshes the list of employees. Called by navigation commands. /// </summary> private void RefreshEmployees() { Employees = EmployeeAccess.GetEmployees(start, itemCount, sortColumn, ascending, out totalItems); NotifyPropertyChanged("Start"); NotifyPropertyChanged("End"); NotifyPropertyChanged("TotalItems"); }
public MainWindowViewModel() { myEventAggregator = EventAggregatorSG.Instance.getAggregator(); myEventAggregator.Subscribe(this); myEmployeeDatabase = new EmployeeAccess(); CountEmployees(); ActivateItem(new MenuViewModel(this)); }
public ViewEmployeesViewModel(MainWindowViewModel _mainWindow) { mainWindow = _mainWindow; myEmployeeDatabase = new EmployeeAccess(); myEmployees = new BindableCollection <EmployeeModel>(); myEmployeeFamily = new List <FamilyMembersModel>(); RetreiveEmployees(); }
/// <summary> /// 修改员工 /// </summary> /// <param name="entity"></param> /// <returns></returns> public static async Task <ResponseResult> Put(EmployeeModel entity) { ResponseResult result; if (!ValidateUtil.IsValid(entity, out result)) { return(result); } return(await EmployeeAccess.Put(entity)); }
/// <summary> /// 删除员工 /// </summary> /// <param name="id"></param> /// <returns></returns> public static async Task <ResponseResult> Delete(long id) { if (id <= 0) { return new ResponseResult { Result = false, ErrorMessage = "未传入主键或主键非法", Code = ResponseCode.NeedsKeyParameter } } ; return(await EmployeeAccess.Delete(id)); } }
public AddEmployeeViewModel(MainWindowViewModel _mainWindow) { mainWindow = _mainWindow; myEventAggregator = EventAggregatorSG.Instance.getAggregator(); myEmployeeDatabase = new EmployeeAccess(); IsFamilyVis = false; IsEmployeeVis = true; EmployeeVisibility = Visibility.Visible; FamilyVisibility = Visibility.Hidden; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { EmployeeAccess obj = new EmployeeAccess(); List <int> EmpIDList = obj.GetEmployeeID(); int i = 0; foreach (int EmpID in EmpIDList) { EmployeeIDDropDownList.Items.Insert(i, new ListItem(EmpID.ToString())); i++; } } UnobtrusiveValidationMode = UnobtrusiveValidationMode.None; }
protected void EmployeeIDDropDownList_SelectedIndexChanged(object sender, EventArgs e) { EmployeeModel EmpModel = new EmployeeModel(); EmployeeAccess EMpAccess = new EmployeeAccess(); EmpModel = EMpAccess.GetEmployee(Convert.ToInt32(EmployeeIDDropDownList.SelectedValue)); First_NameTextBox.Text = EmpModel.First_Name; Last_NameTextBox.Text = EmpModel.Last_Name; EmailTextBox.Text = EmpModel.Email; Mobile_NumberTextBox.Text = EmpModel.Mobile_Number.ToString(); AlternateMobileNumberTextBox.Text = EmpModel.AlternateMobileNumber.ToString(); Address1TextBox.Text = EmpModel.Address1; Address2TextBox.Text = EmpModel.Address2; Current_CountryTextBox.Text = EmpModel.Current_Country; Home_CountryTextBox.Text = EmpModel.Home_Country; ZipCodeTextBox.Text = EmpModel.ZipCode.ToString(); }
public DataSet GetEmpRecords() { EmployeeAccess objDAL = new EmployeeAccess(); try { return(objDAL.GetEmpRecords()); } catch { throw; } finally { objDAL = null; } }
public int UpdateEmployeeDetails(Employee objBEL) { EmployeeAccess objDAL = new EmployeeAccess(); try { return(objDAL.UpdateEmployee(objBEL)); } catch { throw; } finally { objDAL = null; } }
public MainPage() { InitializeComponent(); var mapper = new ModelHandler <Employee>(new StackErrorMapping(commonErr)) .Bind(e => e.FirstName, firstName, fnameErr) .Bind(e => e.LastName, lname, lnameErr) .Bind(e => e.Age, age, ageErr) .Bind(e => e.ToBeFiredOn, fireDate, fireTime, dateErr); submitBtn.Clicked += async delegate { await mapper.SubmitAsync(e => EmployeeAccess.Post(e), s => display.Text = s); }; showBtn.Clicked += async delegate { if (mapper.TryGetModel(out Employee emp)) { var employee = await EmployeeAccess.Get(emp.Age ?? 0); mapper.ClearErrors(); if (employee.IsSuccessful) { mapper.SetModel(employee); } else { await DisplayAlert("Nop", $"Something failed with the error: {employee.StatusCode}", "Oh damit!!!"); } } }; invalidBtn.Clicked += async delegate { await mapper.SubmitAsync(async e => await EmployeeAccess.GetNoErrors()); await DisplayAlert("No errors!", "See ma! no errors!!!", "Nothing is better than something"); }; noDataBtn.Clicked += async delegate { await mapper.SubmitAsync(e => EmployeeAccess.Post(null), s => display.Text = s); }; } }
/// <summary> /// Overloaded Constructor /// Allows for permissions to be established for a Center /// </summary> /// <param name="OrgCode">The Org Code of the Current Page</param> public User(string OrgCode) { //Set the Org Code _OrgCode = OrgCode; //Grabs the Users Identity from Windows Authentication and strips the unnecessary parts user_id = HttpContext.Current.User.Identity.Name.Replace("GS\\", "").Replace("-pr", ""); //Grab Employee information var employee = siftaDB.Employees.FirstOrDefault(p => p.EmployeeID == user_id); if (employee != null) { //Sets Home to be the org code the user is with. _Home = employee.OrgCode; //Grabs permissions from the database permissions = siftaDB.EmployeeAccesses.FirstOrDefault(p => p.EmployeeID == user_id && p.OrgCode == OrgCode); //If they haven't been given any permissions if (permissions == null) { //Set permissions to false _CanInsert = _CanUpdate = _CanDelete = _IsAdmin = _IsCenterAdmin = false; } else { //They have been given permissions _CanInsert = permissions.CanInsertRecords; _CanUpdate = permissions.CanUpdateRecords; _CanDelete = permissions.CanDeleteRecords; _IsAdmin = permissions.CanViewAdminPortal; _IsCenterAdmin = permissions.CenterAdmin; } } else { //Set permissions to false _CanInsert = _CanUpdate = _CanDelete = _IsAdmin = _IsCenterAdmin = false; } }
public static DataTable ReadAll() { return(EmployeeAccess.ReadAll()); }
/// <summary> /// 查询员工 /// </summary> /// <param name="entity"></param> /// <returns></returns> public static async Task <EmployeeModel> Get(long id) { return(await EmployeeAccess.GetById(id)); }
/// <summary> /// 分页查询员工 /// </summary> /// <param name="entity"></param> /// <returns></returns> public static async Task <ResponseCollection <EmployeeModel> > GetPaging(EmployeeFilterModel entity) { return(await EmployeeAccess.GetPaging(entity)); }
public static bool Update(Employee emp) { return(EmployeeAccess.Update(emp)); }
public static bool Delete(int id) { return(EmployeeAccess.Delete(id)); }
public static bool Create(Employee emp) { return(EmployeeAccess.CreateEmployee(emp)); }
public static Employee FindById(int id) { return(EmployeeAccess.FindById(id)); }