/// <summary> /// Returns List of Company Representatives based on Company Name /// </summary> /// <param name="companyName"></param> /// <returns></returns> public List <CompanyRepresentative> GetRepresentativeByCompanyID(int companyID) { CompanyRepresentative companyRepObj = null; List <CompanyRepresentative> list = new List <CompanyRepresentative>(); string query = "select * from company_rep cr where cr.company_id = @cid"; using (var cn = DbConnSingleton.getDbInstance().GetDBConnection()) { MySqlCommand cmd = new MySqlCommand(query, cn); cmd.Parameters.AddWithValue("@cid", companyID); MySqlDataAdapter adap = new MySqlDataAdapter(cmd); DataTable dt = new DataTable(); adap.Fill(dt); foreach (DataRow dr in dt.Rows) { companyRepObj = new CompanyRepresentative(); companyRepObj.first_name = dr["first_name"].ToString(); companyRepObj.last_name = dr["last_name"].ToString(); companyRepObj.email = dr["email"].ToString(); companyRepObj.phone = Convert.ToInt32(dr["phone"]); if (Convert.ToInt32(dr["isAlumni"]).Equals(1)) { companyRepObj.isAlumni = true; } else { companyRepObj.isAlumni = false; } list.Add(companyRepObj); } return(list); } }
public void AddCompanyRepresentitive(CompanyRepresentative Entity) { try { _companyRepresentativeRepository.Insert(Entity); } catch (IntegratorException e) { throw e; } }
public void CompanyRepresentativeDelete() { CompanyRepresentative companyRepresentative = new CompanyRepresentative() { SocialSecurityNumber = "01018523647", FullName = "Kako Skvancheli", Email = "*****@*****.**", Phone = "591013013", ID = 4 }; object obj = new CompanyRepresentativeService().Delete(companyRepresentative); }