Ejemplo n.º 1
0
/*===============================
*  Display Record Form
*  -------------------------------*/


        void Order_Show()
        {
            // Order Show begin

            bool ActionInsert = true;

            if (p_Order_order_id.Value.Length > 0)
            {
                string sWhere = "";

                sWhere += "order_id=" + CCUtility.ToSQL(p_Order_order_id.Value, FieldTypes.Number);

// Order Open Event begin
// Order Open Event end
                string           sSQL      = "select * from orders where " + sWhere;
                OleDbDataAdapter dsCommand = new OleDbDataAdapter(sSQL, Utility.Connection);
                DataSet          ds        = new DataSet();
                DataRow          row;

                if (dsCommand.Fill(ds, 0, 1, "Order") > 0)
                {
                    row = ds.Tables[0].Rows[0];

                    Order_order_id.Value = CCUtility.GetValue(row, "order_id");


                    Order_quantity.Text = CCUtility.GetValue(row, "quantity");
                    Order_item_id.Value = CCUtility.GetValue(row, "item_id");


                    Order_insert.Visible = false;
                    ActionInsert         = false;

// Order ShowEdit Event begin
// Order ShowEdit Event end
                }
            }

            if (ActionInsert)
            {
                String pValue;

                pValue = Utility.GetParam("item_id"); Order_item_id.Value = pValue;
// Order ShowInsert Event begin
// Order ShowInsert Event end
            }



// Order Open Event begin
// Order Open Event end

// Order Show Event begin
// Order Show Event end

            // Order Show end

// Order Close Event begin
// Order Close Event end
        }
Ejemplo n.º 2
0
        bool Categories_delete_Click(Object Src, EventArgs E)
        {
            string sWhere = "";

            if (p_Categories_category_id.Value.Length > 0)
            {
                sWhere += "category_id=" + CCUtility.ToSQL(p_Categories_category_id.Value, FieldTypes.Number);
            }

            string sSQL = "delete from categories where " + sWhere;

// Categories Delete Event begin
// Categories Delete Event end
            Categories_BeforeSQLExecute(sSQL, "Delete");
            OleDbCommand cmd = new OleDbCommand(sSQL, Utility.Connection);

            try {
                cmd.ExecuteNonQuery();
            } catch (Exception e) {
                Categories_ValidationSummary.Text   += e.Message;
                Categories_ValidationSummary.Visible = true;
                return(false);
            }

// Categories AfterDelete Event begin
// Categories AfterDelete Event end
            return(true);
        }
Ejemplo n.º 3
0
        bool ShoppingCartRecord_delete_Click(Object Src, EventArgs E)
        {
            string sWhere = "";

            if (p_ShoppingCartRecord_order_id.Value.Length > 0)
            {
                sWhere += "order_id=" + CCUtility.ToSQL(p_ShoppingCartRecord_order_id.Value, FieldTypes.Number);
            }

            string sSQL = "delete from orders where " + sWhere;

// ShoppingCartRecord Delete Event begin
// ShoppingCartRecord Delete Event end
            ShoppingCartRecord_BeforeSQLExecute(sSQL, "Delete");
            OleDbCommand cmd = new OleDbCommand(sSQL, Utility.Connection);

            try {
                cmd.ExecuteNonQuery();
            } catch (Exception e) {
                ShoppingCartRecord_ValidationSummary.Text   += e.Message;
                ShoppingCartRecord_ValidationSummary.Visible = true;
                return(false);
            }

// ShoppingCartRecord AfterDelete Event begin
// ShoppingCartRecord AfterDelete Event end
            return(true);
        }
Ejemplo n.º 4
0
        // Book Action begin

        bool Book_insert_Click(Object Src, EventArgs E)
        {
            string sSQL    = "";
            bool   bResult = Book_Validate();

// Book Check Event begin
// Book Check Event end

            string p2_name           = CCUtility.ToSQL(Utility.GetParam("Book_name"), FieldTypes.Text);
            string p2_author         = CCUtility.ToSQL(Utility.GetParam("Book_author"), FieldTypes.Text);
            string p2_category_id    = CCUtility.ToSQL(Utility.GetParam("Book_category_id"), FieldTypes.Number);
            string p2_price          = CCUtility.ToSQL(Utility.GetParam("Book_price"), FieldTypes.Number);
            string p2_product_url    = CCUtility.ToSQL(Utility.GetParam("Book_product_url"), FieldTypes.Text);
            string p2_image_url      = CCUtility.ToSQL(Utility.GetParam("Book_image_url"), FieldTypes.Text);
            string p2_notes          = CCUtility.ToSQL(Utility.GetParam("Book_notes"), FieldTypes.Text);
            string c1_is_recommended = CCUtility.getCheckBoxValue(Utility.GetParam("Book_is_recommended"), "1", "0", FieldTypes.Number);

// Book Insert Event begin
// Book Insert Event end


            if (bResult)
            {
                if (sSQL.Length == 0)
                {
                    sSQL = "insert into items (" +
                           "name," +
                           "author," +
                           "category_id," +
                           "price," +
                           "product_url," +
                           "image_url," +
                           "notes," +
                           "is_recommended)" +
                           " values (" +
                           p2_name + "," +
                           p2_author + "," +
                           p2_category_id + "," +
                           p2_price + "," +
                           p2_product_url + "," +
                           p2_image_url + "," +
                           p2_notes + "," +
                           c1_is_recommended + ")";
                }
                Book_BeforeSQLExecute(sSQL, "Insert");
                OleDbCommand cmd = new OleDbCommand(sSQL, Utility.Connection);
                try {
                    cmd.ExecuteNonQuery();
                } catch (Exception e) {
                    Book_ValidationSummary.Text   += e.Message;
                    Book_ValidationSummary.Visible = true;
                    return(false);
                }

// Book AfterInsert Event begin
// Book AfterInsert Event end
            }
            return(bResult);
        }
Ejemplo n.º 5
0
/*===============================
*  Display Record Form
*  -------------------------------*/


        void Categories_Show()
        {
            // Categories Show begin

            bool ActionInsert = true;

            if (p_Categories_category_id.Value.Length > 0)
            {
                string sWhere = "";

                sWhere += "category_id=" + CCUtility.ToSQL(p_Categories_category_id.Value, FieldTypes.Number);

// Categories Open Event begin
// Categories Open Event end
                string           sSQL      = "select * from categories where " + sWhere;
                OleDbDataAdapter dsCommand = new OleDbDataAdapter(sSQL, Utility.Connection);
                DataSet          ds        = new DataSet();
                DataRow          row;

                if (dsCommand.Fill(ds, 0, 1, "Categories") > 0)
                {
                    row = ds.Tables[0].Rows[0];

                    Categories_category_id.Value = CCUtility.GetValue(row, "category_id");


                    Categories_name.Text      = CCUtility.GetValue(row, "name");
                    Categories_insert.Visible = false;
                    ActionInsert = false;

// Categories ShowEdit Event begin
// Categories ShowEdit Event end
                }
            }

            if (ActionInsert)
            {
                String pValue;

                pValue = Utility.GetParam("category_id"); Categories_category_id.Value = pValue; Categories_delete.Visible = false;
                Categories_update.Visible = false;

// Categories ShowInsert Event begin
// Categories ShowInsert Event end
            }



// Categories Open Event begin
// Categories Open Event end

// Categories Show Event begin
// Categories Show Event end

            // Categories Show end

// Categories Close Event begin
// Categories Close Event end
        }
Ejemplo n.º 6
0
        bool Form_update_Click(Object Src, EventArgs E)
        {
            string sWhere = "";
            string sSQL   = "";

            bool bResult = Form_Validate();

            if (bResult)
            {
                if (p_Form_member_id.Value.Length > 0)
                {
                    sWhere = sWhere + "member_id=" + CCUtility.ToSQL(p_Form_member_id.Value, FieldTypes.Number);
                }

// Form Check Event begin
// Form Check Event end

                if (bResult)
                {
                    sSQL = "update members set " +
                           "[member_password]=" + CCUtility.ToSQL(Utility.GetParam("Form_member_password"), FieldTypes.Text) +
                           ",[first_name]=" + CCUtility.ToSQL(Utility.GetParam("Form_name"), FieldTypes.Text) +
                           ",[last_name]=" + CCUtility.ToSQL(Utility.GetParam("Form_last_name"), FieldTypes.Text) +
                           ",[email]=" + CCUtility.ToSQL(Utility.GetParam("Form_email"), FieldTypes.Text) +
                           ",[address]=" + CCUtility.ToSQL(Utility.GetParam("Form_address"), FieldTypes.Text) +
                           ",[phone]=" + CCUtility.ToSQL(Utility.GetParam("Form_phone"), FieldTypes.Text) +
                           ",[notes]=" + CCUtility.ToSQL(Utility.GetParam("Form_notes"), FieldTypes.Text) +
                           ",[card_type_id]=" + CCUtility.ToSQL(Utility.GetParam("Form_card_type_id"), FieldTypes.Number) +
                           ",[card_number]=" + CCUtility.ToSQL(Utility.GetParam("Form_card_number"), FieldTypes.Text);


                    sSQL = sSQL + " where " + sWhere;

// Form Update Event begin
// Form Update Event end
                    Form_BeforeSQLExecute(sSQL, "Update");
                    OleDbCommand cmd = new OleDbCommand(sSQL, Utility.Connection);
                    try {
                        cmd.ExecuteNonQuery();
                    } catch (Exception e) {
                        Form_ValidationSummary.Text   += e.Message;
                        Form_ValidationSummary.Visible = true;
                        return(false);
                    }
                }

                if (bResult)
                {
// Form AfterUpdate Event begin
// Form AfterUpdate Event end
                }
            }
            return(bResult);
        }
