Пример #1
0
    protected void btnSelectDate_Click(object sender, EventArgs e)
    {
        radAppointment.SelectedDate = selDate.DateTime.Value;

        if (txtEmployee.Text.ToUpper() == "TODOS")
        {
            txtEmployee.Text       = "Todos";
            radAppointment.GroupBy = "UserName";
        }
        else
        {
            string[] cpf = txtEmployee.Text.Split(new[] { " | " }, StringSplitOptions.None);

            if (cpf.Count() == 2)
            {
                employee = manager.RetrieveEmployeeByCpf(Company.CompanyId, cpf[0]);

                if (employee != null && employee.Profile.CPF != "")
                {
                    Page.ViewState["userId"]     = manager.GetUserByEmployee(employee.EmployeeId).UserId;
                    Page.ViewState["EmployeeId"] = employee.EmployeeId;
                }
                else
                {
                    EmployeeNotFound();
                }
            }
            else
            {
                EmployeeNotFound();
            }
        }
    }
Пример #2
0
        private void AddAlertWhenPostCommentInCustomerCall(Comment comment)
        {
            if (comment.PageName.ToLower() == "customercall.aspx")
            {
                var alertManager    = new AlertManager(this);
                var customerManager = new CustomerManager(this);

                var call = customerManager.GetCustomerCall(comment.SubjectId);

                //
                // defines Alert description
                //
                string alertDescription = string.Format(@"
                    No chamado <a href='javascript:;' 
                                  onclick=""top.$.LightBoxObject.show('CRM/CustomerCall.aspx?lightbox[iframe]=true&CustomerCallId={0}&ReadOnly=true&ModalPopup=1')"" 
                                  target='content'>{1}</a>, {2} disse: {3} &nbsp;&nbsp;&nbsp;&nbsp;<br />
                    <center>
                        <a href='javascript:;' onclick='$(this).next().show()'>Clique aqui para responder!</a>
                        <iframe id=""comments"" style='display:none' src='../app_shared/comments.aspx?id={4}&pageName=customercall.aspx'>
                    </center>", call.CustomerCallId.ToString(),
                                                        call.CallNumber,
                                                        comment.UserName,
                                                        comment.Description.Shortly(140),
                                                        comment.SubjectId);

                //
                // Send alert to CreatorUser from CustomerCall
                //
                if (call.UserId.HasValue)
                {
                    if (call.User.Profile.AbreviatedName != comment.UserName) // Don't alert yourself
                    {
                        alertManager.InsertAlert(call.UserId.Value, alertDescription);
                    }
                }


                //
                // Send alert to Technical
                //
                if (call.TechnicalEmployeeId.HasValue)
                {
                    var  humanResourcesManager = new HumanResourcesManager(this);
                    User user = humanResourcesManager.GetUserByEmployee(call.TechnicalEmployeeId.Value);
                    if (user != null && user.Profile.AbreviatedName != comment.UserName) // Don't alert yourself
                    {
                        alertManager.InsertAlert(user.UserId, alertDescription);
                    }
                }
            }
        }