using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace digioz.PollSystem
{
    /// <summary>
    /// Summary description for PollRecordInfoManagement
    /// </summary>
    public class PollRecordInfoManagement
    {
        private static PortalSettings coPortalSettings;


        /// <summary>
        /// Pass a PollRecordInfo parameter, add the record to database
        /// </summary>
        /// <param name="record"></param>
        /// <returns></returns>
        public static bool InsertPollRecord(PollRecordInfo record)
        {
            bool lbRetValue=false;
            coPortalSettings = PortalSettingsManagement.GetPortalSettings();

            if (coPortalSettings.DBRelational == true)
            {
                IDataRelational loDB = DataFactory.GetDataObject(coPortalSettings);
                string sql = "exec spSubmitPollRecord " + record.OptionID + ", '" + record.UserID + "'";

                try
                {
                    loDB.openConnection();
                    loDB.ExecDB(sql);
                    lbRetValue = (String.IsNullOrEmpty(loDB.sErr));
                }
                finally
                {
                    loDB.closeConnection();
                }
            }
            return lbRetValue;
        }

    }
}