Exemplo n.º 1
0
        public ResponseStatus DeleteActivity(HttpRequestBase req)
        {
            ResponseStatus resp = ResponseStatus.NONE;
            int            id;
            bool           isclose = false;

            activityDal = new ActivityDAL();
            for (int i = 0; i < req.Form.Count; ++i)
            {
                id = Convert.ToInt32(req.Form.AllKeys[i]);
                if (i == req.Form.Count - 1)
                {
                    isclose = true;
                }

                if (activityDal.Delete(id, isclose))
                {
                    resp = ResponseStatus.SUCCESS;
                }
                else
                {
                    resp = ResponseStatus.FAILED;
                    break;
                }
            }
            activityDal.ReturnUnitToPool();
            return(resp);
        }
Exemplo n.º 2
0
        public void GetDataForPersonalHome(HttpRequestBase req, Container_Notices_MyWorks_TeamWorks_Activities
                                           conTa_Notices_MyWorks_TeamWorks_Activities)
        {
            NoticeDAL noticeDal = new NoticeDAL();
            bool      isResume  = true;

            noticeDal.GetNotices(isResume, null, NoticeType.NONE);
            noticeDal.ReturnUnitToPool();
            conTa_Notices_MyWorks_TeamWorks_Activities.list_Notice = noticeDal.ListNotice;
            Container_List_Activity conta_Activity = new Container_List_Activity();
            ActivityDAL             activityDal    = new ActivityDAL();

            activityDal.GetActivities(conta_Activity, false, true);
            activityDal.ReturnUnitToPool();
            conTa_Notices_MyWorks_TeamWorks_Activities.list_Activity = conta_Activity.activities;
            List <Work> works   = new List <Work>();
            List <Work> m_works = new List <Work>();
            WorkDAL     workDal = new WorkDAL();

            for (int i = 0; i < req.Cookies.Count; ++i)
            {
                if (req.Cookies[i].Name.Contains(GLB.activity))
                {
                    workDal.GetWorks(Convert.ToInt32(req.Cookies[GLB.depId].Value), Convert.ToInt32(req.Cookies[i].Value), works, null);
                    workDal.GetWorks(Convert.ToInt32(req.Cookies[GLB.depId].Value), Convert.ToInt32(req.Cookies[i].Value),
                                     m_works, Convert.ToInt32(req.Cookies[GLB.id].Value));
                }
            }
            workDal.ReturnUnitToPool();
            conTa_Notices_MyWorks_TeamWorks_Activities.list_TeamWork = works;
            conTa_Notices_MyWorks_TeamWorks_Activities.list_MyWork   = m_works;
        }
Exemplo n.º 3
0
        public ResponseStatus GetActivity(int id, Activity atvy)
        {
            activityDal = new ActivityDAL();
            ResponseStatus resp = activityDal.GetActivity(id, atvy);

            activityDal.ReturnUnitToPool();
            return(resp);
        }
Exemplo n.º 4
0
        public ResponseStatus GetActivities(Container_List_Activity conta_Activity, bool isHasNoActive)
        {
            activityDal = new ActivityDAL();
            ResponseStatus resp = activityDal.GetActivities(conta_Activity, isHasNoActive, false);

            activityDal.ReturnUnitToPool();
            return(resp);
        }
