コード例 #1
0
ファイル: frmLogin.cs プロジェクト: nguyenhongphat0/fpt5
        private void loginBtn_Click(object sender, EventArgs e)
        {
            this.bookStoreDataSet.Reset();
            this.employeeTableAdapter.Fill(bookStoreDataSet.Employee);
            EmployeeRow er = this.bookStoreDataSet.Employee.Where(em => em.EmpID.Trim() == empIDTextBox.Text && em.EmpPassword.Trim() == empPasswordTextBox.Text).FirstOrDefault();

            if (er == null)
            {
                MessageBox.Show("Incorrect username or password!");
            }
            else
            {
                Employee emp = new Employee(er.EmpID, er.EmpPassword, er.EmpRole);
                if (emp?.EmpRole == true)
                {
                    this.Hide();
                    new FrmMaintainBooks(emp).ShowDialog();
                    this.Show();
                }
                else
                {
                    this.Hide();
                    new FrmChangeAccount(emp).ShowDialog();
                    this.Show();
                }
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: Mikhail174/DZUrok5
        static void Main(string[] args)
        {
            string         connectionString = @"Data Source=WKS456\SQLEXPRESS;Initial Catalog=ShopDB;Integrated Security=True";
            string         commandString    = "SELECT * FROM Employees; SELECT * FROM Orders;";
            DataSet        shopDB           = new DataSet("ShopDB");
            SqlDataAdapter adapter          = new SqlDataAdapter(commandString, connectionString);

            adapter.Fill(shopDB);
            DataTable Employees = shopDB.Tables[0];
            DataTable orders    = shopDB.Tables[1];

            shopDB.Relations.Add("Employees_Orders", Employees.Columns["EmployeeID"], orders.Columns["EmployeeID"]);
            // Employees.Columns.Add("CountSale", typeof(double), "SUM(Child(Employees_Orders).EmployeeID)");

            foreach (DataRow EmployeeRow in Employees.Rows)
            {
                // метод GetChaildRows получает дочерние строки в виде массива DataRow[]
                DataRow[] chilRows = EmployeeRow.GetChildRows("Employees_Orders");

                if (chilRows.Length != 0) // если существуют дочерние записи
                {
                    //Console.WriteLine("{0} {1} {2}", EmployeeRow[2], EmployeeRow[1], EmployeeRow[3]);



                    //foreach (DataRow ordersRow in chilRows)
                    // Console.WriteLine("\tOrderId: {0}, OrderDate: {1};", ordersRow["OrderID"], ordersRow["OrderDate"]);

                    //  Console.WriteLine();
                }
            }
        }
コード例 #3
0
        public TableAdjustment EditTrainsStaffMember(LatticeData <Employee, EmployeeRow> latticeData,
                                                     EmployeeRow employeeRow)
        {
            if (string.IsNullOrEmpty(employeeRow.UserId))
            {
                return(latticeData.Adjust(x => x
                                          .Message(LatticeMessage.User("failure", "Editing", "Can not create create new employee from here"))
                                          ));
            }

            Employee employee = _context.Employees
                                .FirstOrDefault(x => x.UserId == employeeRow.UserId);

            if (employee == null)
            {
                return(latticeData.Adjust(x => x
                                          .Message(LatticeMessage.User("failure", "Editing", "Can not find employee"))
                                          ));
            }


            employee.TrainId = employeeRow.TrainId;
            _context.SaveChanges();
            return(latticeData.Adjust(x => x
                                      .Update(employeeRow)
                                      .Message(LatticeMessage.User("success", "Editing", "Employee saved"))
                                      ));
        }
コード例 #4
0
        public void ShouldReturnQueryForAddingEmployee()
        {
            string      expected = "INSERT INTO public.ett_employee (first_name, last_name, employee_number) VALUES('Daniel', 'Moon', 'b003223');";
            EmployeeRow obj      = new EmployeeRow {
                EmployeeNumber = "b003223", LastName = "Moon", FirstName = "Daniel"
            };
            string actual = QueryGenerator.AddEmployee(obj);

            Assert.Equal(expected, actual);
        }
コード例 #5
0
            public EmployeeRow AddEmployeeRow(string Address, string FirstName, string JobType, string LastName, System.Decimal Salary)
            {
                EmployeeRow rowEmployeeRow = ((EmployeeRow)(this.NewRow()));

                rowEmployeeRow.ItemArray = new object[] {
                    Address,
                    null,
                    FirstName,
                    JobType,
                    LastName,
                    Salary
                };
                this.Rows.Add(rowEmployeeRow);
                return(rowEmployeeRow);
            }
コード例 #6
0
            public EmployeeRow AddEmployeeRow(System.Guid IID, string Name, string Code, string Phone, string Address)
            {
                EmployeeRow rowEmployeeRow = ((EmployeeRow)(this.NewRow()));

                object[] columnValuesArray = new object[] {
                    IID,
                    Name,
                    Code,
                    Phone,
                    Address
                };
                rowEmployeeRow.ItemArray = columnValuesArray;
                this.Rows.Add(rowEmployeeRow);
                return(rowEmployeeRow);
            }
コード例 #7
0
            public EmployeeRow AddEmployeeRow(string FirstName, string LastName, string Address, string JobType, decimal Salary)
            {
                EmployeeRow rowEmployeeRow = ((EmployeeRow)(this.NewRow()));

                object[] columnValuesArray = new object[] {
                    null,
                    FirstName,
                    LastName,
                    Address,
                    JobType,
                    Salary
                };
                rowEmployeeRow.ItemArray = columnValuesArray;
                this.Rows.Add(rowEmployeeRow);
                return(rowEmployeeRow);
            }
コード例 #8
0
ファイル: Form1.cs プロジェクト: Mikhail174/DZUrok5
        private void Form1_Load(object sender, EventArgs e)
        {
            string         connectionString = @"Data Source=МИХАИЛ-ПК\MSSQLSERVER1;Initial Catalog=ShopDB;Integrated Security=True";
            string         commandString    = "SELECT EmployeeID FROM Employees; SELECT * FROM Orders;";
            DataSet        shopDB           = new DataSet("ShopDB");
            SqlDataAdapter adapter          = new SqlDataAdapter(commandString, connectionString);

            adapter.Fill(shopDB);
            DataTable Employees = shopDB.Tables[0];
            DataTable orders    = shopDB.Tables[1];

            shopDB.Relations.Add("Employees_Orders", Employees.Columns["EmployeeID"], orders.Columns["EmployeeID"]);
            Employees.Columns.Add("CountSale", typeof(double), "Count(Child(Employees_Orders).EmployeeID)");


            foreach (DataRow EmployeeRow in Employees.Rows)
            {
                // метод GetChaildRows получает дочерние строки в виде массива DataRow[]
                DataRow[] chilRows = EmployeeRow.GetChildRows("Employees_Orders");

                //    if (chilRows.Length != 0) // если существуют дочерние записи
                //  {


                dataGridView1.DataSource = Employees;



                foreach (DataRow ordersRow in chilRows)
                {
                    Console.WriteLine("\tOrderId: {0}, OrderDate: {1};", ordersRow["OrderID"], ordersRow["OrderDate"]);
                }


                Console.WriteLine();
                //}
            }
        }
コード例 #9
0
ファイル: data.Designer.cs プロジェクト: azad012614/dot_net
 public EmployeeRowChangeEvent(EmployeeRow row, global::System.Data.DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }
コード例 #10
0
 public EmployeeRowChangeEvent(EmployeeRow row, global::System.Data.DataRowAction action) {
     this.eventRow = row;
     this.eventAction = action;
 }
コード例 #11
0
 public void RemoveEmployeeRow(EmployeeRow row) {
     this.Rows.Remove(row);
 }
コード例 #12
0
 public void AddEmployeeRow(EmployeeRow row) {
     this.Rows.Add(row);
 }
コード例 #13
0
 public EmployeeRowChangeEvent(EmployeeRow row, DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }
コード例 #14
0
 public void RemoveEmployeeRow(EmployeeRow row)
 {
     this.Rows.Remove(row);
 }
コード例 #15
0
 public void AddEmployeeRow(EmployeeRow row)
 {
     this.Rows.Add(row);
 }
コード例 #16
0
ファイル: QueryGenerator.cs プロジェクト: callibrity/ETT-ETL
 public static string AddEmployee(EmployeeRow employeeObject)
 {
     return($"INSERT INTO public.ett_employee (first_name, last_name, employee_number) VALUES('{employeeObject.FirstName}', '{employeeObject.LastName}', '{employeeObject.EmployeeNumber}');");
 }