예제 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (IsInternalUser)
         {
             Response.Redirect("/SunnetTicket/InternalDashboard.aspx");
         }
         var list = ticketApp.GetWorkingOnTickets(UserInfo.ID);
         if (list != null && list.Count > 0)
         {
             var ticketlist = list.Distinct(new CompareTicket()).ToList();
             rptTicketsList.DataSource = ticketlist;
             rptTicketsList.DataBind();
         }
         else
         {
             phlNoTicket.Visible = true;
         }
         _globalPage = this.Page as GlobalPage;
         List <UsersEntity> userList = new App.ProjectApplication().GetProjectUsersByUserId(UserInfo);
         userList        = userList.Distinct(new CompareUser()).ToList();
         hiUserIds.Value = string.Join(",", userList.Select(r => r.UserID).ToArray());
     }
 }
예제 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         List <UsersEntity> userList = new App.ProjectApplication().GetProjectUsersByUserId(UserInfo);
         userList        = userList.Distinct(new CompareUser()).ToList();
         hiUserIds.Value = string.Join(",", userList.Select(r => r.UserID).ToArray());
     }
 }
예제 #3
0
        protected void SendEamil(List <EventInviteEntity> inviteList, List <EventEntity> eventList)
        {
            string addcontent = GetEmailExecuter("CreateEvent.txt").Replace("[Host]", UserInfo.FirstAndLastName);

            foreach (EventEntity eventEntity in eventList)
            {
                ProjectsEntity projectEntity = new App.ProjectApplication().Get(eventEntity.ProjectID);
                string         time          = string.Empty;
                if (eventEntity.AllDay)
                {
                    time = eventEntity.FromDay.ToString("MM/dd/yyyy");
                }
                else
                {
                    eventEntity.FromDay = DateTime.Parse(string.Format("{0}/{1}/{2} {3} {4}"
                                                                       , eventEntity.FromDay.Month, eventEntity.FromDay.Day, eventEntity.FromDay.Year, eventEntity.FromTime, eventEntity.FromTimeType == 1 ? "AM" : "PM"));
                    eventEntity.ToDay = DateTime.Parse(string.Format("{0}/{1}/{2} {3} {4}"
                                                                     , eventEntity.ToDay.Month, eventEntity.ToDay.Day, eventEntity.ToDay.Year, eventEntity.ToTime, eventEntity.ToTimeType == 1 ? "AM" : "PM"));

                    time = string.Format("{0}  ----  {1}", eventEntity.FromDay.ToString("MM/dd/yyyy hh:mm tt"), eventEntity.ToDay.ToString("MM/dd/yyyy hh:mm tt"));
                }

                string subject = string.Format("[{0}]You are invited to attend this event.", eventEntity.Name);

                foreach (EventInviteEntity item in inviteList)
                {
                    string from = Config.DefaultSendEmail;
                    if (item.UserID > 0)
                    {
                        UsersEntity user = new App.UserApplication().GetUser(item.UserID);
                        item.FirstName = user.FirstName;
                        item.LastName  = user.LastName;
                        item.Email     = user.Email;
                    }
                    if (item.Email.Trim() != string.Empty)
                    {
                        string content = addcontent.Replace("[ClientName]", item.FirstName).Replace("[Project]", projectEntity.Title)
                                         .Replace("[Title]", eventEntity.Name).Replace("[Where]", eventEntity.Where)
                                         .Replace("[Detail]", eventEntity.Details).Replace("[Time]", time);
                        ObjectFactory.GetInstance <IEmailSender>().SendMail(item.Email, Config.DefaultSendEmail, subject, content);
                    }
                }
            }
        }
