bool User_update_Click(Object Src, EventArgs E) { string sWhere = ""; string sSQL = ""; bool bResult = User_Validate(); if (bResult) { if (p_User_user_id.Value.Length > 0) { sWhere = sWhere + "user_id=" + CCUtility.ToSQL(p_User_user_id.Value, CCUtility.FIELD_TYPE_Number); } // User Check Event begin // User Check Event end if (bResult) { sSQL = "update users set " + "[login]=" + CCUtility.ToSQL(Utility.GetParam("User_login"), CCUtility.FIELD_TYPE_Text) + ",[pass]=" + CCUtility.ToSQL(Utility.GetParam("User_pass"), CCUtility.FIELD_TYPE_Text) + ",[security_level]=" + CCUtility.ToSQL(Utility.GetParam("User_security_level"), CCUtility.FIELD_TYPE_Number) + ",[user_name]=" + CCUtility.ToSQL(Utility.GetParam("User_user_name"), CCUtility.FIELD_TYPE_Text) + ",[email]=" + CCUtility.ToSQL(Utility.GetParam("User_email"), CCUtility.FIELD_TYPE_Text) + ",[allow_upload]=" + CCUtility.getCheckBoxValue(Utility.GetParam("User_allow_upload"), "1", "0", CCUtility.FIELD_TYPE_Number) + ",[notify_new]=" + CCUtility.getCheckBoxValue(Utility.GetParam("User_notify_new"), "1", "0", CCUtility.FIELD_TYPE_Number) + ",[notify_original]=" + CCUtility.getCheckBoxValue(Utility.GetParam("User_notify_original"), "1", "0", CCUtility.FIELD_TYPE_Number) + ",[notify_reassignment]=" + CCUtility.getCheckBoxValue(Utility.GetParam("User_notify_reassignment"), "1", "0", CCUtility.FIELD_TYPE_Number) + ",[supervisor_id]=" + CCUtility.ToSQL(Utility.GetParam("User_supervisor"), CCUtility.FIELD_TYPE_Number); sSQL = sSQL + " where " + sWhere; // User Update Event begin // User Update Event end User_BeforeSQLExecute(sSQL, "Update"); OleDbCommand cmd = new OleDbCommand(sSQL, Utility.Connection); try { cmd.ExecuteNonQuery(); } catch (Exception e) { User_ValidationSummary.Text += e.Message; User_ValidationSummary.Visible = true; return(false); } } if (bResult) { // User AfterUpdate Event begin // User AfterUpdate Event end } } return(bResult); }
// User Action begin bool User_insert_Click(Object Src, EventArgs E) { string sSQL = ""; bool bResult = User_Validate(); // User Check Event begin // User Check Event end if (bResult) { string p2_login = CCUtility.ToSQL(Utility.GetParam("User_login"), CCUtility.FIELD_TYPE_Text); string p2_pass = CCUtility.ToSQL(Utility.GetParam("User_pass"), CCUtility.FIELD_TYPE_Text); string p2_security_level = CCUtility.ToSQL(Utility.GetParam("User_security_level"), CCUtility.FIELD_TYPE_Number); string p2_user_name = CCUtility.ToSQL(Utility.GetParam("User_user_name"), CCUtility.FIELD_TYPE_Text); string p2_email = CCUtility.ToSQL(Utility.GetParam("User_email"), CCUtility.FIELD_TYPE_Text); string c1_allow_upload = CCUtility.getCheckBoxValue(Utility.GetParam("User_allow_upload"), "1", "0", CCUtility.FIELD_TYPE_Number); string c1_notify_new = CCUtility.getCheckBoxValue(Utility.GetParam("User_notify_new"), "1", "0", CCUtility.FIELD_TYPE_Number); string c1_notify_original = CCUtility.getCheckBoxValue(Utility.GetParam("User_notify_original"), "1", "0", CCUtility.FIELD_TYPE_Number); string c1_notify_reassignment = CCUtility.getCheckBoxValue(Utility.GetParam("User_notify_reassignment"), "1", "0", CCUtility.FIELD_TYPE_Number); string p2_supervisor_id = CCUtility.ToSQL(Utility.GetParam("User_supervisor"), CCUtility.FIELD_TYPE_Number); // User Insert Event begin // User Insert Event end sSQL = "insert into users (" + "login," + "pass," + "security_level," + "user_name," + "email," + "allow_upload," + "notify_new," + "notify_original," + "notify_reassignment," + "supervisor_id)" + " values (" + p2_login + "," + p2_pass + "," + p2_security_level + "," + p2_user_name + "," + p2_email + "," + c1_allow_upload + "," + c1_notify_new + "," + c1_notify_original + "," + c1_notify_reassignment + "," + p2_supervisor_id + ")"; User_BeforeSQLExecute(sSQL, "Insert"); OleDbCommand cmd = new OleDbCommand(sSQL, Utility.Connection); try { cmd.ExecuteNonQuery(); } catch (Exception e) { User_ValidationSummary.Text += e.Message; User_ValidationSummary.Visible = true; return(false); } // User AfterInsert Event begin // User AfterInsert Event end } return(bResult); }