示例#1
0
        /*
         *   try
         *   {
         *     _conn.Open();
         *     if (_cmd.ExecuteNonQuery() > 0)
         *
         *
         *   OleDbConnection _conn = new OleDbConnection(_connectionString);
         *
         *    // add parameters in the order they appear in the update command
         *   OleDbCommand _cmd = new OleDbCommand(_sqlCmd, _conn);
         *   _cmd.Parameters.Add(new OleDbParameter { Value = ItemTypeID });
         *   _cmd.Parameters.Add(new OleDbParameter { Value = Math.Round(QuantityOrdered,2) });
         *   _cmd.Parameters.Add(new OleDbParameter { Value = PackagingID });
         *   _cmd.Parameters.Add(new OleDbParameter { Value = OrderID });
         *
         *   try
         *   {
         *     _conn.Open();
         *     if (_cmd.ExecuteNonQuery() > 0)
         *       return false;
         *   }
         *   catch (OleDbException ex)
         *   {
         *     string _ErrStr = ex.Message;
         *     return _ErrStr == "";
         *   }
         *   finally
         *   {
         *     _conn.Close();
         *   }
         *
         *   return true;
         * }
         */
        public bool InsertOrderDetails(Int64 CustomerID, DateTime OrderDate, DateTime RoastDate, Int32 ToBeDeliveredBy,
                                       DateTime RequiredByDate, Boolean Confirmed, Boolean Done, String Notes,
                                       double QuantityOrdered, Int32 PackagingID, Int32 ItemTypeID)
        {
            string _sqlCmd = "INSERT INTO OrdersTbl (CustomerId, OrderDate, RoastDate, RequiredByDate, ToBeDeliveredBy, Confirmed, Done, Notes, " +
                             " ItemTypeID, QuantityOrdered, PackagingID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
            //1  2  3  4  5  6  7  8  9  10 11
            bool _Success = false;

            // check if the item is a group item then get the next group.
            TrackerTools _TT = new TrackerTools();

            ItemTypeID = _TT.ChangeItemIfGroupToNextItemInGroup(CustomerID, ItemTypeID, RequiredByDate);
            TrackerDb _TDB = new TrackerDb();

            // first summary data
            _TDB.AddParams(CustomerID, DbType.Int64, "@CustomerID");
            _TDB.AddParams(OrderDate, DbType.Date, "@OrderDate");
            _TDB.AddParams(RoastDate, DbType.Date, "@RoastDate");
            _TDB.AddParams(RequiredByDate, DbType.Date, "@RequiredByDate");
            _TDB.AddParams(ToBeDeliveredBy, DbType.Int32, "@ToBeDeliveredBy");
            _TDB.AddParams(Confirmed, DbType.Boolean, "@Confirmed");
            _TDB.AddParams(Done, DbType.Boolean, "@Done");
            _TDB.AddParams(Notes, DbType.String, "@Notes");

            // Now line data
            _TDB.AddParams(ItemTypeID, DbType.Int32, "@ItemTypeID");
            _TDB.AddParams(Math.Round(QuantityOrdered, 2), DbType.Double, "@QuantityOrdered");
            _TDB.AddParams(PackagingID, DbType.Int32, "@PackagingID");

            _Success = String.IsNullOrEmpty(_TDB.ExecuteNonQuerySQL(_sqlCmd));
            _TDB.Close();
            return(_Success);
        }
示例#2
0
        public string Update(PaymentTermsTbl pPaymentTermsTbl, int pOrignal_PaymentTermID)
        {
            string    _result = string.Empty;
            TrackerDb _TDB    = new TrackerDb();

            #region UpdateParameters
            if (pOrignal_PaymentTermID > 0)
            {
                _TDB.AddWhereParams(pOrignal_PaymentTermID, DbType.Int32); // check this line it assumes id field is int32
            }
            else
            {
                _TDB.AddWhereParams(pPaymentTermsTbl.PaymentTermID, DbType.Boolean, "@PaymentTermID");
            }

            _TDB.AddParams(pPaymentTermsTbl.PaymentTermDesc, DbType.String, "@PaymentTermDesc");
            _TDB.AddParams(pPaymentTermsTbl.PaymentDays, DbType.Int32, "@PaymentDays");
            _TDB.AddParams(pPaymentTermsTbl.DayOfMonth, DbType.Int32, "@DayOfMonth");
            _TDB.AddParams(pPaymentTermsTbl.UseDays, DbType.Boolean, "@UseDays");
            _TDB.AddParams(pPaymentTermsTbl.Enabled, DbType.Boolean, "@Enabled");
            _TDB.AddParams(pPaymentTermsTbl.Notes, DbType.String, "@Notes");
            #endregion
            // Now we have the parameters excute the SQL
            _result = _TDB.ExecuteNonQuerySQL(CONST_SQL_UPDATE);
            _TDB.Close();
            return(_result);
        }