예제 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            projApp = new ProjectApplication();
            if (!Page.IsPostBack)
            {
                List <ProjectDetailDTO> list = projApp.GetUserProjects(UserInfo);
                switch (UserInfo.Role)
                {
                case RolesEnum.Leader:
                case RolesEnum.DEV:
                case RolesEnum.QA:
                    list = list.FindAll(r => r.CompanyID == Config.SunnetCompany);
                    break;
                }

                list.BindDropdown <ProjectDetailDTO>(ddlProjects, "Title", "ProjectID", "ALL", "-1");
                ddlYears.SelectedValue  = DateTime.Now.Year.ToString();
                ddlMonths.SelectedValue = DateTime.Now.Month.ToString();

                List <UsersEntity> userList = new App.ProjectApplication().GetProjectUsersByUserId(UserInfo);
                userList           = userList.Distinct(new CompareUser()).ToList();
                hiUserIds.Value    = string.Join(",", userList.Select(r => r.UserID).ToArray());
                ddlUser.DataSource = userList.OrderBy(r => r.FirstName);
                ddlUser.DataBind();
                ddlUser.Items.Insert(0, new ListItem()
                {
                    Text = "ALL", Value = "0"
                });
            }
            if (ddlProjects.Items.Count <= 0)
            {
                ddlProjects.Items.Add(new ListItem()
                {
                    Selected = true, Text = "None", Value = "0"
                });
            }
            DateTitle = DateTime.Now.ToString("MMMM yyyy", System.Globalization.DateTimeFormatInfo.InvariantInfo);
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            if (IdentityContext.UserID <= 0)
            {
                context.Response.Write("[]");
                return;
            }

            int projectId;

            if (!int.TryParse(context.Request.QueryString["projectId"] + "", out projectId))
            {
                context.Response.Write("[]");
                return;
            }

            UsersEntity user = new App.UserApplication().GetUser(IdentityContext.UserID);

            ProjectsEntity projectEntity = new App.ProjectApplication().Get(projectId);

            List <int> listUserId = new App.ProjectApplication().GetActiveUserIdByProjectId(projectId);

            if (listUserId == null || listUserId.Count == 0)
            {
                context.Response.Write("[]");
                return;
            }
            if (!listUserId.Contains(user.UserID))
            {
                context.Response.Write("[]");
                return;
            }
            else
            {
                listUserId.Remove(user.UserID);
            }

            if (user.Office == "CN" && user.UserType == "SUNNET")//山诺 上海的员工只能获取本公司的项目的相关人员
            {
                if (projectEntity.CompanyID == Config.SunnetCompany)
                {
                    StringBuilder sb = new StringBuilder();
                    sb.Append("[");
                    int index = 0;
                    foreach (int tmpId in listUserId)
                    {
                        UsersEntity tmpUser = new App.UserApplication().GetUser(tmpId);
                        if (tmpUser == null)
                        {
                            continue;
                        }
                        if (tmpUser.UserType == "SUNNET")
                        {
                            CompanysEntity companyEntity = new App.CompanyApplication().GetCompany(tmpUser.CompanyID);
                            if (index > 0)
                            {
                                sb.Append(",");
                            }
                            index++;
                            sb.Append("{");
                            sb.AppendFormat("\"UserID\":\"{0}\"", tmpUser.UserID);
                            sb.AppendFormat(",\"FirstAndLastName\":\"{0}\"", tmpUser.FirstAndLastName);
                            sb.AppendFormat(",\"LastNameAndFirst\":\"{0}\"", tmpUser.LastNameAndFirst);
                            sb.AppendFormat(",\"CompanyName\":\"{0}\"", companyEntity.CompanyName);
                            sb.AppendFormat(",\"Title\":\"{0}\"", tmpUser.Title);
                            sb.Append("}");
                        }
                    }
                    sb.Append("]");
                    context.Response.Write(sb.ToString());
                    return;
                }
                else
                {
                    context.Response.Write("[]");
                    return;
                }
            }
            else
            {
                if (user.Role == RolesEnum.CLIENT || user.Role == RolesEnum.ADMIN || user.Role == RolesEnum.PM || user.Role == RolesEnum.Sales || user.Role == RolesEnum.Contactor)
                {
                    StringBuilder sb = new StringBuilder();
                    sb.Append("[");
                    int index = 0;
                    foreach (int tmpId in listUserId)
                    {
                        UsersEntity tmpUser = new App.UserApplication().GetUser(tmpId);
                        if (tmpUser == null)
                        {
                            continue;
                        }
                        if (projectEntity.CompanyID == Config.SunnetCompany)
                        {
                            CompanysEntity companyEntity = new App.CompanyApplication().GetCompany(tmpUser.CompanyID);
                            if (index > 0)
                            {
                                sb.Append(",");
                            }
                            index++;
                            sb.Append("{");
                            sb.AppendFormat("\"UserID\":\"{0}\"", tmpUser.UserID);
                            sb.AppendFormat(",\"FirstAndLastName\":\"{0}\"", tmpUser.FirstAndLastName);
                            sb.AppendFormat(",\"LastNameAndFirst\":\"{0}\"", tmpUser.LastNameAndFirst);
                            sb.AppendFormat(",\"CompanyName\":\"{0}\"", companyEntity.CompanyName);
                            sb.AppendFormat(",\"Title\":\"{0}\"", tmpUser.Title);
                            sb.Append("}");
                        }
                        else
                        {
                            if (tmpUser.Role == RolesEnum.CLIENT || tmpUser.Role == RolesEnum.ADMIN || tmpUser.Role == RolesEnum.PM || tmpUser.Role == RolesEnum.Sales || user.Role == RolesEnum.Contactor)
                            {
                                CompanysEntity companyEntity = new App.CompanyApplication().GetCompany(tmpUser.CompanyID);
                                if (index > 0)
                                {
                                    sb.Append(",");
                                }
                                index++;
                                sb.Append("{");
                                sb.AppendFormat("\"UserID\":\"{0}\"", tmpUser.UserID);
                                sb.AppendFormat(",\"FirstAndLastName\":\"{0}\"", tmpUser.FirstAndLastName);
                                sb.AppendFormat(",\"LastNameAndFirst\":\"{0}\"", tmpUser.LastNameAndFirst);
                                sb.AppendFormat(",\"CompanyName\":\"{0}\"", companyEntity.CompanyName);
                                sb.AppendFormat(",\"Title\":\"{0}\"", tmpUser.Title);
                                sb.Append("}");
                            }
                        }
                    }
                    sb.Append("]");
                    context.Response.Write(sb.ToString());
                    return;
                }
            }
        }
