Beispiel #1
0
 public DeptManager(String fn, String ln, String em, int id, Department dept)
 {
     FirstName = fn;
     LastName = ln;
     Email = em;
     UserType = UserType.DEPT_MANAGER;
     UserId = id;
     Dept = dept;
 }
Beispiel #2
0
 public DepartmentPP(MySqlConnection c, List<DeptManager> l, Department d, DeptManager cm, MainStoreManagerApp pf)
 {
     InitializeComponent();
     connection = c;
     dept = d;
     parentForm = pf;
     deptManagers = l;
     currentManager = cm;
     RefreshFields();
     SetManagerItems();
     AddCurrentlySetManager();
 }
Beispiel #3
0
        public override void Execute()
        {
            Command = new MySqlCommand(GenerateQuery(), Connection);
            MySqlDataReader read = Command.ExecuteReader();
            Result = new List<Department>();

            while (read.Read())
            {
                int deptId = read.GetInt32(0);
                string deptName = read.GetString(1);

                var d = new Department(deptId,deptName);

                Result.Add(d);
            }
            read.Close();
        }
        public override void Execute()
        {
            Command = new MySqlCommand(GenerateQuery(), Connection);
            MySqlDataReader read = Command.ExecuteReader();
            Result = new List<DeptManager>();

            while (read.Read())
            {
                int id = read.GetInt32(0);
                string fn = read.GetString(1);
                string ln = read.GetString(2);
                string em = read.GetString(3);

                int deptId = read.GetInt32(4);
                string deptName = read.GetString(5);

                var d = new Department(deptId,deptName);

                Result.Add(new DeptManager(fn,ln,em,id,d));
            }
            read.Close();

            Command = new MySqlCommand(GenerateSecondQuery(), Connection);
            read = Command.ExecuteReader();

            while (read.Read())
            {
                int id = read.GetInt32(0);
                string fn = read.GetString(1);
                string ln = read.GetString(2);
                string em = read.GetString(3);

                Result.Add(new DeptManager(fn, ln, em, id, null));
            }
            read.Close();
        }
Beispiel #5
0
        private void Save()
        {
            String n = DeptNameInputBox.Text.Trim();
            int m = deptManagers[ManagerComboBox.SelectedIndex].UserId;
            int s = parentForm.Database.StoreId;

            if (dept == null)
            {
                var proc = new sm_NewDepartment(connection, n , m , s);
                proc.Execute();
                dept = new Department(proc.Id,n);
            }
            else
            {
                var proc = new StoredProcBase();
                if (currentManager == null)
                {
                    proc = new sm_EditDepartment(connection, n, m, -1, dept.DepartmentId);
                }
                else
                {
                    proc = new sm_EditDepartment(connection, n, m, currentManager.UserId, dept.DepartmentId);
                }

                proc.Execute();
                dept = new Department(dept.DepartmentId,n);
            }
        }