Ejemplo n.º 1
0
        public ActionResult Index()
        {
            DirectoryDataSet     ds = new DirectoryDataSet();
            employeeTableAdapter da = new employeeTableAdapter();

            da.Fill(ds.employee);

            return(View("AdoNetIndex", ds.employee));
        }
Ejemplo n.º 2
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            departmentsTableAdapter dadeps = new departmentsTableAdapter();

            dadeps.Update(ds.departments);

            employeeTableAdapter daemps = new employeeTableAdapter();

            daemps.Update(ds.employee);
        }
Ejemplo n.º 3
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            departmentsTableAdapter dadeps = new departmentsTableAdapter();

            ds = new DataSet2();
            dadeps.Fill(ds.departments);
            dgdept.ItemsSource = ds.departments.DefaultView;


            employeeTableAdapter daemps = new employeeTableAdapter();

            daemps.Fill(ds.employee);
            dgData.ItemsSource = ds.employee.DefaultView;
        }
Ejemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                return;
            }
            {
                txtOrderDateLow.Text  = DateTime.Now.Date.AddDays(-7).ToString("yyyy-MM-dd");
                txtOrderDateHigh.Text = DateTime.Now.Date.ToString("yyyy-MM-dd");
                employeeTableAdapter daEmp = new employeeTableAdapter();
                daEmp.Fill(dsEmp.employee);

                foreach (DataRow r in dsEmp.employee)
                {
                    MakeTable(r);
                }
            }
        }
Ejemplo n.º 5
0
        public void ValidatePassword(string connectionString, string password, out string opName, out string opCode, out string error)
        {
            opName = "";
            opCode = "";
            error  = "";
            try
            {
                using (var eta = new employeeTableAdapter())
                {
                    eta.Connection.ConnectionString = connectionString;
                    dsLogon.employeeDataTable edt = eta.GetData(password);

                    if (edt.Rows.Count > 0)
                    {
                        opName = edt[0].name;
                        opCode = edt[0].operator_code;
                    }
                }
            }
            catch (SqlException ex)
            {
                if (ex.InnerException != null)
                {
                    error = "Sql Exception: " + ex.InnerException.ToString();
                }
                else
                {
                    error = "Sql Exception: " + ex.Message;
                }
            }
            catch (Exception ex)
            {
                if (ex.InnerException != null)
                {
                    error = "Exception: " + ex.InnerException.ToString();
                }
                else
                {
                    error = "Exception: " + ex.Message;
                }
            }
        }
Ejemplo n.º 6
0
        static Purchase()
        {
            receiptTableAdapter daReceipt = new receiptTableAdapter();

            daReceipt.Fill(dsReceipt.receipt);
            employeeTableAdapter daEmployee = new employeeTableAdapter();

            daEmployee.Fill(dsReceipt.employee);
            productTableAdapter daProducts = new productTableAdapter();

            productTable = daProducts.GetData();
            order_lineTableAdapter daLine = new order_lineTableAdapter();

            daLine.Fill(dsReceipt.order_line);
            service_orderTableAdapter daService = new service_orderTableAdapter();

            daService.Fill(dsReceipt.service_order);
            equipmentTableAdapter daEqu = new equipmentTableAdapter();

            daEqu.Fill(dsReceipt.equipment);
        }
Ejemplo n.º 7
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string search = "empFull LIKE '%" + txtName.Text + "%' AND posName LIKE '%" + ((ddlPosition.SelectedIndex > 0) ? ddlPosition.SelectedItem.Text : "") + "%'";


            employeeTableAdapter daEmp = new employeeTableAdapter();

            try
            {
                daEmp.Fill(dsEmp.employee);
            }
            catch { }

            //Execute where clause
            DataRow[] rows = dsEmp.employee.Select(search);


            //display results
            foreach (DataRow r in rows)
            {
                MakeTable(r);
            }
        }
Ejemplo n.º 8
0
        static Repair_Details()
        {
            employeeTableAdapter daEmployees = new employeeTableAdapter();

            employees = daEmployees.GetData();
        }
Ejemplo n.º 9
0
        static Login()
        {
            var roleStore   = new RoleStore <IdentityRole>();
            var roleManager = new RoleManager <IdentityRole>(roleStore);
            var userStore   = new UserStore <IdentityUser>();
            var userManager = new UserManager <IdentityUser>(userStore);
            positionTableAdapter daPositions = new positionTableAdapter();
            employeeTableAdapter daEmployees = new employeeTableAdapter();
            DataTable            posTable    = daPositions.GetData();

            EmmasEnginesLibrary.EmployeeDataSet dsEmployee = new EmmasEnginesLibrary.EmployeeDataSet();
            daEmployees.Fill(dsEmployee.employee);
            foreach (DataRow r in posTable.Rows)
            {
                if (!roleManager.RoleExists(r["posName"].ToString()))
                {
                    if (!roleManager.Create(new IdentityRole(r["posName"].ToString())).Succeeded)
                    {
                        throw new Exception("Failed to create role " + r["posName"].ToString());
                    }
                }
            }
            string userName;
            string position = "";

            foreach (DataRow r in dsEmployee.employee.Rows)
            {
                userName = r["empLogin"] != DBNull.Value? r["empLogin"].ToString() : r["empFirst"].ToString().ToLower()[0] + r["empLast"].ToString().ToLower() + r["id"].ToString();
                if (r["posID"] != DBNull.Value)
                {
                    position = posTable.Select("id = " + r["posID"].ToString())[0]["posName"].ToString();
                }
                IdentityUser user = userManager.FindByName(userName);
                if (user == null)
                {
                    user = new IdentityUser(userName);
                    if (!userManager.Create(user, "password").Succeeded)
                    {
                        throw new Exception("Failed to register user " + userName);
                    }
                }
                r["loginId"]  = userManager.FindByName(userName).Id;
                r["empLogin"] = userName;
                if (user.Roles.Count == 0 && !String.IsNullOrEmpty(position))
                {
                    userManager.AddToRole(user.Id, position);
                }
                if (user.Roles.Count > Convert.ToInt32(!String.IsNullOrEmpty(position)))
                {
                    foreach (DataRow pr in posTable.Rows)
                    {
                        if (pr["posName"].ToString() != position && userManager.IsInRole(user.Id, pr["posName"].ToString()))
                        {
                            userManager.RemoveFromRole(user.Id, pr["posName"].ToString());
                        }
                    }
                }
            }
            daEmployees.Update(dsEmployee.employee);
            dsEmployee.AcceptChanges();
        }
Ejemplo n.º 10
0
        static Default()
        {
            employeeTableAdapter daEmployees = new employeeTableAdapter();

            employees = daEmployees.GetData();
        }