Exemple #1
0
        protected void ButtonInsert_Click(object sender, EventArgs e)
        {
            using (SalesSystem.DataClassesSalesDataContext context = new DataClassesSalesDataContext())
            {
                int roleID = context.sp_Insert_Role(TextBoxRoleDescription.Text, Convert.ToDecimal(TextBoxRoleRate.Text));

                Response.Redirect("~/Default.aspx");
            }
        }
Exemple #2
0
        protected void LoadEmployeesGrid()
        {
            using (SalesSystem.DataClassesSalesDataContext context = new DataClassesSalesDataContext())
            {
                var employeeRole = (from empRol in context.vw_Custom_SelectEmployeeRoles
                                    select empRol).ToList();

                GridViewEmployees.DataSource = employeeRole;
                GridViewEmployees.DataBind();
            }
        }
Exemple #3
0
        protected void ButtonSearch_Click(object sender, EventArgs e)
        {
            using (SalesSystem.DataClassesSalesDataContext context = new DataClassesSalesDataContext())
            {
                var result = (from searchRes in context.vw_Custom_SelectEmployeeRoles
                              where (searchRes.RoleRate.ToString().Contains(TextBoxSearch.Text)) || (searchRes.EmployeeName.Contains(TextBoxSearch.Text)) || (searchRes.EmployeeSurname.Contains(TextBoxSearch.Text)) || (searchRes.RoleDescription.Contains(TextBoxSearch.Text))
                              select new { searchRes.EmployeeID, searchRes.EmployeeName, searchRes.EmployeeSurname, searchRes.RoleDescription, searchRes.RoleRate });

                GridViewEmployees.DataSource = result;
                GridViewEmployees.DataBind();
            }
        }
        protected void LoadRoleDropDown()
        {
            using (SalesSystem.DataClassesSalesDataContext context = new DataClassesSalesDataContext())
            {
                var role = (from rl in context.Roles
                            select rl).ToList();

                DropDownListRole.DataValueField = "RoleID";
                DropDownListRole.DataTextField  = "RoleDescription";

                DropDownListRole.DataSource = role;
                DropDownListRole.DataBind();
            }
        }
        protected void ButtonInsert_Click(object sender, EventArgs e)
        {
            using (SalesSystem.DataClassesSalesDataContext context = new DataClassesSalesDataContext())
            {
                if (string.IsNullOrEmpty(hdfPrimaryKey.Value))
                {
                    int EmployeeID = context.sp_Insert_Employee(Convert.ToInt32(DropDownListRole.SelectedValue), TextBoxEmployeeName.Text, TextBoxEmployeeSurname.Text);
                }
                else
                {
                    context.sp_Update_Employee(Convert.ToInt32(hdfPrimaryKey.Value), Convert.ToInt32(DropDownListRole.SelectedValue), TextBoxEmployeeName.Text, TextBoxEmployeeSurname.Text, Convert.ToInt32(hdfCounter.Value));
                }

                Response.Redirect("~/Default.aspx");
            }
        }
        protected void LoadEmployee(int employeeID)
        {
            using (SalesSystem.DataClassesSalesDataContext context = new DataClassesSalesDataContext())
            {
                var result = (from emp in context.vw_Data_Employees
                              where emp.EmployeeID == employeeID
                              select emp).FirstOrDefault();

                hdfPrimaryKey.Value = result.EmployeeID.ToString();
                hdfCounter.Value    = result.Counter.ToString();

                DropDownListRole.SelectedValue = result.RoleID.ToString();
                TextBoxEmployeeName.Text       = result.EmployeeName;
                TextBoxEmployeeSurname.Text    = result.EmployeeSurname;
            }
        }