コード例 #1
0
ファイル: clsMyObj.cs プロジェクト: puentepr/creasys-acms
    //團隊活動報名或取消報名
    public AlterRegistResult AlterRegist_Team(ActivityRegistVO myActivityRegistVO, List<CustomFieldValueVO> myCustomFieldValueVOList, List<ActivityTeamMemberVO> myActivityTeamMemberVOList, AlterRegistType myAlterRegistType, Guid activity_id, string emp_id, string regist_deadline, string cancelregist_deadline ,string webPath,string path,  string  allTeam ,string  RegWebPath )
    {
        lock (this)
        {
            if (myAlterRegistType == AlterRegistType.RegistInsert || myAlterRegistType == AlterRegistType.RegistUpdate)
            {
                string strEmp_id = "";
                foreach (ACMS.VO.ActivityTeamMemberVO myActivityTeamMemberVO in myActivityTeamMemberVOList)
                {
                    strEmp_id += string.Format("{0},", myActivityTeamMemberVO.emp_id);
                }

                if (strEmp_id.EndsWith(","))
                {
                    strEmp_id = strEmp_id.Substring(0, strEmp_id.Length - 1);
                }

                ACMS.DAO.ActivityRegistDAO myActivityRegistDAO = new ACMS.DAO.ActivityRegistDAO();

                if (myAlterRegistType == AlterRegistType.RegistInsert)
                {
                    //先Insert報名資訊看是否成功
                    int intSaveResult = myActivityRegistDAO.UpdateActivityRegist(myActivityRegistVO, myCustomFieldValueVOList, myActivityTeamMemberVOList, "insert", "2",webPath,path);

                    if (intSaveResult == 1)
                    {
                        //andy-報名成功寄信
                        clsMyObj.RegistSuccess_Team(myActivityRegistVO.activity_id.ToString(), strEmp_id, myActivityRegistVO.regist_by,webPath,path);

                        return AlterRegistResult.RegistSucess;
                    }
                    else
                    {
                        //若失敗可能是重複報名或額滿

                        //是否重複報名

                        int RegistCount = myActivityRegistDAO.IsPersonRegisted(myActivityRegistVO.activity_id, strEmp_id, myActivityRegistVO.regist_by, "2");

                        if (RegistCount > 0)
                        {
                            //andy-報名失敗寄信
                           // clsMyObj.RegistFail_Team(myActivityRegistVO.activity_id.ToString(), strEmp_id, myActivityRegistVO.regist_by,webPath);

                            return AlterRegistResult.RegistFail_Already;
                        }

                        //是否已額滿
                        int RegistableCount = myActivityRegistDAO.RegistableCount(myActivityRegistVO.activity_id);

                        if (RegistableCount <= 0)
                        {
                            //andy-報名失敗寄信
                            //clsMyObj.RegistFail_Team(myActivityRegistVO.activity_id.ToString(), strEmp_id, myActivityRegistVO.regist_by,webPath);

                            return AlterRegistResult.RegistFail_Full;
                        }

                        //andy-報名失敗寄信
                        //clsMyObj.RegistFail_Team(myActivityRegistVO.activity_id.ToString(), strEmp_id, myActivityRegistVO.regist_by,webPath);

                        return AlterRegistResult.RegistFail;
                    }

                }
                else
                {
                    int intSaveResult = myActivityRegistDAO.UpdateActivityRegist(myActivityRegistVO, myCustomFieldValueVOList, myActivityTeamMemberVOList, "update","2",webPath,path);

                    if (intSaveResult == 1)
                    {
                        //團隊修改寄信
                        if (allTeam == "All")//全隊取消
                        {
                            clsMyObj.CancelRegist_TeamUnderLimit(myActivityRegistVO.activity_id.ToString(), strEmp_id, myActivityRegistVO.regist_by, RegWebPath);
                        }

                        else
                        {
                            clsMyObj.RegistSuccess_Team(myActivityRegistVO.activity_id.ToString(), strEmp_id, myActivityRegistVO.regist_by, webPath, path);
                        }

                        return AlterRegistResult.UpdateRegistSucess;
                    }
                    else
                    {
                        //因為團長會異動報名的人,所以要檢查是否選到重複的人
                        if (myActivityRegistVO.emp_id == myActivityRegistVO.regist_by)
                        {
                            //是否重複報名

                            int RegistCount = myActivityRegistDAO.IsPersonRegisted(myActivityRegistVO.activity_id, strEmp_id, myActivityRegistVO.regist_by, "2");

                            if (RegistCount > 0)
                            {
                                //andy-報名失敗寄信
                               // clsMyObj.RegistFail_Team(myActivityRegistVO.activity_id.ToString(), strEmp_id, myActivityRegistVO.regist_by, webPath);

                                return AlterRegistResult.RegistFail_Already;
                            }
                        }

                        return AlterRegistResult.UpdateRegistFail;
                    }
                }

            }
            else
            {
                //報名截止日之前-刪除
                //報名截止日之後-狀態改取消
                //取消報名截止日之後-不可以取消

                ACMS.DAO.ActivityRegistDAO myActivityRegistDAO = new ACMS.DAO.ActivityRegistDAO();
               // myActivityRegistDAO.InsertActivityRegistCancel(activity_id, emp_id, "2", clsAuth.ID);

                if (Convert.ToDateTime(regist_deadline) >= DateTime.Today)
                {
                    //取消報名截止日之前-刪除
                    if (myActivityRegistDAO.DeleteRegist(activity_id, emp_id,"2",webPath,allTeam ,RegWebPath  ) > 0)
                    {
                        //寄信
                        //clsMyObj.RegistSuccess_Team(activity_id.ToString (), emp_id, "", webPath);

                        return AlterRegistResult.CancelRegistSucess;
                    }
                    else
                    {
                        return AlterRegistResult.CancelRegistFail;
                    }
                }
                else if (Convert.ToDateTime(regist_deadline) < DateTime.Today)
                {
                    //取消報名截止日之後-狀態改取消
                    if (myActivityRegistDAO.CancelRegist(activity_id, emp_id,"2",webPath) > 0)
                    {
                        //寄信
                       // clsMyObj.RegistSuccess_Team(activity_id.ToString(), emp_id,"", webPath,path);

                        return AlterRegistResult.CancelRegistSucess;
                    }
                    else
                    {
                        return AlterRegistResult.CancelRegistFail;
                    }
                }
                else if (Convert.ToDateTime(cancelregist_deadline) < DateTime.Today)
                {
                    //取消報名截止日之後-不可以取消
                    return AlterRegistResult.CancelRegistFail_DayOver;
                }

                return AlterRegistResult.CancelRegistFail;

            }

        }
    }
