Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.actSvc  = new AccountItemSvc();
            this.procSvc = new ProcessSvc();



            string procSerialNumber = Page.Request.QueryString["p"] as string;

            if (string.IsNullOrEmpty(procSerialNumber))
            {
                this.lt_alert.Text = UtilitySvc.alertMsg("參數錯誤,查無此表單");
                return;
            }
            AccountItemViewModel.OutsideApplyFormInstanceResult outsideRet = this.actSvc.getOutsideApplyFormInstanceResult(procSerialNumber);
            ProcessViewModel.ProcessHistoryListResult           procRet    = this.procSvc.getProcessHistoryByProcessSerialNumber(procSerialNumber);

            if (!outsideRet.success)
            {
                this.lt_alert.Text = UtilitySvc.alertMsg("參數錯誤,查無此表單");
                return;
            }

            this.ins            = outsideRet.instance;
            this.procHistoryIns = procRet;


            this.init();
        }
Exemplo n.º 2
0
        /// <summary>
        /// 發起表單
        /// </summary>
        public CommonViewModel.Result invokeProcess(string processId, string userId, string orgUnitId, string formOID, string formFieldValue, string subject)
        {
            CommonViewModel.Result ret = new CommonViewModel.Result();

            try {
                string processSerialNumber = this.plmSvc.invokeProcess(processId, userId, orgUnitId, formOID, formFieldValue, subject);

                ret.resultMessage = processSerialNumber;
                ret.success       = !string.IsNullOrEmpty(processSerialNumber);
                ret.resultCode    = "200";
            } catch (Exception ex) {
                ret.success         = false;
                ret.resultCode      = "500";
                ret.resultException = ex.ToString();

                UtilitySvc.writeLog("======== invokeProcess Start =========");
                UtilitySvc.writeLog("processId:" + processId);
                UtilitySvc.writeLog("userId:" + userId);
                UtilitySvc.writeLog("orgUnitId:" + orgUnitId);
                UtilitySvc.writeLog("formOID:" + formOID);
                UtilitySvc.writeLog("formFieldValue:" + formFieldValue);
                UtilitySvc.writeLog("subject:" + subject);
                UtilitySvc.writeLog("excption:" + ex.ToString());
                UtilitySvc.writeLog("======== invokeProcess End =========");
            }

            return(ret);
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.actSvc  = new AccountItemSvc();
            this.procSvc = new ProcessSvc();

            //2016/05/30 Stephen Add 目前只有廠商請款會顯示出來,現在一律都不顯示付款群組
            this.lb_paymentGroup.Visible = false;

            string procSerialNumber = Page.Request.QueryString["p"] as string;

            if (string.IsNullOrEmpty(procSerialNumber))
            {
                this.lt_alert.Text = UtilitySvc.alertMsg("參數錯誤,查無此表單");
                return;
            }

            AccountItemViewModel.CostApplyFormInstanceResult costRet = this.actSvc.getCostApplyFormInstanceResult(procSerialNumber);

            ProcessViewModel.ProcessHistoryListResult procRet = this.procSvc.getProcessHistoryByProcessSerialNumber(procSerialNumber);


            if (!costRet.success)
            {
                this.lt_alert.Text = UtilitySvc.alertMsg("參數錯誤,查無此表單");
                return;
            }

            this.ins            = costRet.instance;
            this.procHistoryIns = procRet;

            this.init();
        }
