Esempio n. 1
0
 public Operator GetOperatorByAccountIdAndLoginName(string accountId, string loginName)
 {
     string sql = string.Format("select * from [LiveSupport].[dbo].[LiveChat_Operator] where AccountId='{0}' and LoginName='{1}'", accountId, loginName);
     Operator op = new Operator();
     op = GetOperatorBySql(sql);
     return op;
 }
Esempio n. 2
0
 public Operator GetOperatorByOperatorId(string operatorId)
 {
     string sql = "select * from  dbo.LiveChat_Operator where OperatorId='" + operatorId+"'";
     Operator op = new Operator();
     op=GetOperatorBySql(sql);
     return op;
 }
Esempio n. 3
0
 public static Chat CreateNewChat(Visitor v, Operator o)
 {
     Chat c = new Chat();
     c.AccountId = v.AccountId;
     c.OperatorId = o.OperatorId;
     c.VisitorId = v.VisitorId;
     return c;
 }
Esempio n. 4
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;
        }
Esempio n. 5
0
        public static Operator CreateNewOperator(string accountId)
        {
            Operator op = new Operator();
            op.AccountId = accountId;
            op.LoginName = Guid.NewGuid().ToString();
            op.Password = Guid.NewGuid().ToString();
            op.AVChatStatus = "aa";

            op.Email = "dd";
            op.NickName = "客服" + r.Next(1000);
            return op;
        }
Esempio n. 6
0
        public TestFixture()
        {
            // 1. creat 10 operator
            for (int i = 0; i < operatorsCount; i++)
            {
                Operator o = new Operator();
                o.NickName = i.ToString() + "号客服";
                o.OperatorId = i.ToString();
                o.AccountId = AccountId;
                o.Status = i % 2 == 0? OperatorStatus.Idle:OperatorStatus.Offline;
                operators.Add(o);
            }

            for (int i = 0; i < visitorsCount; i++)
            {
                visitors.Add(NewVisitor(i));
            }
        }
Esempio n. 7
0
 public void ChatPageRequestChat()
 {
     LiveSupport.LiveSupportModel.Chat chatRequest = new LiveSupport.LiveSupportModel.Chat();
     chatRequest.AccountId  = "aid";
     chatRequest.ChatId     = Guid.NewGuid().ToString();
     chatRequest.CreateTime = DateTime.Now;
     chatRequest.Status     = LiveSupport.LiveSupportModel.ChatStatus.Requested;
     chatRequest.OperatorId = "aa";
     //    ChatService.ChatPageRequestChat(chatRequest);
     LiveSupport.LiveSupportModel.Operator op = null;
     foreach (var item in OperatorService.GetAllOperators())
     {
         if (chatRequest.OperatorId == item.OperatorId)
         {
             op = item;
         }
     }
     Assert.AreEqual(op.Status, OperatorStatus.InviteChat);
 }
Esempio n. 8
0
        private void btnAddoperator_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < 500; i++)
            {
                //Random ran = new Random();
                //int num = ran.Next(100000, 999999);
                //添加
                Account at = new Account();
                at.AccountId = Guid.NewGuid().ToString();
                at.AccountNumber = i.ToString();
                at.CompanyName = i + "公司";
                at.Url ="http://www.www"+i+".com";
                at.Phone = i.ToString(); ;
                at.ContactName = i+"";
                at.Email = i.ToString()+ "@sina.com";
                at.Province = "江西省";
                at.City = "南昌市";
                at.Industry = "计算机";
                at.OperatorCount = 1;
                at.RegisterDate = DateTime.Now;
                bool b = AccountsManager.AddAccount(at, "admin客服", "admin" , "admin");

                //Account at = AccountsManager.GetAccountByAccountId(at.AccountId);
                Operator op = new Operator();
                op.Account = at;
                op.LoginName = "admin" + i;
                op.Password = "******" + i;
                op.NickName = "admin1号客服";
                op.IsAdmin = false;
                op.Department = DepartmentManager.GetDepartmentByAccountId(at.AccountId)[0];
                op.Status = (OperatorStatus)Enum.Parse((typeof(OperatorStatus)), OperatorStatus.Offline.ToString());
                op.AVChatStatus = OperatorStatus.Offline.ToString();
                op.Email = "admin" + i + "@sina.com";
                bool a = OperatorsManager.NewOperator(op);

            }
        }
