internal bool addCustomer(Customer customer) { try { SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@pName", customer.Name), new SqlParameter("@pEmailId", customer.EmailId), new SqlParameter("@pPhoneNo", customer.PhoneNo), new SqlParameter("@pGSTN", customer.GSTN), new SqlParameter("@pAddressLine1", customer.AddressLine1), new SqlParameter("@pAddressLine2", customer.AddressLine2), new SqlParameter("@pCity", customer.City), new SqlParameter("@pState", customer.State), new SqlParameter("@pZipCode", customer.ZipCode), new SqlParameter("@pIsActive", customer.IsActive), new SqlParameter("@pCreatedBy", customer.CreatedBy) }; customer.CustomerId = Convert.ToInt32(SqlDBHelper.ExecuteNonQueryReturnData("app_AddCustomers", CommandType.StoredProcedure, parameters, "pCustomerId")); if (customer.CustomerId == 0) { return(false); } else { return(true); } } catch (Exception ex) { return(false); } }
internal bool addUser(User user) { try { SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@pFirstName", user.FirstName), new SqlParameter("@pLastName", user.LastName), new SqlParameter("@pUserName", user.UserName), new SqlParameter("@pEmailId", user.EmailId), new SqlParameter("@pPassword", user.Password), new SqlParameter("@pPhoneNo", user.PhoneNo), new SqlParameter("@pCreatedBy", user.CreatedBy) }; user.UserId = Convert.ToInt32(SqlDBHelper.ExecuteNonQueryReturnData("app_AddUsers", CommandType.StoredProcedure, parameters, "pUserId")); if (user.UserId == 0) { return(false); } else { return(true); } } catch (Exception ex) { return(false); } }
internal int addOrder(Order order, List <OrderItems> listItems) { try { SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@pOrderDate", order.OrderDate), new SqlParameter("@pBillToContact", order.BillToContact), new SqlParameter("@pBillToGSTN", order.BillToGSTN), new SqlParameter("@pBillToEmail", order.BillToEmail), new SqlParameter("@pBillToPhone", order.BillToPhone), new SqlParameter("@pBillToAddress1", order.BillToAddress1), new SqlParameter("@pBillToAddress2", order.BillToAddress2), new SqlParameter("@pBillToCity", order.BillToCity), new SqlParameter("@pBillToState", order.BillToState), new SqlParameter("@pBillToZip", order.BillToZip), new SqlParameter("@pDiscount", order.Discount), new SqlParameter("@pCGSTRate", order.CGSTRate), new SqlParameter("@pSGSTRate", order.SGSTRate), new SqlParameter("@pIGSTRate", order.IGSTRate), new SqlParameter("@pTaxablePrice", order.TaxablePrice), new SqlParameter("@pTotalProductPrice", order.TotalProductPrice), new SqlParameter("@pGrandtotal", order.Grandtotal), new SqlParameter("@GrandtotalInWords", order.GrandtotalInWords), new SqlParameter("@pCreatedBy", 1) }; order.OrderId = Convert.ToInt32(SqlDBHelper.ExecuteNonQueryReturnData("app_AddOrder", CommandType.StoredProcedure, parameters, "pOrderId")); if (order.OrderId != null) { if (listItems.Count() > 0) { foreach (OrderItems item in listItems) { SqlParameter[] param = new SqlParameter[] { new SqlParameter("@pOrderId", order.OrderId), new SqlParameter("@pMaterialId", item.MaterialId), new SqlParameter("@pMaterialName", item.MaterialName), new SqlParameter("@pHSNCode", item.HSNCode), new SqlParameter("@pQuantity", item.Quantity), new SqlParameter("@pUnitPrice", item.UnitPrice), new SqlParameter("@pTotalPrice", item.TotalPrice) }; SqlDBHelper.ExecuteNonQuery("app_AddOrderItems", CommandType.StoredProcedure, param); } } } return(order.OrderId); } catch (Exception ex) { return(0); } }
internal bool addMaterial(Material material) { try { SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@pMaterialCode", material.MaterialCode), new SqlParameter("@pMaterialName", material.MaterialName), new SqlParameter("@pMaterialDescription", material.MaterialDescription), new SqlParameter("@pHSNCode", material.HSNCode), new SqlParameter("@pOneKGSize", material.Prices.OneKGSize), new SqlParameter("@pOneKGPrice", material.Prices.OneKGPrice), new SqlParameter("@pHalfKGSize", material.Prices.HalfKGSize), new SqlParameter("@pHalfKGPrice", material.Prices.HalfKGPrice), new SqlParameter("@pSize1", material.Prices.Size1), new SqlParameter("@pPrice1", material.Prices.Price1), new SqlParameter("@pSize2", material.Prices.Size2), new SqlParameter("@pPrice2", material.Prices.Price2), new SqlParameter("@pSize3", material.Prices.Size3), new SqlParameter("@pPrice3", material.Prices.Price3), new SqlParameter("@pSize4", material.Prices.Size4), new SqlParameter("@pPrice4", material.Prices.Price4), new SqlParameter("@pSize5", material.Prices.Size5), new SqlParameter("@pPrice5", material.Prices.Price5), new SqlParameter("@pSize6", material.Prices.Size6), new SqlParameter("@pPrice6", material.Prices.Price6), new SqlParameter("@pSize7", material.Prices.Size7), new SqlParameter("@pPrice7", material.Prices.Price7), new SqlParameter("@pSize8", material.Prices.Size8), new SqlParameter("@pPrice8", material.Prices.Price8), new SqlParameter("@pSize9", material.Prices.Size9), new SqlParameter("@pPrice9", material.Prices.Price9), new SqlParameter("@IsActive", material.IsActive), new SqlParameter("@IsDeleted", material.IsDeleted), new SqlParameter("@CreatedBy", material.CreatedBy) }; material.MaterialId = Convert.ToInt32(SqlDBHelper.ExecuteNonQueryReturnData("app_AddMaterials", CommandType.StoredProcedure, parameters, "pMaterialId")); if (material.MaterialId == 0) { return(false); } else { return(true); } } catch (Exception ex) { return(false); } }