示例#3
0
        public string UpdateRepair(TrackerDotNet.control.RepairsTbl RepairItem, int orig_RepairID)
        {
            string    _result    = String.Empty;
            TrackerDb _TrackerDb = new TrackerDb();

            _TrackerDb.AddParams(RepairItem.CustomerID, DbType.Int64);
            _TrackerDb.AddParams(RepairItem.ContactName, DbType.String);
            _TrackerDb.AddParams(RepairItem.ContactEmail, DbType.String);
            _TrackerDb.AddParams(RepairItem.JobCardNumber, DbType.String);
            _TrackerDb.AddParams(RepairItem.DateLogged, DbType.Date);
            _TrackerDb.AddParams(RepairItem.LastStatusChange, DbType.Date);
            _TrackerDb.AddParams(RepairItem.MachineTypeID, DbType.Int32);
            _TrackerDb.AddParams(RepairItem.MachineSerialNumber, DbType.String);
            _TrackerDb.AddParams(RepairItem.SwopOutMachineID, DbType.Int32);
            _TrackerDb.AddParams(RepairItem.MachineConditionID, DbType.Int32);
            _TrackerDb.AddParams(RepairItem.TakenFrother, DbType.Boolean);
            _TrackerDb.AddParams(RepairItem.TakenBeanLid, DbType.Boolean);
            _TrackerDb.AddParams(RepairItem.TakenWaterLid, DbType.Boolean);
            _TrackerDb.AddParams(RepairItem.BrokenFrother, DbType.Boolean);
            _TrackerDb.AddParams(RepairItem.BrokenBeanLid, DbType.Boolean);
            _TrackerDb.AddParams(RepairItem.BrokenWaterLid, DbType.Boolean);
            _TrackerDb.AddParams(RepairItem.RepairFaultID, DbType.Int32);
            _TrackerDb.AddParams(RepairItem.RepairFaultDesc, DbType.String);
            _TrackerDb.AddParams(RepairItem.RepairStatusID, DbType.Int32);
            _TrackerDb.AddParams(RepairItem.RelatedOrderID, DbType.Int64);
            _TrackerDb.AddParams(RepairItem.Notes, DbType.String);

            _TrackerDb.AddWhereParams(orig_RepairID, DbType.Int32);

            _result = _TrackerDb.ExecuteNonQuerySQL(CONST_SQL_UPDATE);
            _TrackerDb.Close();

            return(_result);
        }
示例#4
0
        public string UpdateItemGroup(ItemGroupTbl pItemGroupTbl, int pOrignal_ItemGroupID)
        {
            string    _result = string.Empty;
            TrackerDb _TDB    = new TrackerDb();

            #region UpdateParameters
            if (pOrignal_ItemGroupID > 0)
            {
                _TDB.AddWhereParams(pOrignal_ItemGroupID, DbType.Int32); // check this line it assumes id field is int32
            }
            else
            {
                _TDB.AddWhereParams(pItemGroupTbl.ItemGroupID, DbType.Int32, "@ItemGroupID");
            }

            _TDB.AddParams(pItemGroupTbl.GroupItemTypeID, DbType.Int32, "@GroupItemTypeID");
            _TDB.AddParams(pItemGroupTbl.ItemTypeID, DbType.Int32, "@ItemTypeID");
            _TDB.AddParams(pItemGroupTbl.ItemTypeSortPos, DbType.Int32, "@ItemTypeSortPos");
            _TDB.AddParams(pItemGroupTbl.Enabled, DbType.Boolean, "@Enabled");
            _TDB.AddParams(pItemGroupTbl.Notes, DbType.String, "@Notes");
            #endregion
            // Now we have the parameters excute the SQL
            _result = _TDB.ExecuteNonQuerySQL(CONST_SQL_UPDATE);
            _TDB.Close();
            return(_result);
        }
示例#5
0
        public string Update(UsedItemGroupTbl pUsedItemGroupTbl, int pOrignal_UsedItemGroupID)
        {
            string    _result = string.Empty;
            TrackerDb _TDB    = new TrackerDb();

            #region UpdateParameters
            if (pOrignal_UsedItemGroupID > 0)
            {
                _TDB.AddWhereParams(pOrignal_UsedItemGroupID, DbType.Int32); // check this line it assumes id field is int32
            }
            else
            {
                _TDB.AddWhereParams(pUsedItemGroupTbl.UsedItemGroupID, DbType.Int32, "@UsedItemGroupID");
            }

            _TDB.AddParams(pUsedItemGroupTbl.ContactID, DbType.Int64, "@ContactID");
            _TDB.AddParams(pUsedItemGroupTbl.GroupItemTypeID, DbType.Int32, "@GroupItemTypeID");
            _TDB.AddParams(pUsedItemGroupTbl.LastItemTypeID, DbType.Int32, "@LastItemTypeID");
            _TDB.AddParams(pUsedItemGroupTbl.LastItemTypeSortPos, DbType.Int32, "@LastItemTypeSortPos");
            _TDB.AddParams(pUsedItemGroupTbl.LastItemDateChanged, DbType.Date, "@LastItemDateChanged");
            _TDB.AddParams(pUsedItemGroupTbl.Notes, DbType.String, "@Notes");
            #endregion
            // Now we have the parameters excute the SQL
            _result = _TDB.ExecuteNonQuerySQL(CONST_SQL_UPDATE); // UPDATE UsedItemGroupTbl SET ContactID = ?, GroupItemTypeID = ?, LastItemTypeID = ?, LastItemTypeSortPos = ?, LastItemDateChanged = ?, Notes = ?  WHERE (UsedItemGroupID = ?)";
            _TDB.Close();
            return(_result);
        }