Ejemplo n.º 7
0
        bool Book_update_Click(Object Src, EventArgs E)
        {
            string sWhere = "";
            string sSQL   = "";

            bool bResult = Book_Validate();

            if (bResult)
            {
                if (p_Book_item_id.Value.Length > 0)
                {
                    sWhere = sWhere + "item_id=" + CCUtility.ToSQL(p_Book_item_id.Value, FieldTypes.Number);
                }

// Book Check Event begin
// Book Check Event end

                if (bResult)
                {
                    sSQL = "update items set " +
                           "[name]=" + CCUtility.ToSQL(Utility.GetParam("Book_name"), FieldTypes.Text) +
                           ",[author]=" + CCUtility.ToSQL(Utility.GetParam("Book_author"), FieldTypes.Text) +
                           ",[category_id]=" + CCUtility.ToSQL(Utility.GetParam("Book_category_id"), FieldTypes.Number) +
                           ",[price]=" + CCUtility.ToSQL(Utility.GetParam("Book_price"), FieldTypes.Number) +
                           ",[product_url]=" + CCUtility.ToSQL(Utility.GetParam("Book_product_url"), FieldTypes.Text) +
                           ",[image_url]=" + CCUtility.ToSQL(Utility.GetParam("Book_image_url"), FieldTypes.Text) +
                           ",[notes]=" + CCUtility.ToSQL(Utility.GetParam("Book_notes"), FieldTypes.Text) +
                           ",[is_recommended]=" + CCUtility.getCheckBoxValue(Utility.GetParam("Book_is_recommended"), "1", "0", FieldTypes.Number);


                    sSQL = sSQL + " where " + sWhere;

// Book Update Event begin
// Book Update Event end
                    Book_BeforeSQLExecute(sSQL, "Update");
                    OleDbCommand cmd = new OleDbCommand(sSQL, Utility.Connection);
                    try {
                        cmd.ExecuteNonQuery();
                    } catch (Exception e) {
                        Book_ValidationSummary.Text   += e.Message;
                        Book_ValidationSummary.Visible = true;
                        return(false);
                    }
                }

                if (bResult)
                {
// Book AfterUpdate Event begin
// Book AfterUpdate Event end
                }
            }
            return(bResult);
        }
Ejemplo n.º 8
0
        bool editorials_update_Click(Object Src, EventArgs E)
        {
            string sWhere = "";
            string sSQL   = "";

            bool bResult = editorials_Validate();

            if (bResult)
            {
                if (p_editorials_article_id.Value.Length > 0)
                {
                    sWhere = sWhere + "article_id=" + CCUtility.ToSQL(p_editorials_article_id.Value, FieldTypes.Number);
                }

// editorials Check Event begin
// editorials Check Event end

                if (bResult)
                {
                    sSQL = "update editorials set " +
                           "[article_desc]=" + CCUtility.ToSQL(Utility.GetParam("editorials_article_desc"), FieldTypes.Text) +
                           ",[article_title]=" + CCUtility.ToSQL(Utility.GetParam("editorials_article_title"), FieldTypes.Text) +
                           ",[editorial_cat_id]=" + CCUtility.ToSQL(Utility.GetParam("editorials_editorial_cat_id"), FieldTypes.Number) +
                           ",[item_id]=" + CCUtility.ToSQL(Utility.GetParam("editorials_item_id"), FieldTypes.Number);


                    sSQL = sSQL + " where " + sWhere;

// editorials Update Event begin
// editorials Update Event end
                    editorials_BeforeSQLExecute(sSQL, "Update");
                    OleDbCommand cmd = new OleDbCommand(sSQL, Utility.Connection);
                    try {
                        cmd.ExecuteNonQuery();
                    } catch (Exception e) {
                        editorials_ValidationSummary.Text   += e.Message;
                        editorials_ValidationSummary.Visible = true;
                        return(false);
                    }
                }

                if (bResult)
                {
// editorials AfterUpdate Event begin
// editorials AfterUpdate Event end
                }
            }
            return(bResult);
        }
Ejemplo n.º 9
0
        bool Rating_update_Click(Object Src, EventArgs E)
        {
            string sWhere = "";
            string sSQL   = "";

            bool bResult = Rating_Validate();

            if (bResult)
            {
                if (p_Rating_item_id.Value.Length > 0)
                {
                    sWhere = sWhere + "item_id=" + CCUtility.ToSQL(p_Rating_item_id.Value, FieldTypes.Number);
                }

// Rating Check Event begin
// Rating Check Event end

                if (bResult)
                {
                    sSQL = "update items set " +
                           "[rating]=" + CCUtility.ToSQL(Utility.GetParam("Rating_rating"), FieldTypes.Number) +
                           ",[rating_count]=" + CCUtility.ToSQL(Utility.GetParam("Rating_rating_count"), FieldTypes.Number);


                    sSQL = sSQL + " where " + sWhere;

// Rating Update Event begin
                    sSQL = "update items set rating=rating+" + Rating_rating.SelectedItem.Value + ", rating_count=rating_count+1 where item_id=" + Rating_item_id.Value;
// Rating Update Event end
                    Rating_BeforeSQLExecute(sSQL, "Update");
                    OleDbCommand cmd = new OleDbCommand(sSQL, Utility.Connection);
                    try {
                        cmd.ExecuteNonQuery();
                    } catch (Exception e) {
                        Rating_ValidationSummary.Text   += e.Message;
                        Rating_ValidationSummary.Visible = true;
                        return(false);
                    }
                }

                if (bResult)
                {
// Rating AfterUpdate Event begin
// Rating AfterUpdate Event end
                }
            }
            return(bResult);
        }
        bool Orders_update_Click(Object Src, EventArgs E)
        {
            string sWhere = "";
            string sSQL   = "";

            bool bResult = Orders_Validate();

            if (bResult)
            {
                if (p_Orders_order_id.Value.Length > 0)
                {
                    sWhere = sWhere + "order_id=" + CCUtility.ToSQL(p_Orders_order_id.Value, FieldTypes.Number);
                }

// Orders Check Event begin
// Orders Check Event end

                if (bResult)
                {
                    sSQL = "update orders set " +
                           "[member_id]=" + CCUtility.ToSQL(Utility.GetParam("Orders_member_id"), FieldTypes.Number) +
                           ",[item_id]=" + CCUtility.ToSQL(Utility.GetParam("Orders_item_id"), FieldTypes.Number) +
                           ",[quantity]=" + CCUtility.ToSQL(Utility.GetParam("Orders_quantity"), FieldTypes.Number);


                    sSQL = sSQL + " where " + sWhere;

// Orders Update Event begin
// Orders Update Event end
                    Orders_BeforeSQLExecute(sSQL, "Update");
                    OleDbCommand cmd = new OleDbCommand(sSQL, Utility.Connection);
                    try {
                        cmd.ExecuteNonQuery();
                    } catch (Exception e) {
                        Orders_ValidationSummary.Text   += e.Message;
                        Orders_ValidationSummary.Visible = true;
                        return(false);
                    }
                }

                if (bResult)
                {
// Orders AfterUpdate Event begin
// Orders AfterUpdate Event end
                }
            }
            return(bResult);
        }