예제 #6
0
        private string CreateICSString(UsersEntity user)
        {
            List <EventEntity> list    = new App.EventsApplication().GetEventList(user.UserID, DateTime.Parse("1990/01/01"), DateTime.MaxValue, user.UserID, string.Empty, 0);
            StringBuilder      builder = new StringBuilder();

            builder.Append("BEGIN:VCALENDAR\n");
            builder.Append("PRODID:-//SunNet Solution//My PM Event Book 1.0000//EN\n");
            builder.Append("VERSION:2.0\n");
            builder.Append("CALSCALE:GREGORIAN\n");
            builder.Append("METHOD:PUBLISH\n");
            builder.Append("X-WR-CALNAME:My PM Event Book\n");
            builder.Append("X-WR-TIMEZONE:America/Chicago\n");
            foreach (EventEntity entity in list)
            {
                DateTime dtFromDay = entity.FromDay;
                DateTime dtToDay   = entity.ToDay;
                if (!entity.AllDay)
                {
                    dtFromDay = DateTime.Parse(string.Format("{0}/{1}/{2} {3} {4}"
                                                             , entity.FromDay.Month, entity.FromDay.Day, entity.FromDay.Year, entity.FromTime, entity.FromTimeType == 1 ? "AM" : "PM"));

                    dtToDay = DateTime.Parse(string.Format("{0}/{1}/{2} {3} {4}"
                                                           , entity.ToDay.Month, entity.ToDay.Day, entity.ToDay.Year, entity.ToTime, entity.ToTimeType == 1 ? "AM" : "PM"));
                }

                StringBuilder  builder2 = new StringBuilder();
                ProjectsEntity project  = new App.ProjectApplication().Get(entity.ProjectID);
                builder2.Append("Project Name: " + project.Title + @"\n");
                builder2.Append("Name: " + entity.Name + @"\n");
                builder2.Append("Details: " + entity.Details + @"\n");
                if (entity.AllDay)
                {
                    builder2.Append("FromDay: " + dtFromDay.ToString("MM/dd/yyyy") + @"\n");
                    builder2.Append("ToDay: " + dtToDay.ToString("MM/dd/yyyy") + @"\n");
                }
                else
                {
                    builder2.Append("FromDay: " + dtFromDay.ToString("MM/dd/yyyy hh:mm t") + @"\n");
                    builder2.Append("ToDay: " + dtToDay.ToString("MM/dd/yyyy hh:mm t") + @"\n");
                }

                builder.Append("BEGIN:VEVENT\n");

                if (entity.AllDay)
                {
                    builder.Append("DTEND;VALUE=DATE:" + dtToDay.AddDays(1).ToString("yyyyMMdd") + "\n");
                }
                else
                {
                    builder.Append("DTEND:" + dtToDay.ToString("yyyyMMddTHHmmss") + "\n");
                }


                builder.Append("DTSTAMP:" + DateTime.Now.ToString("yyyyMMddTHHmmss") + "\n");

                if (entity.AllDay)
                {
                    builder.Append("DTSTART;VALUE=DATE:" + dtFromDay.ToString("yyyyMMdd") + "\n");
                }
                else
                {
                    builder.Append("DTSTART:" + dtFromDay.ToString("yyyyMMddTHHmmss") + "\n");
                }


                builder.Append("UID:" + entity.CreatedBy.ToString("N").ToLower() + "@myfamilybook.us\n");
                builder.Append("CREATED:" + entity.CreatedOn.ToString("yyyyMMddTHHmmss") + "\n");
                builder.Append("DESCRIPTION:" + builder2.ToString() + "\n");
                builder.Append("LAST-MODIFIED:" + entity.UpdatedOn.ToString("yyyyMMddTHHmmss") + "\n");
                builder.Append("LOCATION:" + entity.Where + "\n");
                builder.Append("SEQUENCE:0\n");
                builder.Append("STATUS:CONFIRMED\n");
                builder.Append("SUMMARY:" + entity.Name + "\n");
                builder.Append("TRANSP:TRANSPARENT\n");

                builder.Append("END:VEVENT\n");
            }
            builder.Append("END:VCALENDAR");
            return(builder.ToString());
        }
