示例#1
0
 public List<Clustering_Setting> getListClusteringSetting()
 {
     List<Clustering_Setting> lstClusteringSetting = new List<Clustering_Setting>();
     Dictionary<string, object> parameters = new Dictionary<string, object>();
     SqlDataReader reader = executeReader("SELECT RS.CLUSTER_SETTING_TBL.[Keys],RS.CLUSTER_SETTING_TBL.[DataType],RS.CLUSTER_SETTING_TBL.[Description] FROM RS.CLUSTER_SETTING_TBL,RS.CLUSTER_SETTING_VALUE_TBL WHERE RS.CLUSTER_SETTING_TBL.Keys = RS.CLUSTER_SETTING_VALUE_TBL.Keys", parameters);
     while (reader.Read())
     {
         Clustering_Setting cs = new Clustering_Setting();
         cs.Key = reader.GetString(reader.GetOrdinal("Keys"));
         cs.DataType = reader.GetString(reader.GetOrdinal("DataType"));
         cs.Description = reader.GetString(reader.GetOrdinal("Description"));
         lstClusteringSetting.Add(cs);
     }
     reader.Close();
     return lstClusteringSetting;
 }
 public void insertClusteringSetting(Clustering_Setting cs)
 {
     Clustering_DAO dao = null;
     try
     {
         dao = new Clustering_DAO();
         dao.beginTransaction();
         dao.insertClusteringSetting(cs);
         foreach (Cluster_Setting_Value val in cs.Values)
         {
             dao.insertClusteringSettingDetail(val);
         }
         dao.commitTransaction();
     }
     catch (Exception ex)
     {
         dao.rollbackTransaction();
         throw ex;
     }
 }
示例#3
0
 public void updateClusteringSetting(Clustering_Setting cs)
 {
     Dictionary<string, object> parameters = new Dictionary<string, object>();
     parameters.Add("@Key", cs.Key);
     parameters.Add("@DataType", cs.DataType);
     parameters.Add("@Description", cs.Description);
     executeNonQuery("UPDATE [RS].[CLUSTER_SETTING_TBL] SET [Key] = @Key ,[DataType] = @DataType ,[Description] = @Description WHERE [Key] = @Key", parameters);
 }
示例#4
0
 public void insertClusteringSetting(Clustering_Setting cs)
 {
     Dictionary<string, object> parameters = new Dictionary<string, object>();
     parameters.Add("@Key", cs.Key);
     parameters.Add("@DataType", cs.DataType);
     parameters.Add("@Description", cs.Description);
     executeNonQuery("INSERT INTO [RS].[CLUSTER_SETTING_TBL]([Key],[DataType],[Description]) VALUES(@Key ,@DataType,@Description)", parameters);
 }
        public void updateClusteringSetting(Clustering_Setting cs)
        {
            Clustering_DAO dao = null;
            try
            {
                dao = new Clustering_DAO();
                dao.beginTransaction();
                dao.updateClusteringSetting(cs);
                List<Cluster_Setting_Value> lstAvailable = dao.getListClusteringSettingValue(cs.Key);
                foreach (Cluster_Setting_Value avai in lstAvailable)
                {
                    bool isDeleted = true;
                    foreach (Cluster_Setting_Value val in cs.Values)
                    {
                        if (val.ValueID == avai.ValueID)
                        {
                            isDeleted = false;
                            break;
                        }
                    }
                    if (isDeleted)
                        dao.deleteClusteringSettingDetail(avai.ValueID);
                }

                foreach (Cluster_Setting_Value val in cs.Values)
                {
                    if (val.ValueID != -1)
                    {
                        dao.updateClusteringSettingDetail(val);
                    }
                    else
                    {
                        dao.insertClusteringSettingDetail(val);
                    }
                }
                dao.commitTransaction();
            }
            catch (Exception ex)
            {
                dao.rollbackTransaction();
                throw ex;
            }
        }