Ejemplo n.º 11
0
        // editorials Action begin

        bool editorials_insert_Click(Object Src, EventArgs E)
        {
            string sSQL    = "";
            bool   bResult = editorials_Validate();

// editorials Check Event begin
// editorials Check Event end

            string p2_article_desc     = CCUtility.ToSQL(Utility.GetParam("editorials_article_desc"), FieldTypes.Text);
            string p2_article_title    = CCUtility.ToSQL(Utility.GetParam("editorials_article_title"), FieldTypes.Text);
            string p2_editorial_cat_id = CCUtility.ToSQL(Utility.GetParam("editorials_editorial_cat_id"), FieldTypes.Number);
            string p2_item_id          = CCUtility.ToSQL(Utility.GetParam("editorials_item_id"), FieldTypes.Number);

// editorials Insert Event begin
// editorials Insert Event end


            if (bResult)
            {
                if (sSQL.Length == 0)
                {
                    sSQL = "insert into editorials (" +
                           "article_desc," +
                           "article_title," +
                           "editorial_cat_id," +
                           "item_id)" +
                           " values (" +
                           p2_article_desc + "," +
                           p2_article_title + "," +
                           p2_editorial_cat_id + "," +
                           p2_item_id + ")";
                }
                editorials_BeforeSQLExecute(sSQL, "Insert");
                OleDbCommand cmd = new OleDbCommand(sSQL, Utility.Connection);
                try {
                    cmd.ExecuteNonQuery();
                } catch (Exception e) {
                    editorials_ValidationSummary.Text   += e.Message;
                    editorials_ValidationSummary.Visible = true;
                    return(false);
                }

// editorials AfterInsert Event begin
// editorials AfterInsert Event end
            }
            return(bResult);
        }
Ejemplo n.º 12
0
        bool Categories_update_Click(Object Src, EventArgs E)
        {
            string sWhere = "";
            string sSQL   = "";

            bool bResult = Categories_Validate();

            if (bResult)
            {
                if (p_Categories_category_id.Value.Length > 0)
                {
                    sWhere = sWhere + "category_id=" + CCUtility.ToSQL(p_Categories_category_id.Value, FieldTypes.Number);
                }

// Categories Check Event begin
// Categories Check Event end

                if (bResult)
                {
                    sSQL = "update categories set " +
                           "[name]=" + CCUtility.ToSQL(Utility.GetParam("Categories_name"), FieldTypes.Text);


                    sSQL = sSQL + " where " + sWhere;

// Categories Update Event begin
// Categories Update Event end
                    Categories_BeforeSQLExecute(sSQL, "Update");
                    OleDbCommand cmd = new OleDbCommand(sSQL, Utility.Connection);
                    try {
                        cmd.ExecuteNonQuery();
                    } catch (Exception e) {
                        Categories_ValidationSummary.Text   += e.Message;
                        Categories_ValidationSummary.Visible = true;
                        return(false);
                    }
                }

                if (bResult)
                {
// Categories AfterUpdate Event begin
// Categories AfterUpdate Event end
                }
            }
            return(bResult);
        }
        // Orders Action begin

        bool Orders_insert_Click(Object Src, EventArgs E)
        {
            string sSQL    = "";
            bool   bResult = Orders_Validate();

// Orders Check Event begin
// Orders Check Event end

            string p2_member_id = CCUtility.ToSQL(Utility.GetParam("Orders_member_id"), FieldTypes.Number);
            string p2_item_id   = CCUtility.ToSQL(Utility.GetParam("Orders_item_id"), FieldTypes.Number);
            string p2_quantity  = CCUtility.ToSQL(Utility.GetParam("Orders_quantity"), FieldTypes.Number);

// Orders Insert Event begin
// Orders Insert Event end


            if (bResult)
            {
                if (sSQL.Length == 0)
                {
                    sSQL = "insert into orders (" +
                           "member_id," +
                           "item_id," +
                           "quantity)" +
                           " values (" +
                           p2_member_id + "," +
                           p2_item_id + "," +
                           p2_quantity + ")";
                }
                Orders_BeforeSQLExecute(sSQL, "Insert");
                OleDbCommand cmd = new OleDbCommand(sSQL, Utility.Connection);
                try {
                    cmd.ExecuteNonQuery();
                } catch (Exception e) {
                    Orders_ValidationSummary.Text   += e.Message;
                    Orders_ValidationSummary.Visible = true;
                    return(false);
                }

// Orders AfterInsert Event begin
// Orders AfterInsert Event end
            }
            return(bResult);
        }
Ejemplo n.º 14
0
        // Categories Action begin

        bool Categories_insert_Click(Object Src, EventArgs E)
        {
            string sSQL    = "";
            bool   bResult = Categories_Validate();

// Categories Check Event begin
// Categories Check Event end

            string p2_name = CCUtility.ToSQL(Utility.GetParam("Categories_name"), FieldTypes.Text);

// Categories Insert Event begin
// Categories Insert Event end


            if (bResult)
            {
                if (sSQL.Length == 0)
                {
                    sSQL = "insert into categories (" +
                           "name)" +
                           " values (" +
                           p2_name + ")";
                }
                Categories_BeforeSQLExecute(sSQL, "Insert");
                OleDbCommand cmd = new OleDbCommand(sSQL, Utility.Connection);
                try {
                    cmd.ExecuteNonQuery();
                } catch (Exception e) {
                    Categories_ValidationSummary.Text   += e.Message;
                    Categories_ValidationSummary.Visible = true;
                    return(false);
                }

// Categories AfterInsert Event begin
// Categories AfterInsert Event end
            }
            return(bResult);
        }
Ejemplo n.º 15
0
/*===============================
*  Display Record Form
*  -------------------------------*/


        void Member_Show()
        {
            // Member Show begin

            bool ActionInsert = true;

            if (p_Member_member_id.Value.Length > 0)
            {
                string sWhere = "";

                sWhere += "member_id=" + CCUtility.ToSQL(p_Member_member_id.Value, FieldTypes.Number);

// Member Open Event begin
// Member Open Event end
                string           sSQL      = "select * from members where " + sWhere;
                OleDbDataAdapter dsCommand = new OleDbDataAdapter(sSQL, Utility.Connection);
                DataSet          ds        = new DataSet();
                DataRow          row;

                if (dsCommand.Fill(ds, 0, 1, "Member") > 0)
                {
                    row = ds.Tables[0].Rows[0];

                    Member_member_id.Value = CCUtility.GetValue(row, "member_id");


                    Member_member_login.Text = Server.HtmlEncode(CCUtility.GetValue(row, "member_login").ToString());

                    Member_member_login.NavigateUrl = "MyInfo.aspx" + "?" + "";


                    Member_name.Text = Server.HtmlEncode(CCUtility.GetValue(row, "first_name").ToString());



                    Member_last_name.Text = Server.HtmlEncode(CCUtility.GetValue(row, "last_name").ToString());



                    Member_address.Text = Server.HtmlEncode(CCUtility.GetValue(row, "address").ToString());



                    Member_email.Text = Server.HtmlEncode(CCUtility.GetValue(row, "email").ToString());



                    Member_phone.Text = Server.HtmlEncode(CCUtility.GetValue(row, "phone").ToString());



                    ActionInsert = false;

// Member ShowEdit Event begin
// Member ShowEdit Event end
                }
            }

            if (ActionInsert)
            {
                String pValue;

                if (Session["UserID"] != null)
                {
                    pValue = Session["UserID"].ToString();
                }
                else
                {
                    pValue = "";
                } Member_member_id.Value = pValue;
// Member ShowInsert Event begin
// Member ShowInsert Event end
            }



// Member Open Event begin
// Member Open Event end

// Member Show Event begin
// Member Show Event end

            // Member Show end

// Member Close Event begin
// Member Close Event end
        }