Exemplo n.º 4
0
        /// <summary>
        /// 發起流程
        /// </summary>
        public CommonViewModel.Result createProcess()
        {
            CommonViewModel.Result ret = new CommonViewModel.Result();

            try {
                if (this.procInstance == null)
                {
                    ret.success       = false;
                    ret.resultCode    = "301";
                    ret.resultMessage = "not specific process instance";
                    return(ret);
                }

                ret = this.procInstance.create();
                UtilitySvc.writeLog("============ create Process result: ============");
                UtilitySvc.writeLog(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss:fff"));
                UtilitySvc.writeLog(Newtonsoft.Json.JsonConvert.SerializeObject(ret));
            } catch (Exception ex) {
                ret.success         = false;
                ret.resultCode      = "500";
                ret.resultException = ex.ToString();
                UtilitySvc.writeLog("============ create Process exception: ============");
                UtilitySvc.writeLog(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss:fff"));
                UtilitySvc.writeLog(ex.ToString());
            }

            return(ret);
        }
Exemplo n.º 5
0
        public void ExportMessages()
        {
            HttpContext context  = HttpContext.Current;
            string      filePath = context.Server.MapPath("~/Template/Export-MSP-Sample.xls");

            using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read)) {
                using (MemoryStream st = new MemoryStream()) {
                    try {
                        IWorkbook wb = new HSSFWorkbook(fs);
                        wb = this.mspSvc.exportMessageWrokbook(wb, context);
                        wb.Write(st);
                        context.Response.ClearHeaders();
                        context.Response.Clear();
                        context.Response.AddHeader("content-disposition", String.Format("attachment;filename={0}", "MSP-" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls"));
                        context.Response.BinaryWrite(st.ToArray());
                    } catch (Exception ex)  {
                        UtilitySvc.writeLog("============ Export/MSP Start =============");
                        UtilitySvc.writeLog("DateTime:" + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
                        UtilitySvc.writeLog("Exception:" + ex.ToString());
                        UtilitySvc.writeLog("============ Export/MSP End =============");
                    } finally {
                        st.Dispose();
                        st.Close();
                        fs.Close();
                        context.Response.End();
                    }
                }
            }
        }
        protected void btn_oilTransSubsidy_add_Click(object sender, EventArgs e)
        {
            this.lt_msg.Text = "";
            string year  = this.ddl_oilTransSubsidy_year.SelectedValue;
            string month = this.ddl_oilTransSubsidy_month.SelectedValue;

            DateTime dateStart        = DateTime.Parse(year + "/" + month + "/01 00:00:00");
            int      thisMonthLastDay = dateStart.AddMonths(1).AddDays(-1).Day;
            DateTime dateEnd          = DateTime.Parse(year + "/" + month + "/" + thisMonthLastDay + " 23:59:59");


            //check is exist
            FormOptionsSettingViewModel.OilTransportationSubsidyParameter param = new FormOptionsSettingViewModel.OilTransportationSubsidyParameter()
            {
                dateEnd    = dateEnd,
                dateStart  = dateStart,
                desc       = true,
                orderField = "dateStart",
                pageIndex  = 1,
                pageSize   = 100,
                transTypes = new List <string>()
            };

            FormOptionsSettingViewModel.OilTransportationSubsidyListResult list_ret = this.formOptionSettingSvc.getOilTransportationSubsidyListResult(param);

            if (list_ret.count > 0)
            {
                this.lt_msg.Text = UtilitySvc.alertMsg("選取的時間已存在列表中,請用修改的方式修改補助金額");
                return;
            }
            //add
            WebServiceForEFGP.Models.OilTransportationSubsidy o_car = new Models.OilTransportationSubsidy()
            {
                dateCreated  = DateTime.Now,
                dateEnd      = dateEnd,
                dateStart    = dateStart,
                subsidyPrice = double.Parse(this.txt_oilTransSubsidy_car_price.Text),
                type         = "car"
            };
            WebServiceForEFGP.Models.OilTransportationSubsidy o_motorcycle = new Models.OilTransportationSubsidy()
            {
                dateCreated  = DateTime.Now,
                dateEnd      = dateEnd,
                dateStart    = dateStart,
                subsidyPrice = double.Parse(this.txt_oilTransSubsidy_motorcycle_price.Text),
                type         = "motorcycle"
            };

            this.formOptionSettingSvc.addOilTransportationSubsidy(o_car);
            this.formOptionSettingSvc.addOilTransportationSubsidy(o_motorcycle);

            //clear field
            this.ddl_oilTransSubsidy_month.SelectedValue   = "";
            this.ddl_oilTransSubsidy_year.SelectedValue    = "";
            this.txt_oilTransSubsidy_car_price.Text        = "";
            this.txt_oilTransSubsidy_motorcycle_price.Text = "";


            this.reload();
        }
Exemplo n.º 7
0
        protected void rpt_paymentItemSetting_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            switch (e.CommandName)
            {
            case "update":
                Dictionary <string, object> dicObj = new Dictionary <string, object>();

                DropDownList ddl_paymentItemSetting_list_cashApply        = e.Item.FindControl("ddl_paymentItemSetting_list_cashApply") as DropDownList;
                TextBox      txt_paymentItemSetting_list_name             = e.Item.FindControl("txt_paymentItemSetting_list_name") as TextBox;
                DropDownList ddl_paymentItemSetting_list_accountNo        = e.Item.FindControl("ddl_paymentItemSetting_list_accountNo") as DropDownList;
                TextBox      txt_paymentItemSetting_list_taxRate          = e.Item.FindControl("txt_paymentItemSetting_list_taxRate") as TextBox;
                TextBox      txt_paymentItemSetting_list_foreignRate      = e.Item.FindControl("txt_paymentItemSetting_list_foreignRate") as TextBox;
                TextBox      txt_paymentItemSetting_list_localRate        = e.Item.FindControl("txt_paymentItemSetting_list_localRate") as TextBox;
                TextBox      txt_paymentItemSetting_list_secondNHITaxRate = e.Item.FindControl("txt_paymentItemSetting_list_secondNHITaxRate") as TextBox;
                //TextBox txt_paymentItemSetting_list_memo = e.Item.FindControl("txt_paymentItemSetting_list_memo") as TextBox;

                List <AccountItemViewModel.XXX_EP_ACC_COMB_V> accCombVList = this.accountItemSvc.getAccCombVList();
                if (!accCombVList.Exists(x => x.ACC_COMB_2 == ddl_paymentItemSetting_list_accountNo.SelectedValue))
                {
                    this.lt_paymentItemSetting_msg.Text = UtilitySvc.alertMsg("selected  ACC_COMB_2 value is not exist");
                    return;
                }

                string accountName = accCombVList.First(x => x.ACC_COMB_2 == ddl_paymentItemSetting_list_accountNo.SelectedValue).ACC_COMB_2_NAME;

                dicObj.Add("applyTypeKey", ddl_paymentItemSetting_list_cashApply.SelectedValue);
                dicObj.Add("itemName", txt_paymentItemSetting_list_name.Text);
                dicObj.Add("accountNo", ddl_paymentItemSetting_list_accountNo.Text);
                dicObj.Add("accountName", accountName);
                dicObj.Add("taxRate", Math.Round(float.Parse(txt_paymentItemSetting_list_taxRate.Text), 2));
                dicObj.Add("foreignIncomeTaxRate", Math.Round(float.Parse(txt_paymentItemSetting_list_foreignRate.Text), 2));
                dicObj.Add("localIncomeTaxRate", Math.Round(float.Parse(txt_paymentItemSetting_list_localRate.Text), 2));
                dicObj.Add("secondNHITaxRate", Math.Round(float.Parse(txt_paymentItemSetting_list_secondNHITaxRate.Text), 2));
                //dicObj.Add("memo", txt_paymentItemSetting_list_memo.Text.Trim());

                this.accountItemSvc.updateAccountItemTaxRateSetting(long.Parse(e.CommandArgument.ToString()), dicObj);


                break;

            case "delete":

                this.accountItemSvc.deleteAccountItemTaxRateSetting(long.Parse(e.CommandArgument.ToString()));

                break;

            case "edit":
                Response.Redirect("PaymentItemSetting.aspx?mode=edit&id=" + e.CommandArgument.ToString());
                break;
            }


            this.reloadAccountList();
        }
Exemplo n.º 8
0
        /// <summary>
        /// 加簽關卡
        /// </summary>
        public CommonViewModel.Result addCustomActivity(string processSerialNumber, string activityID,
                                                        string refActId, NaNaProcessViewModel.AddActivityParameter param)
        {
            CommonViewModel.Result ret = new CommonViewModel.Result();

            XmlDocument defXML = this.getAddCustomAcivityXML(param);

            UtilitySvc.writeLog(defXML.OuterXml);

            this.plmSvc.addCustomParallelAndSerialActivity(processSerialNumber, activityID, refActId, defXML.OuterXml);

            return(ret.setResultValue(true, "200", string.Empty, string.Empty));
        }
Exemplo n.º 9
0
        public bool TempCostApply(string processSerialNumber)
        {
            bool ret = false;

            UtilitySvc.writeLog("-----[暫支款申請]processSerialNumber:" + processSerialNumber + "---------------------- start:" + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + " --------------------");
            try {
                ret = this.actSvc.tempCostApply(processSerialNumber);
            } catch (Exception ex) {
                UtilitySvc.writeLog(ex.ToString());
            }

            UtilitySvc.writeLog("-----[暫支款申請]processSerialNumber:" + processSerialNumber + "---------------------- end:" + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + " --------------------");
            return(ret);
        }
        protected void btn_admEmployeeTransportationSetting_add_Click(object sender, EventArgs e)
        {
            this.lt_akert_msg.Text = "";

            //check this empNo is Exist in row


            FormOptionsSettingViewModel.EmployeeTransportationSettingQueryParameter param = new FormOptionsSettingViewModel.EmployeeTransportationSettingQueryParameter()
            {
                desc       = true,
                keyword    = "",
                orderField = "EmpNo",
                pageIndex  = 1,
                pageSize   = int.MaxValue,
                transType  = this.ddl_admEmployeeTransportationSetting_trans_type.SelectedValue,
                empNo      = this.hid_admEmployeeTransportationSetting_emp.Value
            };


            FormOptionsSettingViewModel.ViewEmployeeTransportationSettingListResult list_ret = this.formOptSvc.getViewEmployeeTransportationSettingListResult(param);

            if (list_ret.count > 0)
            {
                this.lt_akert_msg.Text = UtilitySvc.alertMsg("此員工已存在");
                return;
            }


            EmployeeTransportationSetting ee = new EmployeeTransportationSetting()
            {
                DateCreated = DateTime.Now,
                Deleted     = false,
                EmpNo       = this.hid_admEmployeeTransportationSetting_emp.Value,
                TransId     = this.txt_admEmployeeTransportationSetting_transId.Text,
                TransType   = this.ddl_admEmployeeTransportationSetting_trans_type.SelectedValue
            };

            FormOptionsSettingViewModel.ViewEmployeeTransportationSettingResult add_ret = this.formOptSvc.addEmployeeTransportationSetting(ee);

            if (add_ret.success)
            {
                this.lt_akert_msg.Text = UtilitySvc.alertMsg("新增成功");
            }
            else
            {
                this.lt_akert_msg.Text = UtilitySvc.alertMsg(add_ret.resultException);
            }
        }
Exemplo n.º 11
0
        public bool MSPSubmit(string processSerialNumber)
        {
            bool ret = false;

            UtilitySvc.writeLog("---------------------------");
            UtilitySvc.writeLog(processSerialNumber);

            try {
                ret = this.mspSvc.MSPSubmit(processSerialNumber);
            } catch (Exception ex) {
                ret = false;
                UtilitySvc.writeLog(ex.ToString());
            }

            return(ret);
        }
Exemplo n.º 12
0
        public bool postHireEmployeeData(string processSerialNumber)
        {
            bool ret = false;

            UtilitySvc.writeLog("=========== 回傳錄用核定表資訊至HR系統 Start ===========");
            try {
                CommonViewModel.Result deliveryRet = this.hireEmpSvc.deliverHireEmployeeInfo(processSerialNumber);
                ret = deliveryRet.success;
                UtilitySvc.writeLog(Newtonsoft.Json.JsonConvert.SerializeObject(deliveryRet));
            } catch (Exception ex) {
                ret = false;
                UtilitySvc.writeLog(Newtonsoft.Json.JsonConvert.SerializeObject(ex.ToString()));
            }
            UtilitySvc.writeLog("=========== 回傳錄用核定表資訊至HR系統 End ===========");
            //ret = true;
            return(ret);
        }
Exemplo n.º 13
0
        // Call Procedure
        public CommonViewModel.Result callXXX_EP_AP_INTERFACE_PKG(string formSerialNumber)
        {
            CommonViewModel.Result ret = new CommonViewModel.Result();

            using (OleDbConnection cn = new OleDbConnection(this.ERPConnectionString)) {
                using (OleDbCommand cmd = new OleDbCommand()) {
                    cmd.Connection = cn;
                    cn.Open();
                    cmd.CommandText = "APPS.XXX_EP_AP_INT_PKG.CHECK_DATA";
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;

                    OleDbParameter P_INV_NUM = new OleDbParameter("@P_INV_NUM", OleDbType.VarChar, 100);
                    OleDbParameter X_RETCODE = new OleDbParameter("@X_RETCODE", OleDbType.VarChar, 100);
                    OleDbParameter X_ERRBUF  = new OleDbParameter("@X_ERRBUF", OleDbType.VarChar, 100);

                    P_INV_NUM.Direction = System.Data.ParameterDirection.Input;
                    X_RETCODE.Direction = System.Data.ParameterDirection.Output;
                    X_ERRBUF.Direction  = System.Data.ParameterDirection.Output;

                    P_INV_NUM.Value = formSerialNumber;


                    //X_RETCODE.Direction = System.Data.ParameterDirection.ReturnValue;
                    //X_ERRBUF.Direction = System.Data.ParameterDirection.ReturnValue;

                    cmd.Parameters.Add(P_INV_NUM);
                    cmd.Parameters.Add(X_RETCODE);
                    cmd.Parameters.Add(X_ERRBUF);

                    cmd.ExecuteNonQuery();

                    ret.success       = true;
                    ret.resultCode    = "200";
                    ret.resultMessage = string.Format("XXX_EP_AP_INTERFACE_PKG return value, X_RETCODE = {0} , X_ERRBUF = {1} "
                                                      , X_RETCODE, X_ERRBUF);


                    UtilitySvc.writeLog(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
                    UtilitySvc.writeLog("X_RETCODE=" + X_RETCODE.Value);
                    UtilitySvc.writeLog("X_ERRBUF=" + X_ERRBUF.Value);
                };
            }

            return(ret);
        }
Exemplo n.º 14
0
        public bool CostApply(string processSerialNumber)
        {
            //2016.04.27
            //無論怎麼樣都拋 true 因為到會計待結案關卡會再去捞EP轉入temp table 的 flag 為何
            //而且若是 false 會直接結案

            bool ret = true;

            UtilitySvc.writeLog("-----[零用金,併薪,暫支款沖銷,廠商請款]processSerialNumber:" + processSerialNumber + "---------------------- start:" + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + " --------------------");

            try {
                ret = this.actSvc.CostApply(processSerialNumber);
            } catch (Exception ex) {
                UtilitySvc.writeLog(ex.ToString());
            }
            UtilitySvc.writeLog("-----[零用金,併薪,暫支款沖銷,廠商請款]processSerialNumber:" + processSerialNumber + "---------------------- end:" + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + " --------------------");

            return(ret);
        }
        protected void rpt_oilTransportationSubsidy_list_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            this.lt_msg.Text = "";


            HiddenField hid_car_id        = e.Item.FindControl("hid_car_id") as HiddenField;
            HiddenField hid_motorcycle_id = e.Item.FindControl("hid_motorcycle_id") as HiddenField;

            long car_id        = long.Parse(hid_car_id.Value);
            long motorcycle_id = long.Parse(hid_motorcycle_id.Value);

            TextBox txt_oilTransportationSubsidy_list_car        = e.Item.FindControl("txt_oilTransportationSubsidy_list_car") as TextBox;
            TextBox txt_oilTransportationSubsidy_list_motorcycle = e.Item.FindControl("txt_oilTransportationSubsidy_list_motorcycle") as TextBox;


            switch (e.CommandName)
            {
            case "update":
                Dictionary <string, object> dic_car = new Dictionary <string, object>();
                dic_car.Add("subsidyPrice", double.Parse(txt_oilTransportationSubsidy_list_car.Text));

                Dictionary <string, object> dic_motorcycle = new Dictionary <string, object>();
                dic_motorcycle.Add("subsidyPrice", double.Parse(txt_oilTransportationSubsidy_list_motorcycle.Text));

                this.formOptionSettingSvc.updateOilTransportationSubsidy(car_id, dic_car);
                this.formOptionSettingSvc.updateOilTransportationSubsidy(motorcycle_id, dic_motorcycle);

                this.lt_msg.Text = UtilitySvc.alertMsg("更改成功");

                break;

            case "delete":

                this.formOptionSettingSvc.deleteOilTransportationSubsidy(car_id);
                this.formOptionSettingSvc.deleteOilTransportationSubsidy(motorcycle_id);

                this.lt_msg.Text = UtilitySvc.alertMsg("刪除成功");
                break;
            }

            this.reload();
        }
Exemplo n.º 16
0
        public bool MSPSubmit(string processSerialNumber)
        {
            bool ret = false;

            MSPViewModel.MSPSubmitResponse res = new MSPViewModel.MSPSubmitResponse();
            string url = this.msp_host;

            MSG001 msg = this.mspDao.getMSGData(processSerialNumber);

            if (msg == null)
            {
                return(ret);
            }

            List <MSG001_gridMsg> msg_grid_list = this.mspDao.getMSGGridList(msg.formSerialNumber);

            if (msg_grid_list.Count == 0)
            {
                return(ret);
            }

            //一筆一筆 post
            List <MSPViewModel.MSPSubmitRequestParameter> request_list = this.getRequestListParamter(msg, msg_grid_list);

            foreach (var r in request_list)
            {
                string post_str = this.getPostMSPString(r);
                UtilitySvc.writeLog(post_str);
                string response_str = UtilitySvc.formPostRequest(url, post_str, new Dictionary <string, object>());
                UtilitySvc.writeLog(response_str);
            }

            if (request_list.Count > 0)
            {
                ret = true;
            }

            return(ret);
        }
Exemplo n.º 17
0
        protected void btn_save_Click(object sender, EventArgs e)
        {
            Dictionary <string, object> dicObj = new Dictionary <string, object>();

            if (string.IsNullOrEmpty(this.ddl_fields.SelectedValue))
            {
                this.lt_msg.Text = UtilitySvc.alertMsg("請選擇欄位");
                return;
            }
            dicObj.Add("extData1", this.hid_current_select_emp_id_arr.Value);

            CommonViewModel.Result ret = this.formSvc.updateFormFieldSettion(this.ddl_fields.SelectedValue, dicObj);

            if (ret.success)
            {
                this.lt_msg.Text = "";
                this.getSelectedEmpList();
            }
            else
            {
                this.lt_msg.Text = ret.resultException;
            }
        }
Exemplo n.º 18
0
        protected void btn_paymentItemSetting_form_confirm_Click(object sender, EventArgs e)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();
            string id      = Request.QueryString["id"] as string;
            long   id_long = long.Parse(id);

            List <AccountItemViewModel.XXX_EP_ACC_COMB_V> accCombVList = this.accountItemSvc.getAccCombVList();

            if (!accCombVList.Exists(x => x.ACC_COMB_2 == ddl_paymentItemSetting_form_accountNo.SelectedValue))
            {
                this.lt_paymentItemSetting_msg.Text = UtilitySvc.alertMsg("selected  ACC_COMB_2 value is not exist");
                return;
            }

            string accountName = accCombVList.First(x => x.ACC_COMB_2 == ddl_paymentItemSetting_form_accountNo.SelectedValue).ACC_COMB_2_NAME;


            dic.Add("applyTypeKey", this.ddl_paymentItemSetting_form_applyTypeKey.SelectedValue);
            dic.Add("itemName", this.txt_paymentItemSetting_form_itemName.Text);
            dic.Add("accountNo", this.ddl_paymentItemSetting_form_accountNo.SelectedValue);
            dic.Add("accountName", accountName);
            dic.Add("taxRate", Math.Round(float.Parse(this.txt_paymentItemSetting_form_taxRate.Text), 2));
            dic.Add("foreignIncomeTaxRate", Math.Round(float.Parse(this.txt_paymentItemSetting_form_foreignIncomeTaxRate.Text), 2));
            dic.Add("localIncomeTaxRate", Math.Round(float.Parse(this.txt_paymentItemSetting_form_localIncomeTaxRate.Text), 2));
            dic.Add("secondNHITaxRate", Math.Round(float.Parse(this.txt_paymentItemSetting_form_secondNHITaxRate.Text), 2));
            dic.Add("memo", this.txt_paymentItemSetting_form_memo.Text.Trim());
            dic.Add("code", this.txt_paymentItemSetting_form_code.Text.Trim());
            dic.Add("needCountersign", this.chk_paymentItemSetting_form_needCountersign.Checked);

            AccountItemViewModel.AccountItemTaxRateSettingResult update_ret = this.accountItemSvc.updateAccountItemTaxRateSetting(id_long, dic);

            if (update_ret.success)
            {
                Response.Redirect("PaymentItemSetting.aspx");
            }
        }
Exemplo n.º 19
0
        /// <summary>
        /// 新增一流程
        /// </summary>
        /// <returns></returns>
        public CommonViewModel.Result create()
        {
            CommonViewModel.Result ret = new CommonViewModel.Result();

            //validate
            ret = this.validateCreateProcessParam();
            if (!ret.success)
            {
                return(ret);
            }

            //get xml template
            NaNaFormViewModel.FormTemplateSimpleResult formOIDRet = this.nanaFormSvc.findFormOIDsOfProcess(this.ProcessID);
            if (!formOIDRet.success)
            {
                ret.resultMessage = "form Instance not found";
                ret.resultCode    = "301";
                return(ret);
            }
            string[] formArr = formOIDRet.formOID.Split(',');

            NaNaFormViewModel.FormTemplateSimpleResult formTemplateRet = this.nanaFormSvc.getFormFieldTemplate(formArr[0]);

            if (!formTemplateRet.success)
            {
                ret.resultMessage = "form Template not found";
                ret.resultCode    = "301";
                return(ret);
            }

            //parse xml document
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(formTemplateRet.xmlTemplate);


            //set post  data
            string FormID = "HR_NewEmployee_1";

            //申請日期
            UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/txtDate", DateTime.Now.ToString("yyyy/MM/dd"));

            //其他初始值
            UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/txtCount", "0");
            UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/txtAdvice", string.Empty);
            UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/hfCheckExtendMonth", "0");


            //取得填單人的資料
            UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/txtUserInfo_Dep1", this.issuerEmpInfoList[1]);
            UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/txtUserInfo_Dep2", this.issuerEmpInfoList[2]);
            UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/txtUserInfo_Id", this.issuerEmpInfoList[3]);
            UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/txtUserInfo_Name", this.issuerEmpInfoList[4]);

            //取得受評人的EP組織資料(部門名稱、ID...)

            UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/hfUpUpDepName", this.evaEmpInfoList[0]);
            UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/txtDep1", this.evaEmpInfoList[1]);
            UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/txtDep2", this.evaEmpInfoList[2]);
            UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/txtUserID", this.evaEmpInfoList[3]);
            UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/txtUserName", this.evaEmpInfoList[4]);
            UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/txtDep2Id", this.evaEmpInfoList[5]);

            //取得受評人的HCP資料(到職日、職等...)
            UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/txtTitle", this.hcpEvaEmpInfoList[0]);
            UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/txtTrial", this.hcpEvaEmpInfoList[1]);
            UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/hfLevel", this.hcpEvaEmpInfoList[2]);
            UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/hfMaturityDate1", this.hcpEvaEmpInfoList[3]);
            UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/hfMaturityDate2", this.hcpEvaEmpInfoList[4]);
            UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/hfOkayDate", this.hcpEvaEmpInfoList[5]);
            UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/hfActTrialDate", this.hcpEvaEmpInfoList[6]);

            //取得填單人的核決層級
            string issuerDicisionLevel = this.newEmpEvaDao.getDecisionLevelByEmpId(this.createParam.issuerId);

            if (string.IsNullOrEmpty(issuerDicisionLevel))
            {
                UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/hfApproveLvl", "6000");
            }
            else
            {
                UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/hfApproveLvl", issuerDicisionLevel);
            }

            //取得受評人的核決層級
            string evaEmpDicisionLevel = this.newEmpEvaDao.getDecisionLevelByEmpId(this.createParam.issuerId);

            if (string.IsNullOrEmpty(evaEmpDicisionLevel))
            {
                UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/hfApproveLvl1", "6000");
            }
            else
            {
                UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/hfApproveLvl1", evaEmpDicisionLevel);
            }


            //取得部門相關資訊
            List <string> evaEmpDetpInfo = this.newEmpEvaDao.getDeptInfoByDeptName(evaEmpInfoList[2]);

            UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/hfManagerName", evaEmpDetpInfo[0]);
            UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/hfManagerId", evaEmpDetpInfo[1]);
            UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/hfManagerNameUp", evaEmpDetpInfo[2]);
            UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/hfManagerIdUp", evaEmpDetpInfo[3]);


            //設定最後發起流程的資訊
            List <string> evaEmpProcessInfo = this.newEmpEvaDao.getLastEvaluationProcessByEmpId(this.createParam.evaluationEmpId);

            UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/rbtAppraisal", "0");
            if (evaEmpProcessInfo.Count > 0)
            {
                int ddl2rdItem = 0;
                int.TryParse(evaEmpProcessInfo[0], out ddl2rdItem);
                if (ddl2rdItem > 0)
                {
                    UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/hfMaturityDate1", evaEmpProcessInfo[1]);
                    UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/hfMaturityDate2", evaEmpProcessInfo[2]);
                    UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/hfOkayDate", evaEmpProcessInfo[3]);
                    UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/rbtAppraisal", "1");
                    UtilitySvc.trySetXmlDocInnerText(ref doc, FormID + "/txtTrial", evaEmpProcessInfo[4]);
                }
            }

            UtilitySvc.writeLog("===================== xml template:" +
                                DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + " ================");

            UtilitySvc.writeLog("form xml:");
            UtilitySvc.writeLog(doc.OuterXml);


            ret = this.nanaProcSvc.invokeProcess(this.ProcessID, this.createParam.issuerId, this.issuerEmpInfoList[5],
                                                 formArr[0], doc.OuterXml, string.Empty);

            UtilitySvc.writeLog("===================== create process at:" +
                                DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + " ================");


            UtilitySvc.writeLog("process serial number:");
            UtilitySvc.writeLog(ret.resultMessage);

            return(ret);
        }
Exemplo n.º 20
0
        protected void edit_init()
        {
            this.mv_paymentItemSetting.SetActiveView(this.vw_paymentItemSetting_edit);

            string id = Request.QueryString["id"] as string;

            if (string.IsNullOrEmpty(id))
            {
                Response.Redirect("PaymentItemSetting.aspx");
                return;
            }

            long id_long = 0;

            if (!long.TryParse(id, out id_long))
            {
                Response.Redirect("PaymentItemSetting.aspx");
                return;
            }

            AccountItemViewModel.AccountItemTaxRateSettingResult acc_ret = this.accountItemSvc.getAccountItemTaxRateSetting(id_long);

            if (!acc_ret.success)
            {
                this.lt_paymentItemSetting_msg.Text = UtilitySvc.alertMsg(acc_ret.resultException.ToString());
                return;
            }


            AccountItemViewModel.CashApplyTypeListResult cashApplyListRet = this.accountItemSvc.getCashApplyTypeList();

            if (!cashApplyListRet.list.Exists(x => x.key == "tempPayment_writeOff"))
            {
                cashApplyListRet.list.Add(new AccountItemViewModel.CashApplyType()
                {
                    key = "tempPayment_writeOff", name = "暫支款沖銷"
                });
            }

            List <ListItem> cashApplyOptions = new List <ListItem>();

            cashApplyOptions.Add(new ListItem()
            {
                Text = "- 請選擇 -", Value = ""
            });
            foreach (var c in cashApplyListRet.list)
            {
                cashApplyOptions.Add(new ListItem()
                {
                    Text = c.name, Value = c.key
                });
            }

            this.ddl_paymentItemSetting_form_applyTypeKey.DataSource = cashApplyOptions;
            this.ddl_paymentItemSetting_form_applyTypeKey.DataBind();

            this.ddl_paymentItemSetting_form_applyTypeKey.SelectedValue = acc_ret.acc.applyTypeKey;

            this.txt_paymentItemSetting_form_itemName.Text = acc_ret.acc.accountName;



            List <ListItem> accCombVListOptions = new List <ListItem>();

            accCombVListOptions.Add(new ListItem()
            {
                Text = "- 請輸入會科代碼或名稱 -", Value = ""
            });

            List <AccountItemViewModel.XXX_EP_ACC_COMB_V> accCombVList = this.accountItemSvc.getAccCombVList();

            foreach (var c in accCombVList)
            {
                accCombVListOptions.Add(new ListItem()
                {
                    Text = c.ACC_COMB_2_NAME + " - (" + c.ACC_COMB_2 + ")", Value = c.ACC_COMB_2
                });
            }


            this.ddl_paymentItemSetting_form_accountNo.DataSource = accCombVListOptions;
            this.ddl_paymentItemSetting_form_accountNo.DataBind();
            this.ddl_paymentItemSetting_form_accountNo.SelectedValue   = acc_ret.acc.accountNo;
            this.txt_paymentItemSetting_form_itemName.Text             = acc_ret.acc.itemName;
            this.txt_paymentItemSetting_form_taxRate.Text              = acc_ret.acc.taxRate.ToString();
            this.txt_paymentItemSetting_form_foreignIncomeTaxRate.Text = acc_ret.acc.foreignIncomeTaxRate.ToString();
            this.txt_paymentItemSetting_form_localIncomeTaxRate.Text   = acc_ret.acc.localIncomeTaxRate.ToString();
            this.txt_paymentItemSetting_form_secondNHITaxRate.Text     = acc_ret.acc.secondNHITaxRate.ToString();
            this.txt_paymentItemSetting_form_code.Text = acc_ret.acc.code;
            this.chk_paymentItemSetting_form_needCountersign.Checked = acc_ret.acc.needCountersign;
            this.txt_paymentItemSetting_form_memo.Text = acc_ret.acc.memo;

            return;
        }
        protected void rpt_formClassSettingForInfoSystemApply_list_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            this.lt_akert_msg.Text = "";

            Dictionary <string, object> dicObj_ERAC = new Dictionary <string, object>();
            Dictionary <string, object> dicObj_ERAP = new Dictionary <string, object>();

            TextBox      txt_formClassSettingForInfoSystemApply_list_name;
            HiddenField  hidd_rptPersonnelID;
            HiddenField  hidd_rptAPersonnelID;
            HiddenField  hidd_drp_rptdepartmentID;
            DropDownList drp_rptdepartmentID;

            switch (e.CommandName)
            {
            case "update":
                //類別名稱
                txt_formClassSettingForInfoSystemApply_list_name = e.Item.FindControl("txt_formClassSettingForInfoSystemApply_list_name") as TextBox;
                dicObj_ERAC.Add("name", txt_formClassSettingForInfoSystemApply_list_name.Text.Trim());

                hidd_rptPersonnelID      = e.Item.FindControl("hidd_rptPersonnelID") as HiddenField;                                       //處理人員
                hidd_rptAPersonnelID     = e.Item.FindControl("hidd_rptActivityPersonnelID") as HiddenField;                               //加簽人員
                hidd_drp_rptdepartmentID = e.Item.FindControl("hid_formClassSettingForInfoSystemApply_list_departmentID") as HiddenField;  //部門(隱藏)
                drp_rptdepartmentID      = e.Item.FindControl("ddl_formClassSettingForInfoSystemApply_list_departmentID") as DropDownList; //部門

                //if (hidd_rptPersonnelID.Value != "") {
                //    this.hid_ddl_departmentID.SelectedValue = hidd_rptPersonnelID.Value;
                //    var rptPersonnelID_departmentID = this.ddl_departmentID.Items.FindByText(this.hid_ddl_departmentID.SelectedItem.Text).Value;
                //    this.hid_ddl_departmentID.SelectedValue = "";//清空
                //    dicObj_ERAC.Add("personnelID", hidd_rptPersonnelID.Value);
                //    dicObj_ERAC.Add("departmentID", rptPersonnelID_departmentID);
                //} else {
                //    dicObj_ERAC.Add("personnelID", "");
                //    dicObj_ERAC.Add("departmentID", drp_rptdepartmentID);
                //}

                dicObj_ERAC.Add("personnelID", hidd_rptPersonnelID.Value);
                dicObj_ERAC.Add("departmentID", drp_rptdepartmentID.SelectedValue == "" ? hidd_drp_rptdepartmentID.Value : drp_rptdepartmentID.SelectedValue);
                dicObj_ERAC.Add("addActivityPersonnelID", hidd_rptAPersonnelID.Value);
                //if (hidd_rptAPersonnelID.Value != "") {
                //    dicObj_ERAC.Add("addActivityPersonnelID", hidd_rptAPersonnelID.Value);
                //}

                drp_rptdepartmentID = e.Item.FindControl("ddl_formClassSettingForInfoSystemApply_list_departmentID") as DropDownList;
                break;

            case "delete":
                txt_formClassSettingForInfoSystemApply_list_name = e.Item.FindControl("txt_formClassSettingForInfoSystemApply_list_name") as TextBox;
                int i = this.checkSubClassCount(txt_formClassSettingForInfoSystemApply_list_name.Text.Trim());

                if (i > 0)
                {
                    this.lt_akert_msg.Text = UtilitySvc.alertMsg("請先刪除主類別底下的子類別");
                    return;
                }
                else
                {
                    dicObj_ERAC.Add("deleted", true);
                    dicObj_ERAP.Add("deleted", true);
                }
                break;

            case "advanced":
                //主類別與關鍵字查詢
                var k = string.IsNullOrEmpty(Request.QueryString["k"]) ? "" : Request.QueryString["k"].ToString();
                var c = string.IsNullOrEmpty(Request.QueryString["c"]) ? "" : Request.QueryString["c"].ToString();
                //處理人員與加簽人員
                this.hid_ViewAdvanced_PersonnelID         = e.Item.FindControl("hidd_rptPersonnelID") as HiddenField;
                this.hid_ViewAdvanced_ActivityPersonnelID = e.Item.FindControl("hidd_rptActivityPersonnelID") as HiddenField;
                Response.Redirect("FormClassSettingForInfoSystemApply.aspx?pg=" + pg_str + "&id=" + e.CommandArgument.ToString() + "&k=" + k + "&c=" + c + "&pID=" + HttpUtility.UrlEncode(this.hid_ViewAdvanced_PersonnelID.Value) + "&spID=" + HttpUtility.UrlEncode(this.hid_ViewAdvanced_ActivityPersonnelID.Value));
                break;
            }

            CommonViewModel.Result updateRet_ERAC = this.formOptSvc.updateERACategoryForInf(long.Parse(e.CommandArgument.ToString()), dicObj_ERAC);     //ERACategoryForInf
            CommonViewModel.Result updateRet_ERAP = this.formOptSvc.updateERAPermissionForInf(long.Parse(e.CommandArgument.ToString()), dicObj_ERAP);   //ERAPermissionForInf

            //若不成功 則要顯示錯誤訊息
            if (!updateRet_ERAC.success || !updateRet_ERAC.success)
            {
                this.lt_akert_msg.Text = updateRet_ERAC.resultException + updateRet_ERAP.resultException;
            }
            else
            {
                this.reload();
            }
        }