コード例 #2
0
ファイル: clsMyObj.cs プロジェクト: puentepr/creasys-acms
    //個人活動報名或取消報名
    public AlterRegistResult AlterRegist(ActivityRegistVO myActivityRegistVO, List<CustomFieldValueVO> myCustomFieldValueVOList, AlterRegistType myAlterRegistType, Guid activity_id, string emp_id,string regist_deadline, string cancelregist_deadline, string webPath ,string path,string allTeam,string RegWebPath)
    {
        lock (this)
        {
            if (myAlterRegistType == AlterRegistType.RegistInsert || myAlterRegistType == AlterRegistType.RegistUpdate)
            {
                ACMS.DAO.ActivityRegistDAO myActivityRegistDAO = new ACMS.DAO.ActivityRegistDAO();

                if (myAlterRegistType == AlterRegistType.RegistInsert)
                {
                    //先Insert報名資訊看是否成功
                    int intSaveResult = myActivityRegistDAO.UpdateActivityRegist(myActivityRegistVO, myCustomFieldValueVOList, null, "insert", "1",webPath ,path);
                    if (intSaveResult == 1)
                    {
                        //andy-報名成功寄信
                        clsMyObj.RegistSuccess(myActivityRegistVO.activity_id.ToString(), myActivityRegistVO.emp_id, myActivityRegistVO.regist_by,webPath ,path  );

                        return AlterRegistResult.RegistSucess;
                    }
                    else
                    {
                        //若失敗可能是重複報名或額滿

                        //是否重複報名
                        int RegistCount = myActivityRegistDAO.IsPersonRegisted(myActivityRegistVO.activity_id, myActivityRegistVO.emp_id,"", "1");

                        if (RegistCount > 0)
                        {
                            //andy-報名失敗寄信
                           // clsMyObj.RegistFail(myActivityRegistVO.activity_id.ToString(), myActivityRegistVO.emp_id, myActivityRegistVO.regist_by,webPath );

                            return AlterRegistResult.RegistFail_Already;
                        }

                        //是否已額滿
                        int RegistableCount = myActivityRegistDAO.RegistableCount(myActivityRegistVO.activity_id);

                        if (RegistableCount <= 0)
                        {
                            //andy-報名失敗寄信
                            //clsMyObj.RegistFail(myActivityRegistVO.activity_id.ToString(), myActivityRegistVO.emp_id, myActivityRegistVO.regist_by,webPath );
                            return AlterRegistResult.RegistFail_Full;
                        }

                        //andy-報名失敗寄信
                       // clsMyObj.RegistFail(myActivityRegistVO.activity_id.ToString(), myActivityRegistVO.emp_id, myActivityRegistVO.regist_by,webPath );

                        return AlterRegistResult.RegistFail;
                    }

                }
                else
                {
                    int intSaveResult = myActivityRegistDAO.UpdateActivityRegist(myActivityRegistVO, myCustomFieldValueVOList, null, "update", "1",webPath,path);
                    if (intSaveResult == 1)
                    {
                        //andy-個人修改成功寄信
                        clsMyObj.RegistSuccessUpdate(myActivityRegistVO.activity_id.ToString(), myActivityRegistVO.emp_id, myActivityRegistVO.regist_by, webPath, path);

                        return AlterRegistResult.UpdateRegistSucess;

                    }
                    else
                    {
                        return AlterRegistResult.UpdateRegistFail;
                    }
                }

            }
            else
            {
                //報名截止日之前-刪除
                //報名截止日之後-狀態改取消
                //取消報名截止日之後-不可以取消

                ACMS.DAO.ActivityRegistDAO myActivityRegistDAO = new ACMS.DAO.ActivityRegistDAO();

                // andy add  2011/3/28 取消前需將資料加到 ActivityRegistCancel中
                myActivityRegistDAO.InsertActivityRegistCancel(activity_id, emp_id, "1", clsAuth.ID);

                if (Convert.ToDateTime(regist_deadline) >=DateTime.Today)
                {
                    //報名截止日之前-刪除
                    if (myActivityRegistDAO.DeleteRegist(activity_id, emp_id, "1",webPath, allTeam,RegWebPath  ) > 0)
                    {
                        //andy-取消報名寄信
                        clsMyObj.CancelRegist( activity_id.ToString(),  emp_id, clsAuth.ID,RegWebPath );

                        return AlterRegistResult.CancelRegistSucess;
                    }
                    else
                    {
                        return AlterRegistResult.CancelRegistFail;
                    }
                }
                else if (Convert.ToDateTime(regist_deadline) < DateTime.Today)
                {
                    //報名截止日之後-狀態改取消
                    if (myActivityRegistDAO.CancelRegist(activity_id, emp_id, "1",webPath) > 0)
                    {
                        //andy-取消報名寄信
                        clsMyObj.CancelRegist(activity_id.ToString(), emp_id, clsAuth.ID,webPath);

                        return AlterRegistResult.CancelRegistSucess;
                    }
                    else
                    {
                        return AlterRegistResult.CancelRegistFail;
                    }
                }
                else if (Convert.ToDateTime(cancelregist_deadline) < DateTime.Today)
                {
                    //取消報名截止日之後-不可以取消
                    return AlterRegistResult.CancelRegistFail_DayOver;
                }

                return AlterRegistResult.CancelRegistFail;

            }

        }
    }