public override bool UpdateDrawingType(DrawingType drawingType) { using (SqlConnection cn = new SqlConnection(LayerObjectsConnection)) { SqlCommand cmd = new SqlCommand("DrawingTypes_UpdateDrawingType", cn); //cmd.Parameters.Add("@Id", SqlDbType.NVarChar).Value = drawingType.Id; //cmd.Parameters.Add("@Name", SqlDbType.NVarChar).Value = drawingType.Name; //cmd.Parameters.Add("@Phone", SqlDbType.NVarChar).Value = drawingType.Phone; //cmd.Parameters.Add("@StateId", SqlDbType.Int).Value = drawingType.ItemState; cn.Open(); int ret = ExecuteNonQuery(cmd); return(ret == 1); } }
protected virtual DrawingType GetDrawingTypeFromReader(IDataReader reader) { DrawingType drawingType = new DrawingType() { Id = (Guid)reader["Id"], Caption = reader["Caption"].ToString() }; if (reader["Code"] != DBNull.Value) { drawingType.Code = reader["Code"].ToString(); } return(drawingType); }
public override int InsertDrawingType(DrawingType drawingType) { using (SqlConnection cn = new SqlConnection(LayerObjectsConnection)) { SqlCommand cmd = new SqlCommand("DrawingTypes_InsertDrawingType", cn); cmd.CommandType = CommandType.Text; //cmd.Parameters.Add("@Name", SqlDbType.NVarChar).Value = drawingType.Name; //cmd.Parameters.Add("@Phone", SqlDbType.NVarChar).Value = drawingType.Phone; //cmd.Parameters.Add("@StateId", SqlDbType.Int).Value = drawingType.ItemState; cmd.Parameters.Add("@Id", SqlDbType.Int).Direction = ParameterDirection.Output; cn.Open(); int ret = ExecuteNonQuery(cmd); return((int)cmd.Parameters["@Id"].Value); } }
public abstract bool UpdateDrawingType(DrawingType drawingType);
public abstract int InsertDrawingType(DrawingType drawingType);