示例#6
0
        /// <summary>
        /// Execute the SQL statement does not return results, such as: delete, update, insert operation
        /// </summary>
        /// <param name="strSQL">SQL String of a non Query Type</param>
        /// <returns>success or failure</returns>
        public bool UpdateOrderHeader(OrderHeaderData pOrderHeader, List <string> pOrders)
        {
            bool   _resultState = false;
            string _strSQL      = CONST_ORDERUPDATEHEADER_SQL + " WHERE ";

            // for all the OrderIds passed create a where clause
            for (int i = 0; i < pOrders.Count - 1; i++)
            {
                _strSQL += " OrderID = " + pOrders[i] + " OR";
            }
            _strSQL += " OrderID = " + pOrders[pOrders.Count - 1];

            TrackerDb _TDB = new TrackerDb();

            _TDB.AddParams(pOrderHeader.CustomerID, DbType.Int64, "@CustomerID");
            _TDB.AddParams(pOrderHeader.OrderDate, DbType.Date, "@OrderDate");
            _TDB.AddParams(pOrderHeader.RoastDate, DbType.Date, "@RoastDate");
            _TDB.AddParams(pOrderHeader.ToBeDeliveredBy, DbType.Int64, "@ToBeDeliveredBy");
            _TDB.AddParams(pOrderHeader.RequiredByDate, DbType.Date, "@RequiredByDate");
            _TDB.AddParams(pOrderHeader.Confirmed, DbType.Boolean, "@Confirmed");
            _TDB.AddParams(pOrderHeader.Done, DbType.Boolean, "@Done");
            _TDB.AddParams(pOrderHeader.InvoiceDone, DbType.Boolean, "@InvoiceDone");
            _TDB.AddParams(pOrderHeader.PurchaseOrder, DbType.String, "@PurchaseOrder");
            _TDB.AddParams(pOrderHeader.Notes, DbType.String, "@Notes");

            _resultState = String.IsNullOrEmpty(_TDB.ExecuteNonQuerySQL(_strSQL));

            _TDB.Close();


            return(_resultState);
        }
示例#7
0
        public string SetStatusDoneByTempOrder()
        {
            string            _Result         = String.Empty;
            List <RepairsTbl> _RelatedRepairs = GetListOfRelatedTempOrders();

            if (_RelatedRepairs.Count > 0)
            {
                TempOrdersLinesTbl _TOLines = new TempOrdersLinesTbl();

                for (int i = 0; i < _RelatedRepairs.Count; i++)
                {
                    if (_RelatedRepairs[i].RepairStatusID <= CONST_REPAIRSTATUS_WORKSHOP)
                    {
                        _TOLines.DeleteByOriginalID(_RelatedRepairs[i].RelatedOrderID);
                        OrderTbl _Order = new OrderTbl();
                        _Order.UpdateIncDeliveryDateBy7(_RelatedRepairs[i].RelatedOrderID);
                    }
                    else
                    {
                        TrackerDb _TDB = new TrackerDb();
                        _TDB.AddParams(CONST_REPAIRSTATUS_DONE, DbType.Int32);
                        _Result += _TDB.ExecuteNonQuerySQL(CONST_SQL_SETDONEBYID);
                        _TDB.Close();
                    }
                }
            }
            return(_Result);
        }
示例#8
0
        public string Update(PriceLevelsTbl pPriceLevelsTbl, int pOrignal_PriceLevelID)
        {
            string    _result = string.Empty;
            TrackerDb _TDB    = new TrackerDb();

            #region UpdateParameters
            if (pOrignal_PriceLevelID > 0)
            {
                _TDB.AddWhereParams(pOrignal_PriceLevelID, DbType.Int32); // check this line it assumes id field is int32
            }
            else
            {
                _TDB.AddWhereParams(pPriceLevelsTbl.PriceLevelID, DbType.Boolean, "@PriceLevelID");
            }

            _TDB.AddParams(pPriceLevelsTbl.PriceLevelDesc, DbType.String, "@PriceLevelDesc");
            _TDB.AddParams(Math.Round(pPriceLevelsTbl.PricingFactor, 3), DbType.Double, "@PricingFactor");
            _TDB.AddParams(pPriceLevelsTbl.Enabled, DbType.Int32, "@Enabled");
            _TDB.AddParams(pPriceLevelsTbl.Notes, DbType.String, "@Notes");
            #endregion
            // Now we have the parameters excute the SQL
            _result = _TDB.ExecuteNonQuerySQL(CONST_SQL_UPDATE);
            _TDB.Close();
            return(_result);
        }
示例#9
0
        public bool InsertRepair(RepairsTbl DataItem)
        {
            bool      _result    = false;
            TrackerDb _TrackerDb = new TrackerDb();

            _TrackerDb.AddParams(DataItem.CustomerID, DbType.Int64);
            _TrackerDb.AddParams(DataItem.ContactName, DbType.String);
            _TrackerDb.AddParams(DataItem.ContactEmail, DbType.String);
            _TrackerDb.AddParams(DataItem.JobCardNumber, DbType.String);
            _TrackerDb.AddParams(DataItem.DateLogged, DbType.Date);
            _TrackerDb.AddParams(DataItem.LastStatusChange, DbType.Date);
            _TrackerDb.AddParams(DataItem.MachineTypeID, DbType.Int32);
            _TrackerDb.AddParams(DataItem.MachineSerialNumber, DbType.String);
            _TrackerDb.AddParams(DataItem.SwopOutMachineID, DbType.Int32);
            _TrackerDb.AddParams(DataItem.MachineConditionID, DbType.Int32);
            _TrackerDb.AddParams(DataItem.TakenFrother, DbType.Boolean);
            _TrackerDb.AddParams(DataItem.TakenBeanLid, DbType.Boolean);
            _TrackerDb.AddParams(DataItem.TakenWaterLid, DbType.Boolean);
            _TrackerDb.AddParams(DataItem.BrokenFrother, DbType.Boolean);
            _TrackerDb.AddParams(DataItem.BrokenBeanLid, DbType.Boolean);
            _TrackerDb.AddParams(DataItem.BrokenWaterLid, DbType.Boolean);
            _TrackerDb.AddParams(DataItem.RepairFaultID, DbType.Int32);
            _TrackerDb.AddParams(DataItem.RepairFaultDesc, DbType.String);
            _TrackerDb.AddParams(DataItem.RepairStatusID, DbType.Int32);
            _TrackerDb.AddParams(DataItem.RelatedOrderID, DbType.Int64);
            _TrackerDb.AddParams(DataItem.Notes, DbType.String);

            _result = String.IsNullOrEmpty(_TrackerDb.ExecuteNonQuerySQL(CONST_SQL_INSERT));
            _TrackerDb.Close();

            return(_result);
        }