Esempio n. 9
0
 public int UpdateOperator(LiveSupport.LiveSupportModel.Operator op)
 {
     throw new NotImplementedException();
 }
Esempio n. 10
0
 public AccountInfoDialog(Operator op)
 {
     InitializeComponent();
     this.operatorBindingSource.DataSource = op;
 }
Esempio n. 11
0
 public List<Operator> GetOperatorListBySql(string sql)
 {
     List<Operator> operators = new List<Operator>();
     using (SqlDataReader r = DBHelper.GetReader(sql))
     {
         while (r.Read())
         {
             Operator op = new Operator(r);
             SqlAccountProvider ap = new SqlAccountProvider();
             SqlDepartmentProvider dp = new SqlDepartmentProvider();
             op.Department = dp.GetDepartmentById(r["DepartmentId"].ToString());
             op.Account = ap.GetAccountByAccountId(r["accountId"].ToString());
             operators.Add(op);
         }
         return operators;
     }
 }
Esempio n. 12
0
 public static List<WebSite> GetAllWebSiteByRegisterId(Operator op)
 {
     if (op != null)
     {
         return Provider.GetAllWebSiteByRegisterId(op.Account.AccountId);
     }
     return null;
 }
Esempio n. 13
0
        void ws_LoginCompleted(object sender, LiveSupport.OperatorConsole.LiveChatWS.LoginCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                currentOperator = (Operator)Common.Convert(e.Result);

                if (currentOperator != null)
                {
                    LiveSupport.OperatorConsole.LiveChatWS.AuthenticationHeader h = new LiveSupport.OperatorConsole.LiveChatWS.AuthenticationHeader();
                    h.OperatorId = currentOperator.OperatorId;
                    h.OperatorSession = currentOperator.OperatorSession;
                    ws.AuthenticationHeaderValue = h;

                    socketHandler = new SocketHandler();
                    if (Properties.Settings.Default.OperatorConsole_LiveChatWS_Operator.ToLower().Contains("localhost"))
                    {
                        socket = socketHandler.Connect("127.0.0.1");
                    }
                    else
                    {
                        IPHostEntry entry = Dns.GetHostEntry("lcs.zxkefu.cn");
                        socket = socketHandler.Connect(entry.AddressList[0].ToString());
                    }

                    socketHandler.DataArrive += new EventHandler<DataArriveEventArgs>(socketHandler_DataArrive);
                    socketHandler.Exception += new EventHandler<ExceptionEventArgs>(socketHandler_Exception);
                    socketHandler.SendPacket(socket, new LoginAction(currentOperator.OperatorId));

                    fireConnectStateChange(ConnectionState.Connected, "登录成功");
                    timerAction = TimerAction.HeartBeat;
                    timer.Enabled = true;
                    ws.GetSystemAdvertiseAsync(productVersion, Guid.NewGuid());
                    ws.GetLeaveWordAsync(Guid.NewGuid());
                    ws.GetAllVisitorsAsync(currentOperator.AccountId, Guid.NewGuid());
                    ws.GetAllOperatorsAsync(Guid.NewGuid());
                    ws.GetAccountDomainsAsync(Guid.NewGuid());
                    //Disable the timer checkNewChangesTimer.Enabled = true;
                }
                else
                {
                    fireConnectStateChange(ConnectionState.Disconnected, "登录失败,登录信息输入错误");
                }
            }
            else
            {
                fireConnectStateChange(ConnectionState.Disconnected, "登录失败," + e.Error.Message);
            }
        }
