Пример #1
0
        public async Task<string> UptPlanEnergyResult_Grid_2015(UptPlanEnergyResult_2015Param param)
        {
            var db = new EnergyNetEntities();
            AjaxResult r = new AjaxResult();
            var pass_state = StateCheck(param.CustId);
            if (pass_state == 1)
            {
                r.result = false;
                r.message = "初審已通過不可更新!";
                return defJSON(r);
            }
            try
            {
                var item = await db.PlanEnergyResult_2015.FindAsync(param.CustId, param.YY, param.item);
                var md = param.md;

                if (item != null)
                {
                    item.start_m = md.start_m;
                    item.end_m = md.end_m;
                    item.restrain_amt = md.restrain_amt;
                }
                else
                {
                    r.result = false;
                    r.message = "查無資料!";
                    return defJSON(r);
                }

                await db.SaveChangesAsync();

                r.result = true;
            }
            catch (Exception ex)
            {
                r.result = false;
                r.message = ex.Message;
                return defJSON(r);
            }
            finally
            {
                db.Dispose();
            }
            return defJSON(r);
        }
Пример #2
0
        public async Task<string> UptPlanEnergyResult_2015(UptPlanEnergyResult_2015Param param)
        {
            var db = new EnergyNetEntities();
            AjaxResult r = new AjaxResult();
            var pass_state = StateCheck(param.CustId);
            if (pass_state == 1)
            {
                r.result = false;
                r.message = "初審已通過不可更新!";
                return defJSON(r);
            }
            try
            {
                var item = await db.PlanEnergyResult_2015.FindAsync(param.CustId, param.YY, param.item);
                var md = param.md;

                if (item != null)
                {
                    //item.item = md.item;
                    item.save_src = md.save_src;
                    item.eng_type = md.eng_type;
                    item.save_code = md.save_code;
                    item.act_exec = md.act_exec;
                    item.act_area = md.act_area;
                    item.act_target = md.act_target;
                    item.act_text = md.act_text;
                    item.chg_before = md.chg_before;
                    item.chg_after = md.chg_after;
                    item.y1 = md.y1;
                    item.m1 = md.m1;
                    item.y2 = md.y2;
                    item.m2 = md.m2;
                    item.fma_no1_text = md.fma_no1_text;
                    item.fma_no21_1_B1 = md.fma_no21_1_B1;
                    item.fma_no21_1_B2 = md.fma_no21_1_B2;
                    item.fma_no21_1_B3 = md.fma_no21_1_B3;
                    item.fma_no21_1_B4 = md.fma_no21_1_B4;
                    item.fma_no21_2_B1 = md.fma_no21_2_B1;
                    item.fma_no21_2_B2 = md.fma_no21_2_B2;
                    item.fma_no21_2_B3 = md.fma_no21_2_B3;
                    item.fma_no21_2_B4 = md.fma_no21_2_B4;
                    item.fma_no22_C1 = md.fma_no22_C1;
                    item.fma_no22_C2 = md.fma_no22_C2;
                    item.fma_no22_C3 = md.fma_no22_C3;
                    item.fma_no22_C4 = md.fma_no22_C4;
                    item.fma_no22_C5 = md.fma_no22_C5;
                    item.fma_no22_C6 = md.fma_no22_C6;
                    item.fma_no22_D1 = md.fma_no22_D1;
                    item.fma_no22_D2 = md.fma_no22_D2;
                    item.fma_no22_D3 = md.fma_no22_D3;
                    item.fma_no22_D4 = md.fma_no22_D4;
                    item.fma_no22_D5 = md.fma_no22_D5;
                    item.fma_no22_D6 = md.fma_no22_D6;
                    item.fma_no22_C6_Frm = md.fma_no22_C6_Frm;
                    item.fma_no22_D6_Frm = md.fma_no22_D6_Frm;
                    item.fma_no22_E = md.fma_no22_E;
                    item.fma_no23 = md.fma_no23;
                    item.fma_no3_F = md.fma_no3_F;
                    item.eff_no11_1_g1 = md.eff_no11_1_g1;
                    item.eff_no11_1_g2 = md.eff_no11_1_g2;
                    item.eff_no11_1_g3 = md.eff_no11_1_g3;
                    item.eff_no11_2_g1 = md.eff_no11_2_g1;
                    item.eff_no11_2_g2 = md.eff_no11_2_g2;
                    item.eff_no11_2_g3 = md.eff_no11_2_g3;
                    item.eff_other = md.eff_other;
                    item.eff_save_money = md.eff_save_money;
                    item.inves_no1_1_text = md.inves_no1_1_text;
                    item.inves_no1_1_i1 = md.inves_no1_1_i1;
                    item.inves_no1_1_i2 = md.inves_no1_1_i2;
                    item.inves_no1_1_i3 = md.inves_no1_1_i3;
                    item.inves_no1_1_i4 = md.inves_no1_1_i4;
                    item.inves_no1_2_text = md.inves_no1_2_text;
                    item.inves_no1_2_i1 = md.inves_no1_2_i1;
                    item.inves_no1_2_i2 = md.inves_no1_2_i2;
                    item.inves_no1_2_i3 = md.inves_no1_2_i3;
                    item.inves_no1_2_i4 = md.inves_no1_2_i4;
                    item.inves_no2_1_text = md.inves_no2_1_text;
                    item.inves_no2_1_i5 = md.inves_no2_1_i5;
                    item.inves_no2_2_text = md.inves_no2_2_text;
                    item.inves_no2_2_i6 = md.inves_no2_2_i6;
                    item.inves_total = md.inves_total;

                    item.ECMCECID = md.ECMCECID;
                    item.ECMCTypeCode = md.ECMCTypeCode;
                    item.ECMMECID = md.ECMMECID;

                    item.start_m = md.start_m;
                    item.end_m = md.end_m;
                    item.restrain_amt = md.restrain_amt;
                    item.CalToOilKi = CalToOilKi(md.eng_type, (decimal)md.fma_no3_F);
                }
                else
                {
                    r.result = false;
                    r.message = "查無資料!";
                    return defJSON(r);
                }

                await db.SaveChangesAsync();
                RItemPlanEnergyResult_2015(md.CustID, md.YY);
                RecordReportList(param.CustId, param.YY, "JB1");
                r.result = true;
            }
            catch (DbEntityValidationException ex)
            {
                r.result = false;
                r.message = getDbEntityValidationException(ex);
                return defJSON(r);
            }
            catch (Exception ex)
            {
                r.result = false;
                r.message = ex.Message;
                return defJSON(r);
            }
            finally
            {
                db.Dispose();
            }
            return defJSON(r);
        }