示例#10
0
/*
 *    string _connectionStr = ConfigurationManager.ConnectionStrings[TrackerDotNet.classes.TrackerDb.CONST_CONSTRING].ConnectionString; ;
 *
 *    using (OleDbConnection _conn = new OleDbConnection(_connectionStr))
 *    {
 *      OleDbCommand _cmd = new OleDbCommand(CONST_SQL_DELETEALLCONTACTS, _conn);                    // run the query we have built
 *      _conn.Open();
 *      _cmd.ExecuteNonQuery();
 *      _Success = _cmd.ExecuteNonQuery() >= 0;
 *      _conn.Close();
 *      _cmd.Dispose();
 *    }
 *    return _Success;
 *  }
 */
        /// <summary>
        /// Delete all the records in the contact database
        /// </summary>
        public bool DeleteAllContactItems()
        {
            TrackerDb _TDB     = new TrackerDb();
            bool      _Success = String.IsNullOrEmpty(_TDB.ExecuteNonQuerySQL(CONST_SQL_DELETEALLITEMS));

            _TDB.Close();
            return(_Success);
        }
示例#11
0
        public string Update(CustomersAccInfoTbl pCustomersAccInfoTbl, long pOrignal_CustomersAccInfoID)
        {
            string    _result = string.Empty;
            TrackerDb _TDB    = new TrackerDb();

            if (pCustomersAccInfoTbl.CustomerID == 0)
            {
                _result = "error: CustomerID cannot be 0";
            }
            else
            {
                #region UpdateParameters

                if (pOrignal_CustomersAccInfoID > 0)
                {
                    _TDB.AddWhereParams(pOrignal_CustomersAccInfoID, DbType.Int64); // check this line it assumes id field is int32
                }
                else
                {
                    _TDB.AddWhereParams(pCustomersAccInfoTbl.CustomersAccInfoID, DbType.Int64, "@CustomersAccInfoID");
                }

                _TDB.AddParams(pCustomersAccInfoTbl.CustomerID, DbType.Int64, "@CustomerID");
                _TDB.AddParams(pCustomersAccInfoTbl.RequiresPurchOrder, DbType.Int32, "@RequiresPurchOrder");
                _TDB.AddParams(pCustomersAccInfoTbl.CustomerVATNo, DbType.String, "@CustomerVATNo");
                _TDB.AddParams(pCustomersAccInfoTbl.BillAddr1, DbType.String, "@BillAddr1");
                _TDB.AddParams(pCustomersAccInfoTbl.BillAddr2, DbType.String, "@BillAddr2");
                _TDB.AddParams(pCustomersAccInfoTbl.BillAddr3, DbType.String, "@BillAddr3");
                _TDB.AddParams(pCustomersAccInfoTbl.BillAddr4, DbType.String, "@BillAddr4");
                _TDB.AddParams(pCustomersAccInfoTbl.BillAddr5, DbType.String, "@BillAddr5");
                _TDB.AddParams(pCustomersAccInfoTbl.ShipAddr1, DbType.String, "@ShipAddr1");
                _TDB.AddParams(pCustomersAccInfoTbl.ShipAddr2, DbType.String, "@ShipAddr2");
                _TDB.AddParams(pCustomersAccInfoTbl.ShipAddr3, DbType.String, "@ShipAddr3");
                _TDB.AddParams(pCustomersAccInfoTbl.ShipAddr4, DbType.String, "@ShipAddr4");
                _TDB.AddParams(pCustomersAccInfoTbl.ShipAddr5, DbType.String, "@ShipAddr5");
                _TDB.AddParams(pCustomersAccInfoTbl.AccEmail, DbType.String, "@AccEmail");
                _TDB.AddParams(pCustomersAccInfoTbl.AltAccEmail, DbType.String, "@AltAccEmail");
                _TDB.AddParams(pCustomersAccInfoTbl.PaymentTermID, DbType.Int32, "@PaymentTermID");
                _TDB.AddParams(pCustomersAccInfoTbl.Limit, DbType.Double, "@Limit");
                _TDB.AddParams(pCustomersAccInfoTbl.FullCoName, DbType.String, "@FullCoName");
                _TDB.AddParams(pCustomersAccInfoTbl.AccFirstName, DbType.String, "@AccFirstName");
                _TDB.AddParams(pCustomersAccInfoTbl.AccLastName, DbType.String, "@AccLastName");
                _TDB.AddParams(pCustomersAccInfoTbl.AltAccFirstName, DbType.String, "@AltAccFirstName");
                _TDB.AddParams(pCustomersAccInfoTbl.AltAccLastName, DbType.String, "@AltAccLastName");
                _TDB.AddParams(pCustomersAccInfoTbl.PriceLevelID, DbType.Int32, "@PriceLevelID");
                _TDB.AddParams(pCustomersAccInfoTbl.InvoiceTypeID, DbType.Int32, "@InvoiceTypeID");
                _TDB.AddParams(pCustomersAccInfoTbl.RegNo, DbType.String, "@RegNo");
                _TDB.AddParams(pCustomersAccInfoTbl.BankAccNo, DbType.String, "@BankAccNo");
                _TDB.AddParams(pCustomersAccInfoTbl.BankBranch, DbType.String, "@BankBranch");
                _TDB.AddParams(pCustomersAccInfoTbl.Enabled, DbType.Boolean, "@Enabled");
                _TDB.AddParams(pCustomersAccInfoTbl.Notes, DbType.String, "@Notes");
                #endregion
                // Now we have the parameters excute the SQL
                _result = _TDB.ExecuteNonQuerySQL(CONST_SQL_UPDATE);
                _TDB.Close();
            }
            return(_result);
        }
