protected string Delete(string ID)
        {
            //当前用户为创建用户且meeting状态没有approve
            SchedulesEntity entity = new App.SchedulesApplication().GetInfo(int.Parse(ID));

            if (entity.CreateBy == UserID && (entity.MeetingStatus == 1 || string.IsNullOrEmpty(entity.MeetingID)) && entity.PlanDate >= DateTime.Now.Date)
            {
                SchedulesApplication schedulesApplication = new SchedulesApplication();
                if (string.IsNullOrEmpty(entity.MeetingID))
                {
                    if (schedulesApplication.Delete(entity.ID))
                    {
                        return("1");
                    }
                    else
                    {
                        return("Operation failed.");
                    }
                }
                else
                {
                    if (schedulesApplication.DeleteMeetingSchedule(entity.MeetingID))
                    {
                        UsersEntity userInfo = new UserApplication().GetUser(UserID);
                        if (schedulesApplication.VoteMeeting(entity, DateTime.Now.Date, userInfo))
                        {
                            return("1");
                        }
                        else
                        {
                            return("Operation failed.");
                        }
                    }
                    else
                    {
                        return("Operation failed.");
                    }
                }
            }
            else
            {
                return("unauthorized access.");
            }

            //List<SchedulesEntity> list = new App.SchedulesApplication().GetSchedules(entity.PlanDate, targetUserId);
            //jscheduleResult = SerializeScheduleList(list);
        }
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            //当前用户为创建用户且meeting状态没有approve
            targetUserId = QS("target", 0);
            SchedulesEntity entity = new App.SchedulesApplication().GetInfo(int.Parse(hdID.Value));

            if (entity.CreateBy == UserInfo.UserID && (entity.MeetingStatus == 1 || string.IsNullOrEmpty(entity.MeetingID)) && entity.PlanDate >= DateTime.Now.Date)
            {
                SchedulesApplication schedulesApplication = new SchedulesApplication();
                if (string.IsNullOrEmpty(entity.MeetingID))
                {
                    if (schedulesApplication.Delete(entity.ID))
                    {
                        ShowSuccessMessageToClient(true, true);
                    }
                    else
                    {
                        ShowFailMessageToClient();
                    }
                }
                else
                {
                    if (schedulesApplication.DeleteMeetingSchedule(entity.MeetingID))
                    {
                        if (schedulesApplication.VoteMeeting(entity, DateTime.Now.Date, UserInfo))
                        {
                            ShowSuccessMessageToClient(true, true);
                        }
                        else
                        {
                            ShowFailMessageToClient();
                        }
                    }
                }
            }

            //List<SchedulesEntity> list = new App.SchedulesApplication().GetSchedules(entity.PlanDate, targetUserId);
            //jscheduleResult = SerializeScheduleList(list);
        }
Example #3
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            //当前用户为创建用户且meeting状态没有approve
            targetUserId = QS("target", 0);
            SchedulesEntity entity = new App.SchedulesApplication().GetInfo(int.Parse(hdID.Value));

            if (entity.CreateBy == UserInfo.UserID && (entity.MeetingStatus == 1 || string.IsNullOrEmpty(entity.MeetingID)) && entity.PlanDate >= DateTime.Now.Date)
            {
                SchedulesApplication schedulesApplication = new SchedulesApplication();
                if (string.IsNullOrEmpty(entity.MeetingID))
                {
                    if (schedulesApplication.Delete(entity.ID))
                    {
                        Redirect(Request.RawUrl, false, true);
                    }
                    else
                    {
                        ShowFailMessageToClient("Delete fail.");
                    }
                }
                else
                {
                    if (schedulesApplication.DeleteMeetingSchedule(entity.MeetingID))
                    {
                        if (schedulesApplication.VoteMeeting(entity, DateTime.Now.Date, UserInfo))
                        {
                            Redirect(Request.RawUrl, false, true);
                        }
                        else
                        {
                            ShowFailMessageToClient("Delete fail.");
                        }
                    }
                }
            }
        }