protected void Page_Load(object sender, EventArgs e)
        {
            _trainDetaiRepo = RepositoryFactory.CreateTrainDetailRepo();
            if (!Authentication.HasResource(User.Identity.Name, "ProcessWorkflowList"))
            {
                Response.Redirect(@"/account/logon.aspx?ReturnUrl=%2f");
            }

            if (!IsPostBack)
            {
                _processwfRepo = RepositoryFactory.CreateProcessWorkflowRepo();
                _rootRepo      = RepositoryFactory.CreateRootRepo();

                //從QueryString取得 簽核文件代碼
                if (String.IsNullOrWhiteSpace(Request["SignDocID"]))
                {
                    Response.Write("需要簽核文件代碼!".ToAlertFormat());
                    return;
                }

                ProcessWorkflowViewModel model = _processwfRepo.GetWorkflowDataAndCheck(Request["SignDocID"], User.Identity.Name);
                if (model == null)
                {
                    Response.Write("查無簽核流程資料!".ToAlertFormat());
                    return;
                }

                //將 viewModel 的值綁定到 頁面上
                WebUtils.PageDataBind(model, this.Page);
                SignDocID_FK.Value = model.SignDocID;

                FormContent1.Attributes.Add("Src", ConstructAspxPage(model.SignDocID, model.FormID_FK));
            }
            PageInit();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            _trainDetaiRepo = RepositoryFactory.CreateTrainDetailRepo();
            _rootRepo       = RepositoryFactory.CreateRootRepo();
            if (!Authentication.HasResource(User.Identity.Name, "TrainDetail01"))
            {
                Response.Redirect(@"/account/logon.aspx?ReturnUrl=%2f");
            }
            if (!IsPostBack)
            {
                PageTitle.Value = "學員意見調查維護 > 編輯";

                string CLID            = String.IsNullOrEmpty(Request["CLID"]) ? String.Empty : Request["CLID"].ToString();
                string SID             = String.IsNullOrEmpty(Request["SID"]) ? String.Empty : Request["SID"].ToString();
                var    employeeData    = _rootRepo.QueryForEmployeeByEmpID(SID);
                string DepartmentID_FK = employeeData != null ? employeeData["DepartmentID_FK"].ToString() : String.Empty;
                model = _trainDetaiRepo.GetDetail(CLID, SID, DepartmentID_FK);
                // 取得 QueryString
                //var paggerParms = WebUtils.ParseQueryString<PaggerParms>(Page.Request);
                //var signListParms = WebUtils.ParseQueryString<SignListParms>(Page.Request);
                //signListParms.Member = Authentication.GetMemberViewModel(User.Identity.Name);
                //signListParms.GridView = TrainDetailGridView;
                //signListParms.PaginationBar = paginationBar;
                //paggerParms.OrderField = "qno";


                ////建構頁面
                //ConstructPage(signListParms, paggerParms, RepositoryFactory.CreateTrainDetailRepo());
                WebUtils.PageDataBind(model, this.Page);
                SaveBtn.Attributes.Add("onclick ", "return confirm( '提醒:送出後就不可更改,確定要送出嗎?');");
            }
            PageInit();
        }
