예제 #1
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;
        }
예제 #2
0
        /// <summary>
        /// 添加一条客服信息
        /// </summary>
        /// <param name="op"></param>
        public int  NewOperator(Operator op)
        {
            Operator oper = new SqlOperatorProvider().GetOperatorByAccountIdAndLoginName(op.Account.AccountId, op.LoginName);

            if (oper == null)
            {
                int isAdmin = 0;
                if (op.IsAdmin == false)
                {
                    isAdmin = 0;
                }
                else
                {
                    isAdmin = 1;
                }
                string sql = string.Format(
                    "INSERT INTO [LiveSupport].[dbo].[LiveChat_Operator]"
                    + "([OperatorId]"
                    + " ,[AccountId]"
                    + " ,[LoginName]"
                    + " ,[Password]"
                    + " ,[NickName]"
                    + " ,[Email]"
                    + " ,[IsAdmin]"
                    + " ,[Status]"
                    + "  ,[AVChatStatus]"
                    + ",[DepartmentId])"
                    + "VALUES ('{0}','{1}','{2}','{3}','{4}','{5}',{6},'{7}','{8}','{9}')"
                    , op.OperatorId, op.Account.AccountId, op.LoginName, op.Password, op.NickName, op.Email, isAdmin, op.Status, op.AVChatStatus, op.Department.DepartmentId);
                return(DBHelper.ExecuteCommand(sql));
            }
            else
            {
                return(0);
            }
        }
예제 #3
0
 /// <summary>
 /// ���һ���ͷ���Ϣ
 /// </summary>
 /// <param name="op"></param>
 public int NewOperator(Operator op)
 {
     Operator oper = new SqlOperatorProvider().GetOperatorByAccountIdAndLoginName(op.Account.AccountId, op.LoginName);
     if (oper == null)
     {
         int isAdmin = 0;
         if (op.IsAdmin == false)
             isAdmin = 0;
         else
             isAdmin = 1;
         string sql = string.Format(
         "INSERT INTO [LiveSupport].[dbo].[LiveChat_Operator]"
        + "([OperatorId]"
        + " ,[AccountId]"
        + " ,[LoginName]"
        + " ,[Password]"
        + " ,[NickName]"
        + " ,[Email]"
        + " ,[IsAdmin]"
        + " ,[Status]"
        + "  ,[AVChatStatus]"
        + ",[DepartmentId])"
        + "VALUES ('{0}','{1}','{2}','{3}','{4}','{5}',{6},'{7}','{8}','{9}')"
        , op.OperatorId, op.Account.AccountId, op.LoginName, op.Password, op.NickName, op.Email, isAdmin, op.Status, op.AVChatStatus, op.Department.DepartmentId);
         return DBHelper.ExecuteCommand(sql);
     }
     else
     {
         return 0;
     }
 }