예제 #1
0
파일: User.cs 프로젝트: jamesd24/GGSR
 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;
 }
예제 #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();
 }
예제 #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();
        }
예제 #4
0
        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();
        }
예제 #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);
            }
        }