예제 #7
0
        protected void SendEamil(List <EventInviteEntity> inviteList, EventsView model, bool isEditDate, bool isDelete = false)
        {
            string AddContent        = GetEmailExecuter("CreateEvent.txt").Replace("[Host]", UserInfo.FirstAndLastName);
            string RemoveUserContent = GetEmailExecuter("RemoveUser.txt").Replace("[Host]", UserInfo.FirstAndLastName);
            string UpdateContent     = GetEmailExecuter("EventUpdateTime.txt").Replace("[Host]", UserInfo.FirstAndLastName);
            string DeleteContent     = GetEmailExecuter("DeletedEvent.txt").Replace("[Host]", UserInfo.FirstAndLastName);

            ProjectsEntity projectEntity = new App.ProjectApplication().Get(model.ProjectID);

            string time = string.Empty;

            if (model.AllDay)
            {
                time = model.FromDay.ToString("MM/dd/yyyy");
            }
            else
            {
                model.FromDay = DateTime.Parse(string.Format("{0}/{1}/{2} {3} {4}"
                                                             , model.FromDay.Month, model.FromDay.Day, model.FromDay.Year, model.FromTime, model.FromTimeType == 1 ? "AM" : "PM"));
                model.ToDay = DateTime.Parse(string.Format("{0}/{1}/{2} {3} {4}"
                                                           , model.ToDay.Month, model.ToDay.Day, model.ToDay.Year, model.ToTime, model.ToTimeType == 1 ? "AM" : "PM"));

                time = string.Format("{0}  ----  {1}", model.FromDay.ToString("MM/dd/yyyy hh:mm tt"), model.ToDay.ToString("MM/dd/yyyy hh:mm tt"));
            }

            string subject = string.Empty;
            string content = string.Empty;

            foreach (EventInviteEntity item in inviteList)
            {
                if (item.UserID == 0)
                {
                    if (string.IsNullOrEmpty(item.Email) || item.Email.Trim() == string.Empty)
                    {
                        continue;
                    }
                }
                else
                {
                    UsersEntity user = new App.UserApplication().GetUser(item.UserID);
                    item.FirstName = user.FirstName;
                    item.LastName  = user.LastName;
                    item.Email     = user.Email;
                }

                string from = Config.DefaultSendEmail;
                if (isDelete)
                {
                    subject = string.Format("[{0}]This event has been canceled. ", model.Name);
                    content = DeleteContent.Replace("[ClientName]", item.FirstName).Replace("[Project]", projectEntity.Title)
                              .Replace("[Title]", model.Name).Replace("[Where]", model.Where)
                              .Replace("[Detail]", model.Details).Replace("[Time]", time);
                }
                else
                {
                    switch (item.OptionStatus)
                    {
                    case 1:     //正常
                        if (isEditDate)
                        {
                            subject = string.Format("[{0}]The time of this event has been changed.", model.Name);
                            content = UpdateContent.Replace("[ClientName]", item.FirstName).Replace("[Project]", projectEntity.Title)
                                      .Replace("[Title]", model.Name).Replace("[Where]", model.Where)
                                      .Replace("[Detail]", model.Details).Replace("[Time]", time);
                        }
                        else
                        {
                            continue;
                        }
                        break;

                    case 2:     //新加的
                        subject = string.Format("[{0}]You are invited to attend this event.", model.Name);
                        content = AddContent.Replace("[ClientName]", item.FirstName).Replace("[Project]", projectEntity.Title)
                                  .Replace("[Title]", model.Name).Replace("[Where]", model.Where)
                                  .Replace("[Detail]", model.Details).Replace("[Time]", time);
                        break;

                    case 3:     //删除的
                        subject = string.Format("[{0}]You are not going to attend this event.", model.Name);
                        content = RemoveUserContent.Replace("[ClientName]", item.FirstName).Replace("[Project]", projectEntity.Title)
                                  .Replace("[Title]", model.Name).Replace("[Where]", model.Where)
                                  .Replace("[Detail]", model.Details).Replace("[Time]", time);
                        break;
                    }
                }
                ObjectFactory.GetInstance <IEmailSender>().SendMail(item.Email, Config.DefaultSendEmail, subject, content);

                SendEmail(isEditDate);
            }
        }
