Example #1
0
            public bool UpdateEntity(ConfigurationEntity entity, string moduleName)
            {
                bool          result        = false;
                GUIDGenerator guidGenerator = new GUIDGenerator();

                entity.NewConfigurationId = guidGenerator.GenerateGUIDString(guidGenerator.ExtractUniqueId(entity.ConfigurationId), entity);
                string           commandText           = "UPDATE [tbl_config_detail] SET CONFIG_ID= @NEW_CONFIG_ID, DISPLAY_NAME = @DISPLAY_NAME, DEFAULT_VALUE = @DEFAULT_VALUE, ALLOWED_VALUE = @ALLOWED_VALUE, ALLOWED_PLACE_HOLDER = @ALLOWED_PLACE_HOLDER, Description = @Description, MODULE_NAME=@MODULE_NAME, LASTMODIFIED_TIMESTAMP=GETDATE() WHERE CONFIG_ID=@CONFIG_ID";
                int              affectedRows          = 0;
                TalentDataAccess talentSqlAccessDetail = new TalentDataAccess();
                ErrorObj         err = new ErrorObj();

                //Construct The Call
                talentSqlAccessDetail.Settings = settings;
                talentSqlAccessDetail.CommandElements.CommandExecutionType = CommandExecution.ExecuteNonQuery;
                talentSqlAccessDetail.CommandElements.CommandText          = commandText;
                talentSqlAccessDetail.CommandElements.CommandParameter.Add(Utilities.ConstructParameter("@NEW_CONFIG_ID", entity.NewConfigurationId));
                talentSqlAccessDetail.CommandElements.CommandParameter.Add(Utilities.ConstructParameter("@DISPLAY_NAME", entity.DisplayName));
                talentSqlAccessDetail.CommandElements.CommandParameter.Add(Utilities.ConstructParameter("@DEFAULT_VALUE", entity.DefaultValue));
                talentSqlAccessDetail.CommandElements.CommandParameter.Add(Utilities.ConstructParameter("@ALLOWED_VALUE", entity.AllowedValues));
                talentSqlAccessDetail.CommandElements.CommandParameter.Add(Utilities.ConstructParameter("@ALLOWED_PLACE_HOLDER", entity.AllowedPlaceHolders));
                talentSqlAccessDetail.CommandElements.CommandParameter.Add(Utilities.ConstructParameter("@Description", entity.Description));
                talentSqlAccessDetail.CommandElements.CommandParameter.Add(Utilities.ConstructParameter("@CONFIG_ID", entity.ConfigurationId));
                talentSqlAccessDetail.CommandElements.CommandParameter.Add(Utilities.ConstructParameter("@MODULE_NAME", moduleName));
                //Execute
                err = talentSqlAccessDetail.SQLAccess(DestinationDatabase.TALENT_CONFIG);
                if ((!(err.HasError)) && (!(talentSqlAccessDetail.ResultDataSet == null)))
                {
                    affectedRows = System.Convert.ToInt32(talentSqlAccessDetail.ResultDataSet.Tables[0].Rows[0][0]);
                }
                talentSqlAccessDetail = null;
                if (affectedRows > 0)
                {
                    if (entity.ConfigurationId == entity.NewConfigurationId)
                    {
                        entity.NewConfigurationId = string.Empty;
                    }
                    return(true);
                }
                return(false);
            }