public void TestLogin2()
        {
            // 测试多个客服端用同一个客服帐号登录
            LiveSupport.LiveSupportDAL.SqlProviders.DBHelper.ConnectionString = "Server=rd01;Database=LiveSupport;User ID=sa;Password=;Trusted_Connection=False;";
            Account a = new Account();
            a.LoginName = Util.RandLetter(10);
            a.Password = "******";

            AccountsManager.AddAccount(a);
            Operator op = OperatorService.Login(a.LoginName, a.LoginName, a.Password);

            Assert.AreEqual(a.AccountId, op.OperatorId);
            Assert.AreEqual(op.LoginName, a.LoginName);
            Account ac = AccountService.FindAccountByLoginName(a.LoginName);
            Assert.AreEqual(op.AccountId, ac.AccountId);
            Assert.AreEqual(op.Password, a.Password);
            Assert.AreEqual(op.Status, OperatorStatus.Idle);

            Operator op2 = OperatorService.Login(a.LoginName, a.LoginName, a.Password);
            Assert.IsNull(op2);

            OperatorService.Logout(op.OperatorId);

            op = OperatorService.Login(a.LoginName, a.LoginName, a.Password);
            Assert.IsNotNull(op);
        }
Exemple #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;
        }
Exemple #3
0
 public static Account CreateNewAccount()
 {
     Account at = new Account();
     at.CompanyName = "Company" + r.Next();
     at.Url = "http://test/";
     at.Phone = "1111111";
     at.ContactName = "aaa";
     at.Email = "dd";
     at.Province = "dd";
     at.City = "ee";
     at.Industry = "ee";
     at.OperatorCount = 1;
     at.RegisterDate = DateTime.Now;
     return at;
 }
 private Account createAccount(int index)
 {
     Account at = new Account();
     at.CompanyName = "Company"+index;
     at.Url = "http://test/";
     at.Phone = "1111111";
     at.ContactName = "aaa";
     at.Email = "dd";
     at.Province = "dd";
     at.City = "ee";
     at.Industry = "ee";
     at.OperatorCount = 1;
     at.RegisterDate = DateTime.Now;
     at.LoginName = Guid.NewGuid().ToString();
     at.Password = "******";
     at.NickName = "eeeee";
     return at;
 }
Exemple #5
0
 public static Account CreateNewAccount()
 {
     Random r = new Random();
     Account at = new Account();
     at.CompanyName = "Company" + r.Next();
     at.Url = "http://test/";
     at.Phone = "1111111";
     at.ContactName = "aaa";
     at.Email = "dd";
     at.Province = "dd";
     at.City = "ee";
     at.Industry = "ee";
     at.OperatorCount = 1;
     at.RegisterDate = DateTime.Now;
     at.LoginName = Guid.NewGuid().ToString();
     at.Password = "******";
     at.NickName = "eeeee";
     return at;
 }
 public Account CheckCompanyByaccountNumber(string accountNumber)
 {
     string sql = string.Format("select * from dbo.LiveSupport_Account where accountNumber='{0}'", accountNumber);
     SqlDataReader data = null;
     Account account = null;
     try
     {
         using (data = DBHelper.GetReader(sql))
         {
             if (data.Read())
             {
                 account = new Account(data);
             }
             return account;
         }
     }
     catch(Exception ex)
     {
         return null;
     }
 }
 public int AddAccount(Account account)
 {
     try
     {
         Account ac = new SqlAccountProvider().CheckCompanyByaccountNumber(account.AccountNumber);
         if (ac == null)
         {
             string sql = string.Format(
              "INSERT INTO [LiveSupport].[dbo].[LiveSupport_Account]"
               + " ([AccountId]"
               + " ,[AccountNumber]"
               + " ,[CompanyName]"
               + " ,[Industry]"
               + ",[Email]"
               + " ,[ContactName]"
               + " ,[Phone]"
               + " ,[URL]"
               + ",[Domain]"
               + " ,[OperatorCount]"
               + " ,[Province]"
               + " ,[City]"
               + " ,[RegisterDate]"
               + " ,[Remark]"
               + " ,[PaymentId])"
               + " VALUES ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}',{9},'{10}','{11}','{12}','{13}','{14}')",
               account.AccountId, account.AccountNumber, account.CompanyName, account.Industry, account.Email, account.ContactName, account.Phone, account.Url, account.Domain, account.OperatorCount, account.Province, account.City, account.RegisterDate, account.Remark, account.PaymentId);
             return DBHelper.ExecuteCommand(sql);
         }
         else
         {
             return 0;
         }
     }
     catch (Exception ex)
     {
         return 0;
     }
 }
Exemple #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);

            }
        }
Exemple #9
0
 /// <summary>
 /// 创建管理员信息
 /// </summary>
 /// <returns></returns>
 public bool NewAccount()
 {
     Account account=new Account();
     account.AccountNumber="10000";
     account.CompanyName=forumtitle.Text;
     account.ContactName=systemadminname.Text;
     account.Email=adminemail.Text;
     account.Url=Util.GetApplicationPath(Request.UrlReferrer.ToString());
     account.Province = "其它";
     account.City = "其它";
     account.Industry = "计算机";
     account.Domain = Util.GetDomainName(Request.UrlReferrer.ToString());
     return  AccountsManager.AddAccount(account, systemadminname.Text, systemadminname.Text, systemadminpws.Text);
 }
Exemple #10
0
 public static bool UpdateAccount(Account account)
 {
     int i = 0;
     i = SqlAccountProvider.Default.UpdateAccount(account);
     if (i != 0)
     {
         ReloadAccounts();
         return true;
     }
     else
         return false;
 }
Exemple #11
0
 public int UpdateAccount(Account account)
 {
     try
     {
         string sql = string.Format(
            "UPDATE [LiveSupport].[dbo].[LiveSupport_Account]"
            + " SET [AccountNumber] = '{0}'"
            + " ,[CompanyName] ='{1}'"
            + " ,[Industry] ='{2}'"
            + "  ,[Email] ='{3}'"
            + " ,[ContactName] ='{4}'"
            + " ,[Phone] ='{5}'"
            + " ,[URL] ='{6}'"
            + " ,[Domain] ='{7}'"
            + "  ,[OperatorCount] ={8}"
            + " ,[Province] ='{9}'"
            + " ,[City] ='{10}'"
            + "  ,[RegisterDate] ='{11}'"
            + " ,[Remark] ='{12}'"
            + " ,[PaymentId] ='{13}'"
            + "  WHERE [AccountId] ='{14}'"
            , account.AccountNumber, account.CompanyName, account.Industry, account.Email, account.ContactName, account.Phone, account.Url, account.Domain, account.OperatorCount, account.Province, account.City, account.RegisterDate, account.Remark, account.PaymentId, account.AccountId);
         return DBHelper.ExecuteCommand(sql);
     }
     catch (Exception ex)
     {
         return 0;
     }
 }
Exemple #12
0
 public Account GetAccountByAccountId(string accountId)
 {
     string sql = string.Format("select * from [LiveSupport].[dbo].[LiveSupport_Account] where  AccountId='{0}'",accountId);
     SqlDataReader data = null;
     Account account = null;
     try
     {
         using (data = DBHelper.GetReader(sql))
         {
             if (data.Read())
             {
                 account = new Account(data);
             }
             return account;
         }
     }
     catch(Exception ex)
     {
         return null;
     }
 }
Exemple #13
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;
        }
Exemple #14
0
 public int UpdateAccount(Account account)
 {
     throw new NotImplementedException();
 }
Exemple #15
0
 public int AddAccount(Account account)
 {
     return 0;
 }
Exemple #16
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);
        }