예제 #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         _trainDetaiRepo = RepositoryFactory.CreateTrainDetailRepo();
         //從QueryString取得 簽核代碼
         string docID = String.IsNullOrEmpty(Request["SignDocID"]) ? String.Empty : Request["SignDocID"].ToString();
         //根據查詢的 簽核代碼 搜尋忘刷單
         model = _trainDetaiRepo.GetData(docID);
         WebUtils.PageDataBind(model, this.Page);
         Signed.NavigateUrl = "~/Area/Sign/WorkflowDetail.aspx?signDocID=" + docID;
     }
     PageInit();
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            _trainDetaiRepo = RepositoryFactory.CreateTrainDetailRepo();
            _rootRepo       = RepositoryFactory.CreateRootRepo();
            if (!Authentication.HasResource(User.Identity.Name, "TrainDetail02"))
            {
                Response.Redirect(@"/account/logon.aspx?ReturnUrl=%2f");
            }
            if (!IsPostBack)
            {
                string signDocID = String.IsNullOrEmpty(Request["SignDocID_FK"]) ? String.Empty : Request["SignDocID_FK"].ToString();
                PageTitle.Value  = "受訓心得報告維護 > 編輯";
                FormSeries.Value = "Train";

                string CLID            = String.IsNullOrEmpty(Request["CLID"]) ? String.Empty : Request["CLID"].ToString();
                string SID             = String.IsNullOrEmpty(Request["SID"]) ? String.Empty : Request["SID"].ToString();
                var    employeeData    = _rootRepo.QueryForEmployeeByEmpID(SID);
                string DepartmentID_FK = employeeData != null ? employeeData["DepartmentID_FK"].ToString() : String.Empty;
                model = _trainDetaiRepo.GetDetail(CLID, SID, DepartmentID_FK);

                // 取得 QueryString
                //var paggerParms = WebUtils.ParseQueryString<PaggerParms>(Page.Request);
                //var signListParms = WebUtils.ParseQueryString<SignListParms>(Page.Request);
                //signListParms.Member = Authentication.GetMemberViewModel(User.Identity.Name);
                //signListParms.GridView = TrainDetailGridView;
                //signListParms.PaginationBar = paginationBar;
                //paggerParms.OrderField = "qno";

                ////建構頁面
                //ConstructPage(signListParms, paggerParms, RepositoryFactory.CreateTrainDetailRepo());
                WebUtils.PageDataBind(model, this.Page);
                if (!String.IsNullOrWhiteSpace(signDocID))
                {
                    //將 viewModel 的值綁定到 頁面上
                    WebUtils.PageDataBind(_trainDetaiRepo.GetData(signDocID), this.Page);

                    SignDocID_FK.Text = signDocID;
                    PageTitle.Value   = "表單編輯作業 > 忘刷單";
                }
            }
            PageInit();
        }
        /// <summary>
        /// 表單送出觸發事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void SaveBtn_Click(object sender, EventArgs e)
        {
            //送簽文件ID
            string signID = Request["SignDocID_FK"];

            //取得資料庫連線字串並建立DB模型
            _trainDetaiRepo = RepositoryFactory.CreateTrainDetailRepo();
            //欲作業的表格對象代碼
            string trainTableID = ((int)TrainingTableTypeEnum.TABLE02).ToString().PadLeft(2, '0');

            //取得頁面資料
            model = PageDataBind();

            #region #0015 取得登入者ID 擴充可幫他人填寫受訓心得表

            var empDc    = ConnectionFactory.GetPortalDC();
            var empRepos = new EmployeeRepository(empDc, new RootRepository(empDc));
            EmployeeViewModel empResult = empRepos.GetEmployeeDataByADAccount(User.Identity.Name);
            (model as RinnaiForms).ApplyID_FK = empResult.EmployeeID;

            #endregion #0015 取得登入者ID 擴充可幫他人填寫受訓心得表

            List <DataRow> QuestionDataList = _trainDetaiRepo.QueryQuestionDataByTableID(trainTableID);

            String chkString = "";
            String ansString = "";
            txterror.Text = "";

            #region 遍歷所有題目 判斷是否有填答案

            QuestionDataList.All(row =>
            {
                //如果題目填答型態為文字
                if (row["ANSTYPE"].ToString() == "C")
                {
                    TextBox tmpbox = PlaceHolder1.FindControl("textbox" + row["serial_no"].ToString()) as TextBox;
                    ansString      = tmpbox.Text;
                    if (ansString == "")
                    {
                        chkString += "第" + row["serial_no"].ToString() + "題 不可空白!";
                    }
                }
                //如果題目填答型態為數字
                else if (row["ANSTYPE"].ToString() == "N")
                {
                    RadioButtonList tmprbl = (RadioButtonList)PlaceHolder1.FindControl("rbl" + row["serial_no"].ToString());
                    ansString = tmprbl.SelectedValue;
                    if (ansString == "")
                    {
                        chkString += "第" + row["serial_no"].ToString() + "題 不可空白!";
                    }
                }
                return(true);
            });

            #endregion 遍歷所有題目 判斷是否有填答案

            //有沒填的就直接回要面並顯示警示訊息
            if (chkString != "")
            {
                txterror.Text = chkString;
                return;
            }

            //回傳至頁面的訊息
            var responseMessage = "";
            try
            {
                var modelList = new List <RinnaiForms>();
                modelList.Add(model);

                //新增畫面(即未傳入簽核ID)
                if (String.IsNullOrEmpty(signID))
                {
                    #region 建立簽核(送出簽核)

                    _trainDetaiRepo.CreateSignData(modelList);

                    #endregion 建立簽核(送出簽核)

                    string classID   = Request["CLID"];
                    string studentID = Request["SID"];

                    #region 先刪後增

                    #region 刪除答案

                    //刪除課程與簽核的關聯檔
                    _trainDetaiRepo.FromTableNameDeleteValue("FORM_SIGN", classID, studentID, trainTableID);
                    //===刪除全部原有答案===
                    //文字型態
                    _trainDetaiRepo.FromTableNameDeleteValue("CHARACTER_ANSWER", classID, studentID, trainTableID);
                    //數字型態
                    _trainDetaiRepo.FromTableNameDeleteValue("NUMERIC_ANSWER", classID, studentID, trainTableID);

                    #endregion 刪除答案

                    #region 新增答案

                    QuestionDataList.All(row =>
                    {
                        //文字類型
                        if (row["ANSTYPE"].ToString() == "C")
                        {
                            //新增
                            TextBox tmpbox = PlaceHolder1.FindControl("textbox" + row["serial_no"].ToString()) as TextBox;
                            _trainDetaiRepo.AddAnswer_C(Request["CLID"].ToString(), Request["SID"].ToString(), row["TABLE_ID"].ToString(), row["QNO"].ToString(), row["serial_no"].ToString(), tmpbox.Text, User.Identity.Name);
                        }
                        //數字類型
                        else if (row["ANSTYPE"].ToString() == "N")
                        {
                            //新增
                            RadioButtonList tmprbl = (RadioButtonList)PlaceHolder1.FindControl("rbl" + row["serial_no"].ToString());
                            _trainDetaiRepo.AddAnswer_N(Request["CLID"].ToString(), Request["SID"].ToString(), row["TABLE_ID"].ToString(), row["QNO"].ToString(), row["serial_no"].ToString(), tmprbl.SelectedValue, User.Identity.Name);
                        }
                        return(true);
                    });

                    #endregion 新增答案

                    #endregion 先刪後增

                    string EID = _trainDetaiRepo.Find_EDITIONID(trainTableID);
                    bool   hasEmptySignFormRecords = _trainDetaiRepo.CheckHasSignFormRecords(Request["CLID"].ToString(), trainTableID, EID);

                    //寫入空白單記錄
                    if (!hasEmptySignFormRecords)
                    {
                        _trainDetaiRepo.AddRECORDS(Request["CLID"].ToString(), trainTableID, EID);
                    }

                    #region 建立關聯簽核主檔

                    _trainDetaiRepo.AddFormSign(Request["CLID"].ToString(), Request["SID"].ToString(), trainTableID, false, modelList);

                    #endregion 建立關聯簽核主檔
                }

                //編輯畫面
                else
                {
                    //送出簽核
                    _trainDetaiRepo.EditData(modelList);

                    //刪除原有答案
                    string strCLID = _trainDetaiRepo.Find_CLID(Request["SignDocID_FK"]);
                    string strSID  = _trainDetaiRepo.Find_SID(Request["SignDocID_FK"]);

                    _trainDetaiRepo.FromTableNameDeleteValue("CHARACTER_ANSWER", strCLID, strSID, trainTableID);
                    _trainDetaiRepo.FromTableNameDeleteValue("NUMERIC_ANSWER", strCLID, strSID, trainTableID);

                    QuestionDataList.All(row =>
                    {
                        if (row["ANSTYPE"].ToString() == "C")//填文字
                        {
                            //新增
                            TextBox tmpbox = PlaceHolder1.FindControl("textbox" + row["serial_no"].ToString()) as TextBox;
                            _trainDetaiRepo.AddAnswer_C(strCLID, strSID, row["TABLE_ID"].ToString(), row["QNO"].ToString(), row["serial_no"].ToString(), tmpbox.Text, User.Identity.Name);
                        }
                        else if (row["ANSTYPE"].ToString() == "N")
                        {
                            //新增
                            RadioButtonList tmprbl = (RadioButtonList)PlaceHolder1.FindControl("rbl" + row["serial_no"].ToString());
                            _trainDetaiRepo.AddAnswer_N(strCLID, strSID, row["TABLE_ID"].ToString(), row["QNO"].ToString(), row["serial_no"].ToString(), tmprbl.SelectedValue, User.Identity.Name);
                        }
                        return(true);
                    });

                    String EID = _trainDetaiRepo.Find_EDITIONID(trainTableID);
                    bool   hasEmptySignFormRecords = _trainDetaiRepo.CheckHasSignFormRecords(strCLID, trainTableID, EID);
                    //寫入空白單記錄
                    if (!hasEmptySignFormRecords)
                    {
                        _trainDetaiRepo.AddRECORDS(strCLID, trainTableID, EID);
                    }
                }
                responseMessage = "送出成功!";

                #region 寄送email通知

                MailInfo mailInfo = new MailInfo()
                {
                    AddresseeTemp = System.Web.Configuration.WebConfigurationManager.AppSettings["MailTemplate"],
                    Subject       = String.Format("系統提醒!簽核單號 : {0} 已經送達!", model.SignDocID_FK),
                    DomainPattern = ConfigUtils.ParsePageSetting("Pattern")["DomainPattern"],
                };

                // 主管簽核 會簽 mail
                var deptData = _rootRepo.QueryForDepartmentByDeptID(model.DepartmentID_FK.ToString());
                var empData  = _rootRepo.QueryForEmployeeByEmpID(deptData["ChiefID_FK"].ToString());
                var chiefAD  = empData["ADAccount"].ToString();
                mailInfo.To += String.Format(mailInfo.AddresseeTemp, chiefAD) + ",";

                var portalDomain = ConfigUtils.ParsePageSetting("Domain")["Portal"];

                string body =
                    MailTools.BodyToTable(
                        String.Format(
                            @"系統提醒!簽核單號 : {0} 已經送達,請儘速檢視!<br /><a href='{1}/Area/Sign/ProcessWorkflowList.aspx?queryText={0}'>連結</a> <br />此件為系統發送,請勿回覆!",
                            model.SignDocID_FK, portalDomain));

                mailInfo.Body.Append(body);

                mailInfo.CC = new List <string>()
                {
                    String.Format(mailInfo.AddresseeTemp, User.Identity.Name)
                };
                mailInfo.To = mailInfo.To.TrimEnd(new char[] { ',' });
                if (PublicRepository.CurrentWorkflowMode == Enums.WorkflowTypeEnum.RELEASE)
                {
                    new Mailer(mailInfo).SendMail();
                }

                #endregion 寄送email通知

                _log.Trace(String.Format("MailTo : {0}\r\ncc : {1}\r\nTitle : {2}\r\nContent : {3}\r\n", mailInfo.To, String.Join(",", mailInfo.CC), mailInfo.Subject, mailInfo.Body));
                //btn處理
                ViewUtils.ButtonOn(SaveBtn, CoverBtn);
                responseMessage = responseMessage.ToAlertAndRedirect(@"/Area/Sign/WorkflowQueryList.aspx?orderField=CreateDate&descending=True");
            }
            catch (Exception ex)
            {
                responseMessage = String.Concat("送出失敗!\r\n錯誤訊息: ", ex.Message).ToAlertFormat();
                ViewUtils.ShowRefreshBtn(CoverBtn, RefreshBtn);
            }
            finally
            {
                Response.Write(responseMessage);
            }
        }
        protected void SaveBtn_Click(object sender, EventArgs e)
        {
            _processwfRepo = RepositoryFactory.CreateProcessWorkflowRepo();
            _rootRepo      = RepositoryFactory.CreateRootRepo();

            //取得頁面資料

            //簽核擔當
            ProcessWorkflowDetailViewModel model   = PageDataBind();
            ProcessWorkflowViewModel       model_M = _processwfRepo.GetWorkflowDataAndCheck(Request["SignDocID"], User.Identity.Name);

            //btn處理
            ViewUtils.ButtonOff(SaveBtn, CoverBtn);

            var sectionChief = new SectionChief(null);

            #region #0012 忘刷單的時間如果不符合邏輯,在確認簽核的時候主管要看到明顯提示 (目前針對桃園所做設定)

            //判斷是否為忘刷單
            if (model_M.FormID_FK == 1)
            {
                //判斷登入者是否為桃園所的員工
                EmployeeRepository employeeRepository = RepositoryFactory.CreateEmployeeRepo();
                EmployeeViewModel  empInfo            = employeeRepository.GetEmployeeDataByADAccount(Context.User.Identity.Name);
                if (empInfo.DepartmentID_FK == "3910")
                {
                    bool isInRule = _processwfRepo.CheckFogotPunchTimeHasInRule(Request["SignDocID"]);
                    if (!isInRule)
                    {
                        ClientScriptManager cs = Page.ClientScript;
                        cs.RegisterClientScriptBlock(this.GetType(), "PopupScript", "var fpTimeIsSuccess = false;", true);
                        return;
                    }
                }
            }

            #endregion #0012 忘刷單的時間如果不符合邏輯,在確認簽核的時候主管要看到明顯提示 (目前針對桃園所做設定)

            try
            {
                if (model_M.FormID_FK == 3 && model.Status == 3)
                {
                    //txterror.Text = "123";
                    //Response.Write("未填寫單位主管意見".ToAlertFormat());
                    _trainDetaiRepo = RepositoryFactory.CreateTrainDetailRepo();
                    //取得頁面資料

                    model = PageDataBind();
                    var    QuestionDataList = _trainDetaiRepo.QueryQuestionDataByChief("02");
                    String chkString        = "";
                    String ansString        = "";
                    QuestionDataList.All(row =>
                    {
                        if (row["ANSTYPE"].ToString() == "C")//填文字
                        {
                            TextBox tmpbox = PlaceHolder1.FindControl("textbox" + row["serial_no"].ToString()) as TextBox;
                            ansString      = tmpbox.Text;
                            if (ansString == "")
                            {
                                chkString += row["CODENAME"].ToString() + " 不可空白!";
                            }
                        }
                        else if (row["ANSTYPE"].ToString() == "N")
                        {
                            //RadioButtonList tmprbl = PlaceHolder1.FindControl("rbl" + row["serial_no"].ToString()) as RadioButtonList;
                            RadioButtonList tmprbl = (RadioButtonList)PlaceHolder1.FindControl("rbl" + row["serial_no"].ToString());
                            ansString = tmprbl.SelectedValue;
                            if (ansString == "")
                            {
                                chkString += row["CODENAME"].ToString() + " 不可空白!";
                            }
                        }
                        return(true);
                    });
                    if (chkString != "")
                    {
                        Response.Write(chkString.ToAlertFormat());
                        return;
                    }
                    else
                    {
                        //儲存主管意見
                        var    successRdUrl = String.Empty;
                        string strCLID      = _trainDetaiRepo.Find_CLID(Request["SignDocID"]);
                        string strSID       = _trainDetaiRepo.Find_SID(Request["SignDocID"]);
                        //刪除記錄調查表的主管意見
                        _trainDetaiRepo.DelChiefAnswer("CHARACTER_ANSWER", strCLID, strSID, "02");
                        _trainDetaiRepo.DelChiefAnswer("NUMERIC_ANSWER", strCLID, strSID, "02");
                        QuestionDataList.All(row =>
                        {
                            if (row["ANSTYPE"].ToString() == "C")//填文字
                            {
                                //新增
                                TextBox tmpbox = PlaceHolder1.FindControl("textbox" + row["serial_no"].ToString()) as TextBox;
                                //ansString = tmpbox.Text;
                                _trainDetaiRepo.AddAnswer_C(strCLID, strSID, row["TABLE_ID"].ToString(), row["QNO"].ToString(), row["serial_no"].ToString(), tmpbox.Text, "Portal");
                            }
                            else if (row["ANSTYPE"].ToString() == "N")
                            {
                                //新增
                                RadioButtonList tmprbl = (RadioButtonList)PlaceHolder1.FindControl("rbl" + row["serial_no"].ToString());
                                //ansString = tmprbl.SelectedValue;
                                _trainDetaiRepo.AddAnswer_N(strCLID, strSID, row["TABLE_ID"].ToString(), row["QNO"].ToString(), row["serial_no"].ToString(), tmprbl.SelectedValue, "Portal");
                            }
                            return(true);
                        });
                    }
                }

                //主管簽核
                sectionChief.SignOff(model);

                MailInfo info = new MailInfo()
                {
                    AddresseeTemp = System.Web.Configuration.WebConfigurationManager.AppSettings["MailTemplate"],
                    DomainPattern = ConfigUtils.ParsePageSetting("Pattern")["DomainPattern"],
                };

                var     mainData = _processwfRepo.GetWorkflowData(model.SignDocID_FK, null);
                DataRow deptData = null;
                //送簽人AD帳號
                var signSender = (string)_rootRepo.QueryForEmployeeByEmpID(mainData.EmployeeID_FK)["ADAccount"];

                switch (mainData.FinalStatus)
                {
                //待簽核
                default:
                case 2:
                    //尋找目前待簽主管AD帳號
                    deptData = _rootRepo.QueryForDepartmentByDeptID(mainData.CurrentSignLevelDeptID_FK);
                    info.To  = (string)_rootRepo.QueryForEmployeeByEmpID((string)deptData["chiefID_FK"])["ADAccount"];

                    info.Subject = String.Format("系統提醒!簽核單號 : {0} 已經送達,請儘速處理!", model.SignDocID_FK);
                    info.Body.AppendFormat("{0}{1}", info.Subject, "此件為系統發送,請勿回覆!");
                    break;

                //駁回
                case 4:
                    info.To = signSender;

                    info.Subject = String.Format("系統提醒!簽核單號 : {0} 已被駁回,請儘速修改!", model.SignDocID_FK);
                    info.Body.AppendFormat("{0}{1}", info.Subject, "此件為系統發送,請勿回覆!");
                    break;

                //結案
                case 6:

                    #region #0013 加班時間小於結薪日,通知email給總務手動要寫入志元 直接判斷Table=>OvertimeForm的AutoInsert

                    //加班單的時候傳的參數為2,方能判斷是否送來簽核的是加班單
                    if (model_M.FormID_FK == 2)
                    {
                        string sid = Request["SignDocID"].ToString();
                        //取得結薪日
                        DateTime salaryLimit = Convert.ToDateTime(_rootRepo.GetSalaryLimit()["LimitDate"]);
                        Overtime overSev     = new Overtime();
                        List <OvertimeViewModel> overDataList   = new List <OvertimeViewModel>();
                        List <OvertimeViewModel> resultDataList = new List <OvertimeViewModel>();

                        //取得加班資料明細
                        OvertimeRepository _overtimeRepo = RepositoryFactory.CreateOvertimeRepo();
                        DataTable          tableData     = _overtimeRepo.QueryOvertimeFormData(sid);
                        var rows = tableData.Select();


                        overDataList = _overtimeRepo.dataMapping(tableData);
                        foreach (var over in overDataList)
                        {
                            if (!over.AutoInsert)
                            {
                                resultDataList.Add(over);
                            }
                            //DateTime startDate = (DateTime)over.StartDateTime;
                            //int mathDate = new TimeSpan(startDate.Ticks - salaryLimit.Ticks).Days;
                            //if (mathDate <= 0)
                            //resultDataList.Add(over);
                        }

                        //info.To = "wenhua.yu";
                        info.To = "juncheng.liu";
                        info.CC = new List <string>()
                        {
                            "juncheng.liu"
                        };
                        foreach (var ov in resultDataList)
                        {
                            info.Subject = String.Format("系統提醒!加班單號 : {0} [{1}-{2}]手動轉志元通知!", sid, ov.EmployeeID_FK, ov.EmployeeName);
                            DateTime      ovStartTime = (DateTime)ov.StartDateTime;
                            StringBuilder mailBody    = new StringBuilder();
                            mailBody.AppendLine(@"<p>[通知] 加班單 手動轉志元通知。</p>");
                            mailBody.AppendLine(@"<p>&nbsp;</p>");
                            mailBody.AppendLine(@"<p>Dear&nbsp;遇玟樺:</p>");
                            mailBody.AppendLine(@"<p>需手動轉入志元的加班單如下:</p>");
                            mailBody.AppendLine(@"<p>加班單號:<span style=""color:#0000ff;"">OT201707290010</span></p>");
                            mailBody.AppendLine(@"<p>加班日:" + ovStartTime.ToFullTaiwanDate() + "</p>");
                            //mailBody.AppendLine(@"<p>結薪日:<span style=""color:#ff0000;"">" + salaryLimit.ToFullTaiwanDate() + "</span></p>");
                            mailBody.AppendLine(@"<p>員工ID:" + ov.EmployeeID_FK + "</p>");
                            mailBody.AppendLine(@"<p>員工姓名:" + ov.EmployeeName + "</p>");
                            mailBody.AppendLine(@"<p><a href=""http://portal.rinnai.com.tw/Area/Manage/OvertimeReport.aspx"">Portal</a></p>");
                            info.Body = mailBody;
                            _mailer   = new Mailer(info);
                            //if (PublicRepository.CurrentWorkflowMode == Enums.WorkflowTypeEnum.RELEASE)
                            _mailer.SendMail();
                        }
                    }

                    #endregion #0013 加班時間小於結薪日,通知email給總務手動要寫入志元 直接判斷Table=>OvertimeForm的AutoInsert

                    //尋找歸檔人員
                    var fillingDept = (string)_rootRepo.QueryForDepartmentByFormID(mainData.FormID_FK)["DepartmentID"];
                    deptData = _rootRepo.QueryForDepartmentByDeptID(fillingDept);
                    //20170327 修改不寄給歸檔人員
                    //info.To = (string)_rootRepo.QueryForEmployeeByEmpID((string)deptData["FilingEmployeeID_FK"])["ADAccount"];
                    info.To = signSender;
                    //info.CC.Add(signSender);

                    info.Subject = String.Format("系統提醒!簽核單號 : {0} 已通過審核並結案,請儘速確認!", model.SignDocID_FK);
                    info.Body.AppendFormat("{0}{1}", info.Subject, "此件為系統發送,請勿回覆!");
                    break;
                }
                GlobalDiagnosticsContext.Set("User", User.Identity.Name);
                //mail
                _mailer = new Mailer(info);
                if (PublicRepository.CurrentWorkflowMode == Enums.WorkflowTypeEnum.RELEASE)
                {
                    _mailer.SendMail();
                }
                //log
                var cc = String.Join(",", info.CC);
                _log.Trace(String.Format("MailTo : {0}\r\ncc : {1}\r\nTitle : {2}\r\nContent : {3}\r\n", info.To, cc, info.Subject, info.Body));

                Response.Write("已送出簽核".ToAlertAndRedirect("/Area/Sign/ProcessWorkflowList.aspx?orderField=ModifyDate&descending=True"));
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message.ToAlertFormat());
            }
            finally
            {
                //btn處理
                SaveBtn.ButtonOn(CoverBtn);
            }
        }
        protected void SaveBtn_Click(object sender, EventArgs e)
        {
            _trainDetaiRepo = RepositoryFactory.CreateTrainDetailRepo();
            var    QuestionDataList = _trainDetaiRepo.QueryQuestionDataByTableID("01");
            String chkString        = "";
            String ansString        = "";

            txterror.Text = "";
            if (!String.IsNullOrEmpty(Request["CLID"]) && !String.IsNullOrEmpty(Request["SID"]))
            {
                QuestionDataList.All(row =>
                {
                    if (row["ANSTYPE"].ToString() == "C")//填文字
                    {
                        TextBox tmpbox = PlaceHolder1.FindControl("textbox" + row["serial_no"].ToString()) as TextBox;
                        ansString      = tmpbox.Text;
                        if (ansString == "")
                        {
                            chkString += "第" + row["serial_no"].ToString() + "題 不可空白!";
                        }
                    }
                    else if (row["ANSTYPE"].ToString() == "N")
                    {
                        //RadioButtonList tmprbl = PlaceHolder1.FindControl("rbl" + row["serial_no"].ToString()) as RadioButtonList;
                        RadioButtonList tmprbl = (RadioButtonList)PlaceHolder1.FindControl("rbl" + row["serial_no"].ToString());
                        ansString = tmprbl.SelectedValue;
                        if (ansString == "")
                        {
                            chkString += "第" + row["serial_no"].ToString() + "題 不可空白!";
                        }
                    }

                    return(true);
                });
            }
            if (chkString != "")
            {
                txterror.Text = chkString;
            }
            else
            {
                var responseMessage = "";
                var successRdUrl    = String.Empty;
                try
                {
                    var modelList = new List <RinnaiForms>();
                    modelList.Add(model);
                    //刪除原有答案
                    _trainDetaiRepo.FromTableNameDeleteValue("CHARACTER_ANSWER", Request["CLID"], Request["SID"], "01");
                    _trainDetaiRepo.FromTableNameDeleteValue("NUMERIC_ANSWER", Request["CLID"], Request["SID"], "01");
                    QuestionDataList.All(row =>
                    {
                        if (row["ANSTYPE"].ToString() == "C")//填文字
                        {
                            //新增
                            TextBox tmpbox = PlaceHolder1.FindControl("textbox" + row["serial_no"].ToString()) as TextBox;
                            //ansString = tmpbox.Text;
                            _trainDetaiRepo.AddAnswer_C(Request["CLID"].ToString(), Request["SID"].ToString(), row["TABLE_ID"].ToString(), row["QNO"].ToString(), row["serial_no"].ToString(), tmpbox.Text, User.Identity.Name);
                        }
                        else if (row["ANSTYPE"].ToString() == "N")
                        {
                            //新增
                            RadioButtonList tmprbl = (RadioButtonList)PlaceHolder1.FindControl("rbl" + row["serial_no"].ToString());
                            //ansString = tmprbl.SelectedValue;
                            _trainDetaiRepo.AddAnswer_N(Request["CLID"].ToString(), Request["SID"].ToString(), row["TABLE_ID"].ToString(), row["QNO"].ToString(), row["serial_no"].ToString(), tmprbl.SelectedValue, User.Identity.Name);
                        }
                        return(true);
                    });
                    String EID = _trainDetaiRepo.Find_EDITIONID("01");
                    bool   hasEmptySignFormRecords = _trainDetaiRepo.CheckHasSignFormRecords(Request["CLID"].ToString(), "01", EID);
                    //寫入空白單記錄
                    if (!hasEmptySignFormRecords)
                    {
                        _trainDetaiRepo.AddRECORDS(Request["CLID"].ToString(), "01", EID);
                    }
                    //寫入記錄調查表的簽核狀態(只有02表有簽核單號)
                    _trainDetaiRepo.AddFormSign(Request["CLID"].ToString(), Request["SID"].ToString(), "01", true, modelList);
                    successRdUrl    = @"TrainList01.aspx?orderField=CLID&descending=True";
                    responseMessage = "送出成功!";

                    //btn處理
                    ViewUtils.ButtonOn(SaveBtn, CoverBtn);
                    responseMessage = responseMessage.ToAlertAndRedirect(successRdUrl);
                }
                catch (Exception ex)
                {
                    responseMessage = String.Concat("送出失敗!\r\n錯誤訊息: ", ex.Message).ToAlertFormat();
                    ViewUtils.ShowRefreshBtn(CoverBtn, RefreshBtn);
                }
                finally
                {
                    Response.Write(responseMessage);
                }
            }
        }