Beispiel #1
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="accountId"></param>
 /// <returns></returns>
 public List<WebSite> GetAllWebSiteByRegisterId(string accountId)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append("select ");
     strSql.Append(" DomainName,CompanyName,RegisterId,IconStyle,InviteStyle,ChatStyle,IcoLocation ");
     strSql.Append(" FROM WebSite ");
     strSql.Append(" where  RegisterId='" + accountId +"'");
     List<WebSite> modelList = new List<WebSite>();
     using (SqlDataReader r = DBHelper.GetReader(strSql.ToString()))
     {
         while (r.Read())
         {
             WebSite model =new WebSite();
             model.DomainName = r["DomainName"].ToString();
             model.CompanyName = r["CompanyName"].ToString();
             model.RegisterId = r["RegisterId"].ToString();
             model.IconStyle = r["IconStyle"].ToString();
             model.InviteStyle = r["InviteStyle"].ToString();
             model.ChatStyle = r["ChatStyle"].ToString();
             model.IcoLocation = r["IcoLocation"].ToString();
             modelList.Add(model);
         }
         return modelList;
     }
 }
Beispiel #2
0
        public static bool AddAccount(Account account,string NickName, string loginName, string loginPwd)
        {
            int i = 0;
            int di = 0;
            int oi = 0;
            i = SqlAccountProvider.Default.AddAccount(account);
            if (i != 0)
            {
                //添加默认部门
                Department dt = new Department();
                dt.Account = account;
                dt.DepartmentId = Guid.NewGuid().ToString();
                dt.DepartmentName = "默认部门";
                dt.IsDefault = true;
                dt.AddDate = DateTime.Now.ToString();
                di=new SqlDepartmentProvider().AddDepartment(dt);
                if (di!=0)
                {

                    Operator op = new Operator();
                    op.Account =  account;
                    op.LoginName = loginName;
                    op.Password = loginPwd;
                    op.IsAdmin = true;
                    op.NickName = NickName;
                    op.Department = dt;
                    op.Email = account.Email;
                    op.AVChatStatus = OperatorStatus.Offline.ToString();
                    op.Status = OperatorStatus.Offline;
                    oi=new SqlOperatorProvider().NewOperator(op);
                }
                WebSite wst = WebSiteManager.GetWebSiteByDomainName(Util.GetDomainName(account.Url));
                if (wst == null)
                {
                    wst = new WebSite();
                    wst.DomainName =Util.GetDomainName(account.Url);
                    wst.ChatStyle = "0";
                    wst.IcoLocation = "0";
                    wst.IconStyle = "0";
                    wst.InviteStyle = "0";
                    wst.RegisterId = account.AccountId;
                    LiveSupport.BLL.WebSiteManager.NewWebSite(wst);
                }
                if (i != 0 && di != 0 && oi != 0)
                {
                    return true;
                }
                else
                    return false;

            }
            else
                return false;
        }
Beispiel #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(WebSite model)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append("insert into WebSite(");
     strSql.Append("DomainName,CompanyName,RegisterId,IconStyle,InviteStyle,ChatStyle,IcoLocation)");
     strSql.Append(" values (");
     strSql.Append("@DomainName,@CompanyName,@RegisterId,@IconStyle,@InviteStyle,@ChatStyle,@IcoLocation)");
     SqlParameter[] parameters = {
             new SqlParameter("@DomainName", SqlDbType.VarChar,50),
             new SqlParameter("@CompanyName",SqlDbType.VarChar,100),
             new SqlParameter("@RegisterId", SqlDbType.VarChar,50),
             new SqlParameter("@IconStyle", SqlDbType.Text),
             new SqlParameter("@InviteStyle", SqlDbType.Text),
             new SqlParameter("@ChatStyle", SqlDbType.Text),
             new SqlParameter("@IcoLocation", SqlDbType.VarChar,50)};
     parameters[0].Value = model.DomainName;
     parameters[1].Value = model.CompanyName;
     parameters[2].Value = model.RegisterId;
     parameters[3].Value = model.IconStyle;
     parameters[4].Value = model.InviteStyle;
     parameters[5].Value = model.ChatStyle;
     parameters[6].Value = model.IcoLocation;
     return  DBHelper.ExecuteCommand(strSql.ToString(), parameters);
 }
Beispiel #4
0
 public static bool UpdateNewWebSite(NewWebSite nwst)
 {
     WebSite website = new WebSite();
     website.IconStyle = nwst.banners.State + "|" + nwst.banners.Online + "|" + nwst.banners.Offline;
     website.InviteStyle = nwst.invites.State + "|" + nwst.invites.Bgimg + "|" + nwst.invites.Okimg + "|" + nwst.invites.Noimg;
     website.ChatStyle = nwst.chatpage.State + "|" + nwst.chatpage.ChatPageBGImg + "|" + nwst.chatpage.ChatPageRightImg + "|" + nwst.chatpage.LeavePageTopImg;
     website.DomainName = nwst.domainName;
     website.CompanyName=nwst.companyName;
     website.RegisterId = nwst.accountId;
     website.IcoLocation = nwst.icoLocation;
     return Update(website);
 }
