//=============================== // ShoppingCart Show begin protected void Page_Load(object sender, EventArgs e) { Utility = new CCUtility(this); //=============================== // ShoppingCart Open Event begin // ShoppingCart Open Event end //=============================== //=============================== // ShoppingCart OpenAnyPage Event begin // ShoppingCart OpenAnyPage Event end //=============================== // //=============================== // ShoppingCart PageSecurity begin Utility.CheckSecurity(1); // ShoppingCart PageSecurity end //=============================== if (!IsPostBack) { p_Items_order_id.Value = Utility.GetParam("order_id"); if (Session["UserID"] != null) { p_Member_member_id.Value = Session["UserID"].ToString(); } else { p_Member_member_id.Value = ""; } Page_Show(sender, e); } }
bool ShoppingCartRecord_update_Click(Object Src, EventArgs E) { string sWhere = ""; string sSQL = ""; bool bResult = ShoppingCartRecord_Validate(); if (bResult) { if (p_ShoppingCartRecord_order_id.Value.Length > 0) { sWhere = sWhere + "order_id=" + CCUtility.ToSQL(p_ShoppingCartRecord_order_id.Value, FieldTypes.Number); } // ShoppingCartRecord Check Event begin // ShoppingCartRecord Check Event end if (bResult) { sSQL = "update orders set " + "[member_id]=" + CCUtility.ToSQL(Utility.GetParam("ShoppingCartRecord_member_id"), FieldTypes.Number) + ",[quantity]=" + CCUtility.ToSQL(Utility.GetParam("ShoppingCartRecord_quantity"), FieldTypes.Number); sSQL = sSQL + " where " + sWhere; // ShoppingCartRecord Update Event begin // ShoppingCartRecord Update Event end ShoppingCartRecord_BeforeSQLExecute(sSQL, "Update"); OleDbCommand cmd = new OleDbCommand(sSQL, Utility.Connection); try { cmd.ExecuteNonQuery(); } catch (Exception e) { ShoppingCartRecord_ValidationSummary.Text += e.Message; ShoppingCartRecord_ValidationSummary.Visible = true; return(false); } } if (bResult) { // ShoppingCartRecord AfterUpdate Event begin // ShoppingCartRecord AfterUpdate Event end } } return(bResult); }
void Login_login_Click(Object Src, EventArgs E) { if (Login_logged) { // Login Logout begin // Login OnLogout Event begin // Login OnLogout Event end Login_logged = false; Session["UserID"] = 0; Session["UserRights"] = 0; Login_Show(); // Login Logout end } else { // Login Login begin int iPassed = Convert.ToInt32(Utility.Dlookup("members", "count(*)", "member_login ='******' and member_password='******'")); if (iPassed > 0) { // Login OnLogin Event begin // Login OnLogin Event end Login_message.Visible = false; Session["UserID"] = Convert.ToInt32(Utility.Dlookup("members", "member_id", "member_login ='******' and member_password='******'")); Login_logged = true; Session["UserRights"] = Convert.ToInt32(Utility.Dlookup("members", "member_level", "member_login ='******' and member_password='******'")); string sQueryString = Utility.GetParam("querystring"); string sPage = Utility.GetParam("ret_page"); if (!sPage.Equals(Request.ServerVariables["SCRIPT_NAME"]) && sPage.Length > 0) { Response.Redirect(sPage + "?" + sQueryString); } else { Response.Redirect(Login_FormAction); } } else { Login_message.Visible = true; } // Login Login end } }
// OrdersGrid Show end // End of Login form void Search_Show() { // Search Open Event begin // Search Open Event end // Search Show begin Utility.buildListBox(Search_item_id.Items, "select item_id,name from items order by 2", "item_id", "name", "All", ""); Utility.buildListBox(Search_member_id.Items, "select member_id,member_login from members order by 2", "member_id", "member_login", "All", ""); string s; s = Utility.GetParam("item_id"); try { Search_item_id.SelectedIndex = Search_item_id.Items.IndexOf(Search_item_id.Items.FindByValue(s)); }catch {} s = Utility.GetParam("member_id"); try { Search_member_id.SelectedIndex = Search_member_id.Items.IndexOf(Search_member_id.Items.FindByValue(s)); }catch {} // Search Show Event begin // Search Show Event end // Search Show end // Search Close Event begin // Search Close Event end }
// AdminBooks Show end // End of Login form void Search_Show() { // Search Open Event begin // Search Open Event end // Search Show begin Utility.buildListBox(Search_category_id.Items, "select category_id,name from categories order by 2", "category_id", "name", "All", ""); Utility.buildListBox(Search_is_recommended.Items, Search_is_recommended_lov, null, ""); string s; s = Utility.GetParam("category_id"); try { Search_category_id.SelectedIndex = Search_category_id.Items.IndexOf(Search_category_id.Items.FindByValue(s)); }catch {} s = Utility.GetParam("is_recommended"); try { Search_is_recommended.SelectedIndex = Search_is_recommended.Items.IndexOf(Search_is_recommended.Items.FindByValue(s)); }catch {} // Search Show Event begin // Search Show Event end // Search Show end // Search Close Event begin // Search Close Event end }
// MembersGrid Show end // End of Login form void Search_Show() { // Search Open Event begin // Search Open Event end // Search Show begin string s; s = Utility.GetParam("name"); Search_name.Text = s; // Search Show Event begin // Search Show Event end // Search Show end // Search Close Event begin // Search Close Event end }
//=============================== // Books Show begin protected void Page_Load(object sender, EventArgs e) { Utility = new CCUtility(this); //=============================== // Books Open Event begin // Books Open Event end //=============================== //=============================== // Books OpenAnyPage Event begin // Books OpenAnyPage Event end //=============================== // //=============================== // Books PageSecurity begin // Books PageSecurity end //=============================== if (!IsPostBack) { p_Total_item_id.Value = Utility.GetParam("item_id"); Page_Show(sender, e); } }
//=============================== // ShoppingCartRecord Show begin protected void Page_Load(object sender, EventArgs e) { Utility=new CCUtility(this); //=============================== // ShoppingCartRecord Open Event begin // ShoppingCartRecord Open Event end //=============================== //=============================== // ShoppingCartRecord OpenAnyPage Event begin // ShoppingCartRecord OpenAnyPage Event end //=============================== // //=============================== // ShoppingCartRecord PageSecurity begin Utility.CheckSecurity(1); // ShoppingCartRecord PageSecurity end //=============================== if (!IsPostBack){ p_ShoppingCartRecord_order_id.Value = Utility.GetParam("order_id");Page_Show(sender, e); } }
//=============================== // EditorialsGrid Show begin protected void Page_Load(object sender, EventArgs e) { Utility = new CCUtility(this); //=============================== // EditorialsGrid Open Event begin // EditorialsGrid Open Event end //=============================== //=============================== // EditorialsGrid OpenAnyPage Event begin // EditorialsGrid OpenAnyPage Event end //=============================== // //=============================== // EditorialsGrid PageSecurity begin Utility.CheckSecurity(2); // EditorialsGrid PageSecurity end //=============================== if (!IsPostBack) { p_editorials_article_id.Value = Utility.GetParam("article_id"); Page_Show(sender, e); } }
//=============================== // EditorialsRecord Show begin protected void Page_Load(object sender, EventArgs e) { Utility=new CCUtility(this); //=============================== // EditorialsRecord Open Event begin // EditorialsRecord Open Event end //=============================== //=============================== // EditorialsRecord OpenAnyPage Event begin // EditorialsRecord OpenAnyPage Event end //=============================== // //=============================== // EditorialsRecord PageSecurity begin Utility.CheckSecurity(2); // EditorialsRecord PageSecurity end //=============================== if (!IsPostBack){ p_editorials_article_id.Value = Utility.GetParam("article_id");Page_Show(sender, e); } }
//=============================== // BookMaint Show begin protected void Page_Load(object sender, EventArgs e) { Utility=new CCUtility(this); //=============================== // BookMaint Open Event begin // BookMaint Open Event end //=============================== //=============================== // BookMaint OpenAnyPage Event begin // BookMaint OpenAnyPage Event end //=============================== // //=============================== // BookMaint PageSecurity begin Utility.CheckSecurity(2); // BookMaint PageSecurity end //=============================== if (!IsPostBack){ p_Book_item_id.Value = Utility.GetParam("item_id");Page_Show(sender, e); } }
//=============================== // ShoppingCartRecord Show begin protected void Page_Load(object sender, EventArgs e) { Utility = new CCUtility(this); //=============================== // ShoppingCartRecord Open Event begin // ShoppingCartRecord Open Event end //=============================== //=============================== // ShoppingCartRecord OpenAnyPage Event begin // ShoppingCartRecord OpenAnyPage Event end //=============================== // //=============================== // ShoppingCartRecord PageSecurity begin Utility.CheckSecurity(1); // ShoppingCartRecord PageSecurity end //=============================== if (!IsPostBack) { p_ShoppingCartRecord_order_id.Value = Utility.GetParam("order_id"); Page_Show(sender, e); } }
//=============================== // CardTypesRecord Show begin protected void Page_Load(object sender, EventArgs e) { Utility=new CCUtility(this); //=============================== // CardTypesRecord Open Event begin // CardTypesRecord Open Event end //=============================== //=============================== // CardTypesRecord OpenAnyPage Event begin // CardTypesRecord OpenAnyPage Event end //=============================== // //=============================== // CardTypesRecord PageSecurity begin Utility.CheckSecurity(2); // CardTypesRecord PageSecurity end //=============================== if (!IsPostBack){ p_CardTypes_card_type_id.Value = Utility.GetParam("card_type_id");Page_Show(sender, e); } }
//=============================== // CategoriesRecord Show begin protected void Page_Load(object sender, EventArgs e) { Utility = new CCUtility(this); //=============================== // CategoriesRecord Open Event begin // CategoriesRecord Open Event end //=============================== //=============================== // CategoriesRecord OpenAnyPage Event begin // CategoriesRecord OpenAnyPage Event end //=============================== // //=============================== // CategoriesRecord PageSecurity begin Utility.CheckSecurity(2); // CategoriesRecord PageSecurity end //=============================== if (!IsPostBack) { p_Categories_category_id.Value = Utility.GetParam("category_id"); Page_Show(sender, e); } }
/*=============================== * 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 }
// Reg Action begin bool Reg_insert_Click(Object Src, EventArgs E) { string sSQL = ""; bool bResult = Reg_Validate(); { int iCount = Utility.DlookupInt("members", "count(*)", "member_login="******"Reg_member_login"), FieldTypes.Text)); if (iCount != 0) { Reg_ValidationSummary.Visible = true; Reg_ValidationSummary.Text += "The value in field Login* is already in database." + "<br>"; bResult = false; } } // Reg Check Event begin if (Reg_member_password.Text != Reg_member_password2.Text) { Reg_ValidationSummary.Text += "Password and Confirm Password fields don't match" + "<br>"; Reg_ValidationSummary.Visible = true; bResult = false; } // Reg Check Event end string p2_member_login = CCUtility.ToSQL(Utility.GetParam("Reg_member_login"), FieldTypes.Text); string p2_member_password = CCUtility.ToSQL(Utility.GetParam("Reg_member_password"), FieldTypes.Text); string p2_first_name = CCUtility.ToSQL(Utility.GetParam("Reg_first_name"), FieldTypes.Text); string p2_last_name = CCUtility.ToSQL(Utility.GetParam("Reg_last_name"), FieldTypes.Text); string p2_email = CCUtility.ToSQL(Utility.GetParam("Reg_email"), FieldTypes.Text); string p2_address = CCUtility.ToSQL(Utility.GetParam("Reg_address"), FieldTypes.Text); string p2_phone = CCUtility.ToSQL(Utility.GetParam("Reg_phone"), FieldTypes.Text); string p2_card_type_id = CCUtility.ToSQL(Utility.GetParam("Reg_card_type_id"), FieldTypes.Number); string p2_card_number = CCUtility.ToSQL(Utility.GetParam("Reg_card_number"), FieldTypes.Text); // Reg Insert Event begin // Reg Insert Event end if (bResult) { if (sSQL.Length == 0) { sSQL = "insert into members (" + "member_login," + "member_password," + "first_name," + "last_name," + "email," + "address," + "phone," + "card_type_id," + "card_number)" + " values (" + p2_member_login + "," + p2_member_password + "," + p2_first_name + "," + p2_last_name + "," + p2_email + "," + p2_address + "," + p2_phone + "," + p2_card_type_id + "," + p2_card_number + ")"; } Reg_BeforeSQLExecute(sSQL, "Insert"); OleDbCommand cmd = new OleDbCommand(sSQL, Utility.Connection); try { cmd.ExecuteNonQuery(); } catch (Exception e) { Reg_ValidationSummary.Text += e.Message; Reg_ValidationSummary.Visible = true; return(false); } // Reg AfterInsert Event begin // Reg AfterInsert Event end } return(bResult); }
ICollection Categories_CreateDataSource() { // Categories Show begin Categories_sSQL = ""; Categories_sCountSQL = ""; string sWhere = "", sOrder = ""; bool HasParam = false; //------------------------------- // Build ORDER BY statement //------------------------------- sOrder = " order by c.name Asc"; if (Utility.GetParam("FormCategories_Sorting").Length > 0 && !IsPostBack) { ViewState["SortColumn"] = Utility.GetParam("FormCategories_Sorting"); ViewState["SortDir"] = "ASC"; } if (ViewState["SortColumn"] != null) { sOrder = " ORDER BY " + ViewState["SortColumn"].ToString() + " " + ViewState["SortDir"].ToString(); } System.Collections.Specialized.StringDictionary Params = new System.Collections.Specialized.StringDictionary(); //------------------------------- // Build base SQL statement //------------------------------- Categories_sSQL = "select [c].[category_id] as c_category_id, " + "[c].[name] as c_name " + " from [categories] c "; //------------------------------- //------------------------------- //------------------------------- //------------------------------- // Assemble full SQL statement //------------------------------- Categories_sSQL = Categories_sSQL + sWhere + sOrder; if (Categories_sCountSQL.Length == 0) { int iTmpI = Categories_sSQL.ToLower().IndexOf("select "); int iTmpJ = Categories_sSQL.ToLower().LastIndexOf(" from ") - 1; Categories_sCountSQL = Categories_sSQL.Replace(Categories_sSQL.Substring(iTmpI + 7, iTmpJ - 6), " count(*) "); iTmpI = Categories_sCountSQL.ToLower().IndexOf(" order by"); if (iTmpI > 1) { Categories_sCountSQL = Categories_sCountSQL.Substring(0, iTmpI); } } //------------------------------- OleDbDataAdapter command = new OleDbDataAdapter(Categories_sSQL, Utility.Connection); DataSet ds = new DataSet(); command.Fill(ds, (i_Categories_curpage - 1) * Categories_PAGENUM, Categories_PAGENUM, "Categories"); OleDbCommand ccommand = new OleDbCommand(Categories_sCountSQL, Utility.Connection); int PageTemp = (int)ccommand.ExecuteScalar(); Categories_Pager.MaxPage = (PageTemp % Categories_PAGENUM) > 0?(int)(PageTemp / Categories_PAGENUM) + 1:(int)(PageTemp / Categories_PAGENUM); bool AllowScroller = Categories_Pager.MaxPage == 1?false:true; DataView Source; Source = new DataView(ds.Tables[0]); if (ds.Tables[0].Rows.Count == 0) { Categories_no_records.Visible = true; AllowScroller = false; } else { Categories_no_records.Visible = false; AllowScroller = AllowScroller && true; } Categories_Pager.Visible = AllowScroller; return(Source); // Categories Show end }
//=============================== // MembersInfo Show begin protected void Page_Load(object sender, EventArgs e) { Utility=new CCUtility(this); //=============================== // MembersInfo Open Event begin // MembersInfo Open Event end //=============================== //=============================== // MembersInfo OpenAnyPage Event begin // MembersInfo OpenAnyPage Event end //=============================== // //=============================== // MembersInfo PageSecurity begin Utility.CheckSecurity(2); // MembersInfo PageSecurity end //=============================== if (!IsPostBack){ p_Record_member_id.Value = Utility.GetParam("member_id"); p_Orders_order_id.Value = Utility.GetParam("order_id");Page_Show(sender, e); } }
/*=============================== * 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 }
ICollection Results_CreateDataSource() { // Results Show begin Results_sSQL = ""; Results_sCountSQL = ""; string sWhere = "", sOrder = ""; bool HasParam = false; //------------------------------- // Build ORDER BY statement //------------------------------- sOrder = " order by i.name Asc"; //------------------------------- // Build WHERE statement //------------------------------- System.Collections.Specialized.StringDictionary Params = new System.Collections.Specialized.StringDictionary(); if (!Params.ContainsKey("author")) { string temp = Utility.GetParam("author"); Params.Add("author", temp); } 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("name")) { string temp = Utility.GetParam("name"); Params.Add("name", temp); } if (!Params.ContainsKey("pricemax")) { string temp = Utility.GetParam("pricemax"); if (Utility.IsNumeric(null, temp) && temp.Length > 0) { temp = CCUtility.ToSQL(temp, FieldTypes.Number); } else { temp = ""; } Params.Add("pricemax", temp); } if (!Params.ContainsKey("pricemin")) { string temp = Utility.GetParam("pricemin"); if (Utility.IsNumeric(null, temp) && temp.Length > 0) { temp = CCUtility.ToSQL(temp, FieldTypes.Number); } else { temp = ""; } Params.Add("pricemin", temp); } if (Params["author"].Length > 0) { HasParam = true; sWhere += "i.[author] like '%" + Params["author"].Replace("'", "''") + "%'"; } if (Params["category_id"].Length > 0) { if (sWhere.Length > 0) { sWhere += " and "; } HasParam = true; sWhere += "i.[category_id]=" + Params["category_id"]; } if (Params["name"].Length > 0) { if (sWhere.Length > 0) { sWhere += " and "; } HasParam = true; sWhere += "i.[name] like '%" + Params["name"].Replace("'", "''") + "%'"; } if (Params["pricemax"].Length > 0) { if (sWhere.Length > 0) { sWhere += " and "; } HasParam = true; sWhere += "i.[price]<" + Params["pricemax"]; } if (Params["pricemin"].Length > 0) { if (sWhere.Length > 0) { sWhere += " and "; } HasParam = true; sWhere += "i.[price]>" + Params["pricemin"]; } if (HasParam) { sWhere = " AND (" + sWhere + ")"; } //------------------------------- // Build base SQL statement //------------------------------- Results_sSQL = "select [i].[author] as i_author, " + "[i].[category_id] as i_category_id, " + "[i].[image_url] as i_image_url, " + "[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 //------------------------------- Results_sSQL = Results_sSQL + sWhere + sOrder; if (Results_sCountSQL.Length == 0) { int iTmpI = Results_sSQL.ToLower().IndexOf("select "); int iTmpJ = Results_sSQL.ToLower().LastIndexOf(" from ") - 1; Results_sCountSQL = Results_sSQL.Replace(Results_sSQL.Substring(iTmpI + 7, iTmpJ - 6), " count(*) "); iTmpI = Results_sCountSQL.ToLower().IndexOf(" order by"); if (iTmpI > 1) { Results_sCountSQL = Results_sCountSQL.Substring(0, iTmpI); } } //------------------------------- OleDbDataAdapter command = new OleDbDataAdapter(Results_sSQL, Utility.Connection); DataSet ds = new DataSet(); command.Fill(ds, (i_Results_curpage - 1) * Results_PAGENUM, Results_PAGENUM, "Results"); OleDbCommand ccommand = new OleDbCommand(Results_sCountSQL, Utility.Connection); int PageTemp = (int)ccommand.ExecuteScalar(); Results_Pager.MaxPage = (PageTemp % Results_PAGENUM) > 0?(int)(PageTemp / Results_PAGENUM) + 1:(int)(PageTemp / Results_PAGENUM); bool AllowScroller = Results_Pager.MaxPage == 1?false:true; DataView Source; Source = new DataView(ds.Tables[0]); if (ds.Tables[0].Rows.Count == 0) { Results_no_records.Visible = true; AllowScroller = false; } else { Results_no_records.Visible = false; AllowScroller = AllowScroller && true; } Results_Pager.Visible = AllowScroller; return(Source); // Results Show end }
/*=============================== * 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 }
//=============================== // BookDetail Show begin protected void Page_Load(object sender, EventArgs e) { Utility=new CCUtility(this); //=============================== // BookDetail Open Event begin // BookDetail Open Event end //=============================== //=============================== // BookDetail OpenAnyPage Event begin // BookDetail OpenAnyPage Event end //=============================== // //=============================== // BookDetail PageSecurity begin Utility.CheckSecurity(1); // BookDetail PageSecurity end //=============================== if (!IsPostBack){ p_Detail_item_id.Value = Utility.GetParam("item_id"); p_Order_order_id.Value = Utility.GetParam("order_id"); p_Rating_item_id.Value = Utility.GetParam("item_id");Page_Show(sender, e); } }
/*=============================== * 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 }
ICollection editorial_categories_CreateDataSource() { // editorial_categories Show begin editorial_categories_sSQL = ""; editorial_categories_sCountSQL = ""; string sWhere = "", sOrder = ""; bool HasParam = false; //------------------------------- // Build ORDER BY statement //------------------------------- sOrder = " order by e.editorial_cat_name Asc"; if (Utility.GetParam("Formeditorial_categories_Sorting").Length > 0 && !IsPostBack) { ViewState["SortColumn"] = Utility.GetParam("Formeditorial_categories_Sorting"); ViewState["SortDir"] = "ASC"; } if (ViewState["SortColumn"] != null) { sOrder = "ORDER BY @SortColumn @SortDir"; } System.Collections.Specialized.StringDictionary Params = new System.Collections.Specialized.StringDictionary(); //------------------------------- // Build base SQL statement //------------------------------- editorial_categories_sSQL = "select [e].[editorial_cat_id] as e_editorial_cat_id, " + "[e].[editorial_cat_name] as e_editorial_cat_name " + " from [editorial_categories] e "; //------------------------------- //------------------------------- //------------------------------- //------------------------------- // Assemble full SQL statement //------------------------------- editorial_categories_sSQL = editorial_categories_sSQL + sWhere + sOrder; if (editorial_categories_sCountSQL.Length == 0) { int iTmpI = editorial_categories_sSQL.ToLower().IndexOf("select "); int iTmpJ = editorial_categories_sSQL.ToLower().LastIndexOf(" from ") - 1; editorial_categories_sCountSQL = editorial_categories_sSQL.Replace(editorial_categories_sSQL.Substring(iTmpI + 7, iTmpJ - 6), " count(*) "); iTmpI = editorial_categories_sCountSQL.ToLower().IndexOf(" order by"); if (iTmpI > 1) { editorial_categories_sCountSQL = editorial_categories_sCountSQL.Substring(0, iTmpI); } } //------------------------------- OleDbDataAdapter command = new OleDbDataAdapter(editorial_categories_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_editorial_categories_curpage - 1) * editorial_categories_PAGENUM, editorial_categories_PAGENUM, "editorial_categories"); OleDbCommand ccommand = new OleDbCommand(editorial_categories_sCountSQL, Utility.Connection); int PageTemp = (int)ccommand.ExecuteScalar(); editorial_categories_Pager.MaxPage = (PageTemp % editorial_categories_PAGENUM) > 0?(int)(PageTemp / editorial_categories_PAGENUM) + 1:(int)(PageTemp / editorial_categories_PAGENUM); bool AllowScroller = editorial_categories_Pager.MaxPage == 1?false:true; DataView Source; Source = new DataView(ds.Tables[0]); if (ds.Tables[0].Rows.Count == 0) { editorial_categories_no_records.Visible = true; AllowScroller = false; } else { editorial_categories_no_records.Visible = false; AllowScroller = AllowScroller && true; } editorial_categories_Pager.Visible = AllowScroller; return(Source); // editorial_categories Show end }
ICollection CardTypes_CreateDataSource() { // CardTypes Show begin CardTypes_sSQL = ""; CardTypes_sCountSQL = ""; string sWhere = "", sOrder = ""; bool HasParam = false; //------------------------------- // Build ORDER BY statement //------------------------------- sOrder = " order by c.name Asc"; if (Utility.GetParam("FormCardTypes_Sorting").Length > 0 && !IsPostBack) { ViewState["SortColumn"] = Utility.GetParam("FormCardTypes_Sorting"); ViewState["SortDir"] = "ASC"; } if (ViewState["SortColumn"] != null) { sOrder = "ORDER BY @SortColumn @SortDir"; } System.Collections.Specialized.StringDictionary Params = new System.Collections.Specialized.StringDictionary(); //------------------------------- // Build base SQL statement //------------------------------- CardTypes_sSQL = "select [c].[card_type_id] as c_card_type_id, " + "[c].[name] as c_name " + " from [card_types] c "; //------------------------------- //------------------------------- //------------------------------- //------------------------------- // Assemble full SQL statement //------------------------------- CardTypes_sSQL = CardTypes_sSQL + sWhere + sOrder; //------------------------------- OleDbDataAdapter command = new OleDbDataAdapter(CardTypes_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, 0, CardTypes_PAGENUM, "CardTypes"); DataView Source; Source = new DataView(ds.Tables[0]); if (ds.Tables[0].Rows.Count == 0) { CardTypes_no_records.Visible = true; } else { CardTypes_no_records.Visible = false; } return(Source); // CardTypes Show end }
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 }
//=============================== // ShoppingCart Show begin protected void Page_Load(object sender, EventArgs e) { Utility=new CCUtility(this); //=============================== // ShoppingCart Open Event begin // ShoppingCart Open Event end //=============================== //=============================== // ShoppingCart OpenAnyPage Event begin // ShoppingCart OpenAnyPage Event end //=============================== // //=============================== // ShoppingCart PageSecurity begin Utility.CheckSecurity(1); // ShoppingCart PageSecurity end //=============================== if (!IsPostBack){ p_Items_order_id.Value = Utility.GetParam("order_id"); if(Session["UserID"]!=null) p_Member_member_id.Value = Session["UserID"].ToString(); else p_Member_member_id.Value=""; Page_Show(sender, e); } }
/*=============================== * 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 }