Esempio n. 1
0
        private IEnumerable<ReportParameter> CreateReportParameters(AgentInfo agentInfo)
        {
            var parameters = new List<ReportParameter>();
            parameters.Add(new ReportParameter("LogoUrl", agentInfo.ImageUrl));
            parameters.Add(new ReportParameter("LogoName", agentInfo.LogoName));
            parameters.Add(new ReportParameter("AgentName", agentInfo.FullName));
            parameters.Add(new ReportParameter("AgentIdNumber", agentInfo.IdNumber));
            parameters.Add(new ReportParameter("AgentPhone", agentInfo.Phone));
            parameters.Add(new ReportParameter("AgentAddress", agentInfo.Address));
            parameters.Add(new ReportParameter("AgentEmail", agentInfo.Email));
            parameters.Add(new ReportParameter("AgentCertificateNumber", agentInfo.CertificateNumber));



            return parameters.AsReadOnly();
        }
Esempio n. 2
0
        private void LoginForm_Load(object sender, EventArgs e)
        {
            this.Text = "Desktop";

            // Get all the agents.
            List <Logics.LogInAgent> listLogInAgents = Logics.Agents.GetLogInAgents();

            mAgent.DataSource    = listLogInAgents;
            mAgent.ValueMember   = "Name";
            mAgent.DisplayMember = "Alias";

            if (Logics.Logic.Agent != null)
            {
                mAgent.SelectedItem = Logics.Logic.Agent;
            }

            #region Load supported languages
            List <KeyValuePair <string, string> > lSupportedLanguages = new List <KeyValuePair <string, string> >();

            // Load supported languages from the LanguageManager class.
            foreach (System.Globalization.CultureInfo litem in CultureManager.SupportedLanguages.Values)
            {
                lSupportedLanguages.Add(new KeyValuePair <string, string>(litem.Name, litem.NativeName));
            }

            // Load supported languages from the LanguageManager class into the combobox.
            if (lSupportedLanguages.Count > 0)
            {
                KeyValuePair <string, string> lSelectedLanguage = new KeyValuePair <string, string>(CultureManager.Culture.Name, CultureManager.Culture.NativeName);
                this.mLanguage.SelectedIndexChanged -= new System.EventHandler(this.MultilanguageFixedString);
                this.mLanguage.DataSource            = lSupportedLanguages;
                this.mLanguage.ValueMember           = "Key";
                this.mLanguage.DisplayMember         = "Value";
                this.mLanguage.SelectedIndexChanged += new System.EventHandler(this.MultilanguageFixedString);
                this.mLanguage.SelectedItem          = lSelectedLanguage;
                this.mLanguage.Enabled    = true;
                this.mlblLanguage.Enabled = true;
            }

            /* Not avaliable languages for the application.
             * IMPORNTANT: To enable any additional language, go to the
             * 'CultureManager' class and add the needed language
             * in 'CultureManager.SupportedLanguages' property.
             */
            else
            {
                this.mLanguage.Items.Add("None");
                this.mLanguage.SelectedIndex = 0;
                this.mLanguage.Enabled       = false;
                this.mlblLanguage.Enabled    = false;

                // Check the anonymous agent.
                if (this.mAgent.Items.Count == 1)
                {
                    string    lAgentClassName = (mAgent.SelectedItem as Logics.LogInAgent).Name;
                    AgentInfo lAgent          = Oid.Create(lAgentClassName) as AgentInfo;
                    if (lAgent is AnonymousAgentInfo)
                    {
                        LogIn(lAgent);
                    }
                }
            }
            #endregion Load supported languages
        }
Esempio n. 3
0
 public PingResponse Ping(AgentInfo Agent)
 {
     return(Coordinator.Ping(Agent));
 }
Esempio n. 4
0
 public static int Update(AgentInfo model)
 {
     return(AgentInfoDAL.Update(model));
 }
Esempio n. 5
0
 public static AgentInfo GetModelByID(AgentInfo model)
 {
     return(AgentInfoDAL.GetModelByID(model));
 }
Esempio n. 6
0
 public static int Add(AgentInfo ai)
 {
     return(AgentInfoDAL.Add(ai));
 }
Esempio n. 7
0
 private static extern void SetPinky(int worldId, ref AgentInfo agentInfo);
Esempio n. 8
0
        private static void SendEmail(AgentInfo agent, Agreement agreement, string destFile)
        {
            var mailMessage = new MailMessage();
            mailMessage.From = new MailAddress("*****@*****.**", agent.FullName);
            mailMessage.Sender = new MailAddress("*****@*****.**", "Simple. ReDoc");
            mailMessage.To.Add(new MailAddress(agent.Email, agent.FullName, Encoding.UTF8));
            mailMessage.To.Add(new MailAddress("*****@*****.**", "Simple. ReDoc"));
            if (!string.IsNullOrEmpty(agreement.CustomerEmail))
            {
                try
                {
                    mailMessage.To.Add(new MailAddress(agreement.CustomerEmail, agreement.CustomerName, Encoding.UTF8));
                }
                catch (Exception anyException)
                {
                    SystemMonitor.Error(anyException, "Error creating customer mail address");
                }
            }
            mailMessage.Subject = "הסכם לשירותי תיווך מאת - " + agent.FullName;
            mailMessage.Body = "מצורף בזאת הסכם לשירותי תיווך";
            var attachment = new Attachment(destFile, new ContentType("application/pdf"))
                                 {
                                     Name = "הסכם שירותי תיווך - " + DateTime.Now.ToShortDateString() + ".pdf"
                                 };
            mailMessage.Attachments.Add(attachment);

            var smtpClient = new SmtpClient("smtp.gmail.com", 587);
            smtpClient.Credentials = new NetworkCredential("mysmallfish", "Smallfish00");
            smtpClient.EnableSsl = true;

            smtpClient.Send(mailMessage);
        }
Esempio n. 9
0
        /// <summary>获取信息</summary>
        /// <returns></returns>
        public AgentInfo GetInfo()
        {
            Init();

            return(Info = _client.Invoke <AgentInfo>("Info"));
        }
 /// <inheritdoc />
 public void RequestDecision(AgentInfo info, List <ISensor> sensors)
 {
     m_AgentId = info.episodeId;
     m_Communicator?.PutObservations(m_FullyQualifiedBehaviorName, info, sensors);
 }
Esempio n. 11
0
 /// <inheritdoc />
 public void RequestDecision(AgentInfo info, List <ISensor> sensors)
 {
     StepSensors(sensors);
     m_Done = info.done;
     m_DecisionRequested = true;
 }
Esempio n. 12
0
 public APIController(AgentInfo identity)
 {
     _identity = identity;
 }
Esempio n. 13
0
 public IActionResult RegisterAgent([FromBody] AgentInfo agentInfo)
 {
     _logger.LogInformation($"GetMetrics: agentInfo - {agentInfo}");
     return(Ok());
 }
Esempio n. 14
0
 public static void SetAgentCookieNew(AgentInfo user)
 {
     System.Web.HttpContext.Current.Session["agentinfo"] = user;
 }
Esempio n. 15
0
 public DbOperationLog(IServiceProvider services)
     : base(services)
 {
     AgentInfo = services.GetRequiredService <AgentInfo>();
 }