/*===============================
*  Display Record Form
*  -------------------------------*/


        void Orders_Show()
        {
            // Orders Show begin
            Utility.buildListBox(Orders_member_id.Items, "select member_id,member_login from members order by 2", "member_id", "member_login", null, "");
            Utility.buildListBox(Orders_item_id.Items, "select item_id,name from items order by 2", "item_id", "name", null, "");

            bool ActionInsert = true;

            if (p_Orders_order_id.Value.Length > 0)
            {
                string sWhere = "";

                sWhere += "order_id=" + CCUtility.ToSQL(p_Orders_order_id.Value, FieldTypes.Number);

// Orders Open Event begin
// Orders Open Event end
                string           sSQL      = "select * from orders where " + sWhere;
                OleDbDataAdapter dsCommand = new OleDbDataAdapter(sSQL, Utility.Connection);
                DataSet          ds        = new DataSet();
                DataRow          row;

                if (dsCommand.Fill(ds, 0, 1, "Orders") > 0)
                {
                    row = ds.Tables[0].Rows[0];

                    Orders_order_id.Text = Server.HtmlEncode(CCUtility.GetValue(row, "order_id").ToString());



                    { string s;
                      s = CCUtility.GetValue(row, "member_id");

                      try { Orders_member_id.SelectedIndex = Orders_member_id.Items.IndexOf(Orders_member_id.Items.FindByValue(s)); }catch {} }



                    { string s;
                      s = CCUtility.GetValue(row, "item_id");

                      try { Orders_item_id.SelectedIndex = Orders_item_id.Items.IndexOf(Orders_item_id.Items.FindByValue(s)); }catch {} }


                    Orders_quantity.Text  = CCUtility.GetValue(row, "quantity");
                    Orders_insert.Visible = false;
                    ActionInsert          = false;

// Orders ShowEdit Event begin
// Orders ShowEdit Event end
                }
            }

            if (ActionInsert)
            {
                String pValue;

                pValue = Utility.GetParam("order_id"); Orders_order_id.Text = pValue;
                pValue = Utility.GetParam("member_id");
                try { Orders_member_id.SelectedIndex = Orders_member_id.Items.IndexOf(Orders_member_id.Items.FindByValue(pValue)); }catch {}

                pValue = Utility.GetParam("item_id");
                try { Orders_item_id.SelectedIndex = Orders_item_id.Items.IndexOf(Orders_item_id.Items.FindByValue(pValue)); }catch {}
                Orders_delete.Visible = false;
                Orders_update.Visible = false;

// Orders ShowInsert Event begin
// Orders ShowInsert Event end
            }



// Orders Open Event begin
// Orders Open Event end

// Orders Show Event begin
// Orders Show Event end

            // Orders Show end

// Orders Close Event begin
// Orders Close Event end
        }
Ejemplo n.º 17
0
/*===============================
*  Display Record Form
*  -------------------------------*/


        void Form_Show()
        {
            // Form Show begin
            Utility.buildListBox(Form_card_type_id.Items, "select card_type_id,name from card_types order by 2", "card_type_id", "name", "", "");

            bool ActionInsert = true;

            if (p_Form_member_id.Value.Length > 0)
            {
                string sWhere = "";

                sWhere += "member_id=" + CCUtility.ToSQL(p_Form_member_id.Value, FieldTypes.Number);

// Form Open Event begin
// Form Open Event end
                string           sSQL      = "select * from members where " + sWhere;
                OleDbDataAdapter dsCommand = new OleDbDataAdapter(sSQL, Utility.Connection);
                DataSet          ds        = new DataSet();
                DataRow          row;

                if (dsCommand.Fill(ds, 0, 1, "Form") > 0)
                {
                    row = ds.Tables[0].Rows[0];

                    Form_member_id.Value = CCUtility.GetValue(row, "member_id");


                    Form_member_login.Text = Server.HtmlEncode(CCUtility.GetValue(row, "member_login").ToString());



                    Form_member_password.Text = CCUtility.GetValue(row, "member_password");
                    Form_name.Text            = CCUtility.GetValue(row, "first_name");
                    Form_last_name.Text       = CCUtility.GetValue(row, "last_name");
                    Form_email.Text           = CCUtility.GetValue(row, "email");
                    Form_address.Text         = CCUtility.GetValue(row, "address");
                    Form_phone.Text           = CCUtility.GetValue(row, "phone");
                    Form_notes.Text           = CCUtility.GetValue(row, "notes");



                    { string s;
                      s = CCUtility.GetValue(row, "card_type_id");

                      try { Form_card_type_id.SelectedIndex = Form_card_type_id.Items.IndexOf(Form_card_type_id.Items.FindByValue(s)); }catch {} }


                    Form_card_number.Text = CCUtility.GetValue(row, "card_number");

                    ActionInsert = false;

// Form ShowEdit Event begin
// Form ShowEdit Event end
                }
            }

            if (ActionInsert)
            {
                String pValue;

                if (Session["UserID"] != null)
                {
                    pValue = Session["UserID"].ToString();
                }
                else
                {
                    pValue = "";
                } Form_member_id.Value = pValue; Form_update.Visible = false;

// Form ShowInsert Event begin
// Form ShowInsert Event end
            }



// Form Open Event begin
// Form Open Event end

// Form Show Event begin
// Form Show Event end

            // Form Show end

// Form Close Event begin
// Form Close Event end
        }
Ejemplo n.º 18
0
/*===============================
*  Display Record Form
*  -------------------------------*/


        void Record_Show()
        {
            // Record Show begin

            bool ActionInsert = true;

            if (p_Record_member_id.Value.Length > 0)
            {
                string sWhere = "";

                sWhere += "member_id=" + CCUtility.ToSQL(p_Record_member_id.Value, FieldTypes.Number);

// Record Open Event begin
// Record Open Event end
                string           sSQL      = "select * from members where " + sWhere;
                OleDbDataAdapter dsCommand = new OleDbDataAdapter(sSQL, Utility.Connection);
                DataSet          ds        = new DataSet();
                DataRow          row;

                if (dsCommand.Fill(ds, 0, 1, "Record") > 0)
                {
                    row = ds.Tables[0].Rows[0];

                    Record_member_id.Value = CCUtility.GetValue(row, "member_id");


                    Record_member_login.Text = Server.HtmlEncode(CCUtility.GetValue(row, "member_login").ToString());

                    Record_member_login.NavigateUrl = "MembersRecord.aspx" + "?" + "member_id=" + Server.UrlEncode(CCUtility.GetValue(row, "member_id").ToString()) + "&" + "";


                    Record_member_level.Text = Server.HtmlEncode(CCUtility.GetValue(row, "member_level").ToString());



                    Record_name.Text = Server.HtmlEncode(CCUtility.GetValue(row, "first_name").ToString());



                    Record_last_name.Text = Server.HtmlEncode(CCUtility.GetValue(row, "last_name").ToString());



                    Record_email.Text = Server.HtmlEncode(CCUtility.GetValue(row, "email").ToString());



                    Record_phone.Text = Server.HtmlEncode(CCUtility.GetValue(row, "phone").ToString());



                    Record_address.Text = Server.HtmlEncode(CCUtility.GetValue(row, "address").ToString());



                    Record_notes.Text = Server.HtmlEncode(CCUtility.GetValue(row, "notes").ToString());



                    ActionInsert = false;

// Record ShowEdit Event begin
// Record ShowEdit Event end
                }
            }

            if (ActionInsert)
            {
// Record ShowInsert Event begin
// Record ShowInsert Event end
            }



// Record Open Event begin
// Record Open Event end

// Record Show Event begin
// Record Show Event end

            // Record Show end

// Record Close Event begin
// Record Close Event end
        }
Ejemplo n.º 19
0
/*===============================
*  Display Record Form
*  -------------------------------*/


        void Rating_Show()
        {
            // Rating Show begin
            Utility.buildListBox(Rating_rating.Items, Rating_rating_lov, null, "");

            bool ActionInsert = true;

            if (p_Rating_item_id.Value.Length > 0)
            {
                string sWhere = "";

                sWhere += "item_id=" + CCUtility.ToSQL(p_Rating_item_id.Value, FieldTypes.Number);

// Rating Open Event begin
// Rating Open Event end
                string           sSQL      = "select * from items where " + sWhere;
                OleDbDataAdapter dsCommand = new OleDbDataAdapter(sSQL, Utility.Connection);
                DataSet          ds        = new DataSet();
                DataRow          row;

                if (dsCommand.Fill(ds, 0, 1, "Rating") > 0)
                {
                    row = ds.Tables[0].Rows[0];

                    Rating_item_id.Value = CCUtility.GetValue(row, "item_id");


                    Rating_rating_view.Text = CCUtility.GetValue(row, "rating");



                    Rating_rating_count_view.Text = Server.HtmlEncode(CCUtility.GetValue(row, "rating_count").ToString());



                    { string s;
                      s = CCUtility.GetValue(row, "rating");

                      try { Rating_rating.SelectedIndex = Rating_rating.Items.IndexOf(Rating_rating.Items.FindByValue(s)); }catch {} }


                    Rating_rating_count.Value = CCUtility.GetValue(row, "rating_count");



                    ActionInsert = false;

// Rating ShowEdit Event begin
// Rating ShowEdit Event end
                }
            }

            if (ActionInsert)
            {
                String pValue;

                pValue = Utility.GetParam("item_id"); Rating_item_id.Value = pValue; Rating_update.Visible = false;

// Rating ShowInsert Event begin
// Rating ShowInsert Event end
            }



// Rating Open Event begin
// Rating Open Event end

// Rating Show Event begin
            if (Int16.Parse(Rating_rating_view.Text) == 0)
            {
                Rating_rating_view.Text       = "Not rated yet";
                Rating_rating_count_view.Text = "";
            }
            else
            {
                Rating_rating_view.Text = "<img src=images/" + System.Math.Round(Double.Parse(Rating_rating.SelectedItem.Value) / Double.Parse(Rating_rating_count.Value)) + "stars.gif>";
            }
// Rating Show Event end

            // Rating Show end

// Rating Close Event begin
// Rating Close Event end
        }
