public static System_Setting getTransac_CheckPoint() { Clustering_Users_DAO dao = null; System_Setting transac_check_point = new System_Setting(); try { dao = new Clustering_Users_DAO(); dao.beginTransaction(); List <System_Setting> listSystemSetting = dao.getListSystemSetting(); foreach (var item in listSystemSetting) { if (item.Key.Equals(ConstantValues.SST_TRANSAC_CP)) { item.Values = dao.getListSystemSettingValue(ConstantValues.SST_TRANSAC_CP); return(item); } } dao.commitTransaction(); } catch (Exception ex) { dao.rollbackTransaction(); throw ex; } return(transac_check_point); }
public static void updateTransac_CheckPoint() { Clustering_Users_DAO dao = null; System_Setting transac_check_point = getTransac_CheckPoint(); try { dao = new Clustering_Users_DAO(); dao.beginTransaction(); if (ConstantValues.SST_TRANSAC_CP.Equals(transac_check_point.Key)) { if (transac_check_point.Values.Count > 0) { dao.updateTransac_CheckPoint(ConstantValues.SST_TRANSAC_CP); } else { dao.addTransac_CheckPoint(ConstantValues.SST_TRANSAC_CP); } } dao.commitTransaction(); } catch (Exception ex) { dao.rollbackTransaction(); throw ex; } }
public void addSystemSetting(System_Setting sst) { string strQuery = "INSERT INTO [RS].[SYSTEM_SETTING_TBL] ([Key] ,[DataType] ,[Description]) VALUES (@Key ,@DataType ,@Description)"; Dictionary <string, object> parameters = new Dictionary <string, object>(); parameters.Add("@Key", sst.Key); parameters.Add("@DataType", sst.DataType); parameters.Add("@Description", sst.Description); executeNonQuery(strQuery, parameters); }
public List <System_Setting> getListSystemSetting() { List <System_Setting> lst = new List <System_Setting>(); Dictionary <string, object> parameters = new Dictionary <string, object>(); SqlDataReader reader = executeReader("SELECT [Key],[DataType],[Description] FROM [RS].[SYSTEM_SETTING_TBL] ", parameters); while (reader.Read()) { System_Setting cs = new System_Setting(); cs.Key = reader.GetString(reader.GetOrdinal("Key")); cs.DataType = reader.GetString(reader.GetOrdinal("DataType")); cs.Description = reader.GetString(reader.GetOrdinal("Description")); lst.Add(cs); } reader.Close(); return(lst); }
public static void addNewTransacCheckpointKey() { Clustering_Users_DAO dao = null; try { dao = new Clustering_Users_DAO(); dao.beginTransaction(); // Add Key ConstantVariables.SST_TRANSAC_CHECK_POINT System_Setting transac_checkpoint = new System_Setting(); transac_checkpoint.Key = ConstantValues.SST_TRANSAC_CP; transac_checkpoint.DataType = ConstantValues.SST_TRANSAC_CP_TYPE; transac_checkpoint.Description = ConstantValues.SST_TRANSAC_CP_DES; dao.addSystemSetting(transac_checkpoint); dao.commitTransaction(); } catch (Exception ex) { dao.rollbackTransaction(); throw ex; } }