Exemplo n.º 1
0
        /// <summary>
        /// Selects all records from the Qds_Drop table.
        /// </summary>
        public virtual List <Qds_Drop> SelectAllInProcess()
        {
            using (SqlDataReader dataReader = SqlClientUtility.ExecuteReader(connectionStringName, CommandType.StoredProcedure, "Qds_Drop_SelectAllInProcess"))
            {
                List <Qds_Drop> qds_DropList = new List <Qds_Drop>();
                while (dataReader.Read())
                {
                    Qds_Drop qds_Drop = MakeQds_Drop(dataReader);
                    qds_DropList.Add(qds_Drop);
                }

                return(qds_DropList);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a new instance of the Qds_Drop class and populates it with data from the specified SqlDataReader.
        /// </summary>
        protected virtual Qds_Drop MakeQds_Drop(SqlDataReader dataReader)
        {
            Qds_Drop qds_Drop = new Qds_Drop();

            qds_Drop.DropID          = SqlClientUtility.GetInt32(dataReader, "DropID", 0);
            qds_Drop.CustomerID      = SqlClientUtility.GetInt32(dataReader, "CustomerID", 0);
            qds_Drop.NumberOfBags    = SqlClientUtility.GetInt32(dataReader, "NumberOfBags", 0);
            qds_Drop.PaymentMethodID = SqlClientUtility.GetInt32(dataReader, "PaymentMethodID", 0);
            qds_Drop.DepotID         = SqlClientUtility.GetString(dataReader, "DepotID", String.Empty);
            qds_Drop.OrderID         = SqlClientUtility.GetInt32(dataReader, "OrderID", 0);
            qds_Drop.OrderType       = SqlClientUtility.GetString(dataReader, "OrderType", String.Empty);
            //qds_Drop.IsNew = SqlClientUtility.GetBoolean(dataReader, "IsNew", false);

            return(qds_Drop);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Saves a record to the Qds_Drop table.
        /// </summary>
        public virtual void Insert(Qds_Drop qds_Drop)
        {
            ValidationUtility.ValidateArgument("qds_Drop", qds_Drop);

            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@CustomerID", qds_Drop.CustomerID),
                new SqlParameter("@NumberOfBags", qds_Drop.NumberOfBags),
                new SqlParameter("@PaymentMethodID", qds_Drop.PaymentMethodID),
                new SqlParameter("@DepotID", qds_Drop.DepotID),
                new SqlParameter("@OrderID", qds_Drop.OrderID),
                new SqlParameter("@OrderType", qds_Drop.OrderType)
                //            ,
                //new SqlParameter("@IsNew", qds_Drop.IsNew)
            };

            qds_Drop.DropID = (int)SqlClientUtility.ExecuteScalar(connectionStringName, CommandType.StoredProcedure, "Qds_Drop_Insert", parameters);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Selects all records from the Qds_Drop table.
        /// </summary>
        public virtual List <Qds_Drop> SelectAllByOrderTpe(string orderType)
        {
            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@OrderType", orderType)
            };

            using (SqlDataReader dataReader = SqlClientUtility.ExecuteReader(connectionStringName, CommandType.StoredProcedure, "Qds_Drop_SelectAllByOrderType", parameters))
            {
                List <Qds_Drop> qds_DropList = new List <Qds_Drop>();
                while (dataReader.Read())
                {
                    Qds_Drop qds_Drop = MakeQds_Drop(dataReader);
                    qds_DropList.Add(qds_Drop);
                }

                return(qds_DropList);
            }
        }
Exemplo n.º 5
0
        public static void CompleteOrder(
            int orderID
            , string orderType
            , ref List <int> listOfBagsCounted
            , ref List <int> listOfBagsNotCounted
            )
        {
            if (listOfBagsNotCounted.Count < 1)
            {
                return;
            }

            //set the status of the rest of the bags to MISSING
            Qds_Drop_Sp qds_Drop_Sp = new Qds_Drop_Sp(Properties.Settings.Default.WsirDbConnectionString);

            List <Qds_Drop> dl         = qds_Drop_Sp._SelectAllByOrderID_OrderType(orderID, orderType);
            Qds_Drop        qds_Drop   = dl[0];
            Qds_Bag_Sp      qds_Bag_Sp = new Qds_Bag_Sp(Properties.Settings.Default.WsirDbConnectionString);

            List <Qds_Bag> bl = qds_Bag_Sp._SelectAllByDropID(qds_Drop.DropID);
            //create new drop for missing bags
            Qds_Drop nd = new Qds_Drop();

            //nd.DropID = 0;
            nd.CustomerID      = qds_Drop.CustomerID;
            nd.NumberOfBags    = listOfBagsNotCounted.Count; // od.NumberOfBags;
            nd.PaymentMethodID = qds_Drop.PaymentMethodID;
            nd.DepotID         = qds_Drop.DepotID;
            nd.OrderID         = 0;
            nd.OrderType       = "M"; //missing
            qds_Drop_Sp.Insert(nd);

            //move missing bags to new drop
            //foreach(ComboBoxItem i in comboBoxBagId.Items)

            foreach (int id in listOfBagsNotCounted)
            {
                //move missing bag
                Qds_Bag mb = qds_Bag_Sp.Select(id); //bagIdFromComboBox);
                mb.DropID = nd.DropID;
                qds_Bag_Sp.Update(mb);
            }

            //change numer of bags of the original drop
            qds_Drop.NumberOfBags -= listOfBagsNotCounted.Count();
            qds_Drop_Sp.Update(qds_Drop);

            //close order
            Sol_Order_Sp sol_Order_Sp = new Sol_Order_Sp(Properties.Settings.Default.WsirDbConnectionString);
            Sol_Order    sol_Order    = sol_Order_Sp.Select(orderID, orderType);

            sol_Order_Sp.UpdateDates(sol_Order.OrderID, sol_Order.OrderType, "", "DateClosed");

            //is drop ready for payment?
            if (qds_Drop_Sp.IsReady(qds_Drop.DropID))
            {
                string status = String.Empty;
                if (qds_Drop.PaymentMethodID == 1)
                {
                    status = "A";
                }
                else
                {
                    status = "O";
                }
                sol_Order_Sp.UpdateStatus(sol_Order.OrderID, sol_Order.OrderType, status);
            }

            //update customerID
            //sol_Order_Sp._UpdateCustomerID(sol_Order.OrderID, sol_Order.OrderType, qds_Drop.CustomerID);
        }