private void lblLogout_Click(object sender, EventArgs e) { //清空帳號資料 this.BuyerLoginAccount = null; this.SupplierLoginAccount = null; this.Init(); }
public OrderForm(Model.SupplierAccount supplierLoginAccount) { InitializeComponent(); //================================================== pnlContent.BackColor = Color.FromArgb(42, 73, 93); //深藍底 panel1.BackColor = Color.FromArgb(250, 236, 209); //淺黃底 btnNew.BackColor = Color.FromArgb(242, 213, 143); button1.BackColor = Color.FromArgb(242, 213, 143); btnOrderQuery.BackColor = Color.FromArgb(242, 213, 143); panel2.BackColor = Color.FromArgb(42, 73, 93); //======================================== //======================================== this.buyerLoginAccount = buyerLoginAccount; this.SupplierLoginAccount = supplierLoginAccount; //======================================== this.dataGridView1.AllowUserToAddRows = false; this.dataGridView1.ReadOnly = true; //======================================== //判斷操作角色為何,如為採購人員需要多一個新增訂單按鈕 if (this.buyerLoginAccount != null) { btnNew.Enabled = true; btnNew.Visible = true; this.Text += $" - 採購人員:{this.buyerLoginAccount.GetEmployee().Name}"; } else if (this.SupplierLoginAccount != null) { btnNew.Enabled = false; btnNew.Visible = false; this.Text += $" - 供應商 : {this.SupplierLoginAccount.ContactName}"; } //======================================== //=========把訂單編號資料放進TEXTBOX=============================== string sqlCommand = " SELECT OrderID FROM [order]"; //comboBoxOrderID.DataSource = a; //comboBoxOrderID.DisplayMember = "OrderID"; //comboBoxOrderID.ValueMember = "OrderID"; DataTable a = SqlHelper.AdapterFill(sqlCommand); AutoCompleteStringCollection acc = new AutoCompleteStringCollection(); this.comboBoxOrderID.AutoCompleteMode = AutoCompleteMode.SuggestAppend; for (int i = 0; i < a.Rows.Count; i++) { acc.Add(a.Rows[i]["OrderID"].ToString()); } comboBoxOrderID.AutoCompleteCustomSource = acc; }
/// <summary> /// 設定測試帳號 /// </summary> /// <param name="ID">員工編號P000000002或供應商帳號S000000001</param> void SetTestAccount(string ID) { ID = ID.Trim().ToUpper(); if (ID.StartsWith("P")) { BuyerDao bDao = new BuyerDao(); this.BuyerLoginAccount = bDao.FindBuyerByEmployeeID(ID); } else if (ID.StartsWith("S")) { SupplierAccountDao saDao = new SupplierAccountDao(); this.SupplierLoginAccount = saDao.FindSupplierAccountBySupplierAccountID(ID); } }