public static string checkout(string status) { Cart cart; int cartID; DBConnect objDB = new DBConnect(ConfigurationManager.ConnectionStrings["appString"].ConnectionString); try { cart = (Cart)HttpContext.Current.Session["cart"]; if (cart.Items.Count == 0 || cart == null) { return("No Items"); } SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "CreateReceipt"; cmd.Parameters.AddWithValue("@personID", 0); cmd.Parameters.AddWithValue("@points", cart.Points); cmd.Parameters.AddWithValue("@quantity", cart.Items.Count); cmd.Parameters.AddWithValue("@lastUpdateUser", "eshoshan-test"); cmd.Parameters.AddWithValue("@lastUpdateDate", DateTime.Now.ToString("MM/dd/yyyy hh:mm tt")); cmd.Parameters.AddWithValue("@checkoutDate", DateTime.Now.ToString("MM/dd/yyyy hh:mm tt")); cmd.Parameters.Add("@id", SqlDbType.Int).Direction = ParameterDirection.Output; objDB.DoUpdateUsingCmdObj(cmd); cart.CartID = Convert.ToInt32(cmd.Parameters["@id"].Value.ToString()); cartID = cart.CartID; foreach (Item item in cart.Items) { cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "UpdateItemCheckedOut"; cmd.Parameters.AddWithValue("@UPC", item.Upc); cmd.Parameters.AddWithValue("@ReceiptID", cart.CartID); cmd.Parameters.AddWithValue("@lastUpdateUser", "eshoshan-test"); cmd.Parameters.AddWithValue("@lastUpdateDate", DateTime.Now); objDB.DoUpdateUsingCmdObj(cmd); } cart = new Cart(); HttpContext.Current.Session["cart"] = cart; return(cartID.ToString()); } catch (Exception ex) { cart = new Cart(); HttpContext.Current.Session["cart"] = cart; return("error"); } }
public static string setMaxPoint(string point) { try { int pointVal = Convert.ToInt32(point); if (pointVal > 0) { DBConnect objDB = new DBConnect(ConfigurationManager.ConnectionStrings["appString"].ConnectionString); SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "SetMaxPoint"; cmd.Parameters.AddWithValue("@point", pointVal); cmd.Parameters.AddWithValue("@lastUpdateUser", HttpContext.Current.Session["Access_Net"].ToString()); cmd.Parameters.AddWithValue("@lastUpdateDate", DateTime.Now.ToString()); int ret = objDB.DoUpdateUsingCmdObj(cmd); return(pointVal.ToString()); } else { throw new FormatException(); } } catch (Exception ex) { throw ex; } }
public static string UpdateDonation(string DonationId, string DonationType, string DonationDate) { try { DBConnect objDB = new DBConnect(connectionStr); SqlCommand objCommand = new SqlCommand(); objCommand.CommandType = CommandType.StoredProcedure; objCommand.CommandText = "UpdateDonation"; // identify the name of the stored procedure to execute objCommand.Parameters.AddWithValue("@DonationID", Convert.ToInt32(DonationId)); objCommand.Parameters.AddWithValue("@DonationType", DonationType); objCommand.Parameters.AddWithValue("@DonationDate", DonationDate); objCommand.Parameters.AddWithValue("@Last_Update_User", HttpContext.Current.Session["Access_Net"].ToString()); objCommand.Parameters.AddWithValue("@Last_Update_Date", DateTime.Now); objDB.DoUpdateUsingCmdObj(objCommand); return("true"); } catch (Exception ex) { return(ex.Message); } }
public static string UpdateDonationDetails(string DonationDetails, string DonationID) { try { DBConnect objDB = new DBConnect(ConfigurationManager.ConnectionStrings["appString"].ConnectionString); SqlCommand objCommand = new SqlCommand(); ArrayList Donation = new ArrayList(); objCommand.CommandType = CommandType.StoredProcedure; objCommand.CommandText = "UpdateDonationDetail"; // identify the name of the stored procedure to execute objCommand.Parameters.AddWithValue("@DonationID", Convert.ToInt32(DonationID)); objCommand.Parameters.AddWithValue("@DonationDetails", DonationDetails); objCommand.Parameters.AddWithValue("@Last_Update_User", HttpContext.Current.Session["Access_Net"].ToString()); objCommand.Parameters.AddWithValue("@Last_Update_Date", DateTime.Now); objDB.DoUpdateUsingCmdObj(objCommand); return("true"); } catch (Exception ex) { return(ex.Message); } }
public static string UpdateDonor(string DonorID, string DonorFN, string DonorLN, string DonorEmail, string DonorType, string DonorOrgs) { try { DBConnect objDB = new DBConnect(ConfigurationManager.ConnectionStrings["appString"].ConnectionString); SqlCommand objCommand = new SqlCommand(); objCommand.CommandType = CommandType.StoredProcedure; objCommand.CommandText = "UpdateDonor"; // identify the name of the stored procedure to execute objCommand.Parameters.AddWithValue("@Donorid ", DonorID); objCommand.Parameters.AddWithValue("@DonorFN ", DonorFN); objCommand.Parameters.AddWithValue("@DonorLN", DonorLN); objCommand.Parameters.AddWithValue("@DonorEmail", DonorEmail); objCommand.Parameters.AddWithValue("@DonorType", DonorType); objCommand.Parameters.AddWithValue("@DonorOrgs", DonorOrgs); objCommand.Parameters.AddWithValue("@Last_Update_User", HttpContext.Current.Session["Access_Net"].ToString()); objCommand.Parameters.AddWithValue("@Last_Update_Date", DateTime.Now); objDB.DoUpdateUsingCmdObj(objCommand); return("true"); } catch (Exception ex) { return(ex.Message); } }
public static string AddToInventory(string Upc, int Category, string Weight, int Point, int Quantity) { try { DBConnect objDB = new DBConnect(ConnectionString); SqlCommand objCommand = new SqlCommand(); objCommand.CommandType = CommandType.StoredProcedure; objCommand.CommandText = "AddToInventory"; // identify the name of the stored procedure to execute objCommand.Parameters.AddWithValue("@upc", Upc); objCommand.Parameters.AddWithValue("@categoryid", Convert.ToInt32(Category)); objCommand.Parameters.AddWithValue("@weight", Weight.ToString()); objCommand.Parameters.AddWithValue("@point", Convert.ToInt32(Point)); objCommand.Parameters.AddWithValue("@quantity", Convert.ToInt32(Quantity)); objCommand.Parameters.AddWithValue("@user", HttpContext.Current.Session["Access_Net"].ToString()); objCommand.Parameters.AddWithValue("@date", DateTime.Now); objDB.DoUpdateUsingCmdObj(objCommand); return("true"); }catch (Exception ex) { return("false"); } }
public static string AddCategory(string Type, string Packaging) { try { DBConnect objDB = new DBConnect(connectionStr); SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "AddCategory"; cmd.Parameters.AddWithValue("@Type", Type.First().ToString().ToUpper() + Type.Substring(1)); cmd.Parameters.AddWithValue("@Packaging", Packaging); cmd.Parameters.AddWithValue("@LastUpdateUser", HttpContext.Current.Session["Access_Net"].ToString()); cmd.Parameters.AddWithValue("@LastUpdateDate", DateTime.Now); cmd.Parameters.AddWithValue("@ID", SqlDbType.Int).Direction = ParameterDirection.Output; int status = objDB.DoUpdateUsingCmdObj(cmd); string ID = cmd.Parameters["@ID"].Value.ToString(); if (status != -1) { return(ID); } else { return(status.ToString()); } } catch (Exception ex) { return("Error" + ex.Message); } }
public static string UpdateItem(string Upc, string Category, string Packaging, string Weight, int Point, int Quantity) { try { DBConnect objDB = new DBConnect(ConnectionString); SqlCommand objCommand = new SqlCommand(); ArrayList categories = new ArrayList(); objCommand.CommandType = CommandType.StoredProcedure; objCommand.CommandText = "UpdateItem"; // identify the name of the stored procedure to execute objCommand.Parameters.AddWithValue("@UPC", Upc); objCommand.Parameters.AddWithValue("@Category", Category); objCommand.Parameters.AddWithValue("@Packaging", Packaging); objCommand.Parameters.AddWithValue("@Weight", Weight.ToString()); objCommand.Parameters.AddWithValue("@Point", Convert.ToInt32(Point)); objCommand.Parameters.AddWithValue("@Quantity", Convert.ToInt32(Quantity)); objCommand.Parameters.AddWithValue("@Last_Update_User", HttpContext.Current.Session["Access_Net"].ToString()); objCommand.Parameters.AddWithValue("@Last_Update_Date", DateTime.Now); objDB.DoUpdateUsingCmdObj(objCommand); return("true"); } catch (Exception ex) { return(ex.Message); } }
public static string AddToInventory(string Upc, string Category, double Weight, int Point) { try { DBConnect objDB = new DBConnect(ConfigurationManager.ConnectionStrings["appString"].ConnectionString); //TODO: create stored procedure for adding to inventory. SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "AddToInventory"; cmd.Parameters.AddWithValue("@upc", Upc); cmd.Parameters.AddWithValue("@category", Category); cmd.Parameters.AddWithValue("@weight", Weight); cmd.Parameters.AddWithValue("@point", Point); cmd.Parameters.AddWithValue("@quantity", -1); cmd.Parameters.AddWithValue("@user", "test"); cmd.Parameters.AddWithValue("@date", DateTime.Today); int ret = objDB.DoUpdateUsingCmdObj(cmd); return(CheckInventory(Upc)); } catch (Exception ex) { return("false"); } }
public static string RemoveUser(string personID) { try { DBConnect objDB = new DBConnect(ConfigurationManager.ConnectionStrings["appString"].ConnectionString); SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "RemoveUser"; cmd.Parameters.AddWithValue("@PersonID", Convert.ToInt32(personID)); objDB.DoUpdateUsingCmdObj(cmd); return(personID.ToString()); } catch (Exception ex) { return("Error" + ex.Message); } }
public static string Checkin(string ItemCount, List <CheckoutItem> itemList) { Cart cart; int cartID; DBConnect objDB = new DBConnect(connectionStr); try { JavaScriptSerializer js = new JavaScriptSerializer(); var items = itemList; cart = (Cart)HttpContext.Current.Session["cart"]; if (items.Count == 0 || cart == null) { return("No Items"); } foreach (CheckoutItem item in items) { SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "UpdateItemCheckin"; cmd.Parameters.AddWithValue("@CategoryID", item.CategoryID); cmd.Parameters.AddWithValue("@Quantity", Convert.ToInt32(item.Quantity)); cmd.Parameters.AddWithValue("@lastUpdateUser", HttpContext.Current.Session["Access_Net"].ToString()); cmd.Parameters.AddWithValue("@lastUpdateDate", DateTime.Now); objDB.DoUpdateUsingCmdObj(cmd); } cart = new Cart(); HttpContext.Current.Session["cart"] = cart; return("added"); } catch (Exception ex) { cart = new Cart(); HttpContext.Current.Session["cart"] = cart; return("error"); } }
public static string RemoveCategory(string Id) { try { DBConnect objDB = new DBConnect(connectionStr); SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "[RemoveCategory]"; cmd.Parameters.AddWithValue("@ID", Id); int ret = objDB.DoUpdateUsingCmdObj(cmd); return(Id); } catch (Exception ex) { return("Error" + ex.Message); } }
public static string RemoveSavedDonor(string savedDonor) { try { DBConnect objDB = new DBConnect(connectionStr); SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "removeSavedDonor"; cmd.Parameters.AddWithValue("@savedDonor", savedDonor); int ret = objDB.DoUpdateUsingCmdObj(cmd); return("true"); } catch (Exception ex) { return("false"); } }
public static string AddUser(string Role, string FirstName, string LastName, string AccessNet, string Status) { int RoleID = 0; switch (Role) { case "Admin": RoleID = 1; break; case "Volunteer": RoleID = 2; break; case "Student Worker": RoleID = 3; break; } try { DBConnect objDB = new DBConnect(ConfigurationManager.ConnectionStrings["appString"].ConnectionString); SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "AddPerson"; cmd.Parameters.AddWithValue("@FirstName", FirstName); cmd.Parameters.AddWithValue("@LastName", LastName); cmd.Parameters.AddWithValue("@AccessNet", AccessNet); cmd.Parameters.AddWithValue("@Status", Status); cmd.Parameters.AddWithValue("@RoleID", RoleID); cmd.Parameters.AddWithValue("@CreationTime", DateTime.Now.ToShortTimeString()); cmd.Parameters.AddWithValue("@LastUpdateUser", HttpContext.Current.Session["Access_Net"].ToString()); cmd.Parameters.AddWithValue("@LastUpdateDate", DateTime.Now.ToShortDateString()); cmd.Parameters.AddWithValue("@PersonID", SqlDbType.Int).Direction = ParameterDirection.Output; objDB.DoUpdateUsingCmdObj(cmd); string personID = cmd.Parameters["@PersonID"].Value.ToString(); return(personID); } catch (Exception ex) { return("Error" + ex.Message); } }
public static string UpdateCategory(string ID, string Type, string Packaging) { try { DBConnect objDB = new DBConnect(connectionStr); SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "UpdateCategory"; cmd.Parameters.AddWithValue("@Type", Type); cmd.Parameters.AddWithValue("@Packaging", Packaging); cmd.Parameters.AddWithValue("@ID", ID); cmd.Parameters.AddWithValue("@LastUpdateUser", HttpContext.Current.Session["Access_Net"].ToString()); cmd.Parameters.AddWithValue("@LastUpdateDate", DateTime.Now); int ret = objDB.DoUpdateUsingCmdObj(cmd); return(ID); } catch (Exception ex) { return("Error" + ex.Message); } }
public static string DeleteDonor(string DonorID) { try { DBConnect objDB = new DBConnect(ConfigurationManager.ConnectionStrings["appString"].ConnectionString); SqlCommand objCommand = new SqlCommand(); string status = "Inactive"; objCommand.CommandType = CommandType.StoredProcedure; objCommand.CommandText = "DeleteDonor"; // identify the name of the stored procedure to execute objCommand.Parameters.AddWithValue("@DonorID", DonorID); objCommand.Parameters.AddWithValue("@Status", status); objDB.DoUpdateUsingCmdObj(objCommand); return("true"); } catch (Exception ex) { return(ex.Message); } }
public static string getCategoryId(string type, string packaging) { try { ArrayList ids = new ArrayList(); DBConnect objDB = new DBConnect(connectionStr); SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "GetCategoryId"; cmd.Parameters.AddWithValue("@type", type); cmd.Parameters.AddWithValue("@packaging", packaging); DataSet ds = objDB.GetDataSetUsingCmdObj(cmd); if (ds.Tables[0].Rows.Count == 0) { try { cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "AddCategory"; cmd.Parameters.AddWithValue("@Type", type); cmd.Parameters.AddWithValue("@Packaging", packaging); cmd.Parameters.AddWithValue("@LastUpdateUser", HttpContext.Current.Session["Access_Net"].ToString()); cmd.Parameters.AddWithValue("@LastUpdateDate", DateTime.Now); cmd.Parameters.AddWithValue("@ID", SqlDbType.Int).Direction = ParameterDirection.Output; int status = objDB.DoUpdateUsingCmdObj(cmd); string ID = cmd.Parameters["@ID"].Value.ToString(); if (status != -1) { ids.Add(ID); } else { return(status.ToString()); } } catch (Exception ex) { return("Error" + ex.Message); } } else { foreach (DataRow dr in ds.Tables[0].Rows) { ids.Add(dr["Id"].ToString()); } } JavaScriptSerializer js = new JavaScriptSerializer(); return(js.Serialize(ids[0])); } catch (Exception ex) { return("error: " + ex.Message); } }
public static string CheckoutCart(string ItemCount, string PointCount, List <CheckoutItem> itemList) { Cart cart; int cartID; DBConnect objDB = new DBConnect(connectionStr); try { JavaScriptSerializer js = new JavaScriptSerializer(); var items = itemList; cart = (Cart)HttpContext.Current.Session["cart"]; if (items.Count == 0 || cart == null) { return("No Items"); } SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "CreateReceipt"; cmd.Parameters.AddWithValue("@personID", HttpContext.Current.Session["PersonID"].ToString()); cmd.Parameters.AddWithValue("@points", Convert.ToInt32(PointCount)); cmd.Parameters.AddWithValue("@quantity", Convert.ToInt32(ItemCount)); cmd.Parameters.AddWithValue("@lastUpdateUser", HttpContext.Current.Session["Access_Net"].ToString()); cmd.Parameters.AddWithValue("@lastUpdateDate", DateTime.Now); cmd.Parameters.AddWithValue("@checkoutDate", DateTime.Now); cmd.Parameters.Add("@id", SqlDbType.Int).Direction = ParameterDirection.Output; objDB.DoUpdateUsingCmdObj(cmd); cart.CartID = Convert.ToInt32(cmd.Parameters["@id"].Value.ToString()); cartID = cart.CartID; foreach (CheckoutItem item in items) { cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "UpdateItemCheckedOut"; cmd.Parameters.AddWithValue("@CategoryID", item.CategoryID); cmd.Parameters.AddWithValue("@Quantity", item.Quantity); cmd.Parameters.AddWithValue("@ReceiptID", cart.CartID); cmd.Parameters.AddWithValue("@lastUpdateUser", HttpContext.Current.Session["Access_Net"].ToString()); cmd.Parameters.AddWithValue("@lastUpdateDate", DateTime.Now); objDB.DoUpdateUsingCmdObj(cmd); } cart = new Cart(); HttpContext.Current.Session["cart"] = cart; return(cartID.ToString()); } catch (Exception ex) { cart = new Cart(); HttpContext.Current.Session["cart"] = cart; return("error"); } }
public static string SubmitDonor(string firstName, string lastName, string donorType, string donationType, string email, string organization, string templeAffiliation, string tuID, string donationDetail, string savedDonor, string existingDonor) { try { if (existingDonor == "-1") { DBConnect objDB = new DBConnect(ConfigurationManager.ConnectionStrings["appString"].ConnectionString); DateTime lastUpdateDate = DateTime.Now; string LastUpdateUser = HttpContext.Current.Session["Access_Net"].ToString(); string status = "Active"; string personID = HttpContext.Current.Session["PersonID"].ToString(); if (savedDonor != "" && savedDonor != null) { SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "_donation-CheckSavedName"; cmd.Parameters.AddWithValue("@name", savedDonor); DataSet ds2 = objDB.GetDataSetUsingCmdObj(cmd); if (ds2.Tables[0].Rows.Count > 0) { //ClientScript.RegisterStartupScript(this.GetType(), "confirmation", "alertconfirmationError('Saved Donor Name already exists.')", true); return("Donor Name Exists"); } } else { savedDonor = ""; } SqlCommand objCommand = new SqlCommand(); objCommand.CommandType = CommandType.StoredProcedure; objCommand.CommandText = "AddDonor"; objCommand.Parameters.AddWithValue("@DonorID", SqlDbType.Int).Direction = ParameterDirection.Output; objCommand.Parameters.AddWithValue("@DonorType", donorType); objCommand.Parameters.AddWithValue("@FirstName", firstName); objCommand.Parameters.AddWithValue("@LastName", lastName); objCommand.Parameters.AddWithValue("@TempleAffiliation", templeAffiliation); objCommand.Parameters.AddWithValue("@Organization", organization); objCommand.Parameters.AddWithValue("@TUID", tuID); objCommand.Parameters.AddWithValue("@Email", email); objCommand.Parameters.AddWithValue("@LastUpdateDate", lastUpdateDate); objCommand.Parameters.AddWithValue("@LastUpdateUser", LastUpdateUser); objCommand.Parameters.AddWithValue("@Status", status); objCommand.Parameters.AddWithValue("@SavedDonor", savedDonor); objDB.DoUpdateUsingCmdObj(objCommand); string donorID = objCommand.Parameters["@DonorID"].Value.ToString(); objCommand.Parameters.Clear(); objCommand.CommandType = CommandType.StoredProcedure; objCommand.CommandText = "AddDonation"; objCommand.Parameters.AddWithValue("@DonationID", SqlDbType.Int).Direction = ParameterDirection.Output; objCommand.Parameters.AddWithValue("@PersonID", personID); objCommand.Parameters.AddWithValue("@DonorID", donorID); objCommand.Parameters.AddWithValue("@DonationType", donationType); objCommand.Parameters.AddWithValue("@DonationDate", lastUpdateDate); objCommand.Parameters.AddWithValue("@DonationDetail", donationDetail); objCommand.Parameters.AddWithValue("@LastUpdateDate", lastUpdateDate); objCommand.Parameters.AddWithValue("@LastUpdateUser", LastUpdateUser); objCommand.Parameters.AddWithValue("@Status", status); int ret = objDB.DoUpdateUsingCmdObj(objCommand); //ClientScript.RegisterStartupScript(this.GetType(), "confirmation", "alertconfirmation()", true); return("true"); } else { string theDonorID = existingDonor; DateTime lastUpdateDate = DateTime.Now; string LastUpdateUser = HttpContext.Current.Session["Access_Net"].ToString(); string personID = HttpContext.Current.Session["PersonID"].ToString(); string status = "Active"; DBConnect objDB = new DBConnect(ConfigurationManager.ConnectionStrings["appString"].ConnectionString); SqlCommand objCommand = new SqlCommand(); objCommand.Parameters.Clear(); objCommand.CommandType = CommandType.StoredProcedure; objCommand.CommandText = "AddDonation"; objCommand.Parameters.AddWithValue("@DonationID", SqlDbType.Int).Direction = ParameterDirection.Output; objCommand.Parameters.AddWithValue("@PersonID", personID); objCommand.Parameters.AddWithValue("@DonorID", theDonorID); objCommand.Parameters.AddWithValue("@DonationType", donationType); objCommand.Parameters.AddWithValue("@DonationDate", lastUpdateDate); objCommand.Parameters.AddWithValue("@DonationDetail", donationDetail); objCommand.Parameters.AddWithValue("@LastUpdateDate", lastUpdateDate); objCommand.Parameters.AddWithValue("@LastUpdateUser", LastUpdateUser); objCommand.Parameters.AddWithValue("@Status", status); DataSet ds = objDB.GetDataSetUsingCmdObj(objCommand); return("true"); //ClientScript.RegisterStartupScript(this.GetType(), "confirmation", "alertconfirmation()", true); } } catch (Exception ex) { return("error"); //ClientScript.RegisterStartupScript(this.GetType(), "confirmation", "alertconfirmationError()", true); } }
public static string AddToInventory(string Upc, string Category, string Packaging, string Weight, int Point, int Quantity) { try { DBConnect objDB = new DBConnect(connectionStr); SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "_scan-AddCategory"; cmd.Parameters.AddWithValue("@type", Category); cmd.Parameters.AddWithValue("@packaging", Packaging); cmd.Parameters.AddWithValue("@last_update_user", HttpContext.Current.Session["Access_Net"].ToString()); cmd.Parameters.AddWithValue("@last_update_date", DateTime.Today); cmd.Parameters.Add("@CatID", SqlDbType.Int).Direction = ParameterDirection.Output; SqlConnection sqlConnection = new SqlConnection(connectionStr); int returnInt; try { cmd.Connection = sqlConnection; cmd.Connection.Open(); returnInt = cmd.ExecuteNonQuery(); cmd.Connection.Close(); } catch (Exception ex) { returnInt = -1; } int catID = Convert.ToInt32(cmd.Parameters["@CatID"].Value.ToString()); cmd = new SqlCommand(); string weightSub = Weight.Substring(0, 1); int weightInt; bool isWeight = int.TryParse(weightSub, out weightInt); if (!isWeight) { Weight = "n/a"; } cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "_scan-AddToInventory"; cmd.Parameters.AddWithValue("@upc", Upc); cmd.Parameters.AddWithValue("@categoryID", catID); cmd.Parameters.AddWithValue("@weight", Weight); cmd.Parameters.AddWithValue("@point", Point); cmd.Parameters.AddWithValue("@quantity", Quantity); cmd.Parameters.AddWithValue("@user", HttpContext.Current.Session["Access_Net"].ToString()); cmd.Parameters.AddWithValue("@date", DateTime.Today); int ret = objDB.DoUpdateUsingCmdObj(cmd); return(CheckInventory(Upc)); } catch (Exception ex) { return("false"); } }