Exemplo n.º 22
0
        protected void btn_paymentItemSetting_add_Click(object sender, EventArgs e)
        {
            this.lt_paymentItemSetting_msg.Text = "";

            /* validate form */

            if (string.IsNullOrEmpty(this.ddl_paymentItemSetting_accountItem.Text))
            {
                this.lt_paymentItemSetting_msg.Text = UtilitySvc.alertMsg("請選擇會計科目");
                return;
            }

            if (string.IsNullOrEmpty(this.ddl_paymentItemSetting_type.Text))
            {
                this.lt_paymentItemSetting_msg.Text = UtilitySvc.alertMsg("請選擇費用類型");
                return;
            }

            if (string.IsNullOrEmpty(this.txt_paymentItemSetting_foreignRate.Text))
            {
                this.lt_paymentItemSetting_msg.Text = UtilitySvc.alertMsg("請輸入外國人所得稅率");
                return;
            }

            if (string.IsNullOrEmpty(this.txt_paymentItemSetting_localRate.Text))
            {
                this.lt_paymentItemSetting_msg.Text = UtilitySvc.alertMsg("請輸入本國人所得稅率");
                return;
            }


            /*
             * if (string.IsNullOrEmpty(this.txt_paymentItemSetting_memo.Text)) {
             *  this.lt_paymentItemSetting_msg.Text = UtilitySvc.alertMsg("請輸入說明文字");
             *  return;
             * }*/


            if (string.IsNullOrEmpty(this.txt_paymentItemSetting_name.Text))
            {
                this.lt_paymentItemSetting_msg.Text = UtilitySvc.alertMsg("品項不能為空值");
                return;
            }


            if (string.IsNullOrEmpty(this.txt_paymentItemSetting_secondNHITaxRate.Text))
            {
                this.lt_paymentItemSetting_msg.Text = UtilitySvc.alertMsg("二代健保稅率不能為空值");
                return;
            }

            if (string.IsNullOrEmpty(this.txt_paymentItemSetting_taxRate.Text))
            {
                this.lt_paymentItemSetting_msg.Text = UtilitySvc.alertMsg("稅率不能為空值");
                return;
            }

            /* add account item */
            List <AccountItemViewModel.XXX_EP_ACC_COMB_V> accCombVList = this.accountItemSvc.getAccCombVList();

            if (!accCombVList.Exists(x => x.ACC_COMB_2 == this.ddl_paymentItemSetting_accountItem.SelectedValue))
            {
                this.lt_paymentItemSetting_msg.Text = UtilitySvc.alertMsg("selected  ACC_COMB_2 value is not exist");
                return;
            }
            AccountItemTaxRateSetting acc = new AccountItemTaxRateSetting();

            acc.accountNo            = this.ddl_paymentItemSetting_accountItem.SelectedValue;
            acc.accountName          = accCombVList.First(x => x.ACC_COMB_2 == acc.accountNo).ACC_COMB_2_NAME;
            acc.applyTypeKey         = this.ddl_paymentItemSetting_type.SelectedValue;
            acc.dateCreated          = DateTime.Now;
            acc.deleted              = false;
            acc.foreignIncomeTaxRate = Math.Round(float.Parse(this.txt_paymentItemSetting_foreignRate.Text), 2);
            acc.itemName             = this.txt_paymentItemSetting_name.Text.Trim();
            acc.localIncomeTaxRate   = Math.Round(float.Parse(this.txt_paymentItemSetting_localRate.Text), 2);
            acc.memo             = this.txt_paymentItemSetting_memo.Text;
            acc.secondNHITaxRate = Math.Round(float.Parse(this.txt_paymentItemSetting_secondNHITaxRate.Text), 2);
            acc.taxRate          = Math.Round(float.Parse(this.txt_paymentItemSetting_taxRate.Text), 2);
            acc.needCountersign  = this.chk_paymentItemSetting_needCountersign.Checked;
            acc.code             = this.txt_paymentItemSetting_code.Text;

            AccountItemViewModel.AccountItemTaxRateSettingResult accRet = this.accountItemSvc.addAccountItemTaxRateSetting(acc);

            if (accRet.success)
            {
                this.lt_paymentItemSetting_msg.Text = UtilitySvc.alertMsg("新增成功");
                this.clearForm();
                this.reloadAccountList();
            }
            else
            {
                this.lt_paymentItemSetting_msg.Text = accRet.resultException;
            }
        }
