コード例 #1
0
        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>");
            }
        }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
        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")
                    );
            };
        }
コード例 #4
0
        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>");
            }
        }
コード例 #5
0
        /// <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");
        }
コード例 #6
0
        public MainWindowViewModel()
        {
            myEventAggregator = EventAggregatorSG.Instance.getAggregator();
            myEventAggregator.Subscribe(this);

            myEmployeeDatabase = new EmployeeAccess();

            CountEmployees();
            ActivateItem(new MenuViewModel(this));
        }
コード例 #7
0
        public ViewEmployeesViewModel(MainWindowViewModel _mainWindow)
        {
            mainWindow = _mainWindow;

            myEmployeeDatabase = new EmployeeAccess();
            myEmployees        = new BindableCollection <EmployeeModel>();
            myEmployeeFamily   = new List <FamilyMembersModel>();

            RetreiveEmployees();
        }
コード例 #8
0
        /// <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));
        }
コード例 #9
0
     /// <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));
     }
 }
コード例 #10
0
        public AddEmployeeViewModel(MainWindowViewModel _mainWindow)
        {
            mainWindow = _mainWindow;

            myEventAggregator = EventAggregatorSG.Instance.getAggregator();

            myEmployeeDatabase = new EmployeeAccess();

            IsFamilyVis   = false;
            IsEmployeeVis = true;

            EmployeeVisibility = Visibility.Visible;
            FamilyVisibility   = Visibility.Hidden;
        }
コード例 #11
0
 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;
 }
コード例 #12
0
        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();
        }
コード例 #13
0
ファイル: Class1.cs プロジェクト: ka14smet/EmployeeManagement
        public DataSet GetEmpRecords()
        {
            EmployeeAccess objDAL = new EmployeeAccess();

            try
            {
                return(objDAL.GetEmpRecords());
            }
            catch
            {
                throw;
            }
            finally
            {
                objDAL = null;
            }
        }
コード例 #14
0
ファイル: Class1.cs プロジェクト: ka14smet/EmployeeManagement
        public int UpdateEmployeeDetails(Employee objBEL)
        {
            EmployeeAccess objDAL = new EmployeeAccess();

            try
            {
                return(objDAL.UpdateEmployee(objBEL));
            }
            catch
            {
                throw;
            }

            finally
            {
                objDAL = null;
            }
        }
コード例 #15
0
        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);
            };
        }
    }
コード例 #16
0
ファイル: User.cs プロジェクト: PatrickSearcey/SiFTA
        /// <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;
            }
        }
コード例 #17
0
ファイル: EmployeeController.cs プロジェクト: JOELTVA2/danne
 public static DataTable ReadAll()
 {
     return(EmployeeAccess.ReadAll());
 }
コード例 #18
0
 /// <summary>
 /// 查询员工
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public static async Task <EmployeeModel> Get(long id)
 {
     return(await EmployeeAccess.GetById(id));
 }
コード例 #19
0
 /// <summary>
 /// 分页查询员工
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public static async Task <ResponseCollection <EmployeeModel> > GetPaging(EmployeeFilterModel entity)
 {
     return(await EmployeeAccess.GetPaging(entity));
 }
コード例 #20
0
ファイル: EmployeeController.cs プロジェクト: JOELTVA2/danne
 public static bool Update(Employee emp)
 {
     return(EmployeeAccess.Update(emp));
 }
コード例 #21
0
ファイル: EmployeeController.cs プロジェクト: JOELTVA2/danne
 public static bool Delete(int id)
 {
     return(EmployeeAccess.Delete(id));
 }
コード例 #22
0
ファイル: EmployeeController.cs プロジェクト: JOELTVA2/danne
 public static bool Create(Employee emp)
 {
     return(EmployeeAccess.CreateEmployee(emp));
 }
コード例 #23
0
ファイル: EmployeeController.cs プロジェクト: JOELTVA2/danne
 public static Employee FindById(int id)
 {
     return(EmployeeAccess.FindById(id));
 }