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();
        }
        protected void reload()
        {
            string search_year = this.ddl_oilTransSubsidy_search_year.SelectedValue;

            if (string.IsNullOrEmpty(search_year))
            {
                search_year = DateTime.Now.Year.ToString();
            }


            FormOptionsSettingViewModel.OilTransportationSubsidyParameter param = new FormOptionsSettingViewModel.OilTransportationSubsidyParameter()
            {
                dateEnd    = DateTime.Parse(search_year + "/12/31 23:59:59"),
                dateStart  = DateTime.Parse(search_year + "/01/01 00:00:00"),
                desc       = true,
                orderField = "dateStart",
                pageIndex  = 1,
                pageSize   = 100,
                transTypes = new List <string>()
            };

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

            List <page_oilTransportitationSubsidy> list = new List <page_oilTransportitationSubsidy>();

            foreach (var o in list_ret.list)
            {
                string currentY = o.dateStart.ToString("yyyy/MM");
                page_oilTransportitationSubsidy p_o = null;
                if (list.Exists(x => x.ym_str == currentY))
                {
                    p_o = list.First(x => x.ym_str == currentY);
                }
                else
                {
                    p_o = new page_oilTransportitationSubsidy()
                    {
                        ym_str           = o.dateStart.ToString("yyyy/MM"),
                        car_price        = 0d,
                        motorcycle_price = 0d
                    };
                    list.Add(p_o);
                }
                p_o = this.setOilSetting(o, p_o);
            }

            this.rpt_oilTransportationSubsidy_list.DataSource = list;
            this.rpt_oilTransportationSubsidy_list.DataBind();
        }
        public FormOptionsSettingViewModel.OilTransportationSubsidyListResult getOilTransportationSubsidyListResult(FormOptionsSettingViewModel.OilTransportationSubsidyParameter param)
        {
            FormOptionsSettingViewModel.OilTransportationSubsidyListResult ret = new FormOptionsSettingViewModel.OilTransportationSubsidyListResult();

            try {
                ret.success    = true;
                ret.list       = this.formOptionSettingDao.getOilTransportationSubsidyList(param);
                ret.resultCode = "200";
                ret.count      = ret.list.Count;
            } catch (Exception ex) {
                ret.success         = false;
                ret.resultException = ex.ToString();
                ret.resultCode      = "500";
            }

            return(ret);
        }