示例#12
0
        public string DeleteByCityPrepDayID(int pCityPrepDayID)
        {
            string    _result = string.Empty;
            TrackerDb _TDB    = new TrackerDb();

            _TDB.AddWhereParams(pCityPrepDayID, DbType.Int32, "@CityPrepDayID");
            _result = _TDB.ExecuteNonQuerySQL(CONST_SQL_DELETEBYID);
            _TDB.Close();
            return(_result);
        }
示例#13
0
        public string Delete(int pPriceLevelID)
        {
            string    _result = string.Empty;
            TrackerDb _TDB    = new TrackerDb();

            _TDB.AddWhereParams(pPriceLevelID, DbType.Int32, "@PriceLevelID");
            _result = _TDB.ExecuteNonQuerySQL(CONST_SQL_DELETE);
            _TDB.Close();
            return(_result);
        }
示例#14
0
        public string DeleteRepair(int RepairID)
        {
            string    _result    = String.Empty;
            TrackerDb _TrackerDb = new TrackerDb();

            _TrackerDb.AddParams(RepairID, DbType.Int32);

            _result = _TrackerDb.ExecuteNonQuerySQL(CONST_SQL_DELETE);

            return(_result);
        }
示例#15
0
        public string DeleteGroupItemFromGroup(int pGroupItemID, int pItemTypeID)
        {
            string    _result = string.Empty;
            TrackerDb _TDB    = new TrackerDb();

            _TDB.AddWhereParams(pGroupItemID, DbType.Int32, "@GroupItemTypeID");
            _TDB.AddWhereParams(pItemTypeID, DbType.Int32, "@ItemTypeID");
            _result = _TDB.ExecuteNonQuerySQL(CONST_SQL_DELETEITEMFROMGROUP);
            _TDB.Close();
            return(_result);
        }
示例#16
0
        public string UpdateItemsSortPos(int pSortPos, int pGroupItemID, int pItemTypeID)
        {
            string    _result = string.Empty;
            TrackerDb _TDB    = new TrackerDb();

            _TDB.AddParams(pSortPos, DbType.Int32, "@SortPos");
            _TDB.AddWhereParams(pGroupItemID, DbType.Int32, "@GroupItemTypeID");
            _TDB.AddWhereParams(pItemTypeID, DbType.Int32, "@ItemTypeID");
            _result = _TDB.ExecuteNonQuerySQL(CONST_SQL_UPDATEITEMSORTPOS);
            _TDB.Close();
            return(_result);
        }
示例#17
0
/*
 *    OleDbConnection _conn = new OleDbConnection(_connectionString);
 *
 *    // add parameters in the order they appear in the update command
 *    OleDbCommand _cmd = new OleDbCommand(_sqlCmd, _conn);
 *    // first summary data
 *    _cmd.Parameters.Add(new OleDbParameter { Value = CustomerID });
 *    _cmd.Parameters.Add(new OleDbParameter { Value = OrderDate });
 *    _cmd.Parameters.Add(new OleDbParameter { Value = RoastDate });
 *    _cmd.Parameters.Add(new OleDbParameter { Value = RequiredByDate });
 *    _cmd.Parameters.Add(new OleDbParameter { Value = ToBeDeliveredBy });
 *    _cmd.Parameters.Add(new OleDbParameter { Value = Confirmed });
 *    _cmd.Parameters.Add(new OleDbParameter { Value = Done });
 *    _cmd.Parameters.Add(new OleDbParameter { Value = Notes });
 *
 *    // Now line data
 *    _cmd.Parameters.Add(new OleDbParameter { Value = ItemTypeID });
 *    _cmd.Parameters.Add(new OleDbParameter { Value = Math.Round(QuantityOrdered,2) });
 *    _cmd.Parameters.Add(new OleDbParameter { Value = PackagingID });
 *
 *    try
 *    {
 *      _conn.Open();
 *      if (_cmd.ExecuteNonQuery() > 0)
 *        return false;
 *    }
 *    catch (OleDbException ex)
 *    {
 *      return ex.Message == "";        // Handle exception.
 *    }
 *    finally
 *    {
 *      _conn.Close();
 *    }
 *
 *    return true;
 *  }
 */
        public bool DeleteOrderDetails(string OrderID)
        {
            string    _sqlDeleteCmd = "DELETE FROM OrdersTbl WHERE (OrderID = ?)";
            bool      _Success      = false;
            TrackerDb _TDB          = new TrackerDb();

            _TDB.AddWhereParams(OrderID, DbType.String, "@OrderID");

            _Success = String.IsNullOrEmpty(_TDB.ExecuteNonQuerySQL(_sqlDeleteCmd));
            _TDB.Close();

            return(_Success);
        }