Esempio n. 16
0
 private static AgentInfo GetAgentInfo()
 {
     var agentInfo = new AgentInfo()
     {
         ImageUrl = "http://me.5115.us/Safety/ReDoc/Images/Guy.png",
         LogoName = "ג.י.א שיווק נדל\"ן",
         FullName = "גיא אברהמי",
         IdNumber = "25156175",
         CertificateNumber = "15980",
         Address = "חבקוק 42, פתח תקווה",
         Phone = "050-7116850",
         Email = "*****@*****.**"
     };
     return agentInfo;
 }
Esempio n. 17
0
 private string GenerateReport(AgentInfo agent, Agreement agreement)
 {
     var destFile = RenderReport(agent, agreement);
     var reportFilePath = string.Format((agreement.IsExclusive ? "Exclusive-" : "") + "Agreement.{0}[{1}].pdf",
                                        DateTime.Now.ToString("dd-MM-yyyy HH-mm"), agreement.UniqueId);
     var outputPath = GetPropertyAgreementsOutputPath();
     reportFilePath = Path.Combine(outputPath, reportFilePath);
     System.IO.File.Copy(destFile, reportFilePath, true);
     return destFile;
 }
Esempio n. 18
0
 /// <summary>
 /// 添加代理信息
 /// </summary>
 /// <param name="agent">代理信息</param>
 /// <param name="pGameId">父级代理游戏ID</param>
 /// <returns></returns>
 public Message InsertAgentUser(AgentInfo agent, int pGameId = 0)
 {
     return(agentData.InsertAgentUser(agent, pGameId));
 }
Esempio n. 19
0
 /// <summary>
 /// 更新代理基本信息
 /// </summary>
 /// <param name="agent">代理信息</param>
 /// <returns></returns>
 public int UpdateAgentUser(AgentInfo agent)
 {
     return(agentData.UpdateAgentUser(agent));
 }
Esempio n. 20
0
 Task ITenantGrain.UnRegisterAgent(AgentInfo Info)
 {
     Agents.Remove(Info.Id);
     return(Task.CompletedTask);
 }
        public void CreateEncodingSamples()
        {
            StreamWriter writer = new StreamWriter("MessageSamples.txt");

            MessageNumber msgNumber          = MessageNumber.Create(100, 120);
            MessageNumber conversationNumber = MessageNumber.Create(200, 240);
            AgentInfo     agentInfo          = new AgentInfo(10, AgentInfo.PossibleAgentType.BrilliantStudent, new Common.EndPoint("129.123.5.10:1234"))
            {
                AgentStatus = AgentInfo.PossibleAgentStatus.InGame,
                ANumber     = "A00001",
                FirstName   = "Joe",
                LastName    = "Jones",
                Location    = new FieldLocation(10, 20),
                Points      = 100,
                Strength    = 200,
                Speed       = 1.2
            };


            AckNak ackNak = new AckNak(Reply.PossibleStatus.Success, agentInfo, "Test Message")
            {
                MessageNr      = msgNumber,
                ConversationId = conversationNumber,
                IntResult      = 99,
                Note           = "Test Note"
            };

            writer.WriteLine("AckNak");
            writer.WriteLine("\tMessageNr={0}", ackNak.MessageNr.ToString());
            writer.WriteLine("\tConversationId={0}", ackNak.ConversationId.ToString());
            writer.WriteLine("\tReplyType={0}", ackNak.ReplyType);
            writer.WriteLine("\tAckNak Status={0}", ackNak.Status);
            writer.WriteLine("\tAgent Info:");
            writer.WriteLine("\t\tId={0}", agentInfo.Id);
            writer.WriteLine("\t\tAgentStatus={0}", agentInfo.AgentStatus);
            writer.WriteLine("\t\tANumber={0}", agentInfo.ANumber);
            writer.WriteLine("\t\tFirstName={0}", agentInfo.FirstName);
            writer.WriteLine("\t\tLastName={0}", agentInfo.LastName);
            writer.WriteLine("\t\tLocation={0}", agentInfo.Location.ToString());
            writer.WriteLine("\t\tPoints={0}", agentInfo.Points);
            writer.WriteLine("\t\tStrength={0}", agentInfo.Strength);
            writer.WriteLine("\t\tSpeed={0}", agentInfo.Speed);

            ByteList byteList = new ByteList();

            ackNak.Encode(byteList);

            writer.WriteLine("");
            writer.WriteLine("Encoding:");
            writer.WriteLine(byteList.CreateLogString());
            writer.WriteLine("");
            writer.WriteLine("------------------------------------");
            writer.WriteLine("");

            JoinGame joinGame = new JoinGame(20, agentInfo)
            {
                MessageNr      = msgNumber,
                ConversationId = conversationNumber,
            };

            writer.WriteLine("JoinGame");
            writer.WriteLine("\tMessageNr={0}", joinGame.MessageNr.ToString());
            writer.WriteLine("\tConversationId={0}", joinGame.ConversationId.ToString());
            writer.WriteLine("\tGameId={0}", joinGame.GameId);
            writer.WriteLine("\tAgent Info:");
            writer.WriteLine("\t\tId={0}", agentInfo.Id);
            writer.WriteLine("\t\tAgentStatus={0}", agentInfo.AgentStatus);
            writer.WriteLine("\t\tANumber={0}", agentInfo.ANumber);
            writer.WriteLine("\t\tFirstName={0}", agentInfo.FirstName);
            writer.WriteLine("\t\tLastName={0}", agentInfo.LastName);
            writer.WriteLine("\t\tLocation={0}", agentInfo.Location.ToString());
            writer.WriteLine("\t\tPoints={0}", agentInfo.Points);
            writer.WriteLine("\t\tStrength={0}", agentInfo.Strength);
            writer.WriteLine("\t\tSpeed={0}", agentInfo.Speed);

            byteList = new ByteList();
            joinGame.Encode(byteList);

            writer.WriteLine("");
            writer.WriteLine("Encoding:");
            writer.WriteLine(byteList.CreateLogString());
            writer.WriteLine("");
            writer.WriteLine("------------------------------------");
            writer.WriteLine("");

            // TODO: All of the other message types
        }