예제 #8
0
        private List <EventInviteEntity> BuilderInvite(EventsView model)
        {
            ///获取旧数据
            List <EventInviteEntity> oldlist = new App.EventsApplication().GetEventInvites(model.ID);

            foreach (EventInviteEntity tmpItem in oldlist)
            {
                if (tmpItem.UserID > 0)
                {
                    UsersEntity tmpUser = new App.UserApplication().GetUser(tmpItem.UserID);
                    tmpItem.FirstName = tmpUser.FirstName;
                    tmpItem.LastName  = tmpUser.LastName;
                    tmpItem.Email     = tmpUser.Email;
                }
            }


            ///获取project users 选中的用户,并区分是新加的,还是原本就有的
            List <EventInviteEntity> inviteList = new List <EventInviteEntity>();
            string projectUserIds = QF("chkProjectUser");

            if (projectUserIds.Trim() != string.Empty)
            {
                List <int> listUserId = new App.ProjectApplication().GetActiveUserIdByProjectId(model.ProjectID);
                projectUserIds = projectUserIds.Trim();
                if (projectUserIds.EndsWith(","))
                {
                    projectUserIds = projectUserIds.Remove(projectUserIds.Length - 1);
                }
                int tmpId;
                foreach (string s in projectUserIds.Split(','))
                {
                    if (int.TryParse(s, out tmpId))
                    {
                        if (listUserId.Contains(tmpId))
                        {
                            EventInviteEntity newEntity = new EventInviteEntity()
                            {
                                CreatedID = UserInfo.UserID,
                                EventID   = model.ID,
                                FromDay   = model.FromDay,
                                UserID    = tmpId,
                                Email     = "",
                                FirstName = "",
                                LastName  = ""
                            };
                            if (oldlist.Find(r => r.UserID == tmpId) != null)
                            {
                                newEntity.OptionStatus = 1;
                            }
                            else
                            {
                                newEntity.OptionStatus = 2;
                            }
                            inviteList.Add(newEntity);
                        }
                    }
                }
            }

            ///标记被删除的project users
            foreach (EventInviteEntity item in oldlist.FindAll(r => r.UserID > 0))
            {
                if (inviteList.Find(r => r.UserID == item.UserID) == null)
                {
                    item.OptionStatus = 3;
                    inviteList.Add(item);
                }
            }

            ///获取other user,  如果有填写 Email 则区分是新加的,还是原有的
            int otherusers_count = QF("otherusers_count", 0);

            if (otherusers_count > 0)
            {
                string firstName;
                string lastName;
                string email;
                for (int i = 1; i <= otherusers_count; i++)
                {
                    firstName = QF("txtOtherUserFirst" + i).Trim();
                    lastName  = QF("txtOtherUserLast" + i).Trim();
                    email     = QF("txtOtherUserEmail" + i).Trim().ToLower();
                    if (firstName != string.Empty && lastName != string.Empty)
                    {
                        EventInviteEntity newEntity = new EventInviteEntity()
                        {
                            CreatedID = UserInfo.UserID,
                            LastName  = lastName,
                            FirstName = firstName,
                            Email     = email,
                            FromDay   = model.FromDay,
                            EventID   = model.ID,
                            UserID    = 0
                        };

                        if (email != string.Empty)
                        {
                            if (oldlist.Find(r => r.Email.ToLower() == email) != null)
                            {
                                newEntity.OptionStatus = 1;
                            }
                            else
                            {
                                newEntity.OptionStatus = 2;
                            }
                        }
                        else
                        {
                            newEntity.OptionStatus = 2;
                        }
                        inviteList.Add(newEntity);
                    }
                }

                ///标记被删除的 other  users(只针对有email的)
                foreach (EventInviteEntity item in oldlist.FindAll(r => r.UserID == 0))
                {
                    if (item.Email != string.Empty)
                    {
                        if (inviteList.Find(r => r.Email.ToLower() == item.Email) == null)
                        {
                            item.OptionStatus = 3;
                            inviteList.Add(item);
                        }
                    }
                }
            }
            return(inviteList);
        }
