/// <summary> /// edits an item in the database /// </summary> /// <param name="code">the items code</param> /// <param name="cost">the items cost</param> /// <param name="desc">the items description</param> public void EditItem(string code, string cost, string desc) { try { int iRet = 0; if (String.IsNullOrEmpty(cost)) { try { iRet = data.ExecuteNonQuery(SQL.UpdateItemD(code, desc)); } catch (Exception ex) { throw new Exception(MethodInfo.GetCurrentMethod().DeclaringType.Name + "." + MethodInfo.GetCurrentMethod().Name + " -> " + ex.Message); } } else if (String.IsNullOrEmpty(desc)) { try { iRet = data.ExecuteNonQuery(SQL.UpdateItemC(code, cost)); } catch (Exception ex) { throw new Exception(MethodInfo.GetCurrentMethod().DeclaringType.Name + "." + MethodInfo.GetCurrentMethod().Name + " -> " + ex.Message); } } else { try { iRet = data.ExecuteNonQuery(SQL.UpdateItem(code, cost, desc)); } catch (Exception ex) { throw new Exception(MethodInfo.GetCurrentMethod().DeclaringType.Name + "." + MethodInfo.GetCurrentMethod().Name + " -> " + ex.Message); } } } catch (Exception ex) { throw new Exception(MethodInfo.GetCurrentMethod().DeclaringType.Name + "." + MethodInfo.GetCurrentMethod().Name + " -> " + ex.Message); } }
public void EditItem(string code, string cost, string desc) { SQLCalls.UpdateItem(code, cost, desc); }