예제 #1
0
        public static bool CreateOn_Order(On_Order on_Order, out string status, out int id)
        {
            status = DataConnection.status;

            DataConnection.command.CommandText =
                "INSERT INTO ON_ORDER(onordInvoiceNum, onordArriveDate, onordNumInOrder, onordPrice, inventoryID, prodorderID) " +
                "OUTPUT INSERTED.ID " +
                "VALUES(" +
                "'" + on_Order.onordInvoiceNum + "', " +
                "" + ((on_Order.onordArriveDate.ToString("yyyy-MM-dd") != "0001-01-01") ? "'" + on_Order.onordArriveDate.ToString("yyyy-MM-dd") + "'" : "Null") + ", " +
                "" + on_Order.onordNumInOrder + ", " +
                "" + on_Order.onordPrice + ", " +
                "" + on_Order.inventoryID + ", " +
                "" + on_Order.prodorderID + ")";

            if (DataConnection.Open())
            {
                try
                {
                    id     = (int)DataConnection.command.ExecuteScalar();
                    status = "Insert successful";
                    DataConnection.Close();
                    return(true);
                }
                catch (Exception e)
                {
                    status = "Insert failed\n" + e.Message;
                }
            }

            DataConnection.Close();
            id = 0;
            return(false);
        }
예제 #2
0
        public static bool UpdateOn_Order(On_Order on_Order, out string status)
        {
            status = DataConnection.status;

            DataConnection.command.CommandText =
                "UPDATE On_Order SET onordInvoiceNum '" + on_Order.onordInvoiceNum + "', " +
                "onordArriveDate = '" + on_Order.onordArriveDate + "', " +
                "onordNumInOrder = " + on_Order.onordNumInOrder + ", " +
                "onordPrice = " + on_Order.onordPrice + ", " +
                "inventoryID = " + on_Order.inventoryID + ", " +
                "prodorderID = " + on_Order.prodorderID + " " +
                "WHERE ID = " + on_Order.id.ToString();

            if (DataConnection.Open())
            {
                try
                {
                    DataConnection.command.ExecuteNonQuery();
                    status = "Update successful";
                    DataConnection.Close();
                    return(true);
                }
                catch (Exception e)
                {
                    status = "Update failed\n" + e.Message;
                }
            }

            DataConnection.Close();
            return(false);
        }
예제 #3
0
        public static bool DeleteOn_Order(On_Order on_Order, out string status)
        {
            status = DataConnection.status;

            DataConnection.command.CommandText = "DELETE FROM On_Order WHERE id = " + on_Order.id.ToString();

            if (DataConnection.Open())
            {
                try
                {
                    DataConnection.command.ExecuteNonQuery();
                    status = "Delete successful";
                    DataConnection.Close();
                    return(true);
                }
                catch (Exception e)
                {
                    status = "Delete failed\n" + e.Message;
                }
            }

            DataConnection.Close();
            return(false);
        }