Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            MyBaseService.Service1Client client = new Service1Client();
            client.ClientCredentials.UserName.UserName = "******";
            client.ClientCredentials.UserName.Password = "******";


            MyBaseService.Employee Employee = client.GetEmployee(2);
            if (Employee.IsActive)
            {
                textBox1.Text = Employee.EmployeeName;
            }

            MyBaseService.EmployeeMessage message = new EmployeeMessage();
            message.IsActive     = true;
            message.EmployeeName = "Sunil";



            //IService1 service = System.ServiceModel.ChannelFactory<IService1Channel>.CreateChannel(wshttpBinding, address);
            //MyBaseWCF_ConsumeClient.MyBaseService.EmployeeData data =  service.GetEmployeeMessage(message);



            string test = client.GetEmployeeMessage(true, "Sunil");

            //MyBaseService.EmployeeData data =
            if (Employee.IsActive)
            {
                textBox1.Text = Employee.EmployeeName;
            }


            //textBox1.Text = client.GetData(1);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Saves a message that was sent to an employee
 /// </summary>
 /// <param name="employeeMessage"></param>
 /// <returns></returns>
 public int SaveEmployeeMessage(EmployeeMessage employeeMessage)
 {
     using (var connection = new SqlConnection(_connectionstring))
     {
         connection.Open();
         return(connection.Execute("INSERT INTO [EmployeeMessage] ([EmployeeId] ,[MessageDate] ,[MessageType]) VALUES (@EmployeeId, @MessageDate, @MessageType)", employeeMessage));
     }
 }
Ejemplo n.º 3
0
        public bool SaveMessage([FromBody] EmployeeMessage employeeMessage)
        {
            try
            {
                employeeMessage.CreatedDate = DateTime.Now;

                _context.Add(employeeMessage);
                int ok = _context.SaveChanges();

                return(ok > 0 ? true : false);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 4
0
        public static async Task OnNewMessage(
            [QueueTrigger("%QUEUE_EMPLOYEE%")] EmployeeMessage message,
            [Queue("%QUEUE_UPDATEO365%")] IAsyncCollector <UpdateO365Message> collector
            )
        {
            var employeeResponse = await httpClient.GetAsync($"employees/{message.Id}?fields=supervisorEid");

            var content = await employeeResponse.Content.ReadAsAsync <JObject>();

            var supervisorId       = content.GetValue("supervisorEid").Value <string>();
            var supervisorResponse = await httpClient.GetAsync($"employees/{supervisorId}?fields=workemail");

            var content2 = await supervisorResponse.Content.ReadAsAsync <JObject>();

            var supervisorEmail = content2.GetValue("workemail").Value <string>();
            await collector.AddAsync(message.To(supervisorEmail, supervisorId));
        }
        public override async Task <SuccessReply> UpdateEmployee(EmployeeMessage request, ServerCallContext context)
        {
            var result = await _mediator.Send(new UpdateEmployeeCommand
            {
                Payload = new EmployeeVM
                {
                    FirstName     = request.FirstName,
                    LastName      = request.LastName,
                    JoinDate      = request.JoinDate.ToDateTime(),
                    Id            = request.Id,
                    DepartementId = request.DepartementId
                }
            });

            return(new SuccessReply {
                Reason = result.Reason, Success = result.Success
            });
        }
Ejemplo n.º 6
0
    // Drain the queue.
    public void start()
    {
        if (m_employees == null)
        {
            return;
        }

        // Process all queue messages.
        while (m_queue.moreMessages() == true)
        {
            try
            {
                EmployeeMessage msg = m_queue.getNextMessage();
                if (msg.MessageType == MsgType.Add)
                {
                    AddEmployeEventArgs args = new AddEmployeEventArgs(
                        (AddEmployeeMessage)msg);
                    OnAddEmployee(this, args);
                }
                else
                {
                    HoursWorkedEventArgs args = new HoursWorkedEventArgs(
                        (PayrollMessage)msg);
                    OnHoursWorked(this, args);
                }
            }
            catch (Exception e)
            {
                m_errLogger.logError(e);
            }
        }

        // Now read one more message to see our custom exception
        // thrown
        try
        {
            EmployeeMessage msg = m_queue.getNextMessage();
        }
        catch (Exception e)
        {
            m_errLogger.logError(e);
        }
    }
Ejemplo n.º 7
0
        public ActionResult CreateMessage(EmployeeMessage item)
        {
            item.CreatedDate = DateTime.Now;
            item.CreatedBy   = new Employee
            {
                Id = GetEmployeeId
            };

            if (item.To.Id != item.CreatedBy.Id)
            {
                var employee = GetSession.Load <Employee>(item.To.Id);
                item.To = employee;

                /*	if (employee.Email.Contains("@")) {
                 *      new NotificationsController().Message(employee).Deliver();
                 *  }*/
            }
            GetSession.Save(item);

            return(RedirectToAction("Card", new { item.To.Id }));
        }
Ejemplo n.º 8
0
    /// <summary>
    /// Gets the next message in the queue if any.
    /// </summary>
    public EmployeeMessage getNextMessage()
    {
        EmployeeMessage msg = null;

        try
        {
            if (moreMessages())
            {
                string Action = m_msgQueue[m_nCurPos, 0];

                switch (Action)
                {
                case "a":
                    msg = processAddEmployeeRequest(m_nCurPos);
                    break;

                case "p":
                    msg = processAddHoursRequest(m_nCurPos);
                    break;
                }
            }
            else
            {
                throw new EndOfMessageQueueException(
                          "Attempt to read past end of queue!");
            }
        }
        catch (Exception e)
        {
            throw e;
        }
        finally
        {
            m_nCurPos++;
        }

        return(msg);
    }
Ejemplo n.º 9
0
 public void Handle(EmployeeMessage message)
 {
 }