예제 #9
0
        private List <EventInviteEntity> GetInviteData(EventEntity eventEntity, bool isDelete = false)
        {
            List <EventInviteEntity> list = new App.EventsApplication().GetEventInvites(eventEntity.ID);

            foreach (EventInviteEntity tmpItem in list.FindAll(r => r.UserID > 0))
            {
                UsersEntity    tmpUser      = new App.UserApplication().GetUser(tmpItem.UserID);
                CompanysEntity comanyEntity = new App.CompanyApplication().GetCompany(tmpUser.CompanyID);
                tmpItem.FirstName   = tmpUser.FirstName;
                tmpItem.LastName    = tmpUser.LastName;
                tmpItem.Email       = tmpUser.Email;
                tmpItem.IsSeleted   = true;
                tmpItem.Title       = tmpUser.Title;
                tmpItem.CompanyName = comanyEntity.CompanyName;
            }
            if (isDelete)
            {
                return(list);
            }

            List <int>     listUserId    = new App.ProjectApplication().GetActiveUserIdByProjectId(eventEntity.ProjectID);
            ProjectsEntity projectEntity = new App.ProjectApplication().Get(eventEntity.ProjectID);

            litProject.Text = projectEntity.Title;

            listUserId.Remove(UserInfo.UserID);
            if (UserInfo.Office == "CN" && UserInfo.UserType == "SUNNET")//山诺 上海的员工只能获取本公司的项目的相关人员
            {
                if (projectEntity.CompanyID == Config.SunnetCompany)
                {
                    foreach (int tmpId in listUserId)
                    {
                        UsersEntity tmpUser = new App.UserApplication().GetUser(tmpId);
                        if (tmpUser == null)
                        {
                            continue;
                        }
                        if (tmpUser.UserType == "SUNNET")
                        {
                            if (list.Find(r => r.UserID == tmpUser.UserID) == null)
                            {
                                list.Add(new EventInviteEntity()
                                {
                                    EventID = eventEntity.ID, UserID = tmpUser.UserID, FirstName = tmpUser.FirstName, LastName = tmpUser.LastName
                                });
                            }
                        }
                    }
                }
            }
            else
            {
                if (UserInfo.Role == RolesEnum.CLIENT || UserInfo.Role == RolesEnum.ADMIN || UserInfo.Role == RolesEnum.PM || UserInfo.Role == RolesEnum.Sales || UserInfo.Role == RolesEnum.Contactor)
                {
                    foreach (int tmpId in listUserId)
                    {
                        UsersEntity tmpUser = new App.UserApplication().GetUser(tmpId);
                        if (tmpUser == null)
                        {
                            continue;
                        }
                        CompanysEntity comanyEntity = new App.CompanyApplication().GetCompany(tmpUser.CompanyID);
                        if (projectEntity.CompanyID == Config.SunnetCompany) //如果是公司项目
                        {
                            if (list.Find(r => r.UserID == tmpUser.UserID) == null)
                            {
                                list.Add(new EventInviteEntity()
                                {
                                    EventID = eventEntity.ID,
                                    UserID  = tmpUser.UserID
                                    ,
                                    FirstName   = tmpUser.FirstName,
                                    LastName    = tmpUser.LastName,
                                    Title       = tmpUser.Title,
                                    CompanyName = comanyEntity.CompanyName
                                });
                            }
                        }
                        else
                        {
                            if (tmpUser.Role == RolesEnum.CLIENT || tmpUser.Role == RolesEnum.ADMIN || tmpUser.Role == RolesEnum.PM || tmpUser.Role == RolesEnum.Sales || UserInfo.Role == RolesEnum.Contactor)
                            {
                                if (list.Find(r => r.UserID == tmpUser.UserID) == null)
                                {
                                    list.Add(new EventInviteEntity()
                                    {
                                        EventID = eventEntity.ID,
                                        UserID  = tmpUser.UserID
                                        ,
                                        FirstName   = tmpUser.FirstName,
                                        LastName    = tmpUser.LastName,
                                        Title       = tmpUser.Title,
                                        CompanyName = comanyEntity.CompanyName
                                    });
                                }
                            }
                        }
                    }
                }
            }
            return(list);
        }