Exemplo n.º 5
0
        public ResponseStatus AddActivity(HttpRequestBase req)
        {
            //Add exception
            Activity       atvy = null;
            ResponseStatus resp = ResponseStatus.NONE;

/*
 *          Verify v = new Verify();
 *          object[,] b = new object[,] { { 1, 1 }, { 2, 2 } };
 *          object[,] a = new object[,] { { 1, new object[,] { { 1, 1 }, { 2, 2 } } } };
 *          object[,] c = new object[,]{
 *              { VerifyType.REQUIRED, "内容必须填写" },
 *              { VerifyType.RANGE_LENGTH,"内容的长度必须在0~0个字符之间"}
 *          };
 *          v.value_option_errMsg = new object[,] {
 *              { req.Form["content"].ToString(), new object[,]{
 *                                                      { VerifyType.REQUIRED, "标题必须填写" },
 *                                                      { VerifyType.RANGE_LENGTH,"标题的长度必须在0~0个字符之间"}
 *                                                }
 *              },
 *              { Convert.ToDateTime(req.Form["prestart"]),new object[,]{
 *                                                              { VerifyType.REQUIRED,"开始时间必须填写"},
 *                                                              { VerifyType.TIME,"无效时间"}
 *                                                         }
 *              },
 *              { Convert.ToDateTime(req.Form["overend"]),new object[,]{
 *                                                              { VerifyType.REQUIRED,"结束时间必须填写"},
 *                                                              { VerifyType.TIME,"无效时间"}
 *                                                        }
 *              },
 *              { req.Form["contentdetails"].ToString(),new object[,]{
 *                                                          { VerifyType.REQUIRED,"内容必须填写" },
 *                                                          { VerifyType.RANGE_LENGTH,"内容的长度必须在0~0个字符之间"}
 *                                                      }
 *              },
 *              {Convert.ToDateTime(req.Form["publish"]),new object[,]{
 *                                                          { VerifyType.REQUIRED,"发布时间必须填写" },
 *                                                          { VerifyType.TIME,"无效时间" }
 *                                                       }
 *              }
 *          };
 */

            if (this.CreateInstance(req, ref atvy))
            {
                activityDal = new ActivityDAL();
                resp        = activityDal.Add(atvy) ? ResponseStatus.SUCCESS : ResponseStatus.FAILED;
                activityDal.ReturnUnitToPool();
            }
            else
            {
                resp = ResponseStatus.FAILED;
            }
            return(resp);
        }
Exemplo n.º 6
0
        public ResponseStatus GetActivityIds(ref List <int> activitiesId)
        {
            ResponseStatus resp = ResponseStatus.NONE;

            activityDal = new ActivityDAL();
            //List<int> activitiesId = null;
            if (activityDal.GetActivitiesId(ref activitiesId))
            {
                resp = ResponseStatus.SUCCESS;
            }
            else
            {
                resp = ResponseStatus.FAILED;
            }
            activityDal.ReturnUnitToPool();
            return(resp);
        }
Exemplo n.º 7
0
        public ResponseStatus GetWorks(HttpRequestBase req, ActivityWorks activityWorks, int id)
        {
            ResponseStatus resp = ResponseStatus.NONE;

            activityDal           = new ActivityDAL();
            activityWorks.id      = id;
            activityWorks.Content = activityDal.GetActivityContent(id);
            activityDal.ReturnUnitToPool();

            #region

            /*for (int i = 0; i < req.Cookies.Count; ++i)
             * {
             *   if (req.Cookies[i].Name.StartsWith(GLB.activity))
             *   {
             *       int activityId = Convert.ToInt32(req.Cookies[i].Value);
             *       int depId = Convert.ToInt32(req.Cookies[GLB.depId].Value);
             *       ActivityWorks aws = new ActivityWorks()
             *       {
             *           Content = activityDal.GetActivityContent(activityId)
             *       };
             *       List<Work> list_work = new List<Work>();
             *       resp = workDal.GetWorks(depId, activityId, list_work);
             *       if(resp == ResponseStatus.SUCCESS)
             *       {
             *           for (int n = 0; n < list_work.Count; ++n)
             *           {
             *               switch (list_work[n].Status)
             *               {
             *                   case WorkStatus.PROCESS:
             *                       aws.processWorks.Add(list_work[n]);
             *                       break;
             *                   case WorkStatus.WAITPASS:
             *                       aws.waitPassWorks.Add(list_work[n]);
             *                       break;
             *                   case WorkStatus.IMPROVE:
             *                       aws.improveWorks.Add(list_work[n]);
             *                       break;
             *                   case WorkStatus.FINISH:
             *                       aws.finishWorks.Add(list_work[n]);
             *                       break;
             *                   default:
             *                       break;
             *               }
             *           }
             *           activityworks.Add(aws);
             *       }
             *       else
             *       {
             *           break;
             *       }
             *    }
             * }*/
            #endregion

            workDal = new WorkDAL();
            int         depId     = Convert.ToInt32(req.Cookies[GLB.depId].Value);
            List <Work> list_work = new List <Work>();
            resp = workDal.GetWorks(depId, id, list_work, null);
            workDal.ReturnUnitToPool();

            //activityWorks.list_Works = resp == ResponseStatus.SUCCESS ? list_work : null;
            activityWorks.list_Works = list_work;

            return(resp);
        }