예제 #1
0
        /// <summary>
        /// Add a record
        /// </summary>
        public int Insert(TicketUsersEntity model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TicketUsers(");
            strSql.Append("TicketID,UserID,Type,[Status])");

            strSql.Append(" values (");
            strSql.Append("@TicketID,@UserID,@Type,@Status)");
            strSql.Append(";select ISNULL( SCOPE_IDENTITY(),0);");
            Database db = DatabaseFactory.CreateDatabase();

            using (DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString()))
            {
                db.AddInParameter(dbCommand, "TicketID", DbType.Int32, model.TicketID);
                db.AddInParameter(dbCommand, "UserID", DbType.Int32, model.UserID);
                db.AddInParameter(dbCommand, "Type", DbType.Int32, (int)model.Type);
                db.AddInParameter(dbCommand, "Status", DbType.Int32, (int)model.WorkingOnStatus);
                int    result;
                object obj = db.ExecuteScalar(dbCommand);
                if (!int.TryParse(obj.ToString(), out result))
                {
                    return(0);
                }
                return(result);
            }
        }
예제 #2
0
        public TicketUsersEntity Get(int ticket, int user)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select top 1 * from TicketUsers where TicketID = @TicketID AND UserID = @UserID Order by TUID desc");
            Database db = DatabaseFactory.CreateDatabase();

            using (DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString()))
            {
                db.AddInParameter(dbCommand, "UserID", DbType.Int32, user);
                db.AddInParameter(dbCommand, "TicketID", DbType.Int32, ticket);
                TicketUsersEntity model = null;
                using (IDataReader dataReader = db.ExecuteReader(dbCommand))
                {
                    try
                    {
                        if (dataReader.Read())
                        {
                            model = TicketUsersEntity.ReaderBind(dataReader);
                        }
                        return(model);
                    }
                    catch (Exception ex)
                    {
                        WebLogAgent.Write(string.Format("[SQLText:{0},{1}Messages:\r\n{2}]",
                                                        strSql, base.FormatParameters(dbCommand.Parameters), ex.Message));
                        return(null);
                    }
                }
            }
        }
예제 #3
0
        private string GetUnameByRoleTypeAndTicketId(int ticketID, TicketUsersType role)
        {
            List <TicketUsersEntity> list = ticketsUserRpst.GetListUsersByTicketId(ticketID);

            TicketUsersEntity tu = new TicketUsersEntity();

            switch (role)
            {
            case TicketUsersType.PM:
                tu = list.FindAll(x => x.Type == TicketUsersType.PM)[0];
                break;

            case TicketUsersType.Dev:
                break;

            case TicketUsersType.QA:
                break;

            case TicketUsersType.Other:
                break;

            case TicketUsersType.Create:
                break;

            default:
                break;
            }
            if (null != tu)
            {
                return(GetNameById(tu.UserID));
            }
            return("");
        }
예제 #4
0
        public List <TicketUsersEntity> GetTicketUserList(int ticketId)
        {
            List <TicketUsersEntity> list   = new List <TicketUsersEntity>();
            StringBuilder            strSql = new StringBuilder();

            strSql.AppendFormat(" select * from ticketUsers where ticketid={0};", ticketId);

            Database db = DatabaseFactory.CreateDatabase();

            using (DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString()))
            {
                try
                {
                    using (IDataReader dataReader = db.ExecuteReader(dbCommand))
                    {
                        while (dataReader.Read())
                        {
                            list.Add(TicketUsersEntity.ReaderBind(dataReader));
                        }
                    }
                }
                catch (Exception ex)
                {
                    WebLogAgent.Write(string.Format("[SQLText:{0},{1}Messages:\r\n{2}]",
                                                    strSql.ToString(), base.FormatParameters(dbCommand.Parameters), ex.Message));
                }
                return(list);
            }
        }