예제 #10
0
        private List <EventInviteEntity> BuilderInvite(EventsView model)
        {
            List <EventInviteEntity> inviteList = new List <EventInviteEntity>();
            string projectIds = QF("chkProjectUser");

            if (projectIds.Trim() != string.Empty)
            {
                List <int> listUserId = new App.ProjectApplication().GetActiveUserIdByProjectId(model.ProjectID);
                projectIds = projectIds.Trim();
                if (projectIds.EndsWith(","))
                {
                    projectIds = projectIds.Remove(projectIds.Length - 1);
                }
                int tmpId;
                foreach (string s in projectIds.Split(','))
                {
                    if (int.TryParse(s, out tmpId))
                    {
                        if (listUserId.Contains(tmpId))
                        {
                            inviteList.Add(new EventInviteEntity()
                            {
                                CreatedID = UserInfo.UserID,
                                EventID   = 0,
                                FromDay   = DateTime.Now,
                                UserID    = tmpId,
                                Email     = "",
                                FirstName = "",
                                LastName  = ""
                            });
                        }
                    }
                }
            }
            int otherusers_count = QF("otherusers_count", 0);

            if (otherusers_count > 0)
            {
                string firstName;
                string lastName;
                string email;
                for (int i = 1; i <= otherusers_count; i++)
                {
                    firstName = QF("txtOtherUserFirst" + i).Trim();
                    lastName  = QF("txtOtherUserLast" + i).Trim();
                    email     = QF("txtOtherUserEmail" + i).Trim();
                    if (firstName != string.Empty && lastName != string.Empty)
                    {
                        inviteList.Add(new EventInviteEntity()
                        {
                            CreatedID = UserInfo.UserID,
                            LastName  = lastName,
                            FirstName = firstName,
                            Email     = email,
                            FromDay   = DateTime.Now,
                            EventID   = 0,
                            UserID    = 0
                        });
                    }
                }
            }
            return(inviteList);
        }
