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;
using System.Data.SqlClient;
using SqlOperate;

namespace Solely
{
    /// <summary>
    /// 商业信息设置
    /// </summary>
    public class BusinessInfoSet
    {

        private bool _VerifyAdd;
        private bool _VerifyEdit;
        private bool _Email;
        private bool _Message;
        private string _MessageTitle;
        private string _MessageInfo;
        private string _EmailTitle;
        private string _EmailInfo;
        private int _MarkAdd;
        private int _MarkEdit;
        private int _BlankingTime;

        /// <summary>
        /// 添加信息审核方式
        /// </summary>
        public bool VerifyAdd
        {
            set {
                //if (value == null || value == "")
                //    _VerifyAdd = false;
                //else
                    _VerifyAdd = value;
            }
            get { return _VerifyAdd; }
        }

        /// <summary>
        /// 修改信息审核方式
        /// </summary>
        public bool VerifyEdit
        {
            set {
                //if (value == null || value == "")
                //    _VerifyEdit = false;
                //else
                    _VerifyEdit = value;
            }
            get { return _VerifyEdit; }
        }

        /// <summary>
        /// 是否发送邮件
        /// </summary>
        public bool Email
        {
            set {
                //if (value == null || value == "")
                //    _Email = false;
                //else
                    _Email = value;
            }
            get { return _Email; }
        }

        /// <summary>
        /// 是否发短信息
        /// </summary>
        public bool Message
        {
            set {
                //if (value == null || value == "")
                //    _Message = false;
                //else
                    _Message = value;
            }
            get { return _Message; }
        }

        /// <summary>
        /// 短信息标题
        /// </summary>
        public string MessageTitle
        {
            set {
                //if (value == null || value == "")
                //    _MessageTitle = "短信息提示";
                //else
                    _MessageTitle = value;
            }
            get { return _MessageTitle; }
        }

        /// <summary>
        /// 短信息内容
        /// </summary>
        public string MessageInfo
        {
            set { _MessageInfo = value; }
            get { return _MessageInfo; }
        }

        /// <summary>
        /// 邮件标题
        /// </summary>
        public string EmailTitle
        {
            set { _EmailTitle = value; }
            get { return _EmailTitle; }
        }

        /// <summary>
        /// 邮件内容
        /// </summary>
        public string EmailInfo
        {
            set { _EmailInfo = value; }
            get { return _EmailInfo; }
        }

        /// <summary>
        ///  添加一条信息奖励积分
        /// </summary>
        public int MarkAdd
        {
            set { _MarkAdd = value; }
            get { return _MarkAdd; }
        }

        /// <summary>
        ///  修改一次奖励积分
        /// </summary>
        public int MarkEdit
        {
            set { _MarkEdit = value; }
            get { return _MarkEdit; }
        } 

        /// <summary>
        ///  添加一条信息奖励积分
        /// </summary>
        public int BlankingTime
        {
            set { _BlankingTime = value; }
            get { return _BlankingTime; }
        }


        /// <summary>
        ///  取得设置信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static BusinessInfoSet GateItem()
        {
            SqlParameter[] param = new SqlParameter[] { 
           new SqlParameter("@strWhere",""), new SqlParameter("@strTableName", "U_Register"),   new SqlParameter("@strOrder", "") 
        };
            BusinessInfoSet info = new BusinessInfoSet();
            using (SqlDataReader reader = SqlHelper.ExecuteReader(CommandType.StoredProcedure, "SP_SelectByWhere", param))
            {
                if (!reader.Read())
                    return info;
                //info.isRegister = Convert.ToBoolean(reader["isRegister"].ToString());
                //info.ManageRegister = Convert.ToBoolean(reader["ManageRegister"].ToString());
                //info.VipGrade = Convert.ToInt16(reader["VipGrade"].ToString());
                //info.isCode = Convert.ToBoolean(reader["isCode"].ToString());
                //info.isQuestion = Convert.ToBoolean(reader["isQuestion"].ToString());
                //info.Question = reader["Question"].ToString();
                //info.Answer = reader["Answer"].ToString();
                //info.BannedIP = reader["BannedIP"].ToString();
                //info.BannedUser = reader["bannedUser"].ToString();
                //info.Code_Login = Convert.ToBoolean(reader["Code_Login"].ToString());
                //info.Code_GetPass = Convert.ToBoolean(reader["Code_GetPass"].ToString());
                //info.GetPass_Count = Convert.ToInt32(reader["GetPass_Count"].ToString());
                //info.Minimum = Convert.ToInt32(reader["Minimum"].ToString());
                //info.Longest = Convert.ToInt32(reader["Longest"].ToString());
                //info.MinTimeRegister = Convert.ToInt32(reader["MinTimeRegister"].ToString());
                //info.Gocipher_Method = Convert.ToInt32(reader["Gocipher_Method"].ToString());
                //info.OnlyUser_Email = Convert.ToBoolean(reader["OnlyUser_Email"].ToString());
                //info.ToMessage = Convert.ToBoolean(reader["ToMessage"].ToString());
                //info.MessageInfo = reader["MessageInfo"].ToString();
                //info.ToEmail = Convert.ToBoolean(reader["ToEmail"].ToString());
                //info.EmailInfo = reader["EmailInfo"].ToString();
            }
            return info;
        }


        /// <summary>
        /// 修改信息设置
        /// </summary>
        /// <param name="eui"></param>
        /// <returns></returns>
        //public int Update(BusinessInfoSet ui)
        //{
        //    SqlParameter[] commandParameters = new SqlParameter[]
        //    {                 
        //        new SqlParameter("@isRegister", ui.isRegister),
        //        new SqlParameter("@ManageRegister",ui.ManageRegister),
        //        new SqlParameter("@VipGrade",ui.VipGrade),
        //        new SqlParameter("@isQuestion",ui.isQuestion),
        //        new SqlParameter("@Question",ui.Question),
        //        new SqlParameter("@Answer",ui.Answer),
        //        new SqlParameter("@BannedIP",ui.BannedIP),
        //        new SqlParameter("@BannedUser",ui.BannedUser),
        //        new SqlParameter("@Code_Login",ui.Code_Login),
        //        new SqlParameter("@Code_GetPass",ui.Code_GetPass),
        //        new SqlParameter("@GetPass_Count",ui.GetPass_Count),
        //        new SqlParameter("Minimum ",ui.Minimum),
        //        new SqlParameter("@Longest",ui.Longest),
        //        new SqlParameter("@MinTimeRegister",ui.MinTimeRegister),
        //        new SqlParameter("@Gocipher_Method",ui.Gocipher_Method),
        //        new SqlParameter("@OnlyUser_Email",ui.OnlyUser_Email),
        //        new SqlParameter("@ToMessage",ui.ToMessage),
        //        new SqlParameter("@MessageInfo",ui.MessageInfo),
        //        new SqlParameter("@ToEmail",ui.ToEmail),
        //        new SqlParameter("@EmailInfo",ui.EmailInfo)
        //    };
        //    return SqlHelper.ExecuteNonQuery(CommandType.StoredProcedure, "SP_U_Register_Update", commandParameters);
        //}
    }
}