public HttpResponseMessage AddWaterSource(tblEQIW_D_Point_Details info)
        {
            string result = string.Empty;
            var    ret    = 0;

            try
            {
                using (EntityContext db = new EntityContext())
                {
                    db.tblEQIW_D_Point_Details.Add(info);
                    ret = db.SaveChanges();
                }

                if (ret <= 0)
                {
                    result = rule.JsonStr("error", "添加失败!", ret);
                }
                else
                {
                    result = rule.JsonStr("ok", "", info);
                }
            }
            catch (Exception e)
            {
                result = rule.JsonStr("error", e.Message, "");
            }

            return(new HttpResponseMessage {
                Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json")
            });
        }
        public HttpResponseMessage GetUpdateWaterSource(GetUpdateWaterSourceInfo info)
        {
            string result = string.Empty;
            var    ret    = 0;

            try
            {
                tblEQIW_D_Point_Details detailsInfo = new tblEQIW_D_Point_Details();

                using (EntityContext db = new EntityContext())
                {
                    detailsInfo = (from x in db.tblEQIW_D_Point_Details
                                   where x.fldAutoID == info.fldAutoID
                                   select x).FirstOrDefault();

                    detailsInfo.fldWSCode         = info.fldWSCode;
                    detailsInfo.fldWSName         = info.fldWSName;
                    detailsInfo.fldAliasName      = info.fldAliasName;
                    detailsInfo.fldSCategory      = info.fldSCategory;
                    detailsInfo.fldState          = short.Parse(info.fldState.ToString());
                    detailsInfo.fldLevel          = info.fldLevel;
                    detailsInfo.fldRSTown         = info.fldRSTown;
                    detailsInfo.fldAddress        = info.fldAddress;
                    detailsInfo.fldLongitude      = info.fldLongitude;
                    detailsInfo.fldLatitude       = info.fldLatitude;
                    detailsInfo.fldSynopsis       = info.fldSynopsis;
                    detailsInfo.fldFirstWaterSys  = info.fldFirstWaterSys;
                    detailsInfo.fldSecondWaterSys = info.fldSecondWaterSys;
                    detailsInfo.fldThirdWaterSys  = info.fldThirdWaterSys;
                    detailsInfo.fldProvideType    = info.fldProvideType;
                    detailsInfo.fldStand          = info.fldStand;
                    detailsInfo.fldServicePeople  = info.fldServicePeople;
                    detailsInfo.fldSupplyWater    = info.fldSupplyWater;
                    detailsInfo.fldDesignQuantity = info.fldDesignQuantity;
                    detailsInfo.fldActualQuantity = info.fldActualQuantity;
                    detailsInfo.fldBuildYear      = info.fldBuildYear;

                    db.tblEQIW_D_Point_Details.AddOrUpdate(detailsInfo);
                    ret = db.SaveChanges();
                }

                if (ret <= 0)
                {
                    result = rule.JsonStr("error", "修改失败!", "");
                }
                else
                {
                    result = rule.JsonStr("ok", "", detailsInfo);
                }
            }
            catch (Exception e)
            {
                result = rule.JsonStr("error", e.Message, "");
            }

            return(new HttpResponseMessage {
                Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json")
            });
        }
        public HttpResponseMessage GetEQIW_D_Point_Details(GetEQIW_D_Point_DetailsInfo info)
        {
            string result = string.Empty;

            try
            {
                tblEQIW_D_Point_Details         list_Details = new tblEQIW_D_Point_Details();
                List <tblEQIW_D_Waterworks>     list_Works   = new List <tblEQIW_D_Waterworks>();
                List <tblEQIW_D_WaterIntake>    list_Intake  = new List <tblEQIW_D_WaterIntake>();
                List <tblEQIW_D_MonitorSection> list_Section = new List <tblEQIW_D_MonitorSection>();
                RetuenEQIW_D_Point_Details      return_list  = new RetuenEQIW_D_Point_Details();
                using (EntityContext db = new EntityContext())
                {
                    list_Details = (from x in db.tblEQIW_D_Point_Details
                                    where x.fldAutoID == info.fldAutoID
                                    select x).FirstOrDefault();

                    if (list_Details != null)
                    {
                        list_Works = (from x in db.tblEQIW_D_Waterworks
                                      where x.fldFKID == list_Details.fldAutoID
                                      select x).ToList();

                        list_Intake = (from x in db.tblEQIW_D_WaterIntake
                                       where x.fldFKID == list_Details.fldAutoID
                                       select x).ToList();

                        list_Section = (from x in db.tblEQIW_D_MonitorSection
                                        where x.fldFKID == list_Details.fldAutoID
                                        select x).ToList();
                    }
                }

                return_list.deInfo = list_Details;
                return_list.woList = list_Works;
                return_list.inList = list_Intake;
                return_list.seList = list_Section;

                if (list_Details != null)
                {
                    result = rule.JsonStr("ok", "", return_list);
                }
                else
                {
                    result = rule.JsonStr("nodata", "没有数据!", "");
                }
            }
            catch (Exception e)
            {
                result = rule.JsonStr("error", e.Message, "");
            }

            return(new HttpResponseMessage {
                Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json")
            });
        }