示例#18
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            if (Request.QueryString["OrderId"] != null)
            {
                string    _sqlDeleteCmd = "DELETE FROM OrdersTbl WHERE OrderID = " + Request.QueryString["OrderId"].ToString();
                TrackerDb _TDB          = new TrackerDb();
                string    _ErrorStr     = _TDB.ExecuteNonQuerySQL(_sqlDeleteCmd);
                _TDB.Close();

                ltrlStatus.Text = (string.IsNullOrEmpty(_ErrorStr)) ? "Item Deleted" : "Error deleting item: " + _ErrorStr;
                ReturnToDetailPage();
            }
        }
示例#19
0
        protected void gvOrderLines_OnItemDelete(object sender, EventArgs e)
        {
            CommandEventArgs cea           = (CommandEventArgs)e;
            string           _OrderId      = cea.CommandArgument.ToString();
            string           _sqlDeleteCmd = "DELETE FROM OrdersTbl WHERE (OrderID = ?)";
            TrackerDb        _TDB          = new TrackerDb();

            _TDB.AddWhereParams(_OrderId, DbType.String, "@OrderID");
            string _ErrorStr = _TDB.ExecuteNonQuerySQL(_sqlDeleteCmd);

            _TDB.Close();
            ltrlStatus.Text = (string.IsNullOrEmpty(_ErrorStr) ? "Item Deleted" : "Error deleting item: " + _ErrorStr);
        }
示例#20
0
        public string InsertTransactionType(TransactionTypesTbl pTransactionType)
        {
            TrackerDb _TDB = new TrackerDb();

            _TDB.AddParams(pTransactionType.TransactionID, DbType.Int32);
            _TDB.AddParams(pTransactionType.TransactionType);
            _TDB.AddParams(pTransactionType.Notes);

            string _Result = _TDB.ExecuteNonQuerySQL(CONST_SQL_INSERT);

            _TDB.Close();

            return(_Result);
        }
示例#21
0
        public string Insert(CustomersAccInfoTbl pCustomersAccInfoTbl)
        {
            string _result = string.Empty;

            if (pCustomersAccInfoTbl.CustomerID == 0)
            {
                _result = "error: customer number cannot be 0";
            }
            else
            {
                TrackerDb _TDB = new TrackerDb();

                #region InsertParameters
                _TDB.AddParams(pCustomersAccInfoTbl.CustomerID, DbType.Int64, "@CustomerID");
                _TDB.AddParams(pCustomersAccInfoTbl.RequiresPurchOrder, DbType.Int32, "@RequiresPurchOrder");
                _TDB.AddParams(pCustomersAccInfoTbl.CustomerVATNo, DbType.String, "@CustomerVATNo");
                _TDB.AddParams(pCustomersAccInfoTbl.BillAddr1, DbType.String, "@BillAddr1");
                _TDB.AddParams(pCustomersAccInfoTbl.BillAddr2, DbType.String, "@BillAddr2");
                _TDB.AddParams(pCustomersAccInfoTbl.BillAddr3, DbType.String, "@BillAddr3");
                _TDB.AddParams(pCustomersAccInfoTbl.BillAddr4, DbType.String, "@BillAddr4");
                _TDB.AddParams(pCustomersAccInfoTbl.BillAddr5, DbType.String, "@BillAddr5");
                _TDB.AddParams(pCustomersAccInfoTbl.ShipAddr1, DbType.String, "@ShipAddr1");
                _TDB.AddParams(pCustomersAccInfoTbl.ShipAddr2, DbType.String, "@ShipAddr2");
                _TDB.AddParams(pCustomersAccInfoTbl.ShipAddr3, DbType.String, "@ShipAddr3");
                _TDB.AddParams(pCustomersAccInfoTbl.ShipAddr4, DbType.String, "@ShipAddr4");
                _TDB.AddParams(pCustomersAccInfoTbl.ShipAddr5, DbType.String, "@ShipAddr5");
                _TDB.AddParams(pCustomersAccInfoTbl.AccEmail, DbType.String, "@AccEmail");
                _TDB.AddParams(pCustomersAccInfoTbl.AltAccEmail, DbType.String, "@AltAccEmail");
                _TDB.AddParams(pCustomersAccInfoTbl.PaymentTermID, DbType.Int32, "@PaymentTermID");
                _TDB.AddParams(pCustomersAccInfoTbl.Limit, DbType.Currency, "@Limit");
                _TDB.AddParams(pCustomersAccInfoTbl.FullCoName, DbType.String, "@FullCoName");
                _TDB.AddParams(pCustomersAccInfoTbl.AccFirstName, DbType.String, "@AccFirstName");
                _TDB.AddParams(pCustomersAccInfoTbl.AccLastName, DbType.String, "@AccLastName");
                _TDB.AddParams(pCustomersAccInfoTbl.AltAccFirstName, DbType.String, "@AltAccFirstName");
                _TDB.AddParams(pCustomersAccInfoTbl.AltAccLastName, DbType.String, "@AltAccLastName");
                _TDB.AddParams(pCustomersAccInfoTbl.PriceLevelID, DbType.Int32, "@PriceLevelID");
                _TDB.AddParams(pCustomersAccInfoTbl.InvoiceTypeID, DbType.Int32, "@InvoiceTypeID");
                _TDB.AddParams(pCustomersAccInfoTbl.RegNo, DbType.String, "@RegNo");
                _TDB.AddParams(pCustomersAccInfoTbl.BankAccNo, DbType.String, "@BankAccNo");
                _TDB.AddParams(pCustomersAccInfoTbl.BankBranch, DbType.String, "@BankBranch");
                _TDB.AddParams(pCustomersAccInfoTbl.Enabled, DbType.Boolean, "@Enabled");
                _TDB.AddParams(pCustomersAccInfoTbl.Notes, DbType.String, "@Notes");
                #endregion
                // Now we have the parameters excute the SQL
                _result = _TDB.ExecuteNonQuerySQL(CONST_SQL_INSERT);
                _TDB.Close();
            }
            return(_result);
        }