Ejemplo n.º 20
0
/*===============================
*  Display Record Form
*  -------------------------------*/


        void editorials_Show()
        {
            // editorials Show begin
            Utility.buildListBox(editorials_editorial_cat_id.Items, "select editorial_cat_id,editorial_cat_name from editorial_categories order by 2", "editorial_cat_id", "editorial_cat_name", null, "");
            Utility.buildListBox(editorials_item_id.Items, "select item_id,name from items order by 2", "item_id", "name", "", "");

            bool ActionInsert = true;

            if (p_editorials_article_id.Value.Length > 0)
            {
                string sWhere = "";

                sWhere += "article_id=" + CCUtility.ToSQL(p_editorials_article_id.Value, FieldTypes.Number);

// editorials Open Event begin
// editorials Open Event end
                string           sSQL      = "select * from editorials where " + sWhere;
                OleDbDataAdapter dsCommand = new OleDbDataAdapter(sSQL, Utility.Connection);
                DataSet          ds        = new DataSet();
                DataRow          row;

                if (dsCommand.Fill(ds, 0, 1, "editorials") > 0)
                {
                    row = ds.Tables[0].Rows[0];

                    editorials_article_id.Value = CCUtility.GetValue(row, "article_id");


                    editorials_article_desc.Text  = CCUtility.GetValue(row, "article_desc");
                    editorials_article_title.Text = CCUtility.GetValue(row, "article_title");

                    { string s;
                      s = CCUtility.GetValue(row, "editorial_cat_id");

                      try { editorials_editorial_cat_id.SelectedIndex = editorials_editorial_cat_id.Items.IndexOf(editorials_editorial_cat_id.Items.FindByValue(s)); }catch {} }



                    { string s;
                      s = CCUtility.GetValue(row, "item_id");

                      try { editorials_item_id.SelectedIndex = editorials_item_id.Items.IndexOf(editorials_item_id.Items.FindByValue(s)); }catch {} }


                    editorials_insert.Visible = false;
                    ActionInsert = false;

// editorials ShowEdit Event begin
// editorials ShowEdit Event end
                }
            }

            if (ActionInsert)
            {
                String pValue;

                pValue = Utility.GetParam("article_id"); editorials_article_id.Value = pValue; editorials_delete.Visible = false;
                editorials_update.Visible = false;

// editorials ShowInsert Event begin
// editorials ShowInsert Event end
            }



// editorials Open Event begin
// editorials Open Event end

// editorials Show Event begin
// editorials Show Event end

            // editorials Show end

// editorials Close Event begin
// editorials Close Event end
        }
Ejemplo n.º 21
0
/*===============================
*  Display Record Form
*  -------------------------------*/


        void Detail_Show()
        {
            // Detail Show begin

            bool ActionInsert = true;

            if (p_Detail_item_id.Value.Length > 0)
            {
                string sWhere = "";

                sWhere += "item_id=" + CCUtility.ToSQL(p_Detail_item_id.Value, FieldTypes.Number);

// Detail Open Event begin
// Detail Open Event end
                string           sSQL      = "select * from items where " + sWhere;
                OleDbDataAdapter dsCommand = new OleDbDataAdapter(sSQL, Utility.Connection);
                DataSet          ds        = new DataSet();
                DataRow          row;

                if (dsCommand.Fill(ds, 0, 1, "Detail") > 0)
                {
                    row = ds.Tables[0].Rows[0];

                    Detail_item_id.Value = CCUtility.GetValue(row, "item_id");


                    Detail_name.Text = Server.HtmlEncode(CCUtility.GetValue(row, "name").ToString());



                    Detail_author.Text = Server.HtmlEncode(CCUtility.GetValue(row, "author").ToString());



                    Detail_category_id.Text = Server.HtmlEncode(Utility.Dlookup("categories", "name", "category_id=" + CCUtility.ToSQL(CCUtility.GetValue(row, "category_id"), FieldTypes.Number)).ToString());



                    Detail_price.Text = Server.HtmlEncode(CCUtility.GetValue(row, "price").ToString());



                    Detail_image_url.Text = CCUtility.GetValue(row, "image_url");

                    Detail_image_url.NavigateUrl = CCUtility.GetValue(row, "product_url") + "";


                    Detail_notes.Text = CCUtility.GetValue(row, "notes");



                    Detail_product_url.Text = Server.HtmlEncode(CCUtility.GetValue(row, "product_url").ToString());

                    Detail_product_url.NavigateUrl = CCUtility.GetValue(row, "product_url") + "";



                    ActionInsert = false;

// Detail ShowEdit Event begin
// Detail ShowEdit Event end
                }
            }

            if (ActionInsert)
            {
                String pValue;

                pValue = Utility.GetParam("item_id"); Detail_item_id.Value = pValue;
// Detail ShowInsert Event begin
// Detail ShowInsert Event end
            }



// Detail Open Event begin
// Detail Open Event end

// Detail Show Event begin
            Detail_image_url.ImageUrl = Detail_image_url.Text;
            Detail_product_url.Text   = "Review this book on Amazon.com";
// Detail Show Event end

            // Detail Show end

// Detail Close Event begin
// Detail Close Event end
        }
Ejemplo n.º 22
0
        ICollection Orders_CreateDataSource()
        {
            // Orders Show begin
            Orders_sSQL      = "";
            Orders_sCountSQL = "";

            string sWhere = "", sOrder = "";


            bool bReq     = true;
            bool HasParam = false;


            //-------------------------------
            // Build ORDER BY statement
            //-------------------------------
            if (Utility.GetParam("FormOrders_Sorting").Length > 0 && !IsPostBack)
            {
                ViewState["SortColumn"] = Utility.GetParam("FormOrders_Sorting");
                ViewState["SortDir"]    = "ASC";
            }
            if (ViewState["SortColumn"] != null)
            {
                sOrder = " ORDER BY " + ViewState["SortColumn"].ToString() + " " + ViewState["SortDir"].ToString();
            }

            //-------------------------------
            // Build WHERE statement
            //-------------------------------
            System.Collections.Specialized.StringDictionary Params = new System.Collections.Specialized.StringDictionary();


            if (!Params.ContainsKey("member_id"))
            {
                string temp = Utility.GetParam("member_id");
                if (Utility.IsNumeric(null, temp) && temp.Length > 0)
                {
                    temp = CCUtility.ToSQL(temp, FieldTypes.Number);
                }
                else
                {
                    temp = "";
                }
                Params.Add("member_id", temp);
            }

            if (Params["member_id"].Length > 0)
            {
                HasParam = true;
                sWhere  += "o.[member_id]=" + Params["member_id"];
            }
            else
            {
                bReq = false;
            }


            if (HasParam)
            {
                sWhere = " AND (" + sWhere + ")";
            }

            //-------------------------------
            // Build base SQL statement
            //-------------------------------


            Orders_sSQL = "select [o].[item_id] as o_item_id, " +
                          "[o].[member_id] as o_member_id, " +
                          "[o].[order_id] as o_order_id, " +
                          "[o].[quantity] as o_quantity, " +
                          "[i].[item_id] as i_item_id, " +
                          "[i].[name] as i_name " +
                          " from [orders] o, [items] i" +
                          " where [i].[item_id]=o.[item_id]  ";

            //-------------------------------
            //-------------------------------


            //-------------------------------

            //-------------------------------
            // Assemble full SQL statement
            //-------------------------------



            Orders_sSQL = Orders_sSQL + sWhere + sOrder;
            //-------------------------------

            if (!bReq)
            {
                Orders_no_records.Visible = true;

                return(null);
            }
            OleDbDataAdapter command = new OleDbDataAdapter(Orders_sSQL, Utility.Connection);
            DataSet          ds      = new DataSet();

            command.Fill(ds, 0, Orders_PAGENUM, "Orders");
            DataView Source;

            Source = new DataView(ds.Tables[0]);

            if (ds.Tables[0].Rows.Count == 0)
            {
                Orders_no_records.Visible = true;
            }
            else
            {
                Orders_no_records.Visible = false;
            }


            return(Source);
            // Orders Show end
        }
