Example #1
0
        private void SaveDepartments(int empID)
        {
            RSLib.COListItem     li;
            CBEmployeeDepartment ed;

            foreach (Object o in lstEmpDept.Items)
            {
                li = ((RSLib.COListItem)o);

                if (Convert.ToInt32(li.Meta) < 1)
                {
                    ed = new CBEmployeeDepartment();

                    ed.EmployeeID   = empID;
                    ed.DepartmentID = li.ID;

                    ed.Save();
                }
            }

            // remove deleted values
            foreach (DataRow dr in mdsRemoved.Tables[0].Rows)
            {
                CBEmployeeDepartment.Delete(Convert.ToInt32(dr["ID"]));
            }
        }
Example #2
0
        private void LoadEmpDeptBox()
        {
            SqlDataReader dr;

            RSLib.COListItem li;

            dr = CBEmployeeDepartment.GetListByEmpID(moEmp.ID);

            lstEmpDept.Items.Clear();
            while (dr.Read())
            {
                li = new RSLib.COListItem();

                li.ID          = Convert.ToInt32(dr["DepartmentID"]);
                li.Description = dr["DepartmentName"].ToString();
                li.Meta        = dr["ID"].ToString();

                lstEmpDept.Items.Add(li);
            }

            dr.Close();
        }