/// <summary>
        /// Method to update an Item
        /// </summary>
        /// <param name="sCode">Item Code of Item to be updated</param>
        /// <param name="sDesc">New Item Description</param>
        /// <param name="sCost">New Item Cost</param>
        /// <returns>Bool; True if cost is valid, false otherwise</returns>
        public bool updateItem(string sCode, string sDesc, string sCost)
        {
            try
            {
                int  iCost;
                int  iRet;
                bool validCost = false;

                validCost = Int32.TryParse(sCost, out iCost);

                if (validCost)
                {
                    string sSQL = clsSQL.UpdateItem(sCode, sDesc, iCost);
                    iRet = clsDA.ExecuteNonQuery(sSQL);
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(MethodInfo.GetCurrentMethod().DeclaringType.Name + "." +
                                    MethodInfo.GetCurrentMethod().Name + " ->" + ex.Message);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Update provided item
 /// </summary>
 /// <param name="SelectedItem">Item to be updated</param>
 /// <param name="Desc">Item's Description</param>
 /// <param name="Cost">Item's Cost</param>
 public void UpdateItem(object SelectedItem, string Desc, string Cost)
 {
     try
     {
         //If the Description or Cost is not changed pass in null
         SQL.UpdateItem(((Item)SelectedItem)._Code, ((Item)SelectedItem)._Desc != Desc ? Desc : null, ((Item)SelectedItem)._Cost.ToString() != Cost ? Cost : null);
     }
     catch (Exception ex)
     {
         throw new Exception(MethodInfo.GetCurrentMethod().DeclaringType.Name + "." +
                             MethodInfo.GetCurrentMethod().Name + " -> " + ex.Message);
     }
 }