Ejemplo n.º 1
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);
        }