예제 #5
0
        /// <summary>
        /// Update a record
        /// </summary>
        public bool Update(TicketUsersEntity model)
        {
            string   strSql = @"update TicketUsers set  
                            TicketID=@TicketID, 
                            UserID=@UserID,
                            [Type]=@Type,
                            [Status]=@Status
                            where TUID=@TUID ";
            Database db     = DatabaseFactory.CreateDatabase();

            using (DbCommand dbCommand = db.GetSqlStringCommand(strSql))
            {
                db.AddInParameter(dbCommand, "TUID", DbType.Int32, model.TUID);
                db.AddInParameter(dbCommand, "TicketID", DbType.Int32, model.TicketID);
                db.AddInParameter(dbCommand, "UserID", DbType.Int32, model.UserID);
                db.AddInParameter(dbCommand, "Type", DbType.Int32, (int)model.Type);
                db.AddInParameter(dbCommand, "Status", DbType.Int32, (int)model.WorkingOnStatus);
                int rows = db.ExecuteNonQuery(dbCommand);

                if (rows > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
예제 #6
0
        public void SetEstimation(TicketUsersEntity ticketUsersEntity)
        {
            if ((int)ticketsEntity.Status > (int)TicketsState.PM_Reviewed && ticketsEntity.EsUserID > 0)
            {
                ltrlEstimationUser.Text = userApp.GetUser(ticketsEntity.EsUserID).FirstAndLastName;
            }
            else
            {
                ltrlEstimationUser.Text = UserInfo.FirstAndLastName;
            }

            List <UsersEntity> listUsers = userApp.GetActiveUserList().FindAll(u => u.UserType == "CLIENT" && u.CompanyID == ticketsEntity.CompanyID)
                                           .OrderBy(r => r.FirstName).ToList();

            foreach (UsersEntity u in listUsers)
            {
                ddlConfirmEstmateUserId.Items.Add(new ListItem()
                {
                    Value = u.UserID.ToString(), Text = string.Format("{0}({1})", u.FirstAndLastName, u.Role)
                });
            }

            if (ticketsEntity.ConfirmEstmateUserId > 0)
            {
                ListItem li = ddlConfirmEstmateUserId.Items.FindByValue(ticketsEntity.ConfirmEstmateUserId.ToString());
                if (li != null)
                {
                    li.Selected = true;
                }
            }

            txtInitialTime.Text        = ticketsEntity.InitialTime.ToString("N");
            txtBoxExtimationHours.Text = ticketsEntity.FinalTime.ToString("N");
        }
예제 #7
0
        private void SetEditClient(TicketUsersEntity ticketUsersEntity)
        {
            if (ticketsEntity.IsInternal == true)
            {
                dvClient.Visible = false;
            }
            else
            {
                List <UsersEntity> clientUsers = projApp.GetPojectClientUsers(ticketsEntity.ProjectID,
                                                                              projApp.Get(ticketsEntity.ProjectID).CompanyID);

                ddlClient.DataSource = clientUsers;

                ddlClient.DataBind();

                clientUsers.BindDropdown(ddlClient, UserNameDisplayProp, "UserID", "Please select...", "-1");
                if (null == ticketUsersEntity || userApp.GetUser(ticketUsersEntity.UserID).Role != RolesEnum.CLIENT)
                {
                    ddlClient.SelectedValue = "-1";
                }
                else
                {
                    ddlClient.SelectedValue = ticketUsersEntity.UserID.ToString();
                }
                //找一下ticket的createuser是不是Client
                //如果是则选中这个client
                //否则选择please select
                dvClient.Visible = true;
            }
        }
예제 #8
0
        private bool AssignTicketUsers(TicketsEntity ticketsEntity, List <int> userIds)
        {
            TicketUsersEntity tuEntity = new TicketUsersEntity();

            string[] userWithRoleList = hdTicketUsers.Value.TrimEnd(',').Split(',');
            int      assignResult     = 0;

            if (userWithRoleList.Length > 0)
            {
                foreach (string item in userWithRoleList)
                {
                    if (item.Length > 0)
                    {
                        string[] userWithRole = item.Split('|');
                        if (userWithRole.Length > 0)
                        {
                            if (userIds.Contains(Convert.ToInt32(userWithRole[0])) == false)
                            {
                                tuEntity.TicketID = ticketsEntity.TicketID;
                                tuEntity.UserID   = Convert.ToInt32(userWithRole[0]);
                                tuEntity.Type     = GetUserTypeByRoleID(userWithRole[1]); //Convert.ToInt32(userWithRole[0]);
                                assignResult      = ticketAPP.AddTicketUser(tuEntity);
                                if (assignResult > 0)
                                {
                                    //当创建Ticket时,不发送邮件给Assign Users了
                                    //new SendHandler(() => ex.SendEmailToAssignedUser(tuEntity, ticketsEntity, UserInfo)).BeginInvoke(null, null);
                                }
                            }
                        }
                    }
                }
            }
            return(true);
        }
예제 #9
0
        protected string GetAction(int ID, TicketsState ticketsState, int confirmEstmateUserId)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("<a href=\"Detail.aspx?tid={0}&returnurl=" + ReturnUrl + "\" target='_blank' ticketId='{0}'><img src=\"/Images/icons/view.png\" title=\"View\" id='imageOpen{0}'></a>"
                            , ID);
            if (ticketsState == TicketsState.Ready_For_Review)
            {
                TicketUsersEntity ticketUsersEntity = ticketAPP.GetTicketUser(ID, UserInfo.UserID);
                if (ticketUsersEntity != null && ticketUsersEntity.Type == TicketUsersType.Create)
                {
                    sb.Append("&nbsp;<a href=\"Approve.aspx?tid=" + ID.ToString()
                              + "&returnurl=" + Server.UrlEncode(Request.RawUrl)
                              + "\" data-target=\"#modalsmall\" data-toggle=\"modal\"><img src=\"/Images/icons/approve.png\" title=\"Approve\"></a>");
                    sb.Append("&nbsp;<a href=\"Deny.aspx?tid=" + ID.ToString()
                              + "&returnurl=" + Server.UrlEncode(Request.RawUrl)
                              + "\" data-target=\"#modalsmall\" data-toggle=\"modal\"><img src=\"/Images/icons/deny.png\" title=\"Deny\"></a>");
                }
            }

            if (ticketsState == TicketsState.Waiting_Confirm && confirmEstmateUserId == UserInfo.UserID)
            {
                sb.AppendFormat("&nbsp;<a href='ConfirmEstimates.aspx?tid={0}' data-toggle='modal' data-target='#modalsmall' title='Waiting Confirm'>", ID)
                .Append("<img src='/Images/icons/pmreview.png' alt='Waiting Confirm'></a>");
            }

            if (ticketList != null && ticketList.Find(r => r.TicketID == ID) != null)
            {
                sb.AppendFormat("&nbsp;<a href='###' id='{0}' onclick='cancelImg({0})'>", ID)
                .Append("<img alt='Cancel' title='Cancel' src='/images/icons/cancel_new.png' /></a>");
            }
            return(sb.ToString());
        }
예제 #10
0
        //create user ticketUser Entity
        public TicketUsersEntity CreateTicketsEntity(int userId)
        {
            TicketUsersEntity info = new TicketUsersEntity();

            info.TicketID = 1;
            info.UserID   = userId;
            info.TUID     = userId;//auto-incrementing
            return(info);
        }
예제 #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int tid = QS("tid", 0);

            if (tid <= 0)
            {
                this.ShowArgumentErrorMessageToClient();
                return;
            }
            else
            {
                TicketID     = tid;
                ticketEntity = ticketApp.GetTicketWithProjectTitle(tid);
                IsCompleted  = ticketEntity.Status == TicketsState.Completed;
                HideControlByStatus(ticketEntity);//hidden control by ticket status
                if (ticketEntity != null)
                {
                    IsCreate = ticketApp.GetTicketCreateUser(TicketID).UserID == UserInfo.UserID;
                    progress.orderedDisplayStates    = displayStates;
                    progress.CurrentState            = ticketApp.ConvertTicketStateToClientProgressState(ticketEntity.RealStatus);
                    this.feedbacks.IsSunnet          = true;
                    this.feedbacks.TicketsEntityInfo = ticketEntity;
                    //ticketBasicInfo.TicketsEntity = ticketEntity;
                    //hdStar.Value = ticketEntity.Star.ToString();
                    GetButtonsHTML();

                    TicketUsersEntity ticketUser = ticketApp.GetTicketUser(ticketEntity.TicketID, UserInfo.ID);
                    if (ticketUser != null)
                    {
                        ltlStatus.Text = ticketUser.WorkingOnStatus.ToText();
                    }
                    if (ticketUser == null || UserInfo.Role == RolesEnum.CLIENT)
                    {
                        phlWorkingOn.Visible = false;
                    }
                    ticketEntity.CreatedUserEntity = userApp.GetUser(ticketEntity.CreatedBy);
                    this.fileUpload.TicketID       = ticketEntity.TicketID;

                    if (ticketEntity.IsEstimates && ticketEntity.Status > TicketsState.Waiting_Confirm && ticketEntity.ConfirmEstmateUserId > 0)
                    {
                        ConfirmEstmateUser = userApp.GetUser(ticketEntity.ConfirmEstmateUserId).FirstAndLastName;
                    }

                    if (ticketEntity.Status == TicketsState.Waiting_Confirm && ticketEntity.ConfirmEstmateUserId == UserInfo.UserID)
                    {
                        isWaitConfirm  = true;
                        UrlWaitConfirm = string.Format("ConfirmEstimates.aspx?tid={0}", ticketEntity.TicketID);
                    }
                }
                else
                {
                    this.ShowArgumentErrorMessageToClient();
                    return;
                }
            }
        }
예제 #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ((Ticket)this.Master).CurrentModule = Codes.SelectedSunnetMenu.Ticket;
            int tid = QS("tid", 0);

            if (tid <= 0)
            {
                this.ShowArgumentErrorMessageToClient();
                return;
            }
            else
            {
                TicketID     = tid;
                ticketEntity = ticketApp.GetTicketWithProjectTitle(tid);
                IsCompleted  = ticketEntity.Status == TicketsState.Completed;
                HideControlByStatus(ticketEntity);//hidden control by ticket status
                if (ticketEntity != null)
                {
                    progress.orderedDisplayStates    = displayStates;
                    progress.CurrentState            = ticketApp.ConvertTicketStateToClientProgressState(ticketEntity.RealStatus);
                    this.feedbacks.IsSunnet          = true;
                    this.feedbacks.TicketsEntityInfo = ticketEntity;
                    //ticketBasicInfo.TicketsEntity = ticketEntity;
                    //hdStar.Value = ticketEntity.Star.ToString();
                    changeHistory.TicketID = TicketID;
                    GetButtonsHTML();

                    TicketUsersEntity ticketUser = ticketApp.GetTicketUser(ticketEntity.TicketID, UserInfo.ID);
                    if (ticketUser != null)
                    {
                        ltlStatus.Text = ticketUser.WorkingOnStatus.ToText();
                    }
                    //Ticket 3023 #4. 隐藏按纽 ([WorkingOn][Completed] [Canceled][None])
                    //if (ticketUser == null || UserInfo.Role == RolesEnum.CLIENT)
                    phlWorkingOn.Visible           = false;
                    ticketEntity.CreatedUserEntity = userApp.GetUser(ticketEntity.CreatedBy);

                    this.fileUpload.TicketID = ticketEntity.TicketID;
                    if (ticketEntity.IsEstimates && ticketEntity.Status > TicketsState.Waiting_Confirm && ticketEntity.ConfirmEstmateUserId > 0)
                    {
                        ConfirmEstmateUser = userApp.GetUser(ticketEntity.ConfirmEstmateUserId).FirstAndLastName;
                    }
                }
                else
                {
                    this.ShowArgumentErrorMessageToClient();
                    return;
                }
            }
        }