示例#22
0
        public string Insert(PriceLevelsTbl pPriceLevelsTbl)
        {
            string    _result = string.Empty;
            TrackerDb _TDB    = new TrackerDb();

            #region InsertParameters
            _TDB.AddParams(pPriceLevelsTbl.PriceLevelDesc, DbType.String, "@PriceLevelDesc");
            _TDB.AddParams(Math.Round(pPriceLevelsTbl.PricingFactor, 3), DbType.Single, "@PricingFactor");
            _TDB.AddParams(pPriceLevelsTbl.Enabled, DbType.Int32, "@Enabled");
            _TDB.AddParams(pPriceLevelsTbl.Notes, DbType.String, "@Notes");
            #endregion
            // Now we have the parameters excute the SQL
            _result = _TDB.ExecuteNonQuerySQL(CONST_SQL_INSERT);
            _TDB.Close();
            return(_result);
        }
示例#23
0
        public string InsertLogItem(SentRemindersLogTbl pSentRemindersLog)
        {
            string _ErrString = String.Empty;

            TrackerDb _TDB = new TrackerDb();

            _TDB.AddParams(pSentRemindersLog.CustomerID, DbType.Int64);
            _TDB.AddParams(pSentRemindersLog.DateSentReminder, DbType.Date);
            _TDB.AddParams(pSentRemindersLog.NextPrepDate, DbType.Date);
            _TDB.AddParams(pSentRemindersLog.ReminderSent, DbType.Boolean);
            _TDB.AddParams(pSentRemindersLog.HadAutoFulfilItem, DbType.Boolean);
            _TDB.AddParams(pSentRemindersLog.HadReoccurItems, DbType.Boolean);
            _ErrString = _TDB.ExecuteNonQuerySQL(CONST_SQL_INSERT);
            _TDB.Close();

            return(_ErrString);
        }
示例#24
0
        public string InsertItemGroup(ItemGroupTbl pItemGroupTbl)
        {
            string    _result = string.Empty;
            TrackerDb _TDB    = new TrackerDb();

            #region InsertParameters
            _TDB.AddParams(pItemGroupTbl.GroupItemTypeID, DbType.Int32, "@GroupItemTypeID");
            _TDB.AddParams(pItemGroupTbl.ItemTypeID, DbType.Int32, "@ItemTypeID");
            _TDB.AddParams(pItemGroupTbl.ItemTypeSortPos, DbType.Int32, "@ItemTypeSortPos");
            _TDB.AddParams(pItemGroupTbl.Enabled, DbType.Boolean, "@Enabled");
            _TDB.AddParams(pItemGroupTbl.Notes, DbType.String, "@Notes");
            #endregion
            // Now we have the parameters excute the SQL
            _result = _TDB.ExecuteNonQuerySQL(CONST_SQL_INSERT);
            _TDB.Close();
            return(_result);
        }
示例#25
0
        public string InsertCityPrepDay(CityPrepDaysTbl objCityPrepDaysTbl)
        {
            string _Result = String.Empty;

            TrackerDb _TDB = new TrackerDb();

            /// CityID, PrepDayOfWeekID, DeliveryDelayDays, DeliveryOrder
            _TDB.AddParams(objCityPrepDaysTbl.CityID, System.Data.DbType.Int32);
            _TDB.AddParams(objCityPrepDaysTbl.PrepDayOfWeekID, System.Data.DbType.Byte);
            _TDB.AddParams(objCityPrepDaysTbl.DeliveryDelayDays, System.Data.DbType.Int32);
            _TDB.AddParams(objCityPrepDaysTbl.DeliveryOrder, System.Data.DbType.Int32);

            _Result = _TDB.ExecuteNonQuerySQL(CONST_SQL_INSERT);

            _TDB.Close();

            return(_Result);
        }
示例#26
0
        public string Insert(UsedItemGroupTbl pUsedItemGroupTbl)
        {
            string    _result = string.Empty;
            TrackerDb _TDB    = new TrackerDb();

            #region InsertParameters
            _TDB.AddParams(pUsedItemGroupTbl.ContactID, DbType.Int64, "@ContactID");
            _TDB.AddParams(pUsedItemGroupTbl.GroupItemTypeID, DbType.Int32, "@GroupItemTypeID");
            _TDB.AddParams(pUsedItemGroupTbl.LastItemTypeID, DbType.Int32, "@LastItemTypeID");
            _TDB.AddParams(pUsedItemGroupTbl.LastItemTypeSortPos, DbType.Int32, "@LastItemTypeSortPos");
            _TDB.AddParams(pUsedItemGroupTbl.LastItemDateChanged, DbType.Date, "@LastItemDateChanged");
            _TDB.AddParams(pUsedItemGroupTbl.Notes, DbType.String, "@Notes");
            #endregion
            // Now we have the parameters excute the SQL
            _result = _TDB.ExecuteNonQuerySQL(CONST_SQL_INSERT);
            _TDB.Close();
            return(_result);
        }