Exemplo n.º 23
0
        private List <MSPViewModel.MSPSubmitRequestParameter> getRequestListParamter(MSG001 msg, List <MSG001_gridMsg> msg_gird_list)
        {
            List <MSPViewModel.MSPSubmitRequestParameter> ret = new List <MSPViewModel.MSPSubmitRequestParameter>();

            string[] ChbExcludeConditionArr = msg.hidChbExcludeCondition.Split(';');

            List <MSPViewModel.BlockListRequestParameter> blockList = new List <MSPViewModel.BlockListRequestParameter>();

            //排除名單

            foreach (var b in ChbExcludeConditionArr)
            {
                int _b = 0;

                if (!int.TryParse(b, out _b))
                {
                    continue;
                }

                blockList.Add(new MSPViewModel.BlockListRequestParameter()
                {
                    Oid = int.Parse(b)
                });
            }

            //測試名單
            string        testDistArr_str = "";
            List <string> testDistArr     = new List <string>();

            if (!string.IsNullOrEmpty(msg.hidApprovedEmp))
            {
                foreach (var s in msg.hidApprovedEmp.Split(';'))
                {
                    if (s.Length > 0)
                    {
                        testDistArr.Add(s);
                    }
                }
                testDistArr_str = string.Join(",", testDistArr.ToArray());
            }



            int sort = 1;

            foreach (var m in msg_gird_list)
            {
                string SendStartDate = "";
                string SendEndDate   = "";
                string SendStartTime = "";
                string SendEndTime   = "";

                //一次性
                if (m.gd_send_type == "一次性發送")
                {
                    DateTime sendStartDateTime = DateTime.Parse(m.gd_date_send.Trim() + " " + m.gd_time_send.Trim());
                    SendStartDate = sendStartDateTime.ToString("yyyyMMdd");
                    SendStartTime = sendStartDateTime.ToString("HHmm");
                }
                else if (m.gd_send_type == "週期性發送")
                {
                    string[] str_date      = m.gd_date_send.Split('~');
                    string   gd_start_date = str_date[0].Trim();
                    string   gd_end_date   = str_date[1].Trim();

                    string[] str_time      = m.gd_time_send.Split('~');
                    string   gd_start_time = str_time[0].Trim();
                    string   gd_end_time   = str_time[1].Trim();

                    DateTime sendStartDateTime = DateTime.Parse(gd_start_date + " " + gd_start_time);
                    DateTime sendEndDateTime   = DateTime.Parse(gd_end_date + " " + gd_end_time);

                    SendStartDate = sendStartDateTime.ToString("yyyyMMdd");
                    SendStartTime = sendStartDateTime.ToString("HHmm");
                    SendEndDate   = sendEndDateTime.ToString("yyyyMMdd");
                    SendEndTime   = sendEndDateTime.ToString("HHmm");
                }

                //換行 handler
                m.gd_content = m.gd_content.Replace("<br />", Environment.NewLine).Replace("&lt;br /&gt;", Environment.NewLine);
                m.gd_memo    = m.gd_memo.Replace("<br />", Environment.NewLine).Replace("&lt;br /&gt;", Environment.NewLine);


                MSPViewModel.MSPSubmitRequestParameter req = new MSPViewModel.MSPSubmitRequestParameter()
                {
                    FormId          = msg.SerialNumber + "-" + sort.ToString("000"), //序號  +  1 + 2 + 3
                    Department      = UtilitySvc.base64Encode(msg.txtApplyDepName),
                    Division        = UtilitySvc.base64Encode(msg.hidApplyDivsion),
                    Username        = UtilitySvc.base64Encode(msg.txtApplyName),
                    Ext             = msg.txtApplyExtNo,
                    PushSystem      = int.Parse(msg.ddlSendSystem),
                    SystemNote      = UtilitySvc.base64Encode(msg.hidITDelegateOption),
                    TaskType        = int.Parse(msg.hidRadioSendLevel),
                    CpDelegated     = int.Parse(msg.hidCPDelegate),
                    CategoryOid     = int.Parse(msg.ddlMsgCategory),
                    EmployeeId      = msg.txtApplyId,
                    PhoneNumber     = msg.hidSendPhoneNumber,
                    Subject         = UtilitySvc.base64Encode(UtilitySvc.parseGridValue(m.gd_title)),
                    Content         = UtilitySvc.base64Encode(UtilitySvc.parseGridValue(m.gd_content)),
                    Note            = UtilitySvc.base64Encode(UtilitySvc.parseGridValue(m.gd_memo)),
                    DistType        = UtilitySvc.base64Encode(m.gd_type),
                    DistFrom        = UtilitySvc.base64Encode(m.gd_src),
                    DistSize        = int.Parse(m.gd_list_count),
                    DistRule        = UtilitySvc.base64Encode(UtilitySvc.parseGridValue(m.gd_condition)),
                    RefDistList     = UtilitySvc.base64Encode(m.gd_list),           //測試名單
                    PushType        = int.Parse(m.gd_send_type == "一次性發送" ? "0" : "1"),
                    SendStartDate   = SendStartDate,
                    SendEndDate     = SendEndDate,
                    SendStartTime   = SendStartTime,
                    SendEndTime     = SendEndTime,
                    OtherDepartment = UtilitySvc.base64Encode(m.gd_segment),
                    ApplySales      = UtilitySvc.base64Encode(m.gd_sales),
                    SendArea        = UtilitySvc.base64Encode(m.gd_point_region),
                    Code            = m.gd_point_id,
                    StoreName       = UtilitySvc.base64Encode(m.gd_point_name),
                    TestDist        = testDistArr_str,          //若為 一般件 要將簽核過的人員工編號放進至試跑名單中
                    Address         = UtilitySvc.base64Encode(m.gd_point_address),
                    ApplyDate       = DateTime.Now.ToString("yyyyMMdd"),
                    BlockList       = blockList
                };


                ret.Add(req);
                sort++;
            }

            return(ret);
        }
        protected void btn_formClassSettingForInfoSystemApply_add_Click(object sender, EventArgs e)
        {
            this.lt_akert_msg.Text = "";

            //新增時判斷DB是否有此項資料(目前作法判斷項目名稱,只要名稱重複.一律不能新增(已存在).即使是同名稱不同人不同層級)
            FormOptionsSettingViewModel.FormClassSettingForInfoSystemApplyQueryParameter param = new FormOptionsSettingViewModel.FormClassSettingForInfoSystemApplyQueryParameter()
            {
                desc                 = true,
                orderField           = "Id",
                pageIndex            = 1,
                pageSize             = int.MaxValue,
                personnelID          = this.hid_formClassSettingForInfoSystemApply_personnelID.Value,
                name                 = this.txt_formClassSettingForInfoSystemApply_className.Text.ToString().Trim(),
                departmentID         = this.hid_departmentID.Value,
                dicisionProcessLevel = this.ddl_formClassSettingForInfoSystemApply_dicisionProcessLevel.SelectedValue
            };

            FormOptionsSettingViewModel.ERACategoryForInfListResult list_ret = this.formOptSvc.getERACategoryForInfListResult(param);

            if (list_ret.count > 0)
            {
                this.lt_akert_msg.Text = UtilitySvc.alertMsg("此類別已存在");
                return;
            }

            //新增ERACategoryForInf項目作法
            long pID = 0;

            if (this.ddl_formClassSettingForInfoSystemApply_parentID.SelectedValue == "-")
            {
                pID = -1;//代表父類別
            }
            else
            {
                pID = long.Parse(this.ddl_formClassSettingForInfoSystemApply_parentID.SelectedValue);//子類別parentID欄位抓取父類別ID
            }

            ERACategoryForInf ec = new ERACategoryForInf()
            {
                parentID               = pID,
                name                   = this.txt_formClassSettingForInfoSystemApply_className.Text,
                departmentID           = this.hid_departmentID.Value,
                personnelID            = this.hid_formClassSettingForInfoSystemApply_personnelID.Value,
                dicisionProcessLevel   = this.ddl_formClassSettingForInfoSystemApply_dicisionProcessLevel.SelectedValue,
                deleted                = false,
                DateCreated            = DateTime.Now,
                addActivityPersonnelID = this.hid_formClassSettingForInfoSystemApply_ActivityPersonnelID.Value
            };

            FormOptionsSettingViewModel.ERACategoryForInfResult add_ret_ERAC = this.formOptSvc.addERACategoryForInf(ec);

            //新增ERAPermissionForInf項目作法
            long iERACategoryID = ec.Id;    //ERAPermissionForInf.ERACategoryID
            bool bIsforAll      = true;

            if (this.ddl_formClassSettingForInfoSystemApply_isforAll.SelectedValue == "0")
            {
                bIsforAll = false;
            }

            ERAPermissionForInf ep = new ERAPermissionForInf()
            {
                ERACategoryID = iERACategoryID,
                isforAll      = bIsforAll,
                enable        = true,
                departmentID  = this.ddl_PermissionDepartmentID.SelectedValue,
                deleted       = false,
                DateCreated   = DateTime.Now
            };

            FormOptionsSettingViewModel.ERAPermissionForInfResult add_ret_ERAP = this.formOptSvc.addERAPermissionForInf(ep);

            if (add_ret_ERAC.success || add_ret_ERAP.success)
            {
                this.lt_akert_msg.Text = UtilitySvc.alertMsg("新增成功");
            }
            else
            {
                this.lt_akert_msg.Text = UtilitySvc.alertMsg(add_ret_ERAC.resultException) + UtilitySvc.alertMsg(add_ret_ERAP.resultException);
            }

            this.reload();
        }
        //儲存
        protected void btn_View_advancedSave_Click(object sender, EventArgs e)
        {
            string ckl_id_save = "";

            //額外動態欄位
            for (int i = 0; i < this.ckl_DisplayOtherField.Items.Count; i++)
            {
                if (this.ckl_DisplayOtherField.Items[i].Selected)
                {
                    ckl_id_save += this.ckl_DisplayOtherField.Items[i].Value;
                }
            }
            //範本下載
            for (int i = 0; i < this.chk_TemplateDownload.Items.Count; i++)
            {
                if (this.chk_TemplateDownload.Items[i].Selected)
                {
                    ckl_id_save += this.chk_TemplateDownload.Items[i].Value;
                }
            }

            //如果使用者有更新checkboxlist
            if (this.lbl_cklValues.Text != ckl_id_save)
            {
                FormOptionsSettingViewModel.FormClassSettingForInfoSystemApplyQueryParameter View_advanced_forList = new FormOptionsSettingViewModel.FormClassSettingForInfoSystemApplyQueryParameter {
                    desc       = true,
                    orderField = "Id",
                    pageIndex  = 1,
                    pageSize   = int.MaxValue,
                    id         = int.Parse(query_id),
                    cateogryId = int.Parse(query_id)
                };

                //判斷該筆資料是否已存在(目前使用cateogryId當條件)
                FormOptionsSettingViewModel.ERACategoryDynamicFieldListResult list_ret = this.formOptSvc.getERACategoryDynamicFieldListResult(View_advanced_forList);
                CommonViewModel.Result      updateRet_ERACDF;
                Dictionary <string, object> dicObj_ERACDF = new Dictionary <string, object>();
                //新增ERACategoryDynamicField項目作法
                FormOptionsSettingViewModel.ERACategoryDynamicFieldResult add_ret_ERAF;
                ERACategoryDynamicField ef;

                if (list_ret.count > 0)
                {
                    dicObj_ERACDF.Add("deleted", true);//更新原有舊資料deleted為1
                    //因為有多筆所以使用迴圈
                    for (int i = 0; i < list_ret.count; i++)
                    {
                        updateRet_ERACDF = this.formOptSvc.updateERACategoryDynamicField(list_ret.list[i].Id, dicObj_ERACDF);//ERACategoryDynamicField
                    }
                }
                //將使用者新勾選資料新增
                for (int i = 0; i < this.ckl_DisplayOtherField.Items.Count; i++)
                {
                    if (this.ckl_DisplayOtherField.Items[i].Selected)
                    {
                        ef = new ERACategoryDynamicField()
                        {
                            dynamicFieldSettingId = long.Parse(ckl_DisplayOtherField.Items[i].Value),
                            cateogryId            = long.Parse(query_id),
                            deleted     = false,
                            dateCreated = DateTime.Now
                        };

                        add_ret_ERAF            = this.formOptSvc.addERACategoryDynamicField(ef);
                        this.lt_akert_msg.Text += (!add_ret_ERAF.success) ? UtilitySvc.alertMsg(add_ret_ERAF.resultException) : "";
                    }
                }

                for (int i = 0; i < this.chk_TemplateDownload.Items.Count; i++)
                {
                    if (this.chk_TemplateDownload.Items[i].Selected)
                    {
                        ef = new ERACategoryDynamicField()
                        {
                            dynamicFieldSettingId = long.Parse(chk_TemplateDownload.Items[i].Value),
                            cateogryId            = long.Parse(query_id),
                            deleted     = false,
                            dateCreated = DateTime.Now
                        };

                        add_ret_ERAF            = this.formOptSvc.addERACategoryDynamicField(ef);
                        this.lt_akert_msg.Text += (!add_ret_ERAF.success) ? UtilitySvc.alertMsg(add_ret_ERAF.resultException) : "";
                    }
                }
            }

            this.lbl_cklValues.Text = "";//清空隱藏判斷欄位

            //修改ERACategoryForInf
            Dictionary <string, object> dicObj_ERAC = new Dictionary <string, object>();

            //處理人員
            dicObj_ERAC.Add("personnelID", this.hid_ViewAdvanced_PersonnelID.Value);
            //if (this.hid_ViewAdvanced_PersonnelID.Value != "") {
            //    dicObj_ERAC.Add("personnelID", this.hid_ViewAdvanced_PersonnelID.Value);
            //}
            //加簽人員
            dicObj_ERAC.Add("addActivityPersonnelID", this.hid_ViewAdvanced_ActivityPersonnelID.Value);
            //if (this.hid_ViewAdvanced_ActivityPersonnelID.Value != "") {
            //    dicObj_ERAC.Add("addActivityPersonnelID", this.hid_ViewAdvanced_ActivityPersonnelID.Value);
            //}
            //部門名稱
            dicObj_ERAC.Add("departmentID", this.ddl_ViewAdvanced_DepartmentID.SelectedValue == "" ? this.hid_ViewAdvanced_departmentID.Value : this.ddl_ViewAdvanced_DepartmentID.SelectedValue);
            //dicObj_ERAC.Add("departmentID", this.hid_ViewAdvanced_departmentID.Value);
            //if (this.hid_ViewAdvanced_PersonnelID.Value != "") {
            //    dicObj_ERAC.Add("departmentID", this.hid_ViewAdvanced_departmentID.Value);
            //} else {
            //    dicObj_ERAC.Add("departmentID", "");
            //}
            //if (this.hid_ViewAdvanced_departmentID.Value != "") {
            //    dicObj_ERAC.Add("departmentID", this.hid_ViewAdvanced_departmentID.Value);
            //}
            //主類別
            var vpID = this.ddl_ViewAdvanced_PartentID.SelectedValue == "-" ? "-1" : this.ddl_ViewAdvanced_PartentID.SelectedValue;

            dicObj_ERAC.Add("parentID", long.Parse(vpID));
            dicObj_ERAC.Add("name", this.txt_ViewAdvanced_ClassName.Text.Trim());                                               //類別名稱
            dicObj_ERAC.Add("dicisionProcessLevel", this.ddl_ViewAdvanced_DicisionProcessLevel.SelectedValue);                  //核決層級

            CommonViewModel.Result updateRet_ERAC = this.formOptSvc.updateERACategoryForInf(long.Parse(query_id), dicObj_ERAC); //ERACategoryForInf

            //修改ERACategoryForInf
            Dictionary <string, object> dicObj_ERAP = new Dictionary <string, object>();

            bool bIsforAll = this.ddl_ViewAdvanced_IsforAll.SelectedValue == "0" ? false : true;

            dicObj_ERAP.Add("isforAll", bIsforAll);                                                                               //是否適用全單位
            dicObj_ERAP.Add("departmentID", this.ddl_ViewAdvanced_PermissionDepartmentID.SelectedValue);                          //權限單位

            CommonViewModel.Result updateRet_ERAP = this.formOptSvc.updateERAPermissionForInf(long.Parse(query_id), dicObj_ERAP); //ERAPermissionForInf

            //若不成功 則要顯示錯誤訊息
            if (!updateRet_ERAC.success || !updateRet_ERAP.success)
            {
                this.lt_akert_msg.Text += updateRet_ERAC.resultException + updateRet_ERAP.resultException;
            }
            else
            {
                this.lt_akert_msg.Text = UtilitySvc.alertMsg("儲存成功");
                this.AdvancedReload();
                this.MultiView.ActiveViewIndex = 1;
            }
        }