Example #1
0
        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;
            }
        }
Example #2
0
        public void deleteClusteringSetting(Clustering_Setting cs)
        {
            Clustering_DAO dao = null;

            try
            {
                dao = new Clustering_DAO();
                dao.beginTransaction();
                foreach (Cluster_Setting_Value val in cs.Values)
                {
                    dao.deleteClusteringSettingDetail(val.ValueID);
                }
                dao.deleteClusteringSetting(cs.Key);
                dao.commitTransaction();
            }
            catch (Exception ex)
            {
                dao.rollbackTransaction();
                throw ex;
            }
        }