Exemple #1
0
 private void cboCustomer_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cboCustomer.Text != "")
     {
         string        CustomerID = cboCustomer.Text.Split('-')[0];
         My.MyDatabase myDB       = new My.MyDatabase();
         mtbPhone.Text   = myDB.GetTableFieldData("CustomerInfo", "CustomerID", CustomerID, "Phone");
         txtAddress.Text = myDB.GetTableFieldData("CustomerInfo", "CustomerID", CustomerID, "Address");
     }
 }
Exemple #2
0
        /// <summary>
        /// 將角色編號轉換成角色名稱
        /// </summary>
        /// <param name="UserId">使用者帳號</param>
        /// <returns></returns>
        public string RoleIdToRoleName(string UserId)
        {
            InitDB();
            string selectCmd;
            string RoleId = "";

            selectCmd = "Select * From " + TableName + " Where UserId='" + UserId + "'";

            try
            {
                cmd = new SqlCommand(selectCmd, conn);
                dr  = cmd.ExecuteReader();
                if (dr.Read())
                {
                    RoleId = dr["RoleId"].ToString();
                    conn.Close();
                    My.MyDatabase MyDB = new My.MyDatabase();

                    return(MyDB.GetTableFieldData("SysRole", "RoleId", RoleId, "RoleName"));
                }
                else
                {
                    conn.Close();
                    return("error");
                }
            }
            catch (Exception ex)
            {
                errorMsg = ex.Message;
                conn.Close();
                return(ex.Message.ToString());
            }
        }
Exemple #3
0
 private void cboPurchaseStaff_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cboPurchaseStaff.Text != "")
     {
         string        EmployeeID = cboPurchaseStaff.Text.Split('-')[0];
         My.MyDatabase myDB       = new My.MyDatabase();
         mtbPurchasePhone.Text = myDB.GetTableFieldData("EmployeeInfo", "EmployeeID", EmployeeID, "Phone");
     }
 }