예제 #13
0
        public string ShowIsExitsInTicketUser(int uid)
        {
            string            check   = "";
            TicketUsersType   tmpType = (TicketUsersType)int.Parse(this.ddlRole.SelectedValue);
            TicketUsersEntity tmpTicketUsersEntity = tiketUserEntityList.Find(r => r.UserID == uid && r.Type == tmpType);

            if (null != tmpTicketUsersEntity)
            {
                check = string.Format("<input type='checkbox' checked='checked'id='{0}' />", uid);
            }
            else
            {
                check = string.Format("<input type='checkbox' id='{0}' />", uid);
            }
            return(check);
        }
예제 #14
0
        public List <TicketUsersEntity> GetListUsersByTicketId(int tid)
        {
            List <TicketUsersEntity> list = new List <TicketUsersEntity>();

            if (tid >= 999)
            {
                TicketUsersEntity user = null;
                for (int i = 999; i < 1010; i++)
                {
                    user          = new TicketUsersEntity();
                    user.UserID   = 1011 - i;
                    user.TicketID = i;
                    list.Add(user);
                }
            }
            return(list);
        }
예제 #15
0
        private void AddTicketUsers(ProjectsEntity projectsEntity, TicketsEntity ticketsEntity, int result)
        {
            TicketUsersEntity ticketUserEntity = new TicketUsersEntity();

            //add pm user
            ticketUserEntity.Type     = TicketUsersType.PM;
            ticketUserEntity.TicketID = result;
            ProjectsEntity projectEntity = new ProjectApplication().Get(ticketsEntity.ProjectID);

            if (projectEntity != null)
            {
                ticketUserEntity.UserID = projectEntity.PMID;
                new TicketsApplication().AddTicketUser(ticketUserEntity);
            }
            else
            {
                WebLogAgent.Write(string.Format("Add Pm To Ticket User Error:Project :{0},Ticket:{1},CreateDate:{2}",
                                                ticketsEntity.ProjectID, ticketsEntity.TicketID, DateTime.Now));
            }
            //add create user
            ticketUserEntity.Type     = TicketUsersType.Create;
            ticketUserEntity.TicketID = result;
            ticketUserEntity.UserID   = ticketsEntity.CreatedBy;
            new TicketsApplication().AddTicketUser(ticketUserEntity);

            if (UserInfo.Role == RolesEnum.PM || UserInfo.Role == RolesEnum.ADMIN)
            {
                //添加当前Project中的Leader到此ticket下.
                List <ProjectUsersEntity> ProjectUsers = new ProjectApplication().GetProjectSunnetUserList(projectsEntity.ID);
                if (ProjectUsers != null)
                {
                    List <ProjectUsersEntity> leaders = ProjectUsers.FindAll(r => r.Role == RolesEnum.Leader);
                    foreach (ProjectUsersEntity leader in leaders)
                    {
                        ticketUserEntity          = new TicketUsersEntity();
                        ticketUserEntity.Type     = TicketUsersType.Dev;
                        ticketUserEntity.TicketID = result;
                        ticketUserEntity.UserID   = leader.UserID;
                        new TicketsApplication().AddTicketUser(ticketUserEntity);
                    }
                }
            }
        }
예제 #16
0
        /// <summary>
        /// Send Email to Responsible when PM,Dev,QA,Seller Review Ticket
        /// </summary>
        /// <param name="tu"></param>
        /// <param name="ticketEntity"></param>
        public void SendEmailToResponsibile(TicketUsersEntity tu, TicketsEntity ticketEntity, UsersEntity createUser)
        {
            string to = "";

            to = GetEmailByUserId(tu.UserID);
            string   projectTitle = GetProjectTitleByPid(ticketEntity.ProjectID);
            XElement xmlInvoice1  = XElement.Load(System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "Template/SendEmailToResponsible.xml");

            emailBody    = xmlInvoice1.Element("email").Elements("content").First().Value;
            emailSubject = xmlInvoice1.Element("email").Elements("subject").First().Value
                           .Replace("{TicketID}", ticketEntity.TicketID.ToString())
                           .Replace("{TicketTitle}", ticketEntity.Title);
            emailBody = emailBody.Replace("{TicketID}", ticketEntity.TicketID.ToString())
                        .Replace("{Project}", projectTitle)
                        .Replace("{CreateName}", createUser.FirstAndLastName)
                        .Replace("{TicketTitle}", ticketEntity.Title);

            SFConfig.Components.EmailSender.SendMail(to, emailSubject, emailBody, true, MailPriority.Normal);
        }
