Beispiel #1
0
        private void load_dataset()
        {
            //DataSet ds = dacGang.GetDS();
            //DataTable dt = dacCache.GetGang();

            DataTable dt = qryGang.GetDT();

            //_ds = ds;
            //_ds = new DataSet();
            //_ds.Tables.Add(dt);

            if (dt == null)
            {
                return;
            }

            foreach (DataRow row in dt.Rows)
            {
                CheckListBoxItem ni = new CheckListBoxItem();
                ni.Tag  = row["EmpId"];
                ni.Text = row["EmpName"].ToString();

                lbxItems.Items.Add(ni);

                clbItems.Items.Add(ni,
                                   (((bool)row["Active"]) ? CheckState.Checked : CheckState.Unchecked));
            }
        }
Beispiel #2
0
        private void cmdDel_Click(object sender, EventArgs e)
        {
            //CheckListBoxItem bi = (CheckListBoxItem)(clbItems.SelectedItem);
            CheckListBoxItem bi = (CheckListBoxItem)(lbxItems.SelectedItem);

            if (bi == null)
            {
                return;
            }

            string emp_id = bi.Tag.ToString();


            //DataRow row = _ds.Tables[0].Rows.Find(emp_id);
            DataRow row = dacCache.GetGang().Rows.Find(emp_id);

            row.Delete();
            dacCache.GetGang().AcceptChanges();

            //dacGang.SaveData(_ds.GetChanges());

            //clbItems.Items.Clear();
            lbxItems.Items.Clear();
            load_dataset();

            if (PostChange != null)
            {
                PostChange();
            }
        }
Beispiel #3
0
        private void clbItems_SelectedIndexChanged(object sender, EventArgs e)
        {
            int idx = clbItems.SelectedIndex;

            if (idx == -1)
            {
                return;
            }

            bool state = clbItems.GetItemChecked(idx);

            CheckListBoxItem bi     = (CheckListBoxItem)(clbItems.SelectedItem);
            string           emp_id = bi.Tag.ToString();

            //DataRow row = _ds.Tables[0].Rows.Find(emp_id);
            DataRow row = dacCache.GetGang().Rows.Find(emp_id);

            row.BeginEdit();
            row["Active"] = state;
            row.EndEdit();

            if (PostChange != null)
            {
                PostChange();
            }
        }
Beispiel #4
0
        private void clbItems_SelectedIndexChanged(object sender, EventArgs e)
        {
            ucNewEmp uc_emp = (ucNewEmp)(pnlEmp.Controls[0]);

            CheckListBoxItem bi     = (CheckListBoxItem)(clbItems.SelectedItem);
            string           emp_id = bi.Tag.ToString();

            uc_emp.ViewEmp(emp_id);
        }
Beispiel #5
0
        /*******************************************************************************************************************\
        *                                                                                                                 *
        \*******************************************************************************************************************/

        private void frmEmployee_Load(object sender, EventArgs e)
        {
            //DataSet ds = dacEmployees.GetDS();
            //DataTable dt = dacCache.GetEmployee();

            DataTable dtEmp = dacEmployees.GetDT();
            var       q     = from tEmp in dtEmp.AsEnumerable()
                              //where !(bool)tEmp["Archive"] && !tEmp["Duty"].Equals(DBNull.Value) && ((string)tEmp["Duty"] == "Master" || (string)tEmp["Duty"] == "Deckhand")
                              //orderby tEmp["EmpID"]
                              orderby(string) tEmp["Last Name"]
                              select new
            {
                EmpID   = (string)tEmp["EmpID"],
                EmpName = (tEmp["Last Name"] == System.DBNull.Value ? "N/A" : string.Format("{0}, {1}", ((string)tEmp["Last Name"]).ToUpper(), (string)tEmp["First Name"]))
            };



            DataTable dt = toDataTable(q.ToList());

            //_ds = ds;
            //_ds = new DataSet();
            //_ds.Tables.Add(dt);

            int count_all  = 0;
            int count_show = 0;

            foreach (DataRow row in dt.Rows)
            {
                count_all++;

                //bool found = dacGang.IsKey(row["EmpId"].ToString());
                //bool found = qryGang.IsKey(row["EmpId"].ToString());
                //if (found) continue;

                count_show++;
                //string emp_name = string.Format("{0} {1}", row["First Name"].ToString(), row["Last Name"].ToString());
                string emp_name = (string)row["EmpName"];

                CheckListBoxItem ni = new CheckListBoxItem();
                ni.Tag  = row["EmpId"];
                ni.Text = emp_name;

                clbItems.Items.Add(ni, false);

                //clbItems.Items.Add(ni,
                //    (((bool)row["Active"]) ? CheckState.Checked : CheckState.Unchecked));
            }

            tbxCount.Text = string.Format("{0} of {1}", count_show, count_all);
            this.Text    += " : " + info();

            //clbItems.Refresh();
        }
Beispiel #6
0
        private void frmGang_Load(object sender, EventArgs e)
        {
            //DataSet ds = dacEmployees.GetDS();
            //DataTable dt = dacCache.GetEmployee();

            DataTable dt = dacEmployees.GetDT();
            DataView  dv = dt.DefaultView;

            dv.Sort = "[Last Name], [First Name]";
            dt      = dv.ToTable();

            //_ds = ds;
            //_ds = new DataSet();
            //_ds.Tables.Add(dt);

            int count_all  = 0;
            int count_show = 0;

            foreach (DataRow row in dt.Rows)
            {
                count_all++;

                //bool found = dacGang.IsKey(row["EmpId"].ToString());
                bool found = qryGang.IsKeyActive(row["EmpId"].ToString());
                if (found)
                {
                    continue;
                }

                count_show++;
                //string emp_name = string.Format("{0} {1}", row["First Name"].ToString(), row["Last Name"].ToString());
                string emp_name = string.Format("{0}, {1}", ((string)row["Last Name"]).ToUpper(), (string)row["First Name"]);

                CheckListBoxItem ni = new CheckListBoxItem();
                ni.Tag  = row["EmpId"];
                ni.Text = emp_name;

                clbItems.Items.Add(ni, false);

                //clbItems.Items.Add(ni,
                //    (((bool)row["Active"]) ? CheckState.Checked : CheckState.Unchecked));
            }

            tbxCount.Text = string.Format("{0} of {1}", count_show, count_all);

            //clbItems.Refresh();
        }
Beispiel #7
0
        private void cmdEdit_Click(object sender, EventArgs e)
        {
            //CheckListBoxItem bi = (CheckListBoxItem)(clbItems.SelectedItem);

            CheckListBoxItem bi = (CheckListBoxItem)(lbxItems.SelectedItem);

            if (bi == null)
            {
                return;
            }

            string emp_id = bi.Tag.ToString();

            Form frm = new Form();

            frm.Size = new Size(660, 510);

            ucNewEmp uc_emp = new ucNewEmp();

            uc_emp.EditEmp(emp_id);
            frm.Controls.Add(uc_emp);
            frm.ShowDialog();
        }