public override int GetHashCode() { unchecked { var hashCode = Created.GetHashCode(); hashCode = (hashCode * 397) ^ (Office != null ? Office.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (RegistrationNumber != null ? RegistrationNumber.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (TachographMake != null ? TachographMake.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (TachographModel != null ? TachographModel.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (SerialNumber != null ? SerialNumber.GetHashCode() : 0); hashCode = (hashCode * 397) ^ InspectionDate.GetHashCode(); hashCode = (hashCode * 397) ^ (Technician != null ? Technician.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (CustomerContact != null ? CustomerContact.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (DepotName != null ? DepotName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (CompanyName != null ? CompanyName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ UserId; hashCode = (hashCode * 397) ^ Uploaded.GetHashCode(); return(hashCode); } }
public bool Save() { if (Group.Director <= 0) { MessageBox.Show("Необходимо выбрать руководителя группы (Состав группы)."); return(false); } if (Number == "") { MessageBox.Show("Необходимо ввести уникальный номер протокола проверки."); return(false); } if (inspection_id == 0) { try { MySQL_cmd.CommandText = "INSERT INTO inspections (protocol, name, _date, reason, director, " + "period_begin, period_end, _comment, modif_inspector, modif_datetime) " + String.Format("VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', NOW())", Number, Name, InspectionDate.ToString("yyyy-MM-dd"), reason, Group.Director, period.Begin.ToString("yyyy-MM-dd"), period.End.ToString("yyyy-MM-dd"), Comment, Inspector); MySQL_cmd.ExecuteNonQuery(); MySQL_cmd.CommandText = "SELECT @@IDENTITY as 'new_id'"; inspection_id = int.Parse(MySQL_cmd.ExecuteScalar().ToString()); InsertDataGr1(); InsertDataGr2(); InsertGroup(); } catch (MySqlException ex) { MessageBox.Show(ex.Message + "\n" + MySQL_cmd.CommandText, "Ошибка MySQL"); return(false); } } else { try { MySQL_cmd.CommandText = String.Format("UPDATE inspections SET protocol='{0}', name='{1}', _date='{2}', reason='{3}', director='{4}', " + "period_begin='{5}', period_end='{6}', _comment='{7}', modif_inspector='{8}', modif_datetime=NOW() WHERE _id={9}", Number, Name, InspectionDate.ToString("yyyy-MM-dd"), reason, Group.Director, period.Begin.ToString("yyyy-MM-dd"), period.End.ToString("yyyy-MM-dd"), Comment, Inspector, inspection_id); MySQL_cmd.ExecuteNonQuery(); MySQL_cmd.CommandText = "DELETE FROM violations WHERE inspection=" + inspection_id; MySQL_cmd.ExecuteNonQuery(); InsertDataGr1(); MySQL_cmd.CommandText = "DELETE FROM eliminations WHERE inspection=" + inspection_id; MySQL_cmd.ExecuteNonQuery(); InsertDataGr2(); MySQL_cmd.CommandText = "DELETE FROM inspection_group WHERE inspection=" + inspection_id; MySQL_cmd.ExecuteNonQuery(); InsertGroup(); } catch (MySqlException ex) { MessageBox.Show(ex.Message, "Ошибка MySQL"); return(false); } } return(true); }
public bool Equals(Document other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(Created.Equals(other.Created) && string.Equals(Office, other.Office) && string.Equals(RegistrationNumber, other.RegistrationNumber) && string.Equals(TachographMake, other.TachographMake) && string.Equals(TachographModel, other.TachographModel) && string.Equals(SerialNumber, other.SerialNumber) && InspectionDate.Equals(other.InspectionDate) && string.Equals(Technician, other.Technician) && string.Equals(CustomerContact, other.CustomerContact) && string.Equals(DepotName, other.DepotName) && string.Equals(CompanyName, other.CompanyName) && UserId == other.UserId && Uploaded.Equals(other.Uploaded)); }