예제 #17
0
        public List <TicketUsersEntity> GetTicketUser(int ticketID, TicketUsersType type)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select * from TicketUsers ");
            strSql.AppendFormat(" where TicketID=@TicketID and [type] = {0} ", (int)type);
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            db.AddInParameter(dbCommand, "TicketID", DbType.Int32, ticketID);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                var list = new List <TicketUsersEntity>();
                while (dataReader.Read())
                {
                    list.Add(TicketUsersEntity.ReaderBind(dataReader));
                }
                return(list);
            }
            return(null);
        }
예제 #18
0
        private void AddDefaultTicketUsers(ProjectsEntity projectsEntity, TicketsEntity ticketsEntity, int result, out List <int> userIds)
        {
            userIds = new List <int>();
            TicketUsersEntity ticketPMUserEntity = new TicketUsersEntity();

            //add pm user
            ticketPMUserEntity.Type     = TicketUsersType.PM;
            ticketPMUserEntity.TicketID = result;
            ProjectsEntity projectEntity = new ProjectApplication().Get(ticketsEntity.ProjectID);

            if (projectEntity != null)
            {
                ticketPMUserEntity.UserID = projectEntity.PMID;
                new TicketsApplication().AddTicketUser(ticketPMUserEntity);
                userIds.Add(projectEntity.PMID);
                //发送Email给Responsible
                ticketPMUserEntity.UserID = int.Parse(ddlRes.SelectedValue);
                new SendHandler(() => ex.SendEmailToResponsibile(ticketPMUserEntity, ticketsEntity, UserInfo)).BeginInvoke(null, null);
            }
            else
            {
                WebLogAgent.Write(string.Format("Add Pm To Ticket User Error:Project :{0},Ticket:{1},CreateDate:{2}",
                                                ticketsEntity.ProjectID, ticketsEntity.TicketID, DateTime.Now));
            }

            //add create user
            TicketUsersEntity ticketCreateUserEntity = new TicketUsersEntity();

            ticketCreateUserEntity.Type     = TicketUsersType.Create;
            ticketCreateUserEntity.TicketID = result;
            ticketCreateUserEntity.UserID   = ticketsEntity.CreatedBy;
            new TicketsApplication().AddTicketUser(ticketCreateUserEntity);

            if (userIds.Contains(ticketsEntity.CreatedBy) == false)
            {
                new SendHandler(() => ex.SendEmailToAssignedUser(ticketCreateUserEntity, ticketsEntity, UserInfo)).BeginInvoke(null, null);
                userIds.Add(ticketsEntity.CreatedBy);
            }
        }
예제 #19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (TicketsEntity != null)
                {
                    GetButtonsHTML();

                    this.fileUpload.TicketID = TicketsEntity.TicketID;
                    TicketUsersEntity ticketUser = ticketsApplication.GetTicketUser(TicketsEntity.TicketID, UserInfo.ID);
                    if (ticketUser != null)
                    {
                        ltlStatus.Text = ticketUser.WorkingOnStatus.ToText();
                    }
                    if (ticketUser == null || UserInfo.Role == RolesEnum.CLIENT)
                    {
                        phlWorkingOn.Visible = false;
                    }
                }
            }
            TicketsEntity.CreatedUserEntity = userApp.GetUser(TicketsEntity.CreatedBy);
        }
예제 #20
0
        public List <TicketUsersEntity> GetListByUserId(int userId)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select * from TicketUsers ");
            strSql.Append(" where UserID=@UserID ");
            Database db = DatabaseFactory.CreateDatabase();
            List <TicketUsersEntity> list = new List <TicketUsersEntity>();

            using (DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString()))
            {
                db.AddInParameter(dbCommand, "UserID", DbType.Int32, userId);
                using (IDataReader dataReader = db.ExecuteReader(dbCommand))
                {
                    while (dataReader.Read())
                    {
                        list.Add(TicketUsersEntity.ReaderBind(dataReader));
                    }
                }
            }
            return(list);
        }
예제 #21
0
        /// <summary>
        /// Get an object entity
        /// </summary>
        public TicketUsersEntity Get(int TUID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select * from TicketUsers ");
            strSql.Append(" where TUID=@TUID ");
            Database db = DatabaseFactory.CreateDatabase();

            using (DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString()))
            {
                db.AddInParameter(dbCommand, "TUID", DbType.Int32, TUID);
                TicketUsersEntity model = null;
                using (IDataReader dataReader = db.ExecuteReader(dbCommand))
                {
                    if (dataReader.Read())
                    {
                        model = TicketUsersEntity.ReaderBind(dataReader);
                    }
                }
                return(model);
            }
        }
예제 #22
0
        public int GetCount(string where)
        {
            var      strSql = "select count(1) from TicketUsers where " + where;
            Database db     = DatabaseFactory.CreateDatabase();

            using (DbCommand dbCommand = db.GetSqlStringCommand(strSql))
            {
                TicketUsersEntity model = null;
                using (IDataReader dataReader = db.ExecuteReader(dbCommand))
                {
                    try
                    {
                        return(dataReader.GetInt32(0));
                    }
                    catch (Exception ex)
                    {
                        WebLogAgent.Write(string.Format("[SQLText:{0},{1}Messages:\r\n{2}]",
                                                        strSql, base.FormatParameters(dbCommand.Parameters), ex.Message));
                        return(0);
                    }
                }
            }
        }