Ejemplo n.º 23
0
        // Members Action begin

        bool Members_insert_Click(Object Src, EventArgs E)
        {
            string sSQL    = "";
            bool   bResult = Members_Validate();

            { int iCount = Utility.DlookupInt("members", "count(*)", "member_login="******"Members_member_login"), FieldTypes.Text));
              if (iCount != 0)
              {
                  Members_ValidationSummary.Visible = true;
                  Members_ValidationSummary.Text   += "The value in field Login* is already in database." + "<br>";
                  bResult = false;
              }
            }

// Members Check Event begin
// Members Check Event end

            string p2_member_login    = CCUtility.ToSQL(Utility.GetParam("Members_member_login"), FieldTypes.Text);
            string p2_member_password = CCUtility.ToSQL(Utility.GetParam("Members_member_password"), FieldTypes.Text);
            string p2_member_level    = CCUtility.ToSQL(Utility.GetParam("Members_member_level"), FieldTypes.Number);
            string p2_name            = CCUtility.ToSQL(Utility.GetParam("Members_name"), FieldTypes.Text);
            string p2_last_name       = CCUtility.ToSQL(Utility.GetParam("Members_last_name"), FieldTypes.Text);
            string p2_email           = CCUtility.ToSQL(Utility.GetParam("Members_email"), FieldTypes.Text);
            string p2_phone           = CCUtility.ToSQL(Utility.GetParam("Members_phone"), FieldTypes.Text);
            string p2_address         = CCUtility.ToSQL(Utility.GetParam("Members_address"), FieldTypes.Text);
            string p2_notes           = CCUtility.ToSQL(Utility.GetParam("Members_notes"), FieldTypes.Text);
            string p2_card_type_id    = CCUtility.ToSQL(Utility.GetParam("Members_card_type_id"), FieldTypes.Number);
            string p2_card_number     = CCUtility.ToSQL(Utility.GetParam("Members_card_number"), FieldTypes.Text);

// Members Insert Event begin
// Members Insert Event end


            if (bResult)
            {
                if (sSQL.Length == 0)
                {
                    sSQL = "insert into members (" +
                           "member_login," +
                           "member_password," +
                           "member_level," +
                           "first_name," +
                           "last_name," +
                           "email," +
                           "phone," +
                           "address," +
                           "notes," +
                           "card_type_id," +
                           "card_number)" +
                           " values (" +
                           p2_member_login + "," +
                           p2_member_password + "," +
                           p2_member_level + "," +
                           p2_name + "," +
                           p2_last_name + "," +
                           p2_email + "," +
                           p2_phone + "," +
                           p2_address + "," +
                           p2_notes + "," +
                           p2_card_type_id + "," +
                           p2_card_number + ")";
                }
                Members_BeforeSQLExecute(sSQL, "Insert");
                OleDbCommand cmd = new OleDbCommand(sSQL, Utility.Connection);
                try {
                    cmd.ExecuteNonQuery();
                } catch (Exception e) {
                    Members_ValidationSummary.Text   += e.Message;
                    Members_ValidationSummary.Visible = true;
                    return(false);
                }

// Members AfterInsert Event begin
// Members AfterInsert Event end
            }
            return(bResult);
        }
Ejemplo n.º 24
0
/*===============================
*  Display Record Form
*  -------------------------------*/


        void Book_Show()
        {
            // Book Show begin
            Utility.buildListBox(Book_category_id.Items, "select category_id,name from categories order by 2", "category_id", "name", null, "");

            bool ActionInsert = true;

            if (p_Book_item_id.Value.Length > 0)
            {
                string sWhere = "";

                sWhere += "item_id=" + CCUtility.ToSQL(p_Book_item_id.Value, FieldTypes.Number);

// Book Open Event begin
// Book Open Event end
                string           sSQL      = "select * from items where " + sWhere;
                OleDbDataAdapter dsCommand = new OleDbDataAdapter(sSQL, Utility.Connection);
                DataSet          ds        = new DataSet();
                DataRow          row;

                if (dsCommand.Fill(ds, 0, 1, "Book") > 0)
                {
                    row = ds.Tables[0].Rows[0];

                    Book_item_id.Value = CCUtility.GetValue(row, "item_id");


                    Book_name.Text   = CCUtility.GetValue(row, "name");
                    Book_author.Text = CCUtility.GetValue(row, "author");

                    { string s;
                      s = CCUtility.GetValue(row, "category_id");

                      try { Book_category_id.SelectedIndex = Book_category_id.Items.IndexOf(Book_category_id.Items.FindByValue(s)); }catch {} }


                    Book_price.Text       = CCUtility.GetValue(row, "price");
                    Book_product_url.Text = CCUtility.GetValue(row, "product_url");
                    Book_image_url.Text   = CCUtility.GetValue(row, "image_url");
                    Book_notes.Text       = CCUtility.GetValue(row, "notes");


                    Book_is_recommended.Checked = CCUtility.GetValue(row, "is_recommended").ToLower().Equals("1".ToLower());

                    Book_insert.Visible = false;
                    ActionInsert        = false;

// Book ShowEdit Event begin
// Book ShowEdit Event end
                }
            }

            if (ActionInsert)
            {
                String pValue;

                pValue = Utility.GetParam("item_id"); Book_item_id.Value = pValue;
                pValue = Utility.GetParam("category_id");
                try { Book_category_id.SelectedIndex = Book_category_id.Items.IndexOf(Book_category_id.Items.FindByValue(pValue)); }catch {}
                Book_delete.Visible = false;
                Book_update.Visible = false;

// Book ShowInsert Event begin
// Book ShowInsert Event end
            }



// Book Open Event begin
// Book Open Event end

// Book Show Event begin
// Book Show Event end

            // Book Show end

// Book Close Event begin
// Book Close Event end
        }
Ejemplo n.º 25
0
/*===============================
*  Display Record Form
*  -------------------------------*/


        void ShoppingCartRecord_Show()
        {
            // ShoppingCartRecord Show begin

            bool ActionInsert = true;

            if (p_ShoppingCartRecord_order_id.Value.Length > 0)
            {
                string sWhere = "";

                sWhere += "order_id=" + CCUtility.ToSQL(p_ShoppingCartRecord_order_id.Value, FieldTypes.Number);

// ShoppingCartRecord Open Event begin
// ShoppingCartRecord Open Event end
                string           sSQL      = "select * from orders where " + sWhere;
                OleDbDataAdapter dsCommand = new OleDbDataAdapter(sSQL, Utility.Connection);
                DataSet          ds        = new DataSet();
                DataRow          row;

                if (dsCommand.Fill(ds, 0, 1, "ShoppingCartRecord") > 0)
                {
                    row = ds.Tables[0].Rows[0];

                    ShoppingCartRecord_order_id.Value = CCUtility.GetValue(row, "order_id");


                    ShoppingCartRecord_member_id.Value = CCUtility.GetValue(row, "member_id");


                    ShoppingCartRecord_item_id.Text = Server.HtmlEncode(Utility.Dlookup("items", "name", "item_id=" + CCUtility.ToSQL(CCUtility.GetValue(row, "item_id"), FieldTypes.Number)).ToString());



                    ShoppingCartRecord_quantity.Text = CCUtility.GetValue(row, "quantity");

                    ActionInsert = false;

// ShoppingCartRecord ShowEdit Event begin
// ShoppingCartRecord ShowEdit Event end
                }
            }

            if (ActionInsert)
            {
                String pValue;

                if (Session["UserID"] != null)
                {
                    pValue = Session["UserID"].ToString();
                }
                else
                {
                    pValue = "";
                } ShoppingCartRecord_member_id.Value = pValue; ShoppingCartRecord_delete.Visible = false;
                ShoppingCartRecord_update.Visible    = false;

// ShoppingCartRecord ShowInsert Event begin
// ShoppingCartRecord ShowInsert Event end
            }



// ShoppingCartRecord Open Event begin
// ShoppingCartRecord Open Event end

// ShoppingCartRecord Show Event begin
// ShoppingCartRecord Show Event end

            // ShoppingCartRecord Show end

// ShoppingCartRecord Close Event begin
// ShoppingCartRecord Close Event end
        }
