public void Delete(string id)
        {
            var service = new mms_rainwaterportService();
            var result  = service.Delete(ParamDelete.Instance().AndWhere("BillNo", id));

            MmsHelper.ThrowHttpExceptionWhen(result <= 0, "信息删除失败[BillNo={0}],请重试或联系管理员!", id);
        }
        public List <dynamic> GetBillNo(string q)
        {
            var service = new mms_rainwaterportService();
            var pQuery  = ParamQuery.Instance().Select("top 10 BillNo").AndWhere("BillNo", q, Cp.StartWith);

            return(service.GetDynamicList(pQuery));
        }
        // GET api/mms/send/getdoperson
        public List <dynamic> GetDoPerson(string q)
        {
            var SendService = new mms_rainwaterportService();
            var pQuery      = ParamQuery.Instance().Select("top 10 DoPerson").AndWhere("DoPerson", q, Cp.StartWithPY);

            return(SendService.GetDynamicList(pQuery));
        }
        public dynamic GetEditMaster(string id)
        {
            var service = new mms_rainwaterportService();

            return(new
            {
                form = service.GetModel(ParamQuery.Instance().AndWhere("BillNo", id)),
                scrollKeys = service.ScrollKeys("BillNo", id, ParamQuery.Instance().AndWhere("ProjectCode", MmsHelper.GetCurrentProject()))
            });
        }
        public void Edit(dynamic data)
        {
            var service     = new mms_rainwaterportService();
            var formWrapper = RequestWrapper.Instance().LoadSettingXmlString(@"
<settings>
    <table>mms_rainwaterport</table>
    <where>
        <field name='BillNo' cp='equal'></field>
    </where>
</settings>");

            var result = service.Edit(formWrapper, null, data);
        }
        public dynamic GetDetail(string id)
        {
            var ReceiveService = new mms_rainwaterportService();
            var query          = RequestWrapper
                                 .InstanceFromRequest()
                                 .SetRequestData("CustomerId", id)
                                 .LoadSettingXmlString(@"
<settings defaultOrderBy='UpdateDate desc'>
    <select>
        A.*
    </select>
    <from>
        psi_customerContract A
    </from>
    <where>
        <field name='CustomerId' cp='equal'></field>
    </where>
</settings>");

            var pQuery1 = query.ToParamQuery();

            query.LoadSettingXmlString(@"
<settings defaultOrderBy='VisitId desc'>
    <select>
        A.*
    </select>
    <from>
        psi_customerVisit A
    </from>
    <where>
        <field name='CustomerId' cp='equal'></field>
    </where>
</settings>");

            var pQuery2 = query.ToParamQuery();
            var result  = ReceiveService.GetDynamicListWithPaging(pQuery2);

            return(result);
        }
        // 查询主表:GET api/mms/send
        public dynamic Get(RequestWrapper query)
        {
            query.LoadSettingXmlString(@"
<settings defaultOrderBy='BillNo'>
    <select>
     A.*
    </select>
    <from>
        mms_rainwaterport A
    </from>
    <where defaultForAll='true' defaultCp='equal' defaultIgnoreEmpty='true' >
        <field name='BillNo'          cp='equal'      ></field>
        <field name='Address'        cp='like'       ></field>
        <field name='Form'            cp='like'      ></field>
        <field name='GarbageInterceptionDevice'           cp='like'      ></field>
        <field name='DeodorizationDevice'        cp='like'  ></field>
    </where>
</settings>");
            var service = new mms_rainwaterportService();
            var pQuery  = query.ToParamQuery().AndWhere("A.ProjectCode", MmsHelper.GetCurrentProject());

            return(service.GetDynamicListWithPaging(pQuery));
        }
        public string GetNewBillNo()
        {
            var service = new mms_rainwaterportService();

            return(service.GetNewKey("BillNo", "dateplus"));
        }
        public JavaScriptJsonResult Echart(string id)
        {
            string titlename       = "";
            var    countnumber     = new List <object>();
            var    countname       = new List <object>();
            var    codeService     = new sys_codeService();
            var    getChartService = new mms_rainwaterportService();

            List <dynamic> data = getChartService.GetCountByGroupName(id);

            foreach (var result in data)
            {
                foreach (var item in (IDictionary <string, object>)result)
                {
                    if (item.Key.Equals(id))
                    {
                        if (id == "RainGrateMaterial")
                        {
                            countname.Add(codeService.GetTextByCode(item.Value.ToString(), "RainGrateMaterial"));
                            titlename = "雨水篦材质类型统计图";
                        }
                        if (id == "AdministrativeArea")
                        {
                            countname.Add(codeService.GetTextByCode(item.Value.ToString(), "AdministrativeArea"));
                            titlename = "雨水口区域分布统计图";
                        }
                        if (id == "Form")
                        {
                            countname.Add(codeService.GetTextByCode(item.Value.ToString(), "RainWaterPortForm"));
                            titlename = "雨水口形式统计图";
                        }
                    }
                    if (item.Key.Equals("countnumber"))
                    {
                        countnumber.Add(item.Value.ToString());
                    }
                }
            }



            var chartOptions = new EChartsOption
            {
                Title = new Title(titlename)
                {
                    Left = new AlignValue(Align.center)
                },
                Tooltip = new Tooltip(),
                Series  = new Series[]
                {
                    new BarSeries
                    {
                        Name      = titlename,
                        Data      = countnumber,
                        MarkPoint = new MarkPoint
                        {
                            Data = new List <MarkData>
                            {
                                new MarkData {
                                    Type = MarkPointDataTypes.max, Name = "最大值"
                                },
                                new MarkData {
                                    Type = MarkPointDataTypes.min, Name = "最小值"
                                }
                            }
                        },
                        MarkLine = new MarkLine
                        {
                            Data = new List <MarkData>
                            {
//new MarkData {Type = MarkPointDataTypes.average, Name = "平均值"}
                            }
                        }
                    }
                },
                XAxis = new XAxis[1] {
                    new XAxis {
                        Type = AxisTypes.category, Data = countname
                    }
                },
                YAxis = new YAxis[1] {
                    new YAxis {
                        Type = AxisTypes.value
                    }
                }
            };

            return(this.ToEChartResult(chartOptions));
        }