public static List<TechnicalDetails> GetSingleTechnicalDetails(string id) { string query = "select technicaldescription.id,technicaldescription.typeid,technicaldescription.amount,technicaldescription.description,technicaldescription.OnAirDate,equipmnttype.typename from technicaldescription,equipmnttype where technicaldescription.typeid=equipmnttype.id and technicaldescription.id=" + id; DBGateway aGateway = new DBGateway(); List<TechnicalDetails> aList = new List<TechnicalDetails>(); DataSet aDataSet = aGateway.Select(query); foreach (DataRow dataRow in aDataSet.Tables[0].Rows) { TechnicalDetails aTechnicalDetails = new TechnicalDetails(); aTechnicalDetails.TechnicalId = dataRow["Id"].ToString(); aTechnicalDetails.TypeID = (int) dataRow["TypeID"]; aTechnicalDetails.Amount = (int) dataRow["Amount"]; aTechnicalDetails.Description = dataRow["Description"].ToString(); aTechnicalDetails.OnAirDate = Convert.ToDateTime(dataRow["OnAirDate"].ToString()); // aData.MailArrivalDate = Convert.ToDateTime(dataRow["DateArrival"].ToString()); aTechnicalDetails.TypeName = dataRow["typename"].ToString(); aList.Add(aTechnicalDetails); } return aList; }
public static void UpdateTechnicalDetails(TechnicalDetails aTechnicalDetails, string OAD) { DateTime dt = Convert.ToDateTime(aTechnicalDetails.OnAirDate); // var date = DateTime.Parse(aTechnicalDetails.OnAirDate); string updateQuery; updateQuery = "UPDATE `signalappdb`.`technicaldescription` SET `TypeId`=" + aTechnicalDetails.TypeID + ", `Amount`=" + aTechnicalDetails.Amount + ",`OnAirDate`='" + OAD + "', `Description`='" + aTechnicalDetails.Description + "' WHERE `Id`=" + aTechnicalDetails.TechnicalId + ";"; DBGateway aGateway = new DBGateway(); string updateResult = aGateway.Update(updateQuery); }
public List<TechnicalDetails> GetEquipmentList(string equipmentType, string description) { DBGateway aGateway = new DBGateway(); string query = "select technicaldescription.id,technicaldescription.typeid,technicaldescription.amount," + "technicaldescription.description,technicaldescription.OnAirDate,equipmnttype.typename from technicaldescription," + "equipmnttype where technicaldescription.typeid=equipmnttype.id"; if (equipmentType.Trim().Length != 0) { query += " and equipmnttype.TypeName like '%" + equipmentType + "%' "; } if (description.Trim().Length != 0) { query += " and technicaldescription.description like '%" + description + "%' "; } query += ";"; List<TechnicalDetails> aList = new List<TechnicalDetails>(); DataSet aDataSet = aGateway.Select(query); foreach (DataRow dataRow in aDataSet.Tables[0].Rows) { TechnicalDetails aTechnicalDetails = new TechnicalDetails(); aTechnicalDetails.TechnicalId = dataRow["Id"].ToString(); aTechnicalDetails.TypeID = (int) dataRow["TypeID"]; aTechnicalDetails.Amount = (int) dataRow["Amount"]; aTechnicalDetails.Description = dataRow["Description"].ToString(); aTechnicalDetails.OnAirDate = Convert.ToDateTime(dataRow["OnAirDate"].ToString()); aTechnicalDetails.TypeName = dataRow["typename"].ToString(); aList.Add(aTechnicalDetails); } return aList; }