예제 #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            projApp = new ProjectApplication();
            if (!Page.IsPostBack)
            {
                List <ProjectDetailDTO> list = projApp.GetUserProjects(UserInfo);
                switch (UserInfo.Role)
                {
                case RolesEnum.Leader:
                case RolesEnum.DEV:
                case RolesEnum.QA:
                    list = list.FindAll(r => r.CompanyID == Config.SunnetCompany);
                    break;
                }
                list.BindDropdown <ProjectDetailDTO>(ddlProjects, "Title", "ProjectID", "ALL", "-1");

                ddlYears.SelectedValue  = DateTime.Now.Year.ToString();
                ddlMonths.SelectedValue = DateTime.Now.Month.ToString();

                List <UsersEntity> userList   = new List <UsersEntity>();
                List <int>         userIdList = new App.ProjectApplication().GetProjectUserIds(UserInfo.UserID);

                if (UserInfo.Role == RolesEnum.CLIENT)
                {
                    foreach (int tmpId in userIdList)
                    {
                        UsersEntity tmpUserEntity = new App.UserApplication().GetUser(tmpId);
                        if (tmpUserEntity != null && tmpUserEntity.Status.ToUpper() == "ACTIVE")
                        {
                            if (tmpUserEntity.Role == RolesEnum.CLIENT)
                            {
                                userList.Add(tmpUserEntity);
                            }
                            else if (tmpUserEntity.Office.ToUpper() == "US" && tmpUserEntity.UserType.ToUpper() == "SUNNET")
                            {
                                userList.Add(tmpUserEntity);
                            }
                        }
                    }
                }
                else
                {
                    if (UserInfo.UserType.ToUpper() == "SUNNET")
                    {
                        if (UserInfo.Office.ToUpper() == "US")
                        {
                            foreach (int tmpId in userIdList)
                            {
                                UsersEntity tmpUserEntity = new App.UserApplication().GetUser(tmpId);
                                if (tmpUserEntity != null && tmpUserEntity.Status.ToUpper() == "ACTIVE")
                                {
                                    userList.Add(tmpUserEntity);
                                }
                            }
                        }
                        else
                        {
                            foreach (int tmpId in userIdList)
                            {
                                UsersEntity tmpUserEntity = new App.UserApplication().GetUser(tmpId);
                                if (tmpUserEntity != null && tmpUserEntity.Status.ToUpper() == "ACTIVE")
                                {
                                    if (tmpUserEntity.Office.ToUpper() == "CN")
                                    {
                                        userList.Add(tmpUserEntity);
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        userList.Add(UserInfo);
                    }
                }

                if (userIdList.Count == 0)
                {
                    userList.Add(UserInfo);
                }
                userList           = userList.Distinct(new CompareUser()).ToList();
                hiUserIds.Value    = string.Join(",", userList.Select(r => r.UserID).ToArray());
                ddlUser.DataSource = userList.OrderBy(r => r.FirstName);
                ddlUser.DataBind();
                ddlUser.Items.Insert(0, new ListItem()
                {
                    Text = "ALL", Value = "0"
                });
            }

            SearchEvents();
            if (ddlProjects.Items.Count <= 0)
            {
                ddlProjects.Items.Add(new ListItem()
                {
                    Selected = true, Text = "None", Value = "0"
                });
            }
        }
예제 #12
0
        private void BindData(ProposalTrackerEntity entity)
        {
            ListItem li = ddlProject.Items.FindByValue(entity.ProjectID.ToString());

            if (li == null)
            {
                ProjectsEntity projectEntity = new App.ProjectApplication().Get(entity.ProjectID);
                if (projectEntity != null)
                {
                    ddlProject.Items.Insert(0, new ListItem()
                    {
                        Text = projectEntity.Title, Value = projectEntity.ID.ToString()
                    });
                }
            }
            else
            {
                li.Selected = true;
            }

            //ddlPayment.SelectedValue = entity.Payment.ToString();
            //txtRequestNo.Text = entity.RequestNo;
            //txtInvoiceNo.Text = entity.InvoiceNo;
            ddlStatus.SelectedValue = entity.Status.ToString();
            //txtDueDate.Text = entity.DueDate == null ? "" : ((DateTime)entity.DueDate).ToString("MM/dd/yyyy");
            txtTitle.Text       = entity.Title;
            txtDescription.Text = entity.Description;

            txtProposalSentTo.Text = entity.ProposalSentTo;
            txtProposalSentOn.Text = entity.ProposalSentOn == null ? "" : entity.ProposalSentOn.Value.ToShortDateString();
            txtPO.Text             = entity.PONo;
            chkLessThen.Checked    = entity.PoTotalLessThenProposalTotal.Value;
            txtApprovedBy.Text     = entity.ApprovedBy;
            txtApprovedOn.Text     = entity.ApprovedOn == null ? "" : entity.ApprovedOn.Value.ToShortDateString();
            //txtInvoiceSentOn.Text = entity.InvoiceSentOn == null ? "" : entity.InvoiceSentOn.Value.ToShortDateString();

            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("<ul class=\"fileList\"><li><a href=\"/do/DoDownWrokRequestFile.ashx?ID={0}\" title='{1}' target=\"_blank\">{1}</a>"
                            , entity.ProposalTrackerID, entity.WorkScopeDisplayName);
            sb.Append("</li></ul>");
            lblFile.InnerHtml = sb.ToString();


            rptNotes.DataSource = wrApp.GetProposalTrackerNotes(entity.ProposalTrackerID);;
            rptNotes.DataBind();

            rptDocuments.DataSource = fileApp.GetFileListBySourceId(entity.ProposalTrackerID, FileSourceType.WorkRequest);
            rptDocuments.DataBind();

            decimal hours = wrApp.GetProposalTrackerHours(QS("id", 0));

            string link = string.Format("<a href='/Report/Timesheet.aspx?WID={0}'>{1}</a>",
                                        entity.ProposalTrackerID, hours.ToString("N"));

            litHours.Text       = link;
            litProjectName.Text = ddlProject.SelectedItem.Text;

            this.rptTicketsList.DataSource = wrApp.GetAllRelation(entity.ProposalTrackerID);
            this.rptTicketsList.DataBind();
        }