public void InstanceOK() { //create an instance of the class we want to create clsDirector AnDirector = new clsDirector(); //test to see that it exists Assert.IsNotNull(AnDirector); }
public void AgeProperty() { //create an instance of the class we want to create clsDirector AnDirector = new clsDirector(); //create some test data to assign to the property string TestData = "34"; //assign the data to the proerty AnDirector.Age = TestData; //test to see that the two values are the same Assert.AreEqual(AnDirector.Age, TestData); }
public void ValidMethodOK() { //create an instance of the class we want to create clsDirector ADirector = new clsDirector(); //boolean variable to store the result of the validation Boolean Ok = false; //create some data to use with the method string DirectorName = "Bob"; string Age = "23"; //invoke the method Ok = ADirector.Valid(DirectorName, Age); //test tto see that the reuslt is correct Assert.IsFalse(Ok); }
static void Main(string[] args) { clsReport objReport; clsDirector objDirector = new clsDirector(); ReportPDF objRptPdf = new ReportPDF(); objReport = objDirector.MakeReport(objRptPdf); objReport.displayReport(); ReportExcel objRptExcel = new ReportExcel(); objReport = objDirector.MakeReport(objRptExcel); objReport.displayReport(); Console.ReadLine(); }
private void btnAdd_Click(object sender, EventArgs e) { if (txtName.Text.Trim() == string.Empty) { MessageBox.Show("Please enter a name."); txtName.Focus(); return; } if (txtCNIC.Text.Trim() == "") { MessageBox.Show("Please enter a CNIC #."); txtCNIC.Focus(); return; } foreach (DataGridViewRow dgr in dgList.Rows) { if (dgr.Cells["DirectorName"].Value.ToString().Trim().ToUpper() == txtName.Text.Trim().ToUpper() && this.id != Convert.ToInt32(dgr.Cells["ID1"].Value)) { MessageBox.Show("A director with same name already exists."); return; } } clsDirector cat = new clsDirector(); cat.strName = txtName.Text.Trim(); cat.strCNIC = txtCNIC.Text.Trim(); cat.id = this.id; bool result = da.AddDirector(cat); if (result == false) { MessageBox.Show("An error occurred."); return; } LoadDirectors(); Clear(); }
public void fncGetDirectors(clsDirector director) { try { // 1. Objet clsListDirectors clsListDirectors ListDirectors = new clsListDirectors(); // 2. Execute open connection Command.Connection = Connection.OpenConnection(); // 3. Execute stored procedure Command.CommandText = "selectDirectors"; // 4. Execute specify the command type Command.CommandType = CommandType.StoredProcedure; // 5. Execute the Reader Read = Command.ExecuteReader(); // 6. Load the list while (Read.Read()) { director.vId = Read.GetInt32(Read.GetOrdinal("iddirector")); director.vIdbank = Read.GetInt32(Read.GetOrdinal("idbank")); director.vNumber = Read.GetString(Read.GetOrdinal("Number")); director.vName = Read.GetString(Read.GetOrdinal("Name")); director.vLastName = Read.GetString(Read.GetOrdinal("Last Name")); director.vEmail = Read.GetString(Read.GetOrdinal("Email")); director.vImg = Read.GetString(Read.GetOrdinal("img")); director.vSalary = Read.GetDecimal(Read.GetOrdinal("salary")); director.vSexe = Read.GetString(Read.GetOrdinal("sexe")); director.vActive = Read.GetString(Read.GetOrdinal("active")); ListDirectors.fncAdd(director); } // 7. Close Read Connection Read.Close(); Connection.CloseConnection(); } catch (Exception ex) { MessageBox.Show("Error in the Model getting the director list from data base " + ex.Message); } }