Ejemplo n.º 26
0
/*===============================
*  Display Record Form
*  -------------------------------*/


        void Members_Show()
        {
            // Members Show begin
            Utility.buildListBox(Members_member_level.Items, Members_member_level_lov, null, "");
            Utility.buildListBox(Members_card_type_id.Items, "select card_type_id,name from card_types order by 2", "card_type_id", "name", "", "");

            bool ActionInsert = true;

            if (p_Members_member_id.Value.Length > 0)
            {
                string sWhere = "";

                sWhere += "member_id=" + CCUtility.ToSQL(p_Members_member_id.Value, FieldTypes.Number);

// Members Open Event begin
// Members Open Event end
                string           sSQL      = "select * from members where " + sWhere;
                OleDbDataAdapter dsCommand = new OleDbDataAdapter(sSQL, Utility.Connection);
                DataSet          ds        = new DataSet();
                DataRow          row;

                if (dsCommand.Fill(ds, 0, 1, "Members") > 0)
                {
                    row = ds.Tables[0].Rows[0];

                    Members_member_id.Value = CCUtility.GetValue(row, "member_id");


                    Members_member_login.Text    = CCUtility.GetValue(row, "member_login");
                    Members_member_password.Text = CCUtility.GetValue(row, "member_password");

                    { string s;
                      s = CCUtility.GetValue(row, "member_level");

                      try { Members_member_level.SelectedIndex = Members_member_level.Items.IndexOf(Members_member_level.Items.FindByValue(s)); }catch {} }


                    Members_name.Text      = CCUtility.GetValue(row, "first_name");
                    Members_last_name.Text = CCUtility.GetValue(row, "last_name");
                    Members_email.Text     = CCUtility.GetValue(row, "email");
                    Members_phone.Text     = CCUtility.GetValue(row, "phone");
                    Members_address.Text   = CCUtility.GetValue(row, "address");
                    Members_notes.Text     = CCUtility.GetValue(row, "notes");



                    { string s;
                      s = CCUtility.GetValue(row, "card_type_id");

                      try { Members_card_type_id.SelectedIndex = Members_card_type_id.Items.IndexOf(Members_card_type_id.Items.FindByValue(s)); }catch {} }


                    Members_card_number.Text = CCUtility.GetValue(row, "card_number");
                    Members_insert.Visible   = false;
                    ActionInsert             = false;

// Members ShowEdit Event begin
// Members ShowEdit Event end
                }
            }

            if (ActionInsert)
            {
                String pValue;

                pValue = Utility.GetParam("member_id"); Members_member_id.Value = pValue;
                pValue = Utility.GetParam("member_login"); Members_member_login.Text = pValue; Members_delete.Visible = false;
                Members_update.Visible = false;

// Members ShowInsert Event begin
// Members ShowInsert Event end
            }



// Members Open Event begin
// Members Open Event end

// Members Show Event begin
// Members Show Event end

            // Members Show end

// Members Close Event begin
// Members Close Event end
        }
Ejemplo n.º 27
0
        ICollection Orders_CreateDataSource()
        {
            // Orders Show begin
            Orders_sSQL      = "";
            Orders_sCountSQL = "";

            string sWhere = "", sOrder = "";


            bool HasParam = false;


            //-------------------------------
            // Build ORDER BY statement
            //-------------------------------
            sOrder = " order by o.order_id Asc";
            if (Utility.GetParam("FormOrders_Sorting").Length > 0 && !IsPostBack)
            {
                ViewState["SortColumn"] = Utility.GetParam("FormOrders_Sorting");
                ViewState["SortDir"]    = "ASC";
            }
            if (ViewState["SortColumn"] != null)
            {
                sOrder = "ORDER BY @SortColumn @SortDir";
            }

            //-------------------------------
            // Build WHERE statement
            //-------------------------------
            System.Collections.Specialized.StringDictionary Params = new System.Collections.Specialized.StringDictionary();


            if (!Params.ContainsKey("item_id"))
            {
                string temp = Utility.GetParam("item_id");
                if (Utility.IsNumeric(null, temp) && temp.Length > 0)
                {
                    temp = CCUtility.ToSQL(temp, FieldTypes.Number);
                }
                else
                {
                    temp = "";
                }
                Params.Add("item_id", temp);
            }

            if (!Params.ContainsKey("member_id"))
            {
                string temp = Utility.GetParam("member_id");
                if (Utility.IsNumeric(null, temp) && temp.Length > 0)
                {
                    temp = CCUtility.ToSQL(temp, FieldTypes.Number);
                }
                else
                {
                    temp = "";
                }
                Params.Add("member_id", temp);
            }

            if (Params["item_id"].Length > 0)
            {
                HasParam = true;
                sWhere  += "o.[item_id]=" + Params["item_id"];
            }
            if (Params["member_id"].Length > 0)
            {
                if (sWhere.Length > 0)
                {
                    sWhere += " and ";
                }
                HasParam = true;
                sWhere  += "o.[member_id]=" + Params["member_id"];
            }


            if (HasParam)
            {
                sWhere = " AND (" + sWhere + ")";
            }

            //-------------------------------
            // Build base SQL statement
            //-------------------------------


            Orders_sSQL = "select [o].[item_id] as o_item_id, " +
                          "[o].[member_id] as o_member_id, " +
                          "[o].[order_id] as o_order_id, " +
                          "[o].[quantity] as o_quantity, " +
                          "[i].[item_id] as i_item_id, " +
                          "[i].[name] as i_name, " +
                          "[m].[member_id] as m_member_id, " +
                          "[m].[member_login] as m_member_login " +
                          " from [orders] o, [items] i, [members] m" +
                          " where [i].[item_id]=o.[item_id] and [m].[member_id]=o.[member_id]  ";

            //-------------------------------
            //-------------------------------


            //-------------------------------

            //-------------------------------
            // Assemble full SQL statement
            //-------------------------------



            Orders_sSQL = Orders_sSQL + sWhere + sOrder;
            if (Orders_sCountSQL.Length == 0)
            {
                int iTmpI = Orders_sSQL.ToLower().IndexOf("select ");
                int iTmpJ = Orders_sSQL.ToLower().LastIndexOf(" from ") - 1;
                Orders_sCountSQL = Orders_sSQL.Replace(Orders_sSQL.Substring(iTmpI + 7, iTmpJ - 6), " count(*) ");
                iTmpI            = Orders_sCountSQL.ToLower().IndexOf(" order by");
                if (iTmpI > 1)
                {
                    Orders_sCountSQL = Orders_sCountSQL.Substring(0, iTmpI);
                }
            }


            //-------------------------------

            OleDbDataAdapter command = new OleDbDataAdapter(Orders_sSQL, Utility.Connection);

            command.SelectCommand.Parameters.Add(new System.Data.OleDb.OleDbParameter("@SortColumn", viewstate["SortColumn"]));
            command.SelectCommand.Parameters.Add(new System.Data.OleDb.OleDbParameter("@SortDir", viewstate["SortDir"]));

            DataSet ds = new DataSet();

            command.Fill(ds, (i_Orders_curpage - 1) * Orders_PAGENUM, Orders_PAGENUM, "Orders");
            OleDbCommand ccommand = new OleDbCommand(Orders_sCountSQL, Utility.Connection);
            int          PageTemp = (int)ccommand.ExecuteScalar();

            Orders_Pager.MaxPage = (PageTemp % Orders_PAGENUM) > 0?(int)(PageTemp / Orders_PAGENUM) + 1:(int)(PageTemp / Orders_PAGENUM);
            bool AllowScroller = Orders_Pager.MaxPage == 1?false:true;

            DataView Source;

            Source = new DataView(ds.Tables[0]);

            if (ds.Tables[0].Rows.Count == 0)
            {
                Orders_no_records.Visible = true;
                AllowScroller             = false;
            }
            else
            {
                Orders_no_records.Visible = false;
                AllowScroller             = AllowScroller && true;
            }

            Orders_Pager.Visible = AllowScroller;
            return(Source);
            // Orders Show end
        }
Ejemplo n.º 28
0
        bool Members_update_Click(Object Src, EventArgs E)
        {
            string sWhere = "";
            string sSQL   = "";

            bool bResult = Members_Validate();

            if (bResult)
            {
                if (p_Members_member_id.Value.Length > 0)
                {
                    sWhere = sWhere + "member_id=" + CCUtility.ToSQL(p_Members_member_id.Value, FieldTypes.Number);
                }

                { int iCount = Utility.DlookupInt("members", "count(*)", "member_login="******"Members_member_login"), FieldTypes.Text) + " and not(" + sWhere + ")");
                  if (iCount != 0)
                  {
                      Members_ValidationSummary.Visible = true;
                      Members_ValidationSummary.Text   += "The value in field Login* is already in database." + "<br>";
                      bResult = false;
                  }
                }