Esempio n. 14
0
        public static object Convert(object obj)
        {
            if (obj == null)
            {
                return null;
            }
            if (obj is LiveSupport.OperatorConsole.LiveChatWS.Visitor)
            {
                LiveSupport.OperatorConsole.LiveChatWS.Visitor v1 = obj as LiveSupport.OperatorConsole.LiveChatWS.Visitor;

                LiveSupportModel.Visitor v2 = new LiveSupport.LiveSupportModel.Visitor();
                v2.AccountId = v1.AccountId;
                v2.Company = v1.Company;
                v2.Email = v1.Email;
                v2.IsVIP = v1.IsVIP;
                v2.Name = v1.Name;
                v2.Remark = v1.Remark;
                v2.VisitCount = v1.VisitCount;
                v2.VisitorId = v1.VisitorId;
                v2.CurrentSession = Convert(v1.CurrentSession) as LiveSupportModel.VisitSession;
                return v2;
            }
            else if (obj is LiveSupport.OperatorConsole.LiveChatWS.VisitSession)
            {
                LiveSupport.OperatorConsole.LiveChatWS.VisitSession v1 = obj as LiveSupport.OperatorConsole.LiveChatWS.VisitSession;
                LiveSupportModel.VisitSession v2 = new LiveSupport.LiveSupportModel.VisitSession();
                v2.Browser = v1.Browser;
                v2.ChatingTime = v1.ChatingTime;
                v2.ChatRequestTime = v1.ChatRequestTime;
                v2.ChattingDuring = v1.ChattingDuring;
                v2.DomainRequested = v1.DomainRequested;
                v2.IP = v1.IP;
                v2.LeaveTime = v1.LeaveTime;
                v2.Location = v1.Location;
                v2.OperatorId = v1.OperatorId;
                v2.PageRequestCount = v1.PageRequestCount;
                v2.PageRequested = v1.PageRequested;
                v2.SessionId = v1.SessionId;
                v2.Referrer = v1.Referrer;
                v2.Status = (LiveSupportModel.VisitSessionStatus)Enum.Parse(typeof(LiveSupportModel.VisitSessionStatus), v1.Status.ToString());
                v2.VisitingTime = v1.VisitingTime;
                v2.VisitorId = v1.VisitorId;
                v2.WaitingDuring = v1.WaitingDuring;
                return v2;
            }
            else if (obj is LiveSupport.OperatorConsole.LiveChatWS.Operator)
            {
                LiveSupport.OperatorConsole.LiveChatWS.Operator v1 = obj as LiveSupport.OperatorConsole.LiveChatWS.Operator;
                LiveSupportModel.Operator v2 = new LiveSupport.LiveSupportModel.Operator();
                v2.AccountId = v1.AccountId;
                v2.AVChatStatus = v1.AVChatStatus;
                v2.Email = v1.Email;
                v2.HeartBeatTime = v1.HeartBeatTime;
                v2.IsAdmin = v1.IsAdmin;
                v2.LoginName = v1.LoginName;
                v2.NickName = v1.NickName;
                v2.OperatorId = v1.OperatorId;
                v2.OperatorSession = v1.OperatorSession;
                v2.Password = v1.Password;
                v2.Status = (LiveSupportModel.OperatorStatus)Enum.Parse(typeof(LiveSupportModel.OperatorStatus), v1.Status.ToString());
                return v2;
            }
            else if (obj is LiveSupportModel.Message)
            {
                LiveSupportModel.Message v1 = obj as  LiveSupport.LiveSupportModel.Message;
                LiveSupport.OperatorConsole.LiveChatWS.Message v2 = new LiveSupport.OperatorConsole.LiveChatWS.Message();
                v2.ChatId = v1.ChatId;
                v2.Destination = v1.Destination;
                v2.MessageId = v1.MessageId;
                v2.SentDate = v1.SentDate;
                v2.Source = v1.Source;
                v2.Text = v1.Text;
                v2.Type = (LiveSupport.OperatorConsole.LiveChatWS.MessageType)Enum.Parse(typeof(LiveSupport.OperatorConsole.LiveChatWS.MessageType), v1.Type.ToString());
                return v2;
            }
            else if (obj is LiveSupport.OperatorConsole.LiveChatWS.Chat)
            {
                LiveSupport.OperatorConsole.LiveChatWS.Chat v1 = obj as LiveSupport.OperatorConsole.LiveChatWS.Chat;
                LiveSupportModel.Chat v2 = new LiveSupport.LiveSupportModel.Chat();
                v2.ChatId = v1.ChatId;
                v2.AcceptTime = v1.AcceptTime;
                v2.AccountId = v1.AccountId;
                v2.CloseBy = v1.CloseBy;
                v2.CloseTime = v1.CloseTime;
                v2.CreateBy = v1.CreateBy;
                v2.CreateTime = v1.CreateTime;
                v2.IsInviteByOperator = v1.IsInviteByOperator;
                v2.LastCheckTime = v1.LastCheckTime;
                v2.OperatorId = v1.OperatorId;
                v2.Status = (LiveSupportModel.ChatStatus)Enum.Parse(typeof(LiveSupportModel.ChatStatus), v1.Status.ToString());
                v2.VisitorId = v1.VisitorId;
                return v2;
            }
            else if (obj is LiveSupport.OperatorConsole.LiveChatWS.LeaveWord)
            {
                LiveSupport.OperatorConsole.LiveChatWS.LeaveWord v1 = obj as LiveSupport.OperatorConsole.LiveChatWS.LeaveWord;
                LiveSupportModel.LeaveWord v2 = new LiveSupport.LiveSupportModel.LeaveWord();
               // v2.Account = v1.Account;
                v2.CallerDate = v1.CallerDate;
                v2.CallerName = v1.CallerName;
                v2.Content = v1.Content;
                v2.DomainName = v1.DomainName;
                v2.Email = v1.Email;
                v2.Id = v1.Id;
                v2.Ip = v1.Ip;
                v2.IsReplied = v1.IsReplied;
                v2.IsSend = v1.IsSend;
                v2.OperatorName = v1.OperatorName;
                v2.Phone = v1.Phone;
                 v2.Senddate = v1.Senddate;
                 v2.Subject = v1.Subject;
                 return v2;
            }
            else if (obj is LiveSupport.OperatorConsole.LiveChatWS.Account)
            {
                LiveSupport.OperatorConsole.LiveChatWS.Account v1 = obj as LiveSupport.OperatorConsole.LiveChatWS.Account;
                LiveSupportModel.Account v2 = new LiveSupport.LiveSupportModel.Account();
                v2.AccountId = v1.AccountId;
                v2.AccountNumber = v1.AccountNumber;
                v2.City = v1.City;
                v2.CompanyName = v1.CompanyName;
                v2.ContactName = v1.ContactName;
                v2.Domain = v1.Domain;
                v2.Email = v1.Email;
                v2.Industry = v1.Industry;
                v2.OperatorCount = v1.OperatorCount;
                v2.PaymentId = v1.PaymentId;
                v2.Phone = v1.Phone;
                v2.Province = v1.Province;
                v2.RegisterDate = v1.RegisterDate;
                v2.Remark = v1.Remark;
                v2.Url = v1.Url;
                return v2;
            }
            else if (obj is LiveSupport.OperatorConsole.LiveChatWS.PageRequest)
            {
             LiveSupport.OperatorConsole.LiveChatWS.PageRequest v1 = obj as LiveSupport.OperatorConsole.LiveChatWS.PageRequest;
                LiveSupportModel.PageRequest v2 = new LiveSupport.LiveSupportModel.PageRequest();
                v2.AccountId = v1.AccountId;
                v2.Page = v1.Page;
                v2.Referrer = v1.Referrer;
                v2.RequestTime = v1.RequestTime;
                v2.SessionId = v1.SessionId;
                return v2;
            }
            else if (obj is LiveSupport.OperatorConsole.LiveChatWS.QuickResponseCategory)
            {
                LiveSupport.OperatorConsole.LiveChatWS.QuickResponseCategory v1 = obj as LiveSupport.OperatorConsole.LiveChatWS.QuickResponseCategory;
                LiveSupportModel.QuickResponseCategory v2 = new LiveSupport.LiveSupportModel.QuickResponseCategory();
                v2.AccountId = v1.AccountId;
                v2.Name = v1.Name;
                v2.QuickId = v1.QuickId;
                v2.Responses =new List<string>(v1.Responses);
                return v2;
            }
            else if (obj is LiveSupportModel.QuickResponseCategory)
            {
                LiveSupportModel.QuickResponseCategory v1 = obj as LiveSupportModel.QuickResponseCategory;
                LiveSupport.OperatorConsole.LiveChatWS.QuickResponseCategory v2 = new LiveSupport.OperatorConsole.LiveChatWS.QuickResponseCategory();
                v2.AccountId = v1.AccountId;
                v2.Name = v1.Name;
                v2.QuickId = v1.QuickId;
                v2.Responses = v1.Responses.ToArray();
                return v2;
            }
            else if (obj is LiveSupport.OperatorConsole.LiveChatWS.Message)
            {
                LiveSupport.OperatorConsole.LiveChatWS.Message v1 = obj as LiveSupport.OperatorConsole.LiveChatWS.Message;
                LiveSupportModel.Message v2 = new LiveSupport.LiveSupportModel.Message();
                v2.ChatId = v1.ChatId;
                v2.Destination = v1.Destination;
                v2.MessageId = v1.MessageId;
                v2.SentDate = v1.SentDate;
                v2.Source = v1.Source;
                v2.Text = v1.Text;
                v2.Type = (LiveSupport.LiveSupportModel.MessageType)Enum.Parse(typeof(LiveSupport.LiveSupportModel.MessageType), v1.Type.ToString());
                return v2;
            }
            else if (obj is LiveSupport.OperatorConsole.LiveChatWS.SystemAdvertise)
            {
                LiveSupport.OperatorConsole.LiveChatWS.SystemAdvertise v1 = obj as LiveSupport.OperatorConsole.LiveChatWS.SystemAdvertise;
                LiveSupportModel.SystemAdvertise v2 = new LiveSupport.LiveSupportModel.SystemAdvertise();
                v2.AdvertiseMessage = v1.AdvertiseMessage;
                v2.AdvertiseUrl = v1.AdvertiseUrl;
                return v2;
            }
            else
            {
                throw new ArgumentException("Unknow type");
            }
            return null;
        }
