コード例 #1
0
        /// <summary>
        /// Кнопка загрузки
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void загрузитьToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (openFileDialog.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }

            if (openFileDialog.FileName.IndexOf(".json") > -1)
            {
                department = department.LoadJSON(openFileDialog.FileName);
            }
            else if (openFileDialog.FileName.IndexOf(".xml") > -1)
            {
                using (FileStream fs = new FileStream(openFileDialog.FileName, FileMode.OpenOrCreate))
                {
                    List <Department> dep = (List <Department>)formatter.Deserialize(fs);
                    department = new DepartmentList();
                    foreach (var item in dep)
                    {
                        department.Add(item);
                    }
                }
            }
            RefreshTreeDepartment(null);
            RefreshDGV(department.First());
        }
コード例 #2
0
ファイル: DepartmentDA.cs プロジェクト: sokogfb/LMS
        /// <summary>
        /// Gets a list of Departments
        /// </summary>
        /// <returns>List of Departments</returns>
        public static DepartmentList GetItem()
        {
            DepartmentList myDepartmentList = null;

            using (SqlConnection myConnection = new SqlConnection(AppSettings.ConnectionString))
            {
                SqlCommand myCommand = new SqlCommand("spSelectDepartmentList", myConnection);
                myCommand.CommandType = CommandType.StoredProcedure;
                myConnection.Open();
                using (SqlDataReader myDataReader = myCommand.ExecuteReader())
                {
                    if (myDataReader.HasRows)
                    {
                        myDepartmentList = new DepartmentList();
                        while (myDataReader.Read())
                        {
                            myDepartmentList.Add(FillRecord(myDataReader));
                        }
                    }
                    myDataReader.Close();
                }
                myConnection.Close();
            }
            return(myDepartmentList);
        }
コード例 #3
0
        void loadOperationDepartment_Completed(object sender, EventArgs e)
        {
            DepartmentEntityDictionary.Clear();
            DepartmentList.Clear();
            LoadOperation loadOperation = sender as LoadOperation;

            foreach (ProductManager.Web.Model.department department in loadOperation.Entities)
            {
                DepartmentEntity departmentEntity = new DepartmentEntity();
                departmentEntity.Department = department;
                departmentEntity.Update();
                DepartmentEntityDictionary.Add(departmentEntity.DepartmentID, departmentEntity);
                DepartmentList.Add(departmentEntity);
            }

            DepartmentEntity departmentEntityZero = new DepartmentEntity();

            departmentEntityZero.DepartmentID   = 0;
            departmentEntityZero.DepartmentName = "请选择部门";
            DepartmentList.Add(departmentEntityZero);

            LoadOperation <ProductManager.Web.Model.user> loadOperationUser =
                SystemManageDomainContext.Load <ProductManager.Web.Model.user>(SystemManageDomainContext.GetUserQuery());

            loadOperationUser.Completed += loadOperationUser_Completed;
        }
コード例 #4
0
        public int DepatmentAdd(Department department)
        {
            var res = databaseServiceSoapClient.DepatmentAdd(department);

            if (res > 0)
            {
                DepartmentList.Add(department);
            }
            return(res);
        }
コード例 #5
0
ファイル: ContactPageViewModel.cs プロジェクト: ycwu/EIPWeb
        private async Task GetDepartmentList()
        {
            var repoDepartmentRepository = new DepartmentRepository();
            await repoDepartmentRepository.ReadAsync();

            DepartmentList.Clear();
            foreach (var item in repoDepartmentRepository.Items)
            {
                DepartmentList.Add(item);
            }
        }
コード例 #6
0
        public void Add()
        {
            var newEntity = new VinaGerman.Entity.BusinessEntity.DepartmentEntity()
            {
                Deleted      = false,
                Description  = "",
                Phone        = "",
                DepartmentId = -1,
                CompanyId    = ApplicationHelper.CurrentUserProfile.CompanyId
            };

            DepartmentList.Add(newEntity);
            DepartmentList = new List <VinaGerman.Entity.BusinessEntity.DepartmentEntity>(_departmentList);
        }
コード例 #7
0
        public void loadLists(MerkatoDbContext _context)
        {
            SelectListItem all = new SelectListItem()
            {
                Text = "All", Value = "0"
            };

            DepartmentList = _context.Department.Select(p => new SelectListItem()
            {
                Text = p.Name, Value = p.Id.ToString()
            }).ToList();
            DepartmentList.Add(all);
            GenderList = _context.Gender.Select(p => new SelectListItem()
            {
                Text = p.Name, Value = p.Id.ToString()
            }).ToList();
            GenderList.Add(all);
        }
コード例 #8
0
        public bool updateDepartment(string depID, string name, string hodID, string newDepID, string newName, string newhodID)
        {
            IDepartment Dep = this.DepartmentList.FirstOrDefault(dep => dep.DepartmentID == depID.Trim());

            if (hodID is null)
            {
                IStaff hod = this.StaffList.FirstOrDefault(user => user.UserID.Equals(newhodID));
                this.StaffList.Remove(hod);
                hod.isHOD = 1;
                this.StaffList.Add(hod);
                DataLayer.updateStaffMemberToOrFromHODinDB(hod, hod.isHOD);
                DepartmentList.Remove(Dep);
                Dep.HeadOfDepartmentID = newhodID;
                DepartmentList.Add(Dep);
                DataLayer.UpdateDepartmentInDB(hod, Dep, depID);
            }
            else
            {
                IStaff hod = this.StaffList.FirstOrDefault(user => user.UserID.Equals(hodID));
                // Remove department and hod from their lists //
                this.DepartmentList.Remove(Dep);
                this.StaffList.Remove(hod);

                // Add them back with changes //
                hod.isHOD = 0;
                DataLayer.updateStaffMemberToOrFromHODinDB(hod, hod.isHOD);
                this.StaffList.Add(hod);

                hod = this.StaffList.FirstOrDefault(user => user.UserID.Equals(newhodID));
                this.StaffList.Remove(hod);
                hod.isHOD = 1;
                this.StaffList.Add(hod);
                DataLayer.updateStaffMemberToOrFromHODinDB(hod, hod.isHOD);

                Dep.DepartmentID       = newDepID;
                Dep.HeadOfDepartmentID = newhodID;
                Dep.Name = newName;
                this.DepartmentList.Add(Dep);

                DataLayer.UpdateDepartmentInDB(hod, Dep, depID);
            }

            return(true);
        }
