public static T_Motor ConvertToDB(MotorClass motor) { T_Motor t_motor = new T_Motor(); t_motor.id = motor.id; t_motor.Name = motor.Name; t_motor.Guid = motor.Guid; t_motor.LineFrequency = motor.LineFrequency; t_motor.Poles = motor.Poles; t_motor.RotorBars = motor.RotorBars; t_motor.StatorCoils = motor.StatorCoils; t_motor.WindingSlots = motor.WindingSlots; t_motor.SCRs = motor.SCRs; t_motor.MotorType = (int)(motor.MotorType); return(t_motor); }
public static MotorClass ConvertFromDB(T_Motor t_motor) { MotorClass motor = new MotorClass(); motor.id = t_motor.id; motor.Name = t_motor.Name; motor.Guid = t_motor.Guid ?? new Guid(); motor.LineFrequency = t_motor.LineFrequency ?? 0; motor.Poles = t_motor.Poles ?? 0; motor.RotorBars = t_motor.RotorBars ?? 0; motor.StatorCoils = t_motor.StatorCoils ?? 0; motor.WindingSlots = t_motor.WindingSlots ?? 0; motor.SCRs = t_motor.SCRs ?? 0; motor.MotorType = (MotorType)(t_motor.MotorType ?? 0); return(motor); }