Esempio n. 15
0
        public int UpdateOperator(Operator op)
        {
            //int isAdmin = 0;
            //if (op.IsAdmin == false)
            //    isAdmin = 0;
            //else
            //    isAdmin = 1;
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update LiveChat_Operator set ");
            strSql.Append("AccountId=@AccountId,");
            strSql.Append("LoginName=@LoginName,");
            strSql.Append("Password=@Password,");
            strSql.Append("NickName=@NickName,");
            strSql.Append("Email=@Email,");
            strSql.Append("IsAdmin=@IsAdmin,");
            strSql.Append("Status=@Status,");
            strSql.Append("AVChatStatus=@AVChatStatus,");
            strSql.Append("DepartmentId=@DepartmentId");
            strSql.Append(" where OperatorId=@OperatorId ");
            SqlParameter[] parameters = {
                    new SqlParameter("@OperatorId", SqlDbType.VarChar,50),
                    new SqlParameter("@AccountId", SqlDbType.VarChar,50),
                    new SqlParameter("@LoginName", SqlDbType.VarChar,30),
                    new SqlParameter("@Password", SqlDbType.VarChar,30),
                    new SqlParameter("@NickName", SqlDbType.VarChar,30),
                    new SqlParameter("@Email", SqlDbType.VarChar,30),
                    new SqlParameter("@IsAdmin", SqlDbType.Bit,1),
                    new SqlParameter("@Status", SqlDbType.VarChar,30),
                    new SqlParameter("@AVChatStatus", SqlDbType.VarChar,30),
                    new SqlParameter("@DepartmentId", SqlDbType.VarChar,50)};
            parameters[0].Value = op.OperatorId;
            parameters[1].Value = op.Account.AccountId;
            parameters[2].Value = op.LoginName;
            parameters[3].Value = op.Password;
            parameters[4].Value = op.NickName;
            parameters[5].Value = op.Email;
            parameters[6].Value = op.IsAdmin;
            parameters[7].Value = op.Status;
            parameters[8].Value = op.AVChatStatus;
            parameters[9].Value = op.Department.DepartmentId;

               return DBHelper.ExecuteCommand(strSql.ToString(), parameters);
        }