示例#27
0
        public string Insert(PaymentTermsTbl pPaymentTermsTbl)
        {
            string    _result = string.Empty;
            TrackerDb _TDB    = new TrackerDb();

            #region InsertParameters
            _TDB.AddParams(pPaymentTermsTbl.PaymentTermDesc, DbType.String, "@PaymentTermDesc");
            _TDB.AddParams(pPaymentTermsTbl.PaymentDays, DbType.Int32, "@PaymentDays");
            _TDB.AddParams(pPaymentTermsTbl.DayOfMonth, DbType.Int32, "@DayOfMonth");
            _TDB.AddParams(pPaymentTermsTbl.UseDays, DbType.Boolean, "@UseDays");
            _TDB.AddParams(pPaymentTermsTbl.Enabled, DbType.Boolean, "@Enabled");
            _TDB.AddParams(pPaymentTermsTbl.Notes, DbType.String, "@Notes");
            #endregion
            // Now we have the parameters excute the SQL
            _result = _TDB.ExecuteNonQuerySQL(CONST_SQL_INSERT);
            _TDB.Close();
            return(_result);
        }
示例#28
0
        public bool InsertLogItem(LogTbl objLog)
        {
            bool _inserted = false;

            TrackerDb _TDB = new TrackerDb();

            _TDB.AddParams(DateTime.Now, DbType.DateTime); // other insert DateTime does not work only date
            _TDB.AddParams(objLog.UserID, DbType.Int32);
            _TDB.AddParams(objLog.SectionID, DbType.Int32);
            _TDB.AddParams(objLog.TranactionTypeID, DbType.Int32);
            _TDB.AddParams(objLog.CustomerID, DbType.Int64);
            _TDB.AddParams(objLog.Details);
            _TDB.AddParams(objLog.Notes);

            _inserted = string.IsNullOrWhiteSpace(_TDB.ExecuteNonQuerySQL(CONST_SQL_INSERT));
            _TDB.Close();

            return(_inserted);
        }
示例#29
0
        /// <summary>
        /// Insert Contact item into Temp Line
        /// </summary>
        /// <param name="pLineData">Contact Line Data to add</param>
        /// <returns>success or failure</returns>
        public bool InsertContactItems(ItemContactRequires pLineData)
        {
            bool      _Success = false;
            TrackerDb _TDB     = new TrackerDb();

            #region Parameters
            // Add data sent CustomerId, OrderDate, RoastDate, RequiredByDate, ToBeDeliveredByID, Confirmed, Done, Notes
            _TDB.AddParams(pLineData.CustomerID, DbType.Int64, "@CustomerID");
            _TDB.AddParams(pLineData.ItemID, DbType.Int32, "@ItemID");
            _TDB.AddParams(pLineData.ItemQty, DbType.Double, "@ItemQty");
            _TDB.AddParams(pLineData.ItemPrepID, DbType.Int32, "@ItemPrepID");
            _TDB.AddParams(pLineData.ItemPackagID, DbType.Int32, "@ItemPackagID");
            _TDB.AddParams(pLineData.AutoFulfill, DbType.Boolean, "@AutoFulfill");
            _TDB.AddParams(pLineData.ReoccurID, DbType.Int64, "@ReoccurID");
            #endregion

            _Success = String.IsNullOrEmpty(_TDB.ExecuteNonQuerySQL(CONST_SQL_INSERTNEWITEMS));
            _TDB.Close();
            return(_Success);
        }
示例#30
0
/*
 *    string _connectionStr = ConfigurationManager.ConnectionStrings[CONST_CONSTRING].ConnectionString;
 *
 *    using (OleDbConnection _conn = new OleDbConnection(_connectionStr))
 *    {
 *      string _sqlCmd = CONST_SQL_SELECT;
 *      OleDbCommand _cmd = new OleDbCommand(_sqlCmd, _conn);                    // run the query we have built
 *      _conn.Open();
 *      OleDbDataReader _DataReader = _cmd.ExecuteReader();
 *      if (_DataReader.Read())
 *      {
 *        _DataItem.SCEMTID = (_DataReader["SCEMTID"] == DBNull.Value) ? 0 : Convert.ToInt32(_DataReader["SCEMTID"]);
 *        _DataItem.Header = (_DataReader["Header"] == DBNull.Value) ? string.Empty : _DataReader["Header"].ToString();
 *        _DataItem.Body = (_DataReader["Body"] == DBNull.Value) ? string.Empty : _DataReader["Body"].ToString();
 *        _DataItem.Footer = (_DataReader["Footer"] == DBNull.Value) ? string.Empty : _DataReader["Footer"].ToString();
 *        _DataItem.DateLastChange = (_DataReader["DateLastChange"] == DBNull.Value) ? System.DateTime.Now : Convert.ToDateTime(_DataReader["DateLastChange"]);
 *        _DataItem.Notes = (_DataReader["Notes"] == DBNull.Value) ? string.Empty : _DataReader["Notes"].ToString();
 *      }
 *    }
 *    return _DataItem;
 *  }
 */
        public string UpdateTexts(SendCheckEmailTextsData pEmailTextsData, int pOriginalID)
        {
            string    _errString = "";
            TrackerDb _TDB       = new TrackerDb();

            #region Parameters
            // Add data sent
            _TDB.AddParams(pEmailTextsData.Header, DbType.String, "@Header");
            _TDB.AddParams(pEmailTextsData.Body, DbType.String, "@Body");
            _TDB.AddParams(pEmailTextsData.Footer, DbType.String, "@Footer");
            _TDB.AddParams(DateTime.Now.Date, DbType.Date, "@DateLastChange");
            _TDB.AddParams(pEmailTextsData.Notes, DbType.String, "@Notes");
            //                                     " WHERE SCEMTID = ?)";
            _TDB.AddWhereParams(pOriginalID, DbType.Int32, "@SCEMTID");
            #endregion

            _errString = _TDB.ExecuteNonQuerySQL(CONST_SQL_UPDATE);
            _TDB.Close();
            return(_errString);
        }