Ejemplo n.º 1
0
        public void BindProductsHistoryDataGrid(DataGridView productsHistoryDataGridView, string productId)
        {
            int productID;

            if (!int.TryParse(productId, out productID))
            {
                return;
            }

            openConnectionIfClosed();

            string query =
                "SELECT LABEL AS PRODUCT, LAST_NAME AS ORDERED_BY, PAYMENT_METHOD, SELLING_PRICE AS UNIT_PRICE, AMOUNT FROM ORDERS " +
                "INNER JOIN ORDERS_PRODUCTS " +
                "ON ORDERS_PRODUCTS.ID_ORDER = ORDERS.ORDER_ID " +
                "INNER JOIN PRODUCTS " +
                "ON PRODUCTS.PRODUCT_ID = ORDERS_PRODUCTS.ID_PRODUCT " +
                "INNER JOIN CUSTOMERS " +
                "ON CUSTOMERS.CUSTOMER_ID = ORDERS.CUSTOMER_ID " +
                "WHERE ORDERS.ORDER_ID = " + productId;

            try
            {
                SqlDataAdapter adapter = new SqlDataAdapter(query, Conn);
                DataSet        dataset = new DataSet();
                adapter.Fill(dataset);
                BindingSource bindingSource = new BindingSource();
                bindingSource.DataSource = dataset.Tables[0].DefaultView;
                productsHistoryDataGridView.DataSource = bindingSource;
            }
            catch (SqlException e)
            {
                ViewMessages.ExceptionOccured(e);
            }
            Conn.Close(); // Close Connection
        }
Ejemplo n.º 2
0
        protected override void Serialize(IDictionary <string, object> json)
        {
            if (Today != DefaultToday)
            {
                json["today"] = Today;
            }

            if (Save != DefaultSave)
            {
                json["save"] = Save;
            }

            if (Cancel != DefaultCancel)
            {
                json["cancel"] = Cancel;
            }

            if (Destroy != DefaultDestroy)
            {
                json["destroy"] = Destroy;
            }

            if (Event != DefaultEvent)
            {
                json["event"] = Event;
            }

            if (Date != DefaultDate)
            {
                json["date"] = Date;
            }

            if (Time != DefaultTime)
            {
                json["time"] = Time;
            }

            if (AllDay != DefaultAllDay)
            {
                json["allDay"] = AllDay;
            }

            //TODO: CHECK IF THERE IS DATA BEFORE ASSIGN:
            IDictionary <string, object> viewMessages = ViewMessages.ToJson();

            if (viewMessages.Count > 0)
            {
                json["views"] = viewMessages;
            }

            IDictionary <string, object> recurrenceMessages = RecurrenceMessages.ToJson();

            if (recurrenceMessages.Count > 0)
            {
                json["recurrenceMessages"] = recurrenceMessages;
            }

            IDictionary <string, object> editorMessages = EditorMessages.ToJson();

            if (editorMessages.Count > 0)
            {
                json["editor"] = editorMessages;
            }

            IDictionary <string, object> recurrenceEditorMessages = RecurrenceEditorMessages.ToJson();

            if (recurrenceEditorMessages.Count > 0)
            {
                json["recurrenceEditor"] = recurrenceEditorMessages;
            }
        }