Beispiel #5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public static bool Update(WebSite model)
 {
     int i= Provider.Update(model);
        if (i > 0)
        {
        return true;
        }
        else
        return false;
 }
Beispiel #6
0
    //保存
    protected void Button1_Click(object sender, EventArgs e)
    {
        string domainName = this.drpDomainName.SelectedValue;
        if (string.IsNullOrEmpty(domainName))
        {
            return;
        }
        else
        {
            WebSite wst = new WebSite();
            wst.DomainName = domainName;
            if (RadioButton0.Checked == true) { wst.IcoLocation = "0"; }
            if (RadioButton1.Checked == true) { wst.IcoLocation = "1"; }
            if (RadioButton2.Checked == true) { wst.IcoLocation = "2"; }
            if (RadioButton3.Checked == true) { wst.IcoLocation = "3"; }
            if (RadioButton4.Checked == true) { wst.IcoLocation = "4"; }
            if (RadioButton5.Checked == true) { wst.IcoLocation = "5"; }
            if (RadioButton6.Checked == true) { wst.IcoLocation = "6"; }
            wst.IconStyle = DropDownList1.SelectedValue;
            wst.InviteStyle = DropDownList2.SelectedValue;
            wst.ChatStyle = DropDownList3.SelectedValue;
            if (Session["User"] != null)
            {
                oper = (Operator)Session["User"];
                wst.RegisterId = oper.Account.AccountId;
                LiveSupport.BLL.WebSiteManager.Update(wst);
                Response.Redirect("DomainName.aspx");
            }
            else
            {
                return;
            }

        }
    }
Beispiel #7
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public int Update(WebSite model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update WebSite set ");
            strSql.Append("CompanyName=@CompanyName,");
            strSql.Append("RegisterId=@RegisterId,");
            strSql.Append("IconStyle=@IconStyle,");
            strSql.Append("InviteStyle=@InviteStyle,");
            strSql.Append("ChatStyle=@ChatStyle,");
            strSql.Append("IcoLocation=@IcoLocation");
            strSql.Append(" where DomainName=@DomainName ");
            SqlParameter[] parameters = {
                    new SqlParameter("@DomainName", SqlDbType.VarChar,50),
                    new SqlParameter("@CompanyName",SqlDbType.VarChar,100),
                    new SqlParameter("@RegisterId", SqlDbType.VarChar,50),
                    new SqlParameter("@IconStyle", SqlDbType.Text),
                    new SqlParameter("@InviteStyle", SqlDbType.Text),
                    new SqlParameter("@ChatStyle", SqlDbType.Text),
                    new SqlParameter("@IcoLocation", SqlDbType.VarChar,50)};
            parameters[0].Value = model.DomainName;
            parameters[1].Value = model.CompanyName;
            parameters[2].Value = model.RegisterId;
            parameters[3].Value = model.IconStyle;
            parameters[4].Value = model.InviteStyle;
            parameters[5].Value = model.ChatStyle;
            parameters[6].Value = model.IcoLocation;

               return  DBHelper.ExecuteCommand(strSql.ToString(), parameters);
        }
Beispiel #8
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public WebSite GetModel(string DomainName)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 DomainName,CompanyName,RegisterId,IconStyle,InviteStyle,ChatStyle,IcoLocation from WebSite ");
            strSql.Append(" where DomainName=@DomainName ");
            SqlParameter[] parameters = {
                    new SqlParameter("@DomainName", SqlDbType.VarChar,50)};
            parameters[0].Value = DomainName;

            WebSite model = new WebSite();
            DataSet ds = DBHelper.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                model.DomainName = ds.Tables[0].Rows[0]["DomainName"].ToString();
                model.CompanyName = ds.Tables[0].Rows[0]["CompanyName"].ToString();
                model.RegisterId = ds.Tables[0].Rows[0]["RegisterId"].ToString();
                model.IconStyle = ds.Tables[0].Rows[0]["IconStyle"].ToString();
                model.InviteStyle = ds.Tables[0].Rows[0]["InviteStyle"].ToString();
                model.ChatStyle = ds.Tables[0].Rows[0]["ChatStyle"].ToString();
                model.IcoLocation = ds.Tables[0].Rows[0]["IcoLocation"].ToString();
                return model;
            }
            else
            {
                return null;
            }
        }