private void ClearView()
 {
     this.departmentDirectors.Clear();
     this.selectedDepartment         = null;
     this.selectedDirector           = null;
     this.selectedDepartmentDirector = null;
     this.view.ClearView();
 }
Пример #2
0
        public void AddItemToListView(DepartmentDirector item)
        {
            ListViewItem lvItem = this.ItemsListView.Items.Add(item.ID.ToString());

            lvItem.SubItems.Add(item.DepartmentID.ToString());
            lvItem.SubItems.Add(item.DepartmentName);
            lvItem.SubItems.Add(item.UserName);
            lvItem.SubItems.Add(item.FullName);
        }
        private void CreateAndSubmitDepartmentDirector()
        {
            DepartmentDirector item = new DepartmentDirector();

            item.DepartmentID = this.selectedDepartment.ID;
            item.UserName     = this.selectedDirector.Value;

            QDepartmentDirectors.InsertItem(item);
            ClearView();
            RefreshDepartmentDirectors();
        }
Пример #4
0
        static void Main(string[] args)
        {
            BonusHandler pm = new PM();
            BonusHandler departmentDirector = new DepartmentDirector();
            BonusHandler financeDirector    = new FinanceDirector();
            BonusHandler ceo = new CEO();

            pm.SetNext(departmentDirector).SetNext(financeDirector).SetNext(ceo);

            pm.Handle(80);
            Console.WriteLine();
            pm.Handle(1230);
            Console.WriteLine();
            pm.Handle(2450);

            Console.Read();
        }
 public static void InsertItem(DepartmentDirector item)
 {
     try
     {
         using (SqlConnection connection = new SqlConnection(connectionString))
         {
             connection.Open();
             using (SqlCommand command = new SqlCommand("dd_insert_department_director", connection))
             {
                 LoginInfo loginInfo = LoginInfo.GetInstance();
                 command.CommandType = CommandType.StoredProcedure;
                 command.Parameters.Add("@DepartmentID", SqlDbType.Int).Value   = item.DepartmentID;
                 command.Parameters.Add("@UserName", SqlDbType.NVarChar).Value  = item.UserName;
                 command.Parameters.Add("@CreatedBy", SqlDbType.NVarChar).Value = loginInfo.UserName;
                 int result = command.ExecuteNonQuery();
             }
         }
     }
     catch (SqlException ex)
     {
         ErrorHandler.CreateLogFile(ErrorFormName, "InsertItem", ex);
     }
 }
        public static IList SelectAllItems()
        {
            IList results = new ArrayList();

            try
            {
                using (SqlConnection connection = new SqlConnection(connectionString))
                {
                    connection.Open();
                    using (SqlCommand command = new SqlCommand("dd_select_department_directors", connection))
                    {
                        command.CommandType = CommandType.StoredProcedure;
                        SqlDataReader reader = command.ExecuteReader();
                        while (reader.Read())
                        {
                            DepartmentDirector item = new DepartmentDirector();
                            item.ID             = Convert.ToInt32(reader[0].ToString());
                            item.DepartmentID   = Convert.ToInt32(reader[1].ToString());
                            item.DepartmentName = reader[2].ToString();
                            item.UserName       = reader[3].ToString();
                            item.FullName       = reader[4].ToString();
                            item.IsActive       = Convert.ToBoolean(reader[5].ToString());
                            results.Add(item);
                        }
                    }
                }
            }
            catch (SqlException ex)
            {
                ErrorHandler.CreateLogFile(ErrorFormName, "SelectAllItems", ex);
            }
            catch (FormatException fe)
            {
                ErrorHandler.CreateLogFile(ErrorFormName, "SelectAllItems", fe);
            }
            return(results);
        }