Esempio n. 22
0
        private void AddAgent()
        {
            try
            {
                AgentInfo agentInfo = new AgentInfo();
                if (string.IsNullOrEmpty(TxtAgentID.Text))
                {
                    ShowException(string.Format("AgentID empty!"));
                    return;
                }
                if (TxtAgentID.Text.Length > 128)
                {
                    CurrentApp.ShowInfoMessage(CurrentApp.GetLanguageInfo("S1103040", "Add content should not exceed 120 characters."));
                    return;
                }
                else
                {
                    agentInfo.AgentID = TxtAgentID.Text;
                }
                if (TxtAgentName.Text.Length > 128)
                {
                    CurrentApp.ShowInfoMessage(CurrentApp.GetLanguageInfo("S1103040", "Add content should not exceed 120 characters."));
                    return;
                }
                else
                {
                    agentInfo.AgentName = TxtAgentName.Text;
                }
                if (ParentItem == null)
                {
                    return;
                }
                agentInfo.OrgID  = ParentItem.ObjID;
                agentInfo.State  = RadioStateEnable.IsChecked == true ? 0 : 2;
                agentInfo.Tenure = ComboBoxTenure.SelectedIndex;
                OperationReturn optReturn;
                optReturn = XMLHelper.SeriallizeObject(agentInfo);
                if (!optReturn.Result)
                {
                    ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                    return;
                }
                string strInfo = optReturn.Data.ToString();

                int              errCode = 0;
                string           strMsg  = string.Empty;
                BackgroundWorker worker  = new BackgroundWorker();
                worker.DoWork += (s, de) =>
                {
                    try
                    {
                        WebRequest webRequest = new WebRequest();
                        webRequest.Session = CurrentApp.Session;
                        webRequest.Code    = (int)S1103Codes.ModifyAgent;
                        webRequest.ListData.Add(CurrentApp.Session.UserInfo.UserID.ToString());
                        webRequest.ListData.Add("1");
                        webRequest.ListData.Add(strInfo);
                        // Service11031Client client = new Service11031Client();
                        Service11031Client client =
                            new Service11031Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                                                   WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service11031"));
                        WebReturn webReturn = client.DoOperation(webRequest);
                        client.Close();
                        if (!webReturn.Result)
                        {
                            errCode = webReturn.Code;
                            strMsg  = webReturn.Message;
                            return;
                        }
                        if (webReturn.ListData == null ||
                            webReturn.ListData.Count < 1)
                        {
                            errCode = Defines.RET_PARAM_INVALID;
                            strMsg  = string.Format("WS return fail.");
                            return;
                        }
                        string strSerialID = webReturn.ListData[0];
                        CurrentApp.WriteLog("AddAgent", string.Format("End.\t{0}", strSerialID));
                    }
                    catch (Exception ex)
                    {
                        errCode = Defines.RET_FAIL;
                        strMsg  = ex.Message;
                    }
                };
                worker.RunWorkerCompleted += (s, re) =>
                {
                    worker.Dispose();

                    if (errCode > 0)
                    {
                        ShowException(string.Format("{0}\t{1}", errCode, strMsg));
                        return;
                    }
                    ShowInformation(string.Format("Add agnet successful!"));

                    if (PageParent != null)
                    {
                        PageParent.ReloadData();
                    }
                    var panel = Parent as PopupPanel;
                    if (panel != null)
                    {
                        panel.IsOpen = false;
                    }
                };
                worker.RunWorkerAsync();
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }
Esempio n. 23
0
 public static int Delete(AgentInfo model)
 {
     return(AgentInfoDAL.Delete(model));
 }
Esempio n. 24
0
        /*
         * Returns a list of agents that have an active ping and the same version info
         *
         * A requested Version of 0.0.0.0 will return all agents
         */
        public static List <AgentInfo> GetAvailableAgents(Hashtable RequestedConfiguration)
        {
            // Validate the requested configuration
            if (RequestedConfiguration.ContainsKey("Version") == false)
            {
                return(null);
            }

            AgentInfo RequestingAgent;
            IPAddress MyAddressFromRequestingAgentPOV;

            // If the requestor is Blocked, ignore the request
            if (!RequestedConfiguration.ContainsKey("RequestingAgentName"))
            {
                return(null);
            }

            // If the requesting agent is not an approved state, block this request
            string RequestingAgentName = RequestedConfiguration["RequestingAgentName"] as string;

            if ((Agents.TryGetValue(RequestingAgentName, out RequestingAgent) &&
                 ((RequestingAgent.State != AgentState.Available) &&
                  (RequestingAgent.State != AgentState.Working) &&
                  (RequestingAgent.State != AgentState.Busy))))
            {
                return(null);
            }

            var BestInt = NetworkUtils.GetBestInterface(RequestingAgent.Configuration["IPAddress"] as IPAddress);

            MyAddressFromRequestingAgentPOV = NetworkUtils.GetInterfaceIPv4Address(BestInt);

            // Extract the requested configuration
            Version RequestedVersion = RequestedConfiguration["Version"] as Version;

            List <AgentInfo> AliveAgents = new List <AgentInfo>();

            lock ( Agents )
            {
                foreach (AgentInfo Agent in Agents.Values)
                {
                    // Only match against major and minor versions
                    bool VersionMatch =
                        (RequestedVersion.Major < Agent.Version.Major) ||
                        ((RequestedVersion.Major == Agent.Version.Major) &&
                         (RequestedVersion.Minor <= Agent.Version.Minor));

                    bool StateMatch =
                        (Agent.State == AgentState.Available) ||
                        (Agent.State == AgentState.Working) ||
                        (Agent.State == AgentState.Busy);

                    // If there is no group name, everything matches, otherwise
                    // the group names must match
                    bool GroupMatch = true;
                    if ((RequestedConfiguration.ContainsKey("GroupName")) &&
                        (Agent.Configuration.ContainsKey("GroupName")))
                    {
                        string RequestedGroupName = RequestedConfiguration["GroupName"] as string;
                        string AgentGroupName     = Agent.Configuration["GroupName"] as string;
                        GroupMatch = (RequestedGroupName == AgentGroupName);
                    }

                    // If all conditions are met, we match
                    if (VersionMatch && StateMatch && GroupMatch)
                    {
                        if (MyAddressFromRequestingAgentPOV != IPAddress.Loopback &&
                            (Agent.Configuration["IPAddress"] as IPAddress).Equals(IPAddress.Loopback))
                        {
                            var NewAgentInfo = ObjectUtils.Duplicate(Agent);

                            NewAgentInfo.Configuration["IPAddress"] = MyAddressFromRequestingAgentPOV;

                            AliveAgents.Add(NewAgentInfo);
                        }
                        else
                        {
                            AliveAgents.Add(Agent);
                        }
                    }
                }

                // If the requesting agent is asking for assignment, do it now that we have the right set
                bool ValidRequestForAssignment = false;
                if (RequestedConfiguration.ContainsKey("RequestAssignmentFor"))
                {
                    // If the requesting agent is not an approved state, block this request
                    ValidRequestForAssignment = (RequestingAgent.State == AgentState.Available) ||
                                                (RequestingAgent.State == AgentState.Working) ||
                                                (RequestingAgent.State == AgentState.Busy);
                }

                if (ValidRequestForAssignment)
                {
                    // Assign all Available agents to this requesting agent and bin the Working ones
                    Int32 NewlyAssignedCount   = 0;
                    Int32 AlreadyAssignedCount = 0;
                    Dictionary <string, List <AgentInfo> > AssignedToBins = new Dictionary <string, List <AgentInfo> >();

                    foreach (AgentInfo Agent in AliveAgents)
                    {
                        if (Agent.State == AgentState.Available)
                        {
                            Agent.Configuration["AssignedTo"]   = RequestingAgent.Name;
                            Agent.Configuration["AssignedTime"] = DateTime.UtcNow;
                            NewlyAssignedCount++;
                        }
                        else if (Agent.State == AgentState.Working)
                        {
                            // Collect the already assigned agents
                            string AssignedTo = Agent.Configuration["AssignedTo"] as string;
                            if (AssignedTo != Agent.Name)
                            {
                                List <AgentInfo> AgentBin;
                                if (!AssignedToBins.TryGetValue(AssignedTo, out AgentBin))
                                {
                                    AgentBin = new List <AgentInfo>();
                                    AssignedToBins[AssignedTo] = AgentBin;
                                }
                                AgentBin.Add(Agent);
                                AlreadyAssignedCount++;
                            }
                        }
                    }

                    // If the ratio of assigned agents is already 1:1, there's nothing more
                    // we can do, regardless of how many we got previously
                    if (AlreadyAssignedCount != AssignedToBins.Count)
                    {
                        // As long as reassigning an agent would not push us above the average, do it
                        while ((NewlyAssignedCount + 1) <= (( float )(AlreadyAssignedCount - 1) / ( float )AssignedToBins.Count))
                        {
                            // Search for the largest bin to reassign an agent from
                            List <AgentInfo> LargestBin      = null;
                            Int32            LargestBinCount = 0;
                            foreach (List <AgentInfo> Bin in AssignedToBins.Values)
                            {
                                if (LargestBinCount < Bin.Count)
                                {
                                    LargestBinCount = Bin.Count;
                                    LargestBin      = Bin;
                                }
                            }
                            // Search for the newest WorkingTime
                            DateTime MaxWorkingTime       = ( DateTime )LargestBin[0].Configuration["WorkingTime"];
                            Int32    ReassignedAgentIndex = 0;
                            for (Int32 i = 1; i < LargestBin.Count; i++)
                            {
                                DateTime NextWorkingTime = ( DateTime )LargestBin[i].Configuration["WorkingTime"];
                                if (MaxWorkingTime < NextWorkingTime)
                                {
                                    MaxWorkingTime       = NextWorkingTime;
                                    ReassignedAgentIndex = i;
                                }
                            }
                            AgentInfo ReassignedAgent = LargestBin[ReassignedAgentIndex];
                            LargestBin.RemoveAt(ReassignedAgentIndex);

                            // Reassigned and adjust the counts
                            ReassignedAgent.Configuration["AssignedTo"]   = RequestingAgent.Name;
                            ReassignedAgent.Configuration["AssignedTime"] = DateTime.UtcNow;
                            AlreadyAssignedCount--;
                            NewlyAssignedCount++;
                        }
                    }

                    // Resort the list -> (Available, Busy, Other (Working))
                    AliveAgents.Sort(AliveAgentSorter);
                }
            }
            return(AliveAgents);
        }
Esempio n. 25
0
 public static AgentInfo GetModelByIDForLower(AgentInfo model)
 {
     return(AgentInfoDAL.GetModelByIDForLower(model));
 }
Esempio n. 26
0
        /*
         * Registers an agent with the coordinator, or updates the ping time
         *
         * Returns true if a restart is required
         */
        public static PingResponse Ping(AgentInfo UpdatedInfo)
        {
            AgentsDirty = true;

            // Add a known set of configuration items
            UpdatedInfo.Configuration["LastPingTime"] = DateTime.UtcNow;

            // Retreive information the agent can provide for us and supply defaults
            if (!UpdatedInfo.Configuration.ContainsKey("GroupName"))
            {
                UpdatedInfo.Configuration["GroupName"] = "Default";
            }
            // If the Agent is working for someone, replace the local user name with
            // the user name on the machine that it's working for
            if (UpdatedInfo.Configuration.ContainsKey("WorkingFor"))
            {
                // Look up the other user name
                string BossAgentName = UpdatedInfo.Configuration["WorkingFor"] as string;
                if ((Agents.ContainsKey(BossAgentName)) &&
                    (Agents[BossAgentName].Configuration.ContainsKey("UserName")))
                {
                    UpdatedInfo.Configuration["UserName"] = Agents[BossAgentName].Configuration["UserName"];
                }
            }
            else
            {
                UpdatedInfo.Configuration["WorkingFor"] = "";
            }
            if (!UpdatedInfo.Configuration.ContainsKey("AssignedTo"))
            {
                UpdatedInfo.Configuration["AssignedTo"]   = "";
                UpdatedInfo.Configuration["AssignedTime"] = DateTime.UtcNow;
            }
            if (!UpdatedInfo.Configuration.ContainsKey("UserName"))
            {
                UpdatedInfo.Configuration["UserName"] = "******";
            }

            // If the agent is remote, ping the machine to make sure we can talk to it
            // but only if the Agent didn't provide an IP address for us
            if (!UpdatedInfo.Configuration.ContainsKey("IPAddress"))
            {
                // By default, we'll set the IP address to the loopback value
                UpdatedInfo.Configuration["IPAddress"] = IPAddress.Loopback;
                bool IPAddressUpdateSuccess = false;

                if (UpdatedInfo.Name != Environment.MachineName)
                {
                    try
                    {
                        // Use the name, which can fail if DNS isn't enabled or if there's no host file
                        Ping      PingSender = new Ping();
                        PingReply Reply      = PingSender.Send(UpdatedInfo.Name);
                        if (Reply.Status == IPStatus.Success)
                        {
                            // With a success, update the known IP address for this agent
                            UpdatedInfo.Configuration["IPAddress"] = Reply.Address;
                            IPAddressUpdateSuccess = true;
                        }
                    }
                    catch (Exception)
                    {
                        // Any exception is a total failure
                    }
                }

                // With a failure, update the agent's state to prevent usage
                if (!IPAddressUpdateSuccess)
                {
                    UpdatedInfo.State = AgentState.Blocked;
                }
            }

            PingResponse Response;

            lock ( Agents )
            {
                if (!Agents.ContainsKey(UpdatedInfo.Name))
                {
                    // If this is a new agent, tell it to restart itself to pick up the latest version
                    Response = PingResponse.Restart;
                }
                else if (Agents[UpdatedInfo.Name].State == AgentState.Restarting)
                {
                    Response = PingResponse.Restart;

                    // If this agent has been instructed to restart, keep overriding the
                    // state until it's freed up to actually restart
                    if (UpdatedInfo.State == AgentState.Available)
                    {
                        UpdatedInfo.State = AgentState.Restarted;
                    }
                    else
                    {
                        // Keep us in this cycle on the next ping
                        UpdatedInfo.State = AgentState.Restarting;
                    }
                }
                else
                {
                    Response = PingResponse.Success;

                    AgentInfo PreviousInfo = Agents[UpdatedInfo.Name];

                    // If the WorkingFor changed, update the time
                    string PreviousWorkingFor = PreviousInfo.Configuration["WorkingFor"] as string;
                    string UpdatedWorkingFor  = UpdatedInfo.Configuration["WorkingFor"] as string;

                    DateTime UpdatedWorkingTime = DateTime.MaxValue;
                    if (UpdatedWorkingFor != PreviousWorkingFor)
                    {
                        UpdatedWorkingTime = DateTime.UtcNow;
                    }
                    else if (PreviousInfo.Configuration.ContainsKey("WorkingTime"))
                    {
                        UpdatedWorkingTime = ( DateTime )PreviousInfo.Configuration["WorkingTime"];
                    }
                    UpdatedInfo.Configuration["WorkingTime"] = UpdatedWorkingTime;

                    // Based on whether or not the agent is Working currently, update some state
                    if (UpdatedInfo.State != AgentState.Working)
                    {
                        // No other agent should be AssignedTo it
                        foreach (AgentInfo Agent in Agents.Values)
                        {
                            if ((Agent.Configuration["AssignedTo"] as string) == UpdatedInfo.Name)
                            {
                                Agent.Configuration["AssignedTo"]   = "";
                                Agent.Configuration["AssignedTime"] = DateTime.UtcNow;
                            }
                        }

                        // If the previous state was Working for the same agent it's AssignedTo,
                        // then we can clear the AssignedTo field
                        if (PreviousInfo.State == AgentState.Working)
                        {
                            string PreviousAssignedTo = PreviousInfo.Configuration["AssignedTo"] as string;
                            if (PreviousAssignedTo == PreviousWorkingFor)
                            {
                                PreviousInfo.Configuration["AssignedTo"]   = "";
                                PreviousInfo.Configuration["AssignedTime"] = DateTime.UtcNow;
                            }
                        }
                    }
                    else
                    {
                        // If it's WorkingFor someone, but not AssignedTo anyone else, update the AssignedTo
                        if (((UpdatedInfo.Configuration["WorkingFor"] as string) != "") &&
                            ((PreviousInfo.Configuration["AssignedTo"] as string) == ""))
                        {
                            PreviousInfo.Configuration["AssignedTo"]   = UpdatedInfo.Configuration["WorkingFor"];
                            PreviousInfo.Configuration["AssignedTime"] = DateTime.UtcNow;
                        }
                    }

                    string UpdatedAssignedTo = PreviousInfo.Configuration["AssignedTo"] as string;
                    UpdatedInfo.Configuration["AssignedTo"]   = UpdatedAssignedTo;
                    UpdatedInfo.Configuration["AssignedTime"] = DateTime.UtcNow;
                }

                // Set or reset the agent info to the latest
                Agents[UpdatedInfo.Name] = UpdatedInfo;
            }
            return(Response);
        }
Esempio n. 27
0
        public HttpResponseMessage AddAgent(AgentViewModel agent)
        {
            try
            {
                if (agent.UserID == 0)
                {
                    throw new Exception();
                }

                Requires.NotNegative("agent.UserID", agent.UserID);

                var user = DotNetNuke.Entities.Users.UserController.GetUserById(PortalSettings.PortalId, agent.UserID);

                var objAgentInfo = new AgentInfo()
                {
                    PortalID     = PortalSettings.PortalId,
                    UserID       = agent.UserID,
                    Priority     = agent.Priority,
                    Enabled      = agent.Enabled,
                    CreateByUser = UserInfo.UserID,
                    CreateDate   = DateTime.Now
                };
                int agentID = AgentManager.Instance.AddAgent(objAgentInfo);
                agent.AgentID = agentID;

                if (!user.IsInRole("MyDnnSupportAgent"))
                {
                    var role = RoleController.Instance.GetRoleByName(PortalSettings.PortalId, "MyDnnSupportAgent");
                    RoleController.AddUserRole(user, role, PortalSettings, DotNetNuke.Security.Roles.RoleStatus.Approved, Null.NullDate, Null.NullDate, true, false);
                }

                var departments = DepartmentManager.Instance.GetDepartments(PortalSettings.PortalId);
                foreach (var item in agent.Departments)
                {
                    var department = departments.FirstOrDefault(d => d.DepartmentName == item);
                    if (department == null)
                    {
                        continue;
                    }
                    var objDepartmentAgentInfo = new DepartmentAgentInfo()
                    {
                        DepartmentID = department.DepartmentID,
                        AgentID      = agentID,
                        UserID       = agent.UserID
                    };
                    DepartmentAgentManager.Instance.AddDepartmentAgent(objDepartmentAgentInfo);
                }

                agent.Email = user.Email;

                return(Request.CreateResponse(HttpStatusCode.OK, new { Success = true, Agent = agent }));
            }
            catch (Exception ex)
            {
                Logger.Error(ex);

                string msg = ex.Message;

                if (((System.Data.SqlClient.SqlException)(ex)).Number == 2627) // user entekhab shode ghablan dar system be onvane agent sabt shode ast
                {
                    msg = string.Format(Localization.Instance.GetString(DotNetNuke.Common.Globals.ResolveUrl("~/MyDnnPackage/dnn8contest/Website/DesktopModules/MVC/MyDnnSupport/LiveChat/App_LocalResources/SharedResources"), PortalSettings.CultureCode, "DuplicateAgent.Text"), agent.DisplayName);
                }

                return(Request.CreateResponse(HttpStatusCode.InternalServerError, msg));
            }
        }
Esempio n. 28
0
    public Level(Grid g, AgentInfo[] agents, TileInfo[] tiles, Func<Agent>[] agentInitializers, Dictionary<string, int> agentMap)
    {
        _grid = g;

        _initialAgents = agents;
        _initialTiles = tiles;

        _initializers = agentInitializers;

        _agentMap = agentMap;

        _agents = new List<Agent>();
        _canSee = new SeeState[Grid.Width, Grid.Height];
        _turnPromises = new List<Promise>();
    }
Esempio n. 29
0
        private void UpdateGridRows()
        {
            if (Coordinator.AgentsDirty)
            {
                // Clear out any existing rows
                AgentGridView.Rows.Clear();

                // Get a list of agents
                Dictionary <string, AgentInfo> Agents = Coordinator.GetAgents();
                List <string> AgentNames = new List <string>(Agents.Keys);
                AgentNames.Sort();

                // Create a row for each agent
                foreach (string AgentName in AgentNames)
                {
                    AgentInfo               NextAgent = Agents[AgentName];
                    DataGridViewRow         Row       = new DataGridViewRow();
                    DataGridViewTextBoxCell NextCell  = null;

                    NextCell       = new DataGridViewTextBoxCell();
                    NextCell.Value = NextAgent.Name;
                    if (NextAgent.Configuration.ContainsKey("UserName"))
                    {
                        NextCell.Value += " (" + NextAgent.Configuration["UserName"] + ")";
                    }
                    else
                    {
                        NextCell.Value += " (UnknownUser)";
                    }
                    Row.Cells.Add(NextCell);

                    NextCell = new DataGridViewTextBoxCell();
                    if (NextAgent.Configuration.ContainsKey("GroupName"))
                    {
                        NextCell.Value = NextAgent.Configuration["GroupName"];
                    }
                    else
                    {
                        NextCell.Value = "Undefined";
                    }
                    Row.Cells.Add(NextCell);

                    NextCell       = new DataGridViewTextBoxCell();
                    NextCell.Value = NextAgent.Version;
                    Row.Cells.Add(NextCell);

                    NextCell = new DataGridViewTextBoxCell();
                    string NextCellStateValue;
                    if (NextAgent.State == AgentState.Working)
                    {
                        if ((NextAgent.Configuration.ContainsKey("WorkingFor")) &&
                            ((NextAgent.Configuration["WorkingFor"] as string) != ""))
                        {
                            NextCellStateValue = "Working for " + NextAgent.Configuration["WorkingFor"];
                        }
                        else
                        {
                            NextCellStateValue = "Working for an unknown Agent";
                        }
                    }
                    else
                    {
                        NextCellStateValue = NextAgent.State.ToString();
                    }
                    if ((NextAgent.Configuration.ContainsKey("AssignedTo")) &&
                        ((NextAgent.Configuration["AssignedTo"] as string) != ""))
                    {
                        NextCellStateValue += ", Assigned to " + NextAgent.Configuration["AssignedTo"];
                    }
                    else
                    {
                        NextCellStateValue += ", Unassigned";
                    }
                    NextCell.Value = NextCellStateValue;
                    Row.Cells.Add(NextCell);

                    NextCell = new DataGridViewTextBoxCell();
                    if (NextAgent.Configuration.ContainsKey("IPAddress"))
                    {
                        NextCell.Value = NextAgent.Configuration["IPAddress"];
                    }
                    else
                    {
                        NextCell.Value = "Undefined";
                    }
                    Row.Cells.Add(NextCell);

                    NextCell = new DataGridViewTextBoxCell();
                    if (NextAgent.Configuration.ContainsKey("LastPingTime"))
                    {
                        NextCell.Value = NextAgent.Configuration["LastPingTime"];
                    }
                    else
                    {
                        NextCell.Value = "Undefined";
                    }
                    Row.Cells.Add(NextCell);

                    NextCell = new DataGridViewTextBoxCell();
                    if (NextAgent.Configuration.ContainsKey("LocalAvailableCores"))
                    {
                        NextCell.Value = NextAgent.Configuration["LocalAvailableCores"];
                    }
                    else
                    {
                        NextCell.Value = "Undefined";
                    }
                    Row.Cells.Add(NextCell);

                    NextCell = new DataGridViewTextBoxCell();
                    if (NextAgent.Configuration.ContainsKey("RemoteAvailableCores"))
                    {
                        NextCell.Value = NextAgent.Configuration["RemoteAvailableCores"];
                    }
                    else
                    {
                        NextCell.Value = "Undefined";
                    }
                    Row.Cells.Add(NextCell);

                    AgentGridView.Rows.Add(Row);
                }

                Coordinator.AgentsDirty = false;
            }
        }
Esempio n. 30
0
 public IActionResult RegisterAgent([FromBody] AgentInfo agentInfo)
 {
     _logger.LogInformation($"Входные данные: {agentInfo}");
     return(Ok());
 }
Esempio n. 31
0
    public static Level LoadLevel(string level)
    {
        string filename = string.Format("Levels/{0}", level);

        string contents = Resources.Load<TextAsset>(filename).text;
        var info = JsonConvert.DeserializeObject<LevelInfo>(contents);

        TileInfo[] tinfos = new TileInfo[info.TileInfos.Length];
        AgentInfo[] agents = new AgentInfo[info.AgentInfos.Length];

        Dictionary<string, int> agentmap = new Dictionary<string, int>();

        for (int i = 0; i < info.TileInfos.Length; i++)
        {
            tinfos[i] = new TileInfo(Resources.Load<Material>(string.Format("Tiles/{0}", info.TileInfos[i].Mat)), info.TileInfos[i].CanWalk);
        }

        for (int i = 0; i < info.AgentInfos.Length; i++)
        {
            agents[i] = new AgentInfo
            {
                Prefab = Resources.Load<GameObject>(string.Format("Agents/{0}", info.AgentInfos[i].Prefab))
            };

            agentmap.Add(info.AgentInfos[i].Prefab, i);
        }

        Grid g = new Grid(info.Meta.Width, info.Meta.Height);

        foreach (var t in info.Tiles)
        {
            g.Set(new Tile(tinfos[t.InfoNo], new Coord(t.Coord[0], t.Coord[1]), t.Elevation));
        }

        Func<Agent>[] agentCreators = new Func<Agent>[info.Agents.Length];
        for (int i = 0; i < info.Agents.Length; i++)
        {
            LevelInfo.AgentInstanceInfo inf = info.Agents[i];
            agentCreators[i] = delegate
            {
                var go = UnityEngine.Object.Instantiate(agents[inf.PrefId].Prefab);
                go.GetComponent<Agent>().Position = new Coord(inf.Coords[0], inf.Coords[1]);
                go.GetComponent<Agent>().Target = inf.Target;
                go.GetComponent<Agent>().Id = inf.Id;
                return go.GetComponent<Agent>();
            };
        }

        return new Level(g, agents, tinfos, agentCreators, agentmap) { NextLevel = info.Meta.Next };
    }
Esempio n. 32
0
 /// <inheritdoc />
 public void RequestDecision(AgentInfo info, List <ISensor> sensors)
 {
     m_LastDecision = m_Heuristic.Invoke();
 }
Esempio n. 33
0
        public ActionResult PropertyAgreement(AgentInfo agent, Agreement agreement)
        {
            try
            {
                SystemMonitor.Info("Sending property agreement from agent '{0}' to customer '{1}'.", agent.FullName, agreement.CustomerName);
                
                agreement.Signature = CreateSignature(agreement);
                
                SystemMonitor.Debug("Signature created, url: {0}", agreement.Signature);

                var destFile = GenerateReport(agent, agreement);

                SystemMonitor.Debug("Report generated, file name: {0}", System.IO.Path.GetFileName(destFile));

                SendByMail(agent, agreement, destFile);
            }
            catch (Exception anyException)
            {
                SystemMonitor.Error(anyException, "Error Creating agreement report");
                return new HttpStatusCodeResult(500);
            }
            return new HttpStatusCodeResult(200);
        }
Esempio n. 34
0
 public void RequestDecision(AgentInfo info, List <ISensor> sensors)
 {
 }
Esempio n. 35
0
 private static void SendByMail(AgentInfo agent, Agreement agreement, string destFile)
 {
     Task.Factory.StartNew(() =>
                               {
                                   try
                                   {
                                       SystemMonitor.Info("Sending Email to: {0}, {1}", agent.Email,
                                                          agreement.CustomerEmail);
                                       SendEmail(agent, agreement, destFile);
                                   }
                                   catch (Exception anyException)
                                   {
                                       SystemMonitor.Error(anyException, "Failed to send agreement by mail.");
                                   }
                               });
 }
Esempio n. 36
0
        protected void btnUpdate_click(object sender, EventArgs e)
        {
            AgentInfo     agentInfo = new AgentInfo();
            AgentInfoData agentData = new AgentInfoData();
            int           Result    = 0;

            agentInfo.AgentID       = Convert.ToInt32(hfAgentID.Value);
            agentInfo.AgentCode     = txtAgentCode.Text;
            agentInfo.RouteID       = Convert.ToInt32(dpRoute.SelectedItem.Value);
            agentInfo.AgentName     = txtAgentName.Text;
            agentInfo.DateofJoining = txtDateOfJoing.Text;
            agentInfo.AppriveBy     = txtApprovedBy.Text;
            if (dpStatus.SelectedItem.Value == "1")
            {
                agentInfo.Status = true;
            }
            if (dpStatus.SelectedItem.Value == "2")
            {
                agentInfo.Status = false;
            }
            //agentInfo.EmployeeID = 1;// Convert.ToInt32(dpEmployeeID.SelectedItem.Value);
            agentInfo.Agensytype    = dpAgencyType.SelectedItem.Text;
            agentInfo.Address1      = txtAddress1.Text;
            agentInfo.Address2      = txtAddress2.Text;
            agentInfo.Address3      = txtAddress3.Text;
            agentInfo.Email         = txtEmail.Text;;
            agentInfo.TelephoneNo   = txtTelephone.Text;;
            agentInfo.MobileNo      = txtMobile.Text;
            agentInfo.Districk      = dpDistric.SelectedItem.Text;
            agentInfo.City          = dpCity.SelectedItem.Text;
            agentInfo.State         = dpState.SelectedItem.Text;
            agentInfo.Country       = dpCountry.SelectedItem.Text;
            agentInfo.BillingMethod = dpbillingtype.SelectedItem.Text;
            agentInfo.PaymentType   = dppaymenttype.SelectedItem.Text;;
            agentInfo.DepositAmount = string.IsNullOrEmpty(txtDepositeAmount.Text) ? 0 : Convert.ToDouble(txtDepositeAmount.Text);
            agentInfo.BankName      = dpBankName.SelectedItem.Text;
            agentInfo.AccounNo      = txtAccountNo.Text;
            agentInfo.AccountType   = dpAccountType.SelectedItem.Text;
            agentInfo.IFSCCode      = dpIfscCode.SelectedItem.Text;
            agentInfo.Volume        = txtValoume.Text;
            agentInfo.NoofTrays     = string.IsNullOrEmpty(txtNoOfTrays.Text) ? 0 : Convert.ToInt32(txtNoOfTrays.Text);
            if (dpDoorToDoor.SelectedItem.Value == "1")
            {
                agentInfo.DoortoDoor = true;
            }
            if (dpDoorToDoor.SelectedItem.Value == "1")
            {
                agentInfo.DoortoDoor = false;
            }

            if (rbcFreezerYes.Checked == true)
            {
                agentInfo.FreezerAvailable = true;
            }
            if (rbcFreezerNo.Checked == true)
            {
                agentInfo.FreezerAvailable = false;
            }
            if (rbFreezerRestrunYes.Checked == true)
            {
                agentInfo.FreezerRestrun = true;
            }
            if (rbFreezerRestrunNo.Checked == true)
            {
                agentInfo.FreezerRestrun = false;
            }
            if (txtDeactivedate.Text == "")
            {
                agentInfo.Deactivedate = txtDeactivedate.Text;
            }
            else
            {
                agentInfo.Deactivedate = (Convert.ToDateTime(txtDeactivedate.Text)).ToString("dd-MM-yyyy");
            }
            agentInfo.DeactiveReason    = Convert.ToString(txtDeactiveRession.Text);
            agentInfo.AmountReturned    = string.IsNullOrEmpty(txtAmountRetrun.Text) ? 0 : Convert.ToDouble(txtAmountRetrun.Text);
            agentInfo.TraysReturned     = string.IsNullOrEmpty(txtTraysReturned.Text) ? 0 : Convert.ToInt32(txtTraysReturned.Text);
            agentInfo.SchemeAmount      = string.IsNullOrEmpty(txtSchemeAmount.Text) ? 0 : Convert.ToDouble(txtSchemeAmount.Text);
            agentInfo.SchemeTotalAmount = string.IsNullOrEmpty(txtSchemeTotalAmount.Text) ? 0 : Convert.ToDouble(txtSchemeTotalAmount.Text);
            agentInfo.IsArchive         = false;
            agentInfo.CreatedBy         = GlobalInfo.Userid;
            agentInfo.Createddate       = DateTime.Now.ToString("dd-MM-yyyy");
            agentInfo.ModifiedBy        = GlobalInfo.Userid;
            agentInfo.ModifiedDate      = DateTime.Now.ToString("dd-MM-yyyy");
            agentInfo.flag = "Update";
            Result         = agentData.InsertAgentInfo(agentInfo);
            if (Result > 0)
            {
                divDanger.Visible      = false;
                divwarning.Visible     = false;
                divSusccess.Visible    = true;
                lblSuccess.Text        = "Agent Updated  Successfully";
                btnAddagent.Visible    = true;
                btnupdateagent.Visible = false;
                Clear();
                BinDAgentInfo();
                upMain.Update();
                pnlError.Update();
                uprouteList.Update();
                //txtAgentCode.Enabled = false;
            }
            else
            {
                divDanger.Visible   = false;
                divwarning.Visible  = true;
                divSusccess.Visible = false;
                lblWarningHead.Text = "   Please Contact to Site Admin";
                lblwarning.Text     = Comman.Comman.msg.ToString();
                pnlError.Update();
            }
        }
Esempio n. 37
0
        private string RenderReport(AgentInfo agent, Agreement agreement)
        {
            var destFile = Path.GetTempFileName() + ".pdf";
            var designFile = Server.MapPath("~/Static/Reports/" + (agreement.IsExclusive ? "Exclusive":"") +"PropertyAgreement.rdlc");

            var parameters = CreateReportParameters(agent);

            Render(designFile, 
                new ReportDataSource[]
                    {
                        new ReportDataSource("Agreement", new[] {agreement})
                    }, destFile,
                   parameters);
            return destFile;
        }
Esempio n. 38
0
        public void DeleteAgentbyID(int AgentId)
        {
            AgentInfo     agentInfo = new AgentInfo();
            AgentInfoData agentData = new AgentInfoData();
            int           Result    = 0;

            agentInfo.AgentID       = Convert.ToInt32(hfAgentID.Value);
            agentInfo.AgentCode     = string.Empty;
            agentInfo.RouteID       = 0;
            agentInfo.AgentName     = string.Empty;
            agentInfo.DateofJoining = string.Empty;
            agentInfo.AppriveBy     = string.Empty;
            if (dpStatus.SelectedItem.Value == "1")
            {
                agentInfo.Status = true;
            }
            if (dpStatus.SelectedItem.Value == "2")
            {
                agentInfo.Status = true;
            }
            //agentInfo.EmployeeID = 0;
            agentInfo.Agensytype    = string.Empty;
            agentInfo.Address1      = string.Empty;
            agentInfo.Address2      = string.Empty;
            agentInfo.Address3      = string.Empty;
            agentInfo.Email         = string.Empty;
            agentInfo.TelephoneNo   = string.Empty;
            agentInfo.MobileNo      = string.Empty;
            agentInfo.Districk      = string.Empty;
            agentInfo.City          = string.Empty;
            agentInfo.State         = string.Empty;
            agentInfo.Country       = string.Empty;
            agentInfo.BillingMethod = string.Empty;
            agentInfo.PaymentType   = string.Empty;
            agentInfo.DepositAmount = 0;
            agentInfo.BankName      = string.Empty;
            agentInfo.AccounNo      = string.Empty;
            agentInfo.AccountType   = string.Empty;
            agentInfo.IFSCCode      = string.Empty;
            agentInfo.Volume        = string.Empty;
            agentInfo.NoofTrays     = 0;

            agentInfo.DoortoDoor = false;

            agentInfo.FreezerAvailable = false;

            agentInfo.Deactivedate      = string.Empty;
            agentInfo.DeactiveReason    = string.Empty;
            agentInfo.AmountReturned    = 0;
            agentInfo.TraysReturned     = 0;
            agentInfo.SchemeAmount      = 0; // string.IsNullOrEmpty(txtAmountRetrun.Text) ? 0 : Convert.ToDouble(txtSchemeAmount.Text);
            agentInfo.SchemeTotalAmount = 0; // string.IsNullOrEmpty(txtAmountRetrun.Text) ? 0 : Convert.ToDouble(txtSchemeAmountShemeTotalAmount.Text);
            agentInfo.IsArchive         = true;
            agentInfo.CreatedBy         = GlobalInfo.Userid;
            agentInfo.Createddate       = DateTime.Now.ToString("dd-MM-yyyy");
            agentInfo.ModifiedBy        = GlobalInfo.Userid;
            agentInfo.ModifiedDate      = DateTime.Now.ToString("dd-MM-yyyy");
            agentInfo.flag = "Delete";
            Result         = agentData.InsertAgentInfo(agentInfo);
            if (Result > 0)
            {
                divDanger.Visible      = false;
                divwarning.Visible     = false;
                divSusccess.Visible    = true;
                lblSuccess.Text        = "Agent Delete  Successfully";
                btnAddagent.Visible    = true;
                btnupdateagent.Visible = false;
                BinDAgentInfo();
                pnlError.Update();
            }
            else
            {
                divDanger.Visible   = false;
                divwarning.Visible  = true;
                divSusccess.Visible = false;
                lblwarning.Text     = "Please Contact to Site Admin";
                pnlError.Update();
            }
        }
Esempio n. 39
0
 private static extern void SetClyde(int worldId, ref AgentInfo agentInfo);
Esempio n. 40
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                this._settings      = new Dictionary <string, string>();
                this._agentInfo     = new AgentInfo();
                this._phoneSettings = new Dictionary <string, string>();

                this._settings.Add("HuaweiCTIServerIP", this.ValidateString(this.textCTIServerIP, false, "CTI Server"));

                this._settings.Add("HuaweiTimeout", this.ValidateInteger(this.textTimeout, true, -1, int.MaxValue, "Timeout").ToString());

                this._settings.Add("HuaweiOutboundPrefix", this.ValidateString(this.textOutboundPrefix, false, "Outbound prefix"));
                this._settings.Add("HuaweiExtensionPrefix", this.ValidateString(this.textExtensionPrefix, false, "Extension prefix"));
                this._settings.Add("HuaweiExtensionLength", this.ValidateInteger(this.textExtensionLength, false, 0, 20, "Extension length").ToString());

                this._agentInfo.AgentId     = this.ValidateString(this.textAgentId, false, "Agent ID");
                this._agentInfo.PassWord    = this.ValidateString(this.textAgentPw5, false, "Agent Password");
                this._agentInfo.PhoneNumber = this.ValidateString(this.textExtension, false, "Exension");

                this._phoneSettings.Add("PhoneNumber", this.ValidateString(this.textBox_PhoneNum, false, "Phone Number"));
                this._phoneSettings.Add("PhonePassword", this.ValidateString(this.textBox_PhonePw5, false, "Phone Password"));
                this._phoneSettings.Add("DispatchNumber", this.ValidateString(this.textBox_DispatchNum, false, "Dispatch Number"));
                this._phoneSettings.Add("SipServerInfo", this.ValidateString(this.textBox_SipServerInfo, false, "Sip Server Info"));
                this._phoneSettings.Add("SipRealName", this.ValidateString(this.textBox_SipRealName, false, "Sip Real Name"));
                this._phoneSettings.Add("LocalIP", this.ValidateString(this.textBox_LocalIP, false, "Local IP"));
                this._phoneSettings.Add("LocalSipPort", this.ValidateString(this.textBox_LocalSipPort, false, "Local Sip Port"));
                this._phoneSettings.Add("LocalAudioPort", this.ValidateString(this.textBox_LocalAudioPort, false, "Local Audio Port"));
                this._phoneSettings.Add("PhoneUsedMode", this.comboBox_PhoneUsedMode.Text);

                this._phoneSettings.Add("IsAutoAnswerIPT", this.checkBox_IsAutoAnswerIPT.Checked ? "true":"false");
                this._phoneSettings.Add("IsAutoAnswerIPCC", this.checkBox_IsAutoAnswerIPCC.Checked ? "true" : "false");
                this._phoneSettings.Add("IsAidEnable", this.checkBox_IsAidEnable.Checked ? "true" : "false");

                this._phoneSettings.Add("MainSpeaker", this.mainSpkComb.Text);
                this._phoneSettings.Add("MainMic", this.mainMicComb.Text);
                if (this.checkBox_IsAidEnable.Checked)
                {
                    this._phoneSettings.Add("AidSpeaker", this.AidSpkComb.Text);
                    this._phoneSettings.Add("AidMic", this.AidMicComb.Text);
                }
                this._phoneSettings.Add("VideoDevice", this.VideoDeviceComb.Text);

                this._phoneSettings.Add("IsRejectCallAgentNotIdle", this.ckbRejectCallNotIdle.Checked ? "true" : "false");


                if (string.IsNullOrEmpty(this.txtVCPhoneNumber.Text))
                {
                    this._agentInfo.VCPhoneNumber = string.Empty;
                }
                else
                {
                    this.ValidateInteger(this.txtVCPhoneNumber, false, 1, int.MaxValue, "VC PhoneNumber").ToString();
                    //防止去掉前面的0
                    this._agentInfo.VCPhoneNumber = this.txtVCPhoneNumber.Text;
                }

                if (this.cmbAgentType.SelectedIndex == 1)
                {
                    this._agentInfo.AgentType = AgentType.Video;
                }
                else
                {
                    this._agentInfo.AgentType = AgentType.Audio;
                }

                //C60新增设置
                if (chkSetAutoAnswer.CheckState == CheckState.Checked)
                {
                    this._settings.Add("HuaweiSetAutoAnswer", "true");
                }
                else
                {
                    this._settings.Add("HuaweiSetAutoAnswer", "false");
                }


                //是否启用事后整理态
                if (chkIsEnableACW.CheckState == CheckState.Checked)
                {
                    this._settings.Add("HuaweiIsEnableACW", "true");
                }
                else
                {
                    this._settings.Add("HuaweiIsEnableACW", "false");
                }

                //是否启动联动
                if (this.comboBox_PhoneLinkage.SelectedIndex == 0)
                {
                    this._settings.Add("HuaweiPhoneLinkage", "0");
                }
                else if (this.comboBox_PhoneLinkage.SelectedIndex == 1)
                {
                    this._settings.Add("HuaweiPhoneLinkage", "1");
                }
                else
                {
                    this._settings.Add("HuaweiPhoneLinkage", "2");
                }

                //是否强制登录
                if (chkIsForceLogin.CheckState == CheckState.Checked)
                {
                    this._settings.Add("IsForceLogin", "true");
                }
                else
                {
                    this._settings.Add("IsForceLogin", "false");
                }

                //双声卡场景下,声卡的切换策略
                if (this.comboBox_AidPolicy.SelectedIndex == 2)
                {
                    this._phoneSettings.Add("AidPolicy", "manual");
                }
                else if (this.comboBox_AidPolicy.SelectedIndex == 1)
                {
                    this._phoneSettings.Add("AidPolicy", "auto");
                }
                else
                {
                    this._phoneSettings.Add("AidPolicy", "default");
                }

                if (this.CNLanguageChecked.Checked)
                {
                    this._settings.Add("Language", "CN");
                }
                else if (this.ENLanguageChecked.Checked)
                {
                    this._settings.Add("Language", "EN");
                }

                this.DialogResult = System.Windows.Forms.DialogResult.OK;
            }
            catch (InvalidOperationException invalidOperationException)
            {
                MsgBox.Error(invalidOperationException.Message);
            }
            catch
            {
                MsgBox.Error("occur exception");
            }
        }
Esempio n. 41
0
        Agent CreateDummyAgent()
        {
            AgentInfo info = new AgentInfo();
            info.FirstName = "Dummy";
            info.LastName = "Agent";

            Agent agent = new Agent(new SimulationObject(new Avatar(), simian.Scenes[0]), info);
            agent.Avatar.Prim.ID = UUID.Random();
            agent.SessionID = UUID.Random();
            agent.Avatar.Prim.Position = new Vector3(128f, 128f, 40f);
            agent.Avatar.Prim.Rotation = Quaternion.Identity;
            return agent;
        }
Esempio n. 42
0
 public IActionResult RegisterAgent([FromBody] AgentInfo agentInfo)
 {
     _logger.LogInformation($"RegisterAgent - agentId {agentInfo.AgentId}, {agentInfo.AgentAddress}");
     return(Ok());
 }