public List<DepartmentLanguages> GetAllByDepartmentId(int DepartmentId) { DepartmentLanguagesDAC _departmentLanguagesComponent = new DepartmentLanguagesDAC(); IDataReader reader = _departmentLanguagesComponent.GetAllDepartmentLanguages("DepartmentId = " + DepartmentId).CreateDataReader(); List<DepartmentLanguages> _departmentLanguagesList = new List<DepartmentLanguages>(); while (reader.Read()) { if (_departmentLanguagesList == null) _departmentLanguagesList = new List<DepartmentLanguages>(); DepartmentLanguages _departmentLanguages = new DepartmentLanguages(); if (reader["DepartmentLanguagesId"] != DBNull.Value) _departmentLanguages.DepartmentLanguagesId = Convert.ToInt32(reader["DepartmentLanguagesId"]); if (reader["DepartmentId"] != DBNull.Value) _departmentLanguages.DepartmentId = Convert.ToInt32(reader["DepartmentId"]); if (reader["LanguageId"] != DBNull.Value) _departmentLanguages.LanguageId = Convert.ToInt32(reader["LanguageId"]); if (reader["DepartmentName"] != DBNull.Value) _departmentLanguages.DepartmentName = Convert.ToString(reader["DepartmentName"]); if (reader["DepartmentDescription"] != DBNull.Value) _departmentLanguages.DepartmentDescription = Convert.ToString(reader["DepartmentDescription"]); if (reader["AddressLine1"] != DBNull.Value) _departmentLanguages.AddressLine1 = Convert.ToString(reader["AddressLine1"]); if (reader["AddressLine2"] != DBNull.Value) _departmentLanguages.AddressLine2 = Convert.ToString(reader["AddressLine2"]); _departmentLanguages.NewRecord = false; _departmentLanguagesList.Add(_departmentLanguages); } reader.Close(); return _departmentLanguagesList; }
public DepartmentLanguages GetByID(int _departmentLanguagesId) { DepartmentLanguagesDAC _departmentLanguagesComponent = new DepartmentLanguagesDAC(); IDataReader reader = _departmentLanguagesComponent.GetByIDDepartmentLanguages(_departmentLanguagesId); DepartmentLanguages _departmentLanguages = null; while(reader.Read()) { _departmentLanguages = new DepartmentLanguages(); if(reader["DepartmentLanguagesId"] != DBNull.Value) _departmentLanguages.DepartmentLanguagesId = Convert.ToInt32(reader["DepartmentLanguagesId"]); if(reader["DepartmentId"] != DBNull.Value) _departmentLanguages.DepartmentId = Convert.ToInt32(reader["DepartmentId"]); if(reader["LanguageId"] != DBNull.Value) _departmentLanguages.LanguageId = Convert.ToInt32(reader["LanguageId"]); if(reader["DepartmentName"] != DBNull.Value) _departmentLanguages.DepartmentName = Convert.ToString(reader["DepartmentName"]); if(reader["DepartmentDescription"] != DBNull.Value) _departmentLanguages.DepartmentDescription = Convert.ToString(reader["DepartmentDescription"]); if(reader["AddressLine1"] != DBNull.Value) _departmentLanguages.AddressLine1 = Convert.ToString(reader["AddressLine1"]); if(reader["AddressLine2"] != DBNull.Value) _departmentLanguages.AddressLine2 = Convert.ToString(reader["AddressLine2"]); _departmentLanguages.NewRecord = false; } reader.Close(); return _departmentLanguages; }
public bool Update(DepartmentLanguages departmentlanguages ,int old_departmentLanguagesId) { DepartmentLanguagesDAC departmentlanguagesComponent = new DepartmentLanguagesDAC(); return departmentlanguagesComponent.UpdateDepartmentLanguages( departmentlanguages.DepartmentId, departmentlanguages.LanguageId, departmentlanguages.DepartmentName, departmentlanguages.DepartmentDescription, departmentlanguages.AddressLine1, departmentlanguages.AddressLine2, old_departmentLanguagesId); }
public bool Insert(DepartmentLanguages departmentlanguages) { int autonumber = 0; DepartmentLanguagesDAC departmentlanguagesComponent = new DepartmentLanguagesDAC(); bool endedSuccessfuly = departmentlanguagesComponent.InsertNewDepartmentLanguages( ref autonumber, departmentlanguages.DepartmentId, departmentlanguages.LanguageId, departmentlanguages.DepartmentName, departmentlanguages.DepartmentDescription, departmentlanguages.AddressLine1, departmentlanguages.AddressLine2); if(endedSuccessfuly) { departmentlanguages.DepartmentLanguagesId = autonumber; } return endedSuccessfuly; }