コード例 #9
0
        protected void lbtnAddDepartment_Click(object sender, EventArgs e)
        {
            CAESDO.Recruitment.Core.Domain.Unit selectedUnit = UnitBLL.GetByID(dlistDepartment.SelectedValue);

            Department associatedDepartment = new Department();

            associatedDepartment.AssociatedPosition = currentPosition;
            associatedDepartment.DepartmentFIS      = selectedUnit.ID;
            associatedDepartment.Unit        = selectedUnit;
            associatedDepartment.PrimaryDept = DepartmentList.Count == 0;

            if (DepartmentList.Contains(associatedDepartment) == false)
            {
                DepartmentList.Add(associatedDepartment);
            }

            gviewDepartments.DataSource = DepartmentList;
            gviewDepartments.DataBind();
        }
コード例 #10
0
ファイル: DeptDAL.cs プロジェクト: ganeshsoley/VMS
        /// <summary>
        /// This method provides List of Departments available in Database.
        /// </summary>
        /// <param name="strWhere">Specifies condition for retrieving records.</param>
        /// <returns>Collection of Department Objects.</returns>
        public static DepartmentList GetList(string strWhere)
        {
            DepartmentList objList = null;
            string         strSql  = "Select * from DEPTMAST ";

            if (strWhere != string.Empty)
            {
                strSql = strSql + " WHERE " + strWhere;
            }
            strSql += " ORDER BY DEPTNAME";

            using (SqlConnection Conn = new SqlConnection(General.GetSQLConnectionString()))
            {
                using (SqlCommand objCmd = new SqlCommand())
                {
                    objCmd.Connection  = Conn;
                    objCmd.CommandType = CommandType.Text;
                    objCmd.CommandText = strSql;

                    if (Conn.State != ConnectionState.Open)
                    {
                        Conn.Open();
                    }

                    using (SqlDataReader oReader = objCmd.ExecuteReader())
                    {
                        if (oReader.HasRows)
                        {
                            objList = new DepartmentList();
                            while (oReader.Read())
                            {
                                objList.Add(FillDataRecord(oReader));
                            }
                        }
                        oReader.Close();
                        oReader.Dispose();
                    }
                }
            }
            return(objList);
        }
コード例 #11
0
        /// <summary>
        /// Кнопка создания нового отделения
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CreateDepartmentButton_Click(object sender, EventArgs e)
        {
            //Создаём новый департамент
            Department newDep = new Department(
                CreateDepartmentName.Text,
                CreateDepartmentDateTime.Value
                );

            //Если выбран не корневой департамент
            if (!CreateDepartmentCheckRoot.Checked)
            {
                department.SearchById(department, TreeDepartments.SelectedNode.Name).departments.Add(newDep);
            }
            else
            {
                department.Add(newDep);
            }
            //Переход обратны из режима добавления департамента
            CreateDepartment.Visible = false;
            //Обновление перечня департаментов
            RefreshTreeDepartment(TreeDepartments.SelectedNode.Name);
        }
コード例 #12
0
        public bool addDepartment(string depID, string name, string hodID)
        {
            IDepartment duplicateDep = this.DepartmentList.FirstOrDefault(dep => dep.DepartmentID == depID.Trim());

            if (duplicateDep != null)
            {
                return(false);
            }
            else
            {
                IStaff newHOD = null;
                if (hodID.Equals("null"))
                {
                    newHOD = null;
                }

                else
                {
                    newHOD = this.StaffList.FirstOrDefault(hod => hod.UserID == hodID.Trim());
                    this.StaffList.Remove(newHOD);
                    newHOD.isHOD = 1;
                    this.StaffList.Add(newHOD);
                    DataLayer.updateStaffMemberToOrFromHODinDB(newHOD, newHOD.isHOD);
                }

                try
                {
                    IDepartment theDep = UserFactory.GetDepartment(depID, name, hodID);
                    DepartmentList.Add(theDep);
                    DataLayer.addNewDepartmentToDB(theDep);
                    return(true);
                }
                catch (System.Exception excep)
                {
                    return(false);
                }
            }
        }
コード例 #13
0
ファイル: DepartmentDA.cs プロジェクト: haripradhan/LMS
 /// <summary>
 /// Gets a list of Departments
 /// </summary>
 /// <returns>List of Departments</returns>
 public static DepartmentList GetItem()
 {
     DepartmentList myDepartmentList = null;
     using (SqlConnection myConnection = new SqlConnection(AppSettings.ConnectionString))
     {
         SqlCommand myCommand = new SqlCommand("spSelectDepartmentList", myConnection);
         myCommand.CommandType = CommandType.StoredProcedure;
         myConnection.Open();
         using (SqlDataReader myDataReader = myCommand.ExecuteReader())
         {
             if (myDataReader.HasRows)
             {
                 myDepartmentList = new DepartmentList();
                 while (myDataReader.Read())
                 {
                     myDepartmentList.Add(FillRecord(myDataReader));
                 }
             }
             myDataReader.Close();
         }
         myConnection.Close();
     }
     return myDepartmentList;
 }