Esempio n. 16
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;
     }
 }
Esempio n. 17
0
 public Operator Login(string accountId, string loginName, string loginPwd)
 {
     string sql = string.Format("select * from LiveChat_Operator where AccountId='{0}' and LoginName='{1}' and Password='******'",accountId,loginName,loginPwd);
     Operator op = new Operator();
     op = GetOperatorBySql(sql);
     return op;
 }
Esempio n. 18
0
 public Operator GetOperatorPassword(string accountNumber, string loginName, string eamil)
 {
     try
     {
         Account ac = SqlAccountProvider.Default.CheckCompanyByaccountNumber(accountNumber);
         if (ac != null)
         {
             string sql = string.Format("select * from LiveChat_Operator where AccountId='{0}' and LoginName='{1}' and Email='{2}'",ac.AccountId, loginName, eamil);
             Operator oper = new Operator();
             oper = GetOperatorBySql(sql);
             return oper;
         }
         else
         {
             return null;
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Esempio n. 19
0
 public int NewOperator(Operator op)
 {
     return 0;
 }
Esempio n. 20
0
 public int UpdateOperator(Operator op)
 {
     throw new NotImplementedException();
 }
Esempio n. 21
0
 private void button11_Click(object sender, EventArgs e)
 {
     for (int i = 0; i < 500; i++)
     {
         Account at = AccountService.FindAccountByAccountNumber(i.ToString());
         Operator op = new Operator();
         op.Account = at;
         op.LoginName = "admin"+(i+1000);
         op.Password = "******" + (i + 1000);
         op.NickName = "admin" + (i + 1000) + "客服";
         op.IsAdmin = false;
         op.Department = DepartmentManager.GetDepartmentByAccountId(at.AccountId)[0];
         op.Status = (OperatorStatus)Enum.Parse((typeof(OperatorStatus)), OperatorStatus.Offline.ToString());
         op.AVChatStatus = OperatorStatus.Offline.ToString();
         op.Email = "*****@*****.**";
         bool b = OperatorsManager.NewOperator(op);
     }
 }
Esempio n. 22
0
 public Operator GetOperatorBySql(string sql)
 {
     Operator operators = new Operator();
     using (SqlDataReader r = DBHelper.GetReader(sql))
     {
         if (r.Read())
         {
             Operator op = new Operator(r);
             SqlAccountProvider ap = new SqlAccountProvider();
             SqlDepartmentProvider dp = new SqlDepartmentProvider();
             op.Department = dp.GetDepartmentById(r["DepartmentId"].ToString());
             op.Account = ap.GetAccountByAccountId(r["accountId"].ToString());
             return op;
         }
         else
         {
             return null;
         }
     }
 }
Esempio n. 23
0
 public static bool NewOperator(Operator op)
 {
     int i = 0;
     i=Provider.NewOperator(op);
     ReloadOperators();
     if (i != 0)
         return true;
     else
         return false;
 }
Esempio n. 24
0
        public void Login(string accountNumber, string operatorName, string password)
        {
            if (State != ConnectionState.Disconnected)
            {
                return;
            }

            try
            {
                this.accountNumber = accountNumber;
                this.operatorName = operatorName;
                this.password = password;

                currentOperator = null;
                fireConnectStateChange(ConnectionState.Connecting, "登录中...");

                ws.LoginAsync(accountNumber, operatorName, password, Guid.NewGuid());
            }
            catch (Exception e)
            {
                Trace.WriteLine(e.Message);
            }
        }
Esempio n. 25
0
        public static object Convert(object obj)
        {
            if (obj == null)
            {
                return(null);
            }
            if (obj is LiveSupport.OperatorConsole.LiveChatWS.Visitor)
            {
                LiveSupport.OperatorConsole.LiveChatWS.Visitor v1 = obj as LiveSupport.OperatorConsole.LiveChatWS.Visitor;

                LiveSupportModel.Visitor v2 = new LiveSupport.LiveSupportModel.Visitor();
                v2.AccountId      = v1.AccountId;
                v2.Company        = v1.Company;
                v2.Email          = v1.Email;
                v2.IsVIP          = v1.IsVIP;
                v2.Name           = v1.Name;
                v2.Remark         = v1.Remark;
                v2.VisitCount     = v1.VisitCount;
                v2.VisitorId      = v1.VisitorId;
                v2.CurrentSession = Convert(v1.CurrentSession) as LiveSupportModel.VisitSession;
                return(v2);
            }
            else if (obj is LiveSupport.OperatorConsole.LiveChatWS.VisitSession)
            {
                LiveSupport.OperatorConsole.LiveChatWS.VisitSession v1 = obj as LiveSupport.OperatorConsole.LiveChatWS.VisitSession;
                LiveSupportModel.VisitSession v2 = new LiveSupport.LiveSupportModel.VisitSession();
                v2.Browser         = v1.Browser;
                v2.ChatingTime     = v1.ChatingTime;
                v2.ChatRequestTime = v1.ChatRequestTime;
                v2.ChattingDuring  = v1.ChattingDuring;
                v2.DomainRequested = v1.DomainRequested;
                v2.IP               = v1.IP;
                v2.LeaveTime        = v1.LeaveTime;
                v2.Location         = v1.Location;
                v2.OperatorId       = v1.OperatorId;
                v2.PageRequestCount = v1.PageRequestCount;
                v2.PageRequested    = v1.PageRequested;
                v2.SessionId        = v1.SessionId;
                v2.Referrer         = v1.Referrer;
                v2.Status           = (LiveSupportModel.VisitSessionStatus)Enum.Parse(typeof(LiveSupportModel.VisitSessionStatus), v1.Status.ToString());
                v2.VisitingTime     = v1.VisitingTime;
                v2.VisitorId        = v1.VisitorId;
                v2.WaitingDuring    = v1.WaitingDuring;
                return(v2);
            }
            else if (obj is LiveSupport.OperatorConsole.LiveChatWS.Operator)
            {
                LiveSupport.OperatorConsole.LiveChatWS.Operator v1 = obj as LiveSupport.OperatorConsole.LiveChatWS.Operator;
                LiveSupportModel.Operator v2 = new LiveSupport.LiveSupportModel.Operator();
                v2.AccountId       = v1.AccountId;
                v2.AVChatStatus    = v1.AVChatStatus;
                v2.Email           = v1.Email;
                v2.HeartBeatTime   = v1.HeartBeatTime;
                v2.IsAdmin         = v1.IsAdmin;
                v2.LoginName       = v1.LoginName;
                v2.NickName        = v1.NickName;
                v2.OperatorId      = v1.OperatorId;
                v2.OperatorSession = v1.OperatorSession;
                v2.Password        = v1.Password;
                v2.Status          = (LiveSupportModel.OperatorStatus)Enum.Parse(typeof(LiveSupportModel.OperatorStatus), v1.Status.ToString());
                return(v2);
            }
            else if (obj is LiveSupportModel.Message)
            {
                LiveSupportModel.Message v1 = obj as  LiveSupport.LiveSupportModel.Message;
                LiveSupport.OperatorConsole.LiveChatWS.Message v2 = new LiveSupport.OperatorConsole.LiveChatWS.Message();
                v2.ChatId      = v1.ChatId;
                v2.Destination = v1.Destination;
                v2.MessageId   = v1.MessageId;
                v2.SentDate    = v1.SentDate;
                v2.Source      = v1.Source;
                v2.Text        = v1.Text;
                v2.Type        = (LiveSupport.OperatorConsole.LiveChatWS.MessageType)Enum.Parse(typeof(LiveSupport.OperatorConsole.LiveChatWS.MessageType), v1.Type.ToString());
                return(v2);
            }
            else if (obj is LiveSupport.OperatorConsole.LiveChatWS.Chat)
            {
                LiveSupport.OperatorConsole.LiveChatWS.Chat v1 = obj as LiveSupport.OperatorConsole.LiveChatWS.Chat;
                LiveSupportModel.Chat v2 = new LiveSupport.LiveSupportModel.Chat();
                v2.ChatId             = v1.ChatId;
                v2.AcceptTime         = v1.AcceptTime;
                v2.AccountId          = v1.AccountId;
                v2.CloseBy            = v1.CloseBy;
                v2.CloseTime          = v1.CloseTime;
                v2.CreateBy           = v1.CreateBy;
                v2.CreateTime         = v1.CreateTime;
                v2.IsInviteByOperator = v1.IsInviteByOperator;
                v2.LastCheckTime      = v1.LastCheckTime;
                v2.OperatorId         = v1.OperatorId;
                v2.Status             = (LiveSupportModel.ChatStatus)Enum.Parse(typeof(LiveSupportModel.ChatStatus), v1.Status.ToString());
                v2.VisitorId          = v1.VisitorId;
                return(v2);
            }
            else if (obj is LiveSupport.OperatorConsole.LiveChatWS.LeaveWord)
            {
                LiveSupport.OperatorConsole.LiveChatWS.LeaveWord v1 = obj as LiveSupport.OperatorConsole.LiveChatWS.LeaveWord;
                LiveSupportModel.LeaveWord v2 = new LiveSupport.LiveSupportModel.LeaveWord();
                // v2.Account = v1.Account;
                v2.CallerDate   = v1.CallerDate;
                v2.CallerName   = v1.CallerName;
                v2.Content      = v1.Content;
                v2.DomainName   = v1.DomainName;
                v2.Email        = v1.Email;
                v2.Id           = v1.Id;
                v2.Ip           = v1.Ip;
                v2.IsReplied    = v1.IsReplied;
                v2.IsSend       = v1.IsSend;
                v2.OperatorName = v1.OperatorName;
                v2.Phone        = v1.Phone;
                v2.Senddate     = v1.Senddate;
                v2.Subject      = v1.Subject;
                return(v2);
            }
            else if (obj is LiveSupport.OperatorConsole.LiveChatWS.Account)
            {
                LiveSupport.OperatorConsole.LiveChatWS.Account v1 = obj as LiveSupport.OperatorConsole.LiveChatWS.Account;
                LiveSupportModel.Account v2 = new LiveSupport.LiveSupportModel.Account();
                v2.AccountId     = v1.AccountId;
                v2.AccountNumber = v1.AccountNumber;
                v2.City          = v1.City;
                v2.CompanyName   = v1.CompanyName;
                v2.ContactName   = v1.ContactName;
                v2.Domain        = v1.Domain;
                v2.Email         = v1.Email;
                v2.Industry      = v1.Industry;
                v2.OperatorCount = v1.OperatorCount;
                v2.PaymentId     = v1.PaymentId;
                v2.Phone         = v1.Phone;
                v2.Province      = v1.Province;
                v2.RegisterDate  = v1.RegisterDate;
                v2.Remark        = v1.Remark;
                v2.Url           = v1.Url;
                return(v2);
            }
            else if (obj is LiveSupport.OperatorConsole.LiveChatWS.PageRequest)
            {
                LiveSupport.OperatorConsole.LiveChatWS.PageRequest v1 = obj as LiveSupport.OperatorConsole.LiveChatWS.PageRequest;
                LiveSupportModel.PageRequest v2 = new LiveSupport.LiveSupportModel.PageRequest();
                v2.AccountId   = v1.AccountId;
                v2.Page        = v1.Page;
                v2.Referrer    = v1.Referrer;
                v2.RequestTime = v1.RequestTime;
                v2.SessionId   = v1.SessionId;
                return(v2);
            }
            else if (obj is LiveSupport.OperatorConsole.LiveChatWS.QuickResponseCategory)
            {
                LiveSupport.OperatorConsole.LiveChatWS.QuickResponseCategory v1 = obj as LiveSupport.OperatorConsole.LiveChatWS.QuickResponseCategory;
                LiveSupportModel.QuickResponseCategory v2 = new LiveSupport.LiveSupportModel.QuickResponseCategory();
                v2.AccountId = v1.AccountId;
                v2.Name      = v1.Name;
                v2.QuickId   = v1.QuickId;
                v2.Responses = new List <string>(v1.Responses);
                return(v2);
            }
            else if (obj is LiveSupportModel.QuickResponseCategory)
            {
                LiveSupportModel.QuickResponseCategory v1 = obj as LiveSupportModel.QuickResponseCategory;
                LiveSupport.OperatorConsole.LiveChatWS.QuickResponseCategory v2 = new LiveSupport.OperatorConsole.LiveChatWS.QuickResponseCategory();
                v2.AccountId = v1.AccountId;
                v2.Name      = v1.Name;
                v2.QuickId   = v1.QuickId;
                v2.Responses = v1.Responses.ToArray();
                return(v2);
            }
            else if (obj is LiveSupport.OperatorConsole.LiveChatWS.Message)
            {
                LiveSupport.OperatorConsole.LiveChatWS.Message v1 = obj as LiveSupport.OperatorConsole.LiveChatWS.Message;
                LiveSupportModel.Message v2 = new LiveSupport.LiveSupportModel.Message();
                v2.ChatId      = v1.ChatId;
                v2.Destination = v1.Destination;
                v2.MessageId   = v1.MessageId;
                v2.SentDate    = v1.SentDate;
                v2.Source      = v1.Source;
                v2.Text        = v1.Text;
                v2.Type        = (LiveSupport.LiveSupportModel.MessageType)Enum.Parse(typeof(LiveSupport.LiveSupportModel.MessageType), v1.Type.ToString());
                return(v2);
            }
            else if (obj is LiveSupport.OperatorConsole.LiveChatWS.SystemAdvertise)
            {
                LiveSupport.OperatorConsole.LiveChatWS.SystemAdvertise v1 = obj as LiveSupport.OperatorConsole.LiveChatWS.SystemAdvertise;
                LiveSupportModel.SystemAdvertise v2 = new LiveSupport.LiveSupportModel.SystemAdvertise();
                v2.AdvertiseMessage = v1.AdvertiseMessage;
                v2.AdvertiseUrl     = v1.AdvertiseUrl;
                return(v2);
            }
            else
            {
                throw new ArgumentException("Unknow type");
            }
            return(null);
        }