private void setParameter(iSqlParameter[] parms, Settingsite.RestrictedPages info) { try { int i = -1; parms[++i].Value = info.Name; parms[++i].Value = info.Query; parms[++i].Value = info.PathandQuery; parms[++i].Value = info.Id; return; } catch (Exception ex) { throw ex; } }
public bool Save(Settingsite.RestrictedPages info) { try { using (iSqlConnection iConn = HELPER.getConnect(HELPER.SQL_SYSTEM)) { using (iSqlTransaction trans = iConn.BeginTransaction()) { try { this.Saveitem(trans, info); trans.Commit(); } catch (Exception ex) { trans.Rollback(); throw ex; } } iConn.Close(); } return true; } catch (Exception ex) { throw ex; } }
private bool Saveitem(iSqlTransaction trans, Settingsite.RestrictedPages info) { try { if (trans == null || info == null) return false; string SQL = string.Empty; if (info.Id == 0) { SQL = SQL_INSERT; info.Id = (int)HELPER.getNewID(trans, TABLENAME); iSqlParameter[] parms = this.getParameter(SQL); this.setParameter(parms, info); HELPER.executeNonQuery(trans, iCommandType.Text, SQL, parms); } else if (HELPER.isExist(trans, TABLENAME, info.Id)) { SQL = SQL_UPDATE; iSqlParameter[] parms = this.getParameter(SQL); this.setParameter(parms, info); HELPER.executeNonQuery(trans, iCommandType.Text, SQL, parms); } else { SQL = SQL_INSERT; info.Id = (int)HELPER.getNewID(trans, TABLENAME); iSqlParameter[] parms = this.getParameter(SQL); this.setParameter(parms, info); HELPER.executeNonQuery(trans, iCommandType.Text, SQL, parms); } return true; } catch (Exception ex) { throw ex; } }
private void setParameter(iSqlParameter[] parms, Settingsite.MailServer info) { try { int i = -1; parms[++i].Value = CFunctions.SetDBString(info.SMTPServer); parms[++i].Value = info.SMTPPort; parms[++i].Value = info.UseSSL; parms[++i].Value = CFunctions.SetDBString(info.Receiver); parms[++i].Value = CFunctions.SetDBString(info.Username); parms[++i].Value = CFunctions.SetDBString(info.Password); parms[++i].Value = CFunctions.SetDBDatetime(info.Timeupdate); parms[++i].Value = info.Id; return; } catch (Exception ex) { throw ex; } }