Example #1
0
        public ResponseStatus DeleteWork(HttpRequestBase req)
        {
            ResponseStatus resp = ResponseStatus.NONE;
            bool isclose = false;
            workDal = new WorkDAL();
            for (int i = 1; i < req.Form.Count; ++i)
            {
                int id;
                if (int.TryParse(req.Form.AllKeys[i], out id))
                {
                    if (i == req.Form.Count - 1) isclose = true;

                    if (workDal.Delete(id, isclose))
                    {
                        resp = ResponseStatus.SUCCESS;
                    }
                    else
                    {
                        resp = ResponseStatus.FAILED;
                        break;
                    }
                }
                else
                {
                    resp = ResponseStatus.FAILED;
                    break;
                }
            }
            if (workDal != null) workDal.ReturnUnitToPool();
            return resp;
        }
Example #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;
 }
Example #3
0
        public ResponseStatus AddWork(HttpRequestBase req)
        {
            ResponseStatus resp = ResponseStatus.NONE;
            string userId = req.Form["userId"].ToString();
            UserDAL userDal = new UserDAL();
            int id = userDal.GetUserAutoId(userId);
            userDal.ReturnUnitToPool();

            if (id != 0)
            {
                workDal = new WorkDAL();
                Work work = new Work()
                {
                    ID = Convert.ToInt32(req.Form["id"]),
                    UserAutoID = id,
                    Content = req.Form["content"].ToString(),
                    StartDate = Convert.ToDateTime(req.Form["startdate"]),
                    CutOffDate = Convert.ToDateTime(req.Form["cutoffdate"]),
                    Status = (WorkStatus)Convert.ToByte(req.Form["status"]),
                    //ImproveContent = req.Form["improveContent"].ToString(),
                    //ImproveCutOffDate = string.IsNullOrEmpty(req.Form["improveCutOffDate"]) ? GLB.initTime :
                    //    Convert.ToDateTime(req.Form["improveCutOffDate"]),
                    activityId = Convert.ToInt32(req.Form["activityId"])
                };
                if (workDal.Add(work))
                {
                    resp = ResponseStatus.SUCCESS;
                }
                else
                {
                    resp = ResponseStatus.FAILED;
                }
                workDal.ReturnUnitToPool();
            }
            else
            {
                resp = ResponseStatus.FAILED;
            }

            return resp;
        }
Example #4
0
        public ResponseStatus GetWork(HttpRequestBase req, Container_UWork conta_UWork, int id)
        {
            conta_UWork.work = new Work();
            ResponseStatus resp = ResponseStatus.NONE;
            workDal = new WorkDAL();
            resp = workDal.GetDetail(id, conta_UWork.work);
            workDal.ReturnUnitToPool();

            resp = this.WorkPrepare(req, conta_UWork);

            return resp;
        }
Example #5
0
 public ResponseStatus UpdateWork(HttpRequestBase req)
 {
     ResponseStatus resp = ResponseStatus.NONE;
     Work work = null;
     if (this.CreateInstance(req,ref work))
     {
         workDal = new WorkDAL();
         workDal.Update(work);
         resp = ResponseStatus.SUCCESS;
     }
     else
     {
         resp = ResponseStatus.FAILED;
     }
     if (workDal != null) workDal.ReturnUnitToPool();
     return resp;
 }
Example #6
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;
        }