Esempio n. 1
0
 public static void En_btn(Device_Management_System form)
 {
     form.Not_Returned_button.Enabled = true;
     form.Returned_log_button.Enabled = true;
     form.Borrow_button.Enabled       = true;
     form.Return_button.Enabled       = true;
 }
Esempio n. 2
0
            public static void Refresh(Device_Management_System form)
            {
                DBHelper db = new DBHelper();
                //string SqlText = "select * from Borrow_Device_Input_List";
                //string SqlText = "select * from Borrow_Device_Input_List union all select * from Borrow_Device_FlashStorage_List";
                string  SqlText = Refresh_SqlText;
                DataSet data    = db.DBselect(SqlText, null);

                form.dataGridView1.DataSource = data.Tables[0];
            }
Esempio n. 3
0
        private void Login_button_Click(object sender, EventArgs e)
        {
            Account_n = Account_textBox.Text;
            if (Account_textBox.Text == "" || Password_textBox.Text == "")
            {
                MessageBox.Show("Account and password can not be empty!", "Prompt", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            DBHelper     db       = new DBHelper();
            string       SqlText  = "select * from Admin where Account = @username and Password = @password";
            SqlParameter Acount   = new SqlParameter("@username", Account_textBox.Text.Trim());
            SqlParameter Password = new SqlParameter("@password", Password_textBox.Text.Trim());

            if (count < 3)
            {
                count++;

                DataSet data = db.DBselect(SqlText, Acount, Password);
                if (data.Tables[0].Rows.Count == 0)
                {
                    SqlText  = "select * from Users where Account = @username and Password = @password";
                    Acount   = new SqlParameter("@username", Account_textBox.Text.Trim());
                    Password = new SqlParameter("@password", Password_textBox.Text.Trim());
                    data     = db.DBselect(SqlText, Acount, Password);
                    if (data.Tables[0].Rows.Count == 0)
                    {
                        MessageBox.Show("The account does not exist or the password is incorrect.", "Prompt", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        Device_Management_System forms = new Device_Management_System();
                        forms.Show();
                        this.Hide();
                    }
                    //MessageBox.Show("The account does not exist or the password is incorrect.", "Prompt", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    Device_Management_System forms = new Device_Management_System();
                    forms.Show();
                    this.Hide();
                }
            }
            else
            {
                Application.Exit();
            }
        }
Esempio n. 4
0
 public static void Set(Device_Management_System form) //参数获取窗体对象
 {
     form.dataGridView1.RowHeadersVisible = false;     //
                                                       //form.dataGridView1.Columns[0].Visible = false;   //隐藏列
                                                       //dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
                                                       //dataGridView1.AutoResizeRows(DataGridViewAutoSizeRowsMode.AllCells);    //自动行高
     form.dataGridView1.Columns[0].Width = 80;         //指定列宽
     form.dataGridView1.Columns[1].Width = 120;
     form.dataGridView1.Columns[2].Width = 80;
     form.dataGridView1.Columns[3].Width = 120;
     form.dataGridView1.Columns[4].Width = 120;
     form.dataGridView1.Columns[5].Width = 180;
     //form.dataGridView1.Columns[6].Width = 200;
     form.dataGridView1.DefaultCellStyle.WrapMode = DataGridViewTriState.True;                          //设置显示所有字段
     form.dataGridView1.AutoSizeRowsMode          = DataGridViewAutoSizeRowsMode.AllCellsExceptHeaders; //自动调节行高
                                                                                                        //dataGridView1.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;    //设置标题栏剧中,但由于
                                                                                                        //dataGridView1.ColumnHeadersDefaultCellStyle.Font = new Font("Tahoma", 9, FontStyle.Bold); //设置标题文字
                                                                                                        //dataGridView1.RowsDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; //所有字段剧中显示
                                                                                                        //dataGridView1.Columns[2].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;    //设置居中对齐
                                                                                                        //dataGridView1.Columns[5].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;  //设置左对齐
                                                                                                        //dataGridView1.Columns[7].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;  //设置右对齐
                                                                                                        //设置字段的对齐方式
     for (int i = 0; i <= 5; i++)
     {
         if (i == 5)
         {
             continue;
         }
         form.dataGridView1.Columns[i].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
     }
     //设置标题剧中
     foreach (DataGridViewColumn col in form.dataGridView1.Columns)
     {
         col.SortMode = DataGridViewColumnSortMode.NotSortable;
     }
     form.dataGridView1.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
     GC.Collect();
 }