// Members Check Event begin
// Members Check Event end

                if (bResult)
                {
                    sSQL = "update members set " +
                           "[member_login]=" + CCUtility.ToSQL(Utility.GetParam("Members_member_login"), FieldTypes.Text) +
                           ",[member_password]=" + CCUtility.ToSQL(Utility.GetParam("Members_member_password"), FieldTypes.Text) +
                           ",[member_level]=" + CCUtility.ToSQL(Utility.GetParam("Members_member_level"), FieldTypes.Number) +
                           ",[first_name]=" + CCUtility.ToSQL(Utility.GetParam("Members_name"), FieldTypes.Text) +
                           ",[last_name]=" + CCUtility.ToSQL(Utility.GetParam("Members_last_name"), FieldTypes.Text) +
                           ",[email]=" + CCUtility.ToSQL(Utility.GetParam("Members_email"), FieldTypes.Text) +
                           ",[phone]=" + CCUtility.ToSQL(Utility.GetParam("Members_phone"), FieldTypes.Text) +
                           ",[address]=" + CCUtility.ToSQL(Utility.GetParam("Members_address"), FieldTypes.Text) +
                           ",[notes]=" + CCUtility.ToSQL(Utility.GetParam("Members_notes"), FieldTypes.Text) +
                           ",[card_type_id]=" + CCUtility.ToSQL(Utility.GetParam("Members_card_type_id"), FieldTypes.Number) +
                           ",[card_number]=" + CCUtility.ToSQL(Utility.GetParam("Members_card_number"), FieldTypes.Text);


                    sSQL = sSQL + " where " + sWhere;

// Members Update Event begin
// Members Update Event end
                    Members_BeforeSQLExecute(sSQL, "Update");
                    OleDbCommand cmd = new OleDbCommand(sSQL, Utility.Connection);
                    try {
                        cmd.ExecuteNonQuery();
                    } catch (Exception e) {
                        Members_ValidationSummary.Text   += e.Message;
                        Members_ValidationSummary.Visible = true;
                        return(false);
                    }
                }

                if (bResult)
                {
// Members AfterUpdate Event begin
// Members AfterUpdate Event end
                }
            }
            return(bResult);
        }
Ejemplo n.º 29
0
        ICollection Total_CreateDataSource()
        {
            // Total Show begin
            Total_sSQL      = "";
            Total_sCountSQL = "";

            string sWhere = "", sOrder = "";


            bool bReq     = true;
            bool HasParam = false;


            //-------------------------------
            // Build WHERE statement
            //-------------------------------
            System.Collections.Specialized.StringDictionary Params = new System.Collections.Specialized.StringDictionary();


            if (!Params.ContainsKey("UserID"))
            {
                object Temp = Session["UserID"];
                string temp;
                if (Temp == null)
                {
                    temp = "";
                }
                else
                {
                    temp = Temp.ToString();
                }

                if (Utility.IsNumeric(null, temp) && temp.Length > 0)
                {
                    temp = CCUtility.ToSQL(temp, FieldTypes.Number);
                }
                else
                {
                    temp = "";
                }
                Params.Add("UserID", temp);
            }

            if (Params["UserID"].Length > 0)
            {
                HasParam = true;
                sWhere  += "[member_id]=" + Params["UserID"];
            }
            else
            {
                bReq = false;
            }


            if (HasParam)
            {
                sWhere = " AND (" + sWhere + ")";
            }

            //-------------------------------
            // Build base SQL statement
            //-------------------------------


            Total_sSQL = "SELECT member_id, sum(quantity*price) as sub_total FROM items, orders WHERE orders.item_id=items.item_id";
            sOrder     = " GROUP BY member_id";

            //-------------------------------
            //-------------------------------


            //-------------------------------

            //-------------------------------
            // Assemble full SQL statement
            //-------------------------------



            Total_sSQL = Total_sSQL + sWhere + sOrder;
            //-------------------------------

            if (!bReq)
            {
                Total_no_records.Visible = true;

                return(null);
            }
            OleDbDataAdapter command = new OleDbDataAdapter(Total_sSQL, Utility.Connection);
            DataSet          ds      = new DataSet();

            command.Fill(ds, 0, Total_PAGENUM, "Total");
            DataView Source;

            Source = new DataView(ds.Tables[0]);

            if (ds.Tables[0].Rows.Count == 0)
            {
                Total_no_records.Visible = true;
            }
            else
            {
                Total_no_records.Visible = false;
            }


            return(Source);
            // Total Show end
        }
Ejemplo n.º 30
0
        ICollection Items_CreateDataSource()
        {
            // Items Show begin
            Items_sSQL      = "";
            Items_sCountSQL = "";

            string sWhere = "", sOrder = "";


            bool HasParam = false;


            //-------------------------------
            // Build ORDER BY statement
            //-------------------------------
            if (Utility.GetParam("FormItems_Sorting").Length > 0 && !IsPostBack)
            {
                ViewState["SortColumn"] = Utility.GetParam("FormItems_Sorting");
                ViewState["SortDir"]    = "ASC";
            }
            if (ViewState["SortColumn"] != null)
            {
                sOrder = "";
            }

            //-------------------------------
            // Build WHERE statement
            //-------------------------------
            System.Collections.Specialized.StringDictionary Params = new System.Collections.Specialized.StringDictionary();


            if (!Params.ContainsKey("category_id"))
            {
                string temp = Utility.GetParam("category_id");
                if (Utility.IsNumeric(null, temp) && temp.Length > 0)
                {
                    temp = CCUtility.ToSQL(temp, FieldTypes.Number);
                }
                else
                {
                    temp = "";
                }
                Params.Add("category_id", temp);
            }

            if (!Params.ContainsKey("is_recommended"))
            {
                string temp = Utility.GetParam("is_recommended");
                if (Utility.IsNumeric(null, temp) && temp.Length > 0)
                {
                    temp = CCUtility.ToSQL(temp, FieldTypes.Number);
                }
                else
                {
                    temp = "";
                }
                Params.Add("is_recommended", temp);
            }

            if (Params["category_id"].Length > 0)
            {
                HasParam = true;
                sWhere  += "i.[category_id]=" + Params["category_id"];
            }
            if (Params["is_recommended"].Length > 0)
            {
                if (sWhere.Length > 0)
                {
                    sWhere += " and ";
                }
                HasParam = true;
                sWhere  += "i.[is_recommended]=" + Params["is_recommended"];
            }


            if (HasParam)
            {
                sWhere = " AND (" + sWhere + ")";
            }

            //-------------------------------
            // Build base SQL statement
            //-------------------------------


            Items_sSQL = "select [i].[author] as i_author, " +
                         "[i].[category_id] as i_category_id, " +
                         "[i].[is_recommended] as i_is_recommended, " +
                         "[i].[item_id] as i_item_id, " +
                         "[i].[name] as i_name, " +
                         "[i].[price] as i_price, " +
                         "[c].[category_id] as c_category_id, " +
                         "[c].[name] as c_name " +
                         " from [items] i, [categories] c" +
                         " where [c].[category_id]=i.[category_id]  ";

            //-------------------------------
            //-------------------------------


            //-------------------------------

            //-------------------------------
            // Assemble full SQL statement
            //-------------------------------



            Items_sSQL = Items_sSQL + sWhere + sOrder;
            if (Items_sCountSQL.Length == 0)
            {
                int iTmpI = Items_sSQL.ToLower().IndexOf("select ");
                int iTmpJ = Items_sSQL.ToLower().LastIndexOf(" from ") - 1;
                Items_sCountSQL = Items_sSQL.Replace(Items_sSQL.Substring(iTmpI + 7, iTmpJ - 6), " count(*) ");
                iTmpI           = Items_sCountSQL.ToLower().IndexOf(" order by");
                if (iTmpI > 1)
                {
                    Items_sCountSQL = Items_sCountSQL.Substring(0, iTmpI);
                }
            }


            //-------------------------------

            OleDbDataAdapter command = new OleDbDataAdapter(Items_sSQL, Utility.Connection);
            DataSet          ds      = new DataSet();

            command.Fill(ds, (i_Items_curpage - 1) * Items_PAGENUM, Items_PAGENUM, "Items");
            OleDbCommand ccommand = new OleDbCommand(Items_sCountSQL, Utility.Connection);
            int          PageTemp = (int)ccommand.ExecuteScalar();

            Items_Pager.MaxPage = (PageTemp % Items_PAGENUM) > 0?(int)(PageTemp / Items_PAGENUM) + 1:(int)(PageTemp / Items_PAGENUM);
            bool AllowScroller = Items_Pager.MaxPage == 1?false:true;

            DataView Source;

            Source = new DataView(ds.Tables[0]);

            if (ds.Tables[0].Rows.Count == 0)
            {
                Items_no_records.Visible = true;
                AllowScroller            = false;
            }
            else
            {
                Items_no_records.Visible = false;
                AllowScroller            = AllowScroller && true;
            }

            Items_Pager.Visible = AllowScroller;
            return(Source);
            // Items Show end
        }