예제 #23
0
        public void DoAddPmAndSendEmail(TicketsEntity ticketEntity)
        {
            #region add pm
            TicketUsersEntity ticketUserEntity = new TicketUsersEntity();
            //add pm user
            ticketUserEntity.Type     = TicketUsersType.PM;
            ticketUserEntity.TicketID = result;
            ProjectsEntity projectEntity = projectApp.Get(ticketEntity.ProjectID);
            if (projectEntity != null)
            {
                ticketUserEntity.UserID = projectEntity.PMID;
                ticketAPP.AddTicketUser(ticketUserEntity);
            }
            else
            {
                WebLogAgent.Write(string.Format("Add Pm To Ticket User Error:Project :{0},Ticket:{1},CreateDate:{2}",
                                                ticketEntity.ProjectID, ticketEntity.TicketID, DateTime.Now));
            }
            //add create user
            ticketUserEntity.Type     = TicketUsersType.Create;
            ticketUserEntity.TicketID = result;
            ticketUserEntity.UserID   = ticketEntity.CreatedBy;
            ticketAPP.AddTicketUser(ticketUserEntity);

            #endregion

            #region send email

            if (!ticketEntity.IsInternal && ticketEntity.Status != TicketsState.Draft)
            {
                TicketStatusManagerApplication ex = new TicketStatusManagerApplication();
                ex.SendEmailToPMWhenTicketAdd(result, ticketEntity.TicketType);
            }

            #endregion
        }
예제 #24
0
        /// <summary>
        /// save : 1:save ; 2:draft ;3 save and new
        /// </summary>
        /// <param name="save"></param>
        private void SaveTicket(int save)
        {
            #region add ticket
            TicketsEntity ticketsEntity = new TicketsEntity();
            ticketsEntity.Title           = txtTitle.Value.NoHTML();
            ticketsEntity.FullDescription = txtDesc.Value.NoHTML();
            ticketsEntity.URL             = txtUrl.Value;
            ticketsEntity.ProjectID       = int.Parse(ddlProject.SelectedValue);
            ticketsEntity.TicketType      = (TicketsType)int.Parse(ddlType.SelectedValue);
            ticketsEntity.TicketCode      = new TicketsApplication().ConvertTicketTypeToTicketCode(ticketsEntity.TicketType);
            ticketsEntity.Priority        = (PriorityState)int.Parse(this.radioPriority.SelectedValue);
            ProjectsEntity projectsEntity = new ProjectApplication().Get(ticketsEntity.ProjectID);
            ticketsEntity.CompanyID   = projectsEntity.CompanyID;
            ticketsEntity.IsEstimates = chkEN.Checked;

            ticketsEntity.IsInternal = false;
            ticketsEntity.CreatedBy  = UserInfo.UserID;
            ticketsEntity.CreatedOn  = DateTime.Now;
            ticketsEntity.ModifiedBy = UserInfo.UserID;
            ticketsEntity.ModifiedOn = DateTime.Now;

            ticketsEntity.PublishDate   = UtilFactory.Helpers.CommonHelper.GetDefaultMinDate();
            ticketsEntity.ConvertDelete = CovertDeleteState.Normal;
            ticketsEntity.StartDate     = UtilFactory.Helpers.CommonHelper.GetDefaultMinDate();
            ticketsEntity.DeliveryDate  = UtilFactory.Helpers.CommonHelper.GetDefaultMinDate();
            if (UserInfo.Role == RolesEnum.PM || UserInfo.Role == RolesEnum.ADMIN)
            {
                ticketsEntity.Source = (RolesEnum)Enum.Parse(typeof(RolesEnum), ddlSource.SelectedValue);
            }
            else
            {
                ticketsEntity.Source = UserInfo.Role;
            }
            if (save == 2)
            {
                ticketsEntity.Status = TicketsState.Draft;
            }
            else
            {
                if (UserInfo.Role == RolesEnum.PM || UserInfo.Role == RolesEnum.ADMIN)
                {
                    ticketsEntity.Status = TicketsState.PM_Reviewed;
                }
                else
                {
                    ticketsEntity.Status = TicketsState.Submitted;
                }
            }
            int result = new TicketsApplication().AddTickets(ticketsEntity);

            if (result > 0)
            {
                TicketUsersEntity ticketUserEntity = new TicketUsersEntity();
                //add pm user
                ticketUserEntity.Type     = TicketUsersType.PM;
                ticketUserEntity.TicketID = result;
                ProjectsEntity projectEntity = new ProjectApplication().Get(ticketsEntity.ProjectID);
                if (projectEntity != null)
                {
                    ticketUserEntity.UserID = projectEntity.PMID;
                    new TicketsApplication().AddTicketUser(ticketUserEntity);
                }
                else
                {
                    WebLogAgent.Write(string.Format("Add Pm To Ticket User Error:Project :{0},Ticket:{1},CreateDate:{2}",
                                                    ticketsEntity.ProjectID, ticketsEntity.TicketID, DateTime.Now));
                }
                //add create user
                ticketUserEntity.Type     = TicketUsersType.Create;
                ticketUserEntity.TicketID = result;
                ticketUserEntity.UserID   = ticketsEntity.CreatedBy;
                new TicketsApplication().AddTicketUser(ticketUserEntity);

                if (UserInfo.Role == RolesEnum.PM || UserInfo.Role == RolesEnum.ADMIN)
                {
                    //添加当前Project中的Leader到此ticket下.
                    List <ProjectUsersEntity> ProjectUsers = new ProjectApplication().GetProjectSunnetUserList(projectsEntity.ID);
                    if (ProjectUsers != null)
                    {
                        List <ProjectUsersEntity> leaders = ProjectUsers.FindAll(r => r.Role == RolesEnum.Leader);
                        foreach (ProjectUsersEntity leader in leaders)
                        {
                            ticketUserEntity          = new TicketUsersEntity();
                            ticketUserEntity.Type     = TicketUsersType.Dev;
                            ticketUserEntity.TicketID = result;
                            ticketUserEntity.UserID   = leader.UserID;
                            new TicketsApplication().AddTicketUser(ticketUserEntity);
                        }
                    }
                }
            }
            #endregion

            #region send email
            TicketStatusManagerApplication ex = new TicketStatusManagerApplication();
            if (!ticketsEntity.IsInternal)
            {
                ex.SendEmailToPMWhenTicketAdd(result, ticketsEntity.TicketType);
            }

            #endregion

            #region add file

            if (fileupload.PostedFile.ContentLength > 0)
            {
                string FolderName = string.Empty;
                if (null != projectsEntity)
                {
                    FolderName = projectsEntity.ProjectID.ToString();
                }


                string filderPath    = System.Configuration.ConfigurationManager.AppSettings["FolderPath"]; //~/path
                string savepath      = Server.MapPath(filderPath) + FolderName;
                string filename      = fileupload.PostedFile.FileName;
                string fileExtension = Path.GetExtension(filename);

                if (!Directory.Exists(savepath))
                {
                    Directory.CreateDirectory(savepath);
                }

                string sNewFileName = string.Format("{0}_{1}{2}", result, DateTime.Now.ToString("yyMMddssmm"), fileExtension);

                fileupload.PostedFile.SaveAs(savepath + @"\" + sNewFileName);



                FilesEntity fileEntity = new FilesEntity();

                fileEntity.ContentType = fileExtension.ToLower();
                fileEntity.CreatedBy   = ticketsEntity.CreatedBy;
                fileEntity.FilePath    = filderPath.Substring(2) + FolderName + @"/" + sNewFileName;
                fileEntity.FileSize    = fileupload.PostedFile.ContentLength;
                fileEntity.FileTitle   = filename.Substring(0, filename.LastIndexOf('.'));
                fileEntity.IsPublic    = !ticketsEntity.IsInternal;
                fileEntity.ProjectId   = ticketsEntity.ProjectID;
                fileEntity.TicketId    = result;
                fileEntity.CreatedOn   = DateTime.Now.Date;
                fileEntity.FeedbackId  = 0;
                fileEntity.SourceType  = (int)FileSourceType.Ticket;
                fileEntity.ThumbPath   = "";
                fileEntity.CompanyID   = ticketsEntity.CompanyID;
                int response = new FileApplication().AddFile(fileEntity);
            }

            #endregion

            switch (save)
            {
            case 1:
                ShowMessageAndRedirect("The ticket has been added.", "/sunnet/Clients/ListTicket.aspx");
                break;

            case 2:
                ShowMessageAndRedirect("The ticket has been added.", "/sunnet/Clients/ListTicketDrafted.aspx");
                break;

            case 3:
                ShowMessageAndRedirect("The ticket has been added.", "/sunnet/Clients/AddBug.aspx");
                break;
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            try
            {
                if (IdentityContext.UserID <= 0)
                {
                    return;
                }

                #region get value

                String action   = context.Request["action"];
                String desc     = (context.Request["desc"]).NoHTML();
                bool   ckIsSave = "no" == context.Request["ckIsSave"] ? false : true;
                int    tid      = Convert.ToInt32(context.Request["tid"]);

                #endregion

                #region declare

                int result = 0;

                TicketsEntity entity = new TicketsEntity();

                TicketsEntity Originalentity = ticketAPP.GetTickets(tid);

                bool Update = true;

                #endregion

                if (action == "cRequest")
                {
                    if (ckIsSave)
                    {
                        #region add

                        entity.ProjectID       = Originalentity.ProjectID;
                        entity.CompanyID       = Originalentity.CompanyID;
                        entity.Priority        = Originalentity.Priority;
                        entity.TicketType      = TicketsType.Request;
                        entity.Title           = Originalentity.Title;
                        entity.URL             = Originalentity.URL;
                        entity.FullDescription = Originalentity.TicketCode + ":" + Originalentity.FullDescription +
                                                 string.Format(Environment.NewLine +
                                                               "==================================" +
                                                               Environment.NewLine +
                                                               "Convert Reason:{0}", desc.TrimStart());
                        entity.CreatedBy     = Originalentity.CreatedBy;
                        entity.CreatedOn     = DateTime.Now;
                        entity.ModifiedOn    = DateTime.Now;
                        entity.Status        = TicketsState.Submitted;
                        entity.IsEstimates   = Originalentity.IsEstimates;
                        entity.TicketCode    = "R";
                        entity.IsInternal    = false;
                        entity.ModifiedBy    = 0;
                        entity.PublishDate   = UtilFactory.Helpers.CommonHelper.GetDefaultMinDate();
                        entity.ConvertDelete = CovertDeleteState.Normal;
                        entity.StartDate     = UtilFactory.Helpers.CommonHelper.GetDefaultMinDate();
                        entity.DeliveryDate  = UtilFactory.Helpers.CommonHelper.GetDefaultMinDate();
                        entity.Source        = userApp.GetUser(IdentityContext.UserID).Role;
                        result = ticketAPP.AddTickets(entity);

                        if (result > 0)
                        {
                            TicketUsersEntity ticketUserEntity = new TicketUsersEntity();
                            ticketUserEntity.Type     = TicketUsersType.PM;
                            ticketUserEntity.TicketID = result;
                            ProjectsEntity projectEntity = projectApp.Get(entity.ProjectID);
                            if (projectEntity != null)
                            {
                                ticketUserEntity.UserID = projectEntity.PMID;
                                ticketAPP.AddTicketUser(ticketUserEntity);
                            }
                            else
                            {
                                WebLogAgent.Write(string.Format("Add Pm To Ticket User Error:Project :{0},Ticket:{1},CreateDate:{2}",
                                                                entity.ProjectID, result, DateTime.Now));
                            }
                            ticketUserEntity.Type     = TicketUsersType.Create;
                            ticketUserEntity.TicketID = result;
                            ticketUserEntity.UserID   = Originalentity.CreatedBy;
                            ticketAPP.AddTicketUser(ticketUserEntity);
                        }
                        #endregion

                        #region add relation

                        TicketsRelationDTO dtoEntity = new TicketsRelationDTO();

                        AddTicketsRelationRequest request = new AddTicketsRelationRequest();

                        dtoEntity.RTID = Convert.ToInt32(result);

                        dtoEntity.TID = Convert.ToInt32(tid);

                        dtoEntity.CreatedBy = Originalentity.CreatedBy;

                        request.dto = dtoEntity;

                        trApp.AddTR(request);

                        #endregion

                        #region history
                        TicketHistorysEntity historEntity = new TicketHistorysEntity();
                        historEntity.ModifiedBy  = IdentityContext.UserID;
                        historEntity.ModifiedOn  = DateTime.Now.Date;
                        historEntity.TicketID    = Originalentity.TicketID;
                        historEntity.Description = entity.FullDescription = Originalentity.TicketCode + ":" + Originalentity.FullDescription +
                                                                            string.Format(Environment.NewLine +
                                                                                          "==================================" +
                                                                                          Environment.NewLine +
                                                                                          "Convert Reason:{0}" +
                                                                                          Environment.NewLine +
                                                                                          "Convert By:{1}"
                                                                                          , desc.TrimStart()
                                                                                          , userApp.GetLastNameFirstName(IdentityContext.UserID)
                                                                                          );
                        ticketAPP.AddTicketHistory(historEntity);
                        #endregion

                        #region update

                        Originalentity.ConvertDelete = CovertDeleteState.ConvertToHistory;
                        Originalentity.ModifiedOn    = DateTime.Now;
                        Originalentity.ModifiedBy    = IdentityContext.UserID;

                        Update = ticketAPP.UpdateTickets(Originalentity);

                        #endregion
                    }
                    else
                    {
                        #region add

                        entity.ProjectID       = Originalentity.ProjectID;
                        entity.CompanyID       = Originalentity.CompanyID;
                        entity.Priority        = Originalentity.Priority;
                        entity.TicketType      = TicketsType.Request;
                        entity.Title           = Originalentity.Title;
                        entity.URL             = Originalentity.URL;
                        entity.FullDescription = Originalentity.TicketCode + ":" + Originalentity.FullDescription +
                                                 string.Format(Environment.NewLine +
                                                               "==================================" +
                                                               Environment.NewLine +
                                                               "Convert Reason:{0}", desc.TrimStart());
                        entity.CreatedBy     = Originalentity.CreatedBy;
                        entity.CreatedOn     = DateTime.Now;
                        entity.ModifiedOn    = DateTime.Now;
                        entity.Status        = TicketsState.Submitted;
                        entity.IsEstimates   = Originalentity.IsEstimates;
                        entity.TicketCode    = "R";
                        entity.IsInternal    = false;
                        entity.ModifiedBy    = 0;
                        entity.PublishDate   = UtilFactory.Helpers.CommonHelper.GetDefaultMinDate();
                        entity.ConvertDelete = CovertDeleteState.Normal;
                        entity.StartDate     = UtilFactory.Helpers.CommonHelper.GetDefaultMinDate();
                        entity.DeliveryDate  = UtilFactory.Helpers.CommonHelper.GetDefaultMinDate();
                        entity.Source        = userApp.GetUser(IdentityContext.UserID).Role;
                        result = ticketAPP.AddTickets(entity);

                        if (result > 0)
                        {
                            TicketUsersEntity ticketUserEntity = new TicketUsersEntity();
                            ticketUserEntity.Type     = TicketUsersType.PM;
                            ticketUserEntity.TicketID = result;
                            ProjectsEntity projectEntity = projectApp.Get(entity.ProjectID);
                            if (projectEntity != null)
                            {
                                ticketUserEntity.UserID = projectEntity.PMID;
                                ticketAPP.AddTicketUser(ticketUserEntity);
                            }
                            else
                            {
                                WebLogAgent.Write(string.Format("Add Pm To Ticket User Error:Project :{0},Ticket:{1},CreateDate:{2}",
                                                                entity.ProjectID, result, DateTime.Now));
                            }
                            ticketUserEntity.Type     = TicketUsersType.Create;
                            ticketUserEntity.TicketID = result;
                            ticketUserEntity.UserID   = Originalentity.CreatedBy;
                            ticketAPP.AddTicketUser(ticketUserEntity);
                        }

                        #endregion

                        #region history
                        TicketHistorysEntity historEntity = new TicketHistorysEntity();
                        historEntity.ModifiedBy  = IdentityContext.UserID;
                        historEntity.ModifiedOn  = DateTime.Now.Date;
                        historEntity.TicketID    = Originalentity.TicketID;
                        historEntity.Description = entity.FullDescription = Originalentity.TicketCode + ":" + Originalentity.FullDescription +
                                                                            string.Format(Environment.NewLine +
                                                                                          "==================================" +
                                                                                          Environment.NewLine +
                                                                                          "Convert Reason:{0}" +
                                                                                          Environment.NewLine +
                                                                                          "Convert By:{1}"
                                                                                          , desc.TrimStart()
                                                                                          , userApp.GetLastNameFirstName(IdentityContext.UserID)
                                                                                          );
                        ticketAPP.AddTicketHistory(historEntity);
                        #endregion

                        #region add relation

                        TicketsRelationDTO dtoEntity = new TicketsRelationDTO();

                        AddTicketsRelationRequest request = new AddTicketsRelationRequest();

                        dtoEntity.RTID = Convert.ToInt32(result);

                        dtoEntity.TID = Convert.ToInt32(tid);

                        dtoEntity.CreatedBy = Originalentity.CreatedBy;

                        request.dto = dtoEntity;

                        trApp.AddTR(request);

                        #endregion

                        #region update

                        Originalentity.Status        = TicketsState.Cancelled;
                        Originalentity.ConvertDelete = CovertDeleteState.ForeverDelete;
                        Originalentity.ModifiedOn    = DateTime.Now;

                        Originalentity.ModifiedBy = IdentityContext.UserID;
                        Update = ticketAPP.UpdateTickets(Originalentity);

                        #endregion
                    }
                }
                if (Update)
                {
                    context.Response.Write("Update Status Success!");
                }
                else
                {
                    context.Response.Write("Update Status Fail!");
                }
            }
            catch (Exception ex)
            {
                context.Response.Write("para error!");
                WebLogAgent.Write(string.Format("Error Ashx:DoConverReasonHandler.ashx Messages:\r\n{0}", ex));
                return;
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            try
            {
                if (IdentityContext.UserID <= 0)
                {
                    return;
                }
                String        checkboxList = context.Request["checkboxList"];
                String        tid          = context.Request["tid"];
                String        type         = context.Request["type"];
                List <string> userArray    = new List <string>();
                List <string> userids      = new List <string>();
                List <string> userTypes    = new List <string>();


                if (!string.IsNullOrEmpty(checkboxList))
                {
                    userArray = checkboxList.Split(',').ToList();
                }

                foreach (string user in userArray)
                {
                    string[] values = user.Split('|');
                    userids.Add(values[0]);
                    userTypes.Add(values[1]);
                }

                IEnumerable <string> distinctedUserTypes = userTypes.Distinct();
                ticketApp.RemoveAllTicketUsersExceptPM(Convert.ToInt32(tid));//remove all ticket user
                TicketUsersEntity entity = new TicketUsersEntity();

                entity.TicketID = Convert.ToInt32(tid);
                int  result   = 0;
                bool HasError = false;
                for (int i = 0; i < userids.Count; i++)
                {
                    if (userids[i].Length > 0)
                    {
                        userID        = Convert.ToInt32(userids[i]);
                        entity.UserID = userID;
                        entity.Type   = (TicketUsersType)int.Parse(userTypes[i] + "");
                        result        = ticketApp.AddTicketUser(entity);
                        if (result > 0)
                        {
                            if (enableEmail)
                            {
                                ticketStatusMgr.SendEmailToAssignedUser(entity);
                            }
                        }
                        else
                        {
                            HasError = true;
                        }
                    }
                }
                if (!HasError)
                {
                    context.Response.Write("User Assign Successful!");
                }
                else
                {
                    context.Response.Write("User Assign Fail!");
                }
            }
            catch (Exception ex)
            {
                context.Response.Write("para error!");
                WebLogAgent.Write(string.Format("Error Ashx:DoAssignUserHandler.ashx Messages:\r\n{0}", ex));
                return;
            }
        }
예제 #27
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (ticketID > 0)
                {
                    ticketsEntity = ticketApp.GetTickets(ticketID);

                    //创建者
                    TicketUsersEntity ticketUser = ticketApp.GetTicketCreateUser(ticketID);
                    UsersEntity       createUser = userApp.GetUser(ticketUser.UserID);
                    if (createUser.Role == RolesEnum.CLIENT)
                    {
                        HiddenField_TicketCreateId.Value = "-1";
                    }
                    else
                    {
                        HiddenField_TicketCreateId.Value = ticketUser.UserID.ToString();;
                    }


                    ProposalTrackerRelationEntity model = wrApp.GetProposalTrackerByTid(ticketID);
                    if (model != null && model.ID != 0)
                    {
                        ddl_Proposal.SelectedValue = model.WID.ToString();
                    }
                    ddlResponsibleUser.Items.Add(new ListItem("System", "-1"));
                }
                if (projectID > 0)
                {
                    ProposalTrackerApplication wrApp = new ProposalTrackerApplication();

                    List <ProposalTrackerEntity> proposalTracker = wrApp.GetProposalTrackerByPid(projectID);
                    ddl_Proposal.DataSource     = proposalTracker;
                    ddl_Proposal.DataValueField = "ProposalTrackerID";
                    ddl_Proposal.DataTextField  = "Title";
                    ddl_Proposal.DataBind();
                    ddl_Proposal.Items.Insert(0, new ListItem("Please select... ", ""));
                }
            }
            if (ticketsEntity != null)
            {
                if (!IsPostBack)
                {
                    if (ticketsEntity.Status >= TicketsState.PM_Reviewed &&
                        ticketsEntity.Status <= TicketsState.Estimation_Approved && ticketsEntity.TicketType == TicketsType.Bug)
                    {
                        dvChangeRequest.Style.Add("display", "block");
                    }
                    else
                    {
                        dvChangeRequest.Style.Add("display", "none");
                    }
                    litHead.Text = string.Format("Ticket ID: {0}, {1}&nbsp;&nbsp; ; &nbsp;&nbsp;Status: {2}"
                                                 , ticketsEntity.TicketID, ticketsEntity.Title, ticketsEntity.Status.ToText());
                    TicketUsersEntity ticketUsersEntity = ticketApp.GetTicketCreateUser(ticketsEntity.TicketID);
                    SetEstimation(ticketUsersEntity);
                    SetEditClient(ticketUsersEntity);
                    BindStatus();

                    txtProprosalName.Text = ticketsEntity.ProprosalName;
                    txtWorkPlanName.Text  = ticketsEntity.WorkPlanName;
                    txtWorkScope.Text     = ticketsEntity.WorkScope;
                    txtInvoice.Text       = ticketsEntity.Invoice;
                }
            }
            else
            {
                ShowFailMessageToClient();
            }
        }
예제 #28
0
        public void AddTicket(TicketsEntity te, TicketUsersEntity tu)
        {
            FakeEmailSender emailSender = new FakeEmailSender();

            emailSender.SendMail(tu.UserID.ToString(), "", te.Title, te.Description);
        }
예제 #29
0
 public bool Update(TicketUsersEntity entity)
 {
     throw new NotImplementedException();
 }
예제 #30
0
        protected string GetButtonsHTML()
        {
            StringBuilder resultButtonHTMLBuilder = new StringBuilder();
            TicketsState  currentTicketState      = ticketEntity.Status;

            if (ticketApp.IsTicketUser(ticketEntity.ID, UserInfo.UserID))
            {
                switch (UserInfo.Role)
                {
                case RolesEnum.PM:
                {
                    ReviewUrl  = "PMReview.aspx?tid=" + ticketEntity.ID.ToString() + "&pid=" + ticketEntity.ProjectID.ToString();
                    ReviewName = "PM Review";
                    break;
                }

                case RolesEnum.CLIENT:
                {
                    TicketUsersEntity ticketUsersEntity = ticketApp.GetTicketUser(ticketEntity.TicketID, UserInfo.UserID);

                    if (ticketApp.ClientDealState.Find(r => r == ticketEntity.Status) != 0 &&
                        ticketUsersEntity != null && ticketUsersEntity.Type == TicketUsersType.Create)
                    {
                        SetReadyforReview();
                    }
                    break;
                }

                case RolesEnum.QA:
                {
                    if (ticketApp.QaDealState.Find(r => r == ticketEntity.Status) != 0)
                    {
                        if (ticketEntity.Status == TicketsState.Waiting_For_Estimation)
                        {
                            ReviewUrl  = "QAReview.aspx?tid=" + ticketEntity.ID.ToString();
                            ReviewName = "QA Review";
                        }
                        else
                        {
                            if (ticketEntity.Status == TicketsState.Ready_For_Review)
                            {
                                SetReadyforReview();
                            }
                            else
                            {
                                ReviewUrl = "QAReview.aspx?tid=" + ticketEntity.ID.ToString();

                                ReviewName = "QA Review";
                            }
                        }
                    }
                    break;
                }

                case RolesEnum.Leader:
                case RolesEnum.DEV:
                {
                    if (ticketApp.DevDealState.Find(r => r == ticketEntity.Status) != 0)
                    {
                        if (ticketEntity.Status == TicketsState.Waiting_For_Estimation)
                        {
                            if (ticketEntity.EsUserID == UserInfo.UserID)
                            {
                                ReviewUrl = "DevReview.aspx?tid=" + ticketEntity.ID.ToString();

                                ReviewName = "DEV Review";
                            }
                        }
                        else
                        {
                            if (UserInfo.Role == RolesEnum.Leader)
                            {
                                if (ticketEntity.Status == TicketsState.Ready_For_Review)
                                {
                                    SetReadyforReview();
                                }
                                else
                                {
                                    ReviewUrl = "DevReview.aspx?tid=" + ticketEntity.ID.ToString();

                                    ReviewName = "DEV Review";
                                }
                            }
                            else
                            {
                                ReviewUrl = "DevReview.aspx?tid=" + ticketEntity.ID.ToString();

                                ReviewName = "DEV Review";
                            }
                        }
                    }
                    break;
                }

                case RolesEnum.Sales:
                {
                    if (ticketApp.SalerDealState.Find(r => r == ticketEntity.Status) != 0)
                    {
                        if (ticketEntity.Status != TicketsState.Ready_For_Review)
                        {
                            ReviewUrl  = "SalerReview.aspx?tid=" + ticketEntity.ID.ToString();
                            ReviewName = "Saler Review";
                        }
                        else
                        {
                            SetReadyforReview();
                        }
                    }
                    break;
                }
                }
            }
            return(resultButtonHTMLBuilder.ToString());
        }