public HttpResponseMessage saveResidence(dynamic r)
        {
            string companyId         = r.companyId;
            string residence_content = r.residence_content;
            Object data;

            try
            {
                BLL.handleResidence residence = new BLL.handleResidence();
                bool flag = false;
                flag = residence.EditResidence(residence_content, companyId);

                if (flag)
                {
                    data = new
                    {
                        success = true
                    };
                }
                else
                {
                    data = new
                    {
                        success = false,
                        backMsg = "更新房屋信息失败"
                    };
                }
            }
            catch (Exception ex)
            {
                data = new
                {
                    success = false,
                    backMsg = "服务异常"
                };
            }

            JavaScriptSerializer serializer = new JavaScriptSerializer();
            string json = serializer.Serialize(data);

            return(new HttpResponseMessage
            {
                Content = new StringContent(json, System.Text.Encoding.UTF8, "application/json")
            });
        }
        public HttpResponseMessage getResidenceInfo()
        {
            DataTable dt = new BLL.handleResidence().GetResidenceInfo();
            Object    data;

            if (dt.Rows.Count > 0)
            {
                List <residence> list = new List <residence>();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    residence residence = new residence();
                    residence.id                = dt.Rows[i]["id"].ToString();
                    residence.companyId         = dt.Rows[i]["companyId"].ToString();
                    residence.residence_content = dt.Rows[i]["residence_content"].ToString();
                    residence.create_time       = dt.Rows[i]["create_time"].ToString();

                    list.Add(residence);
                }


                data = new
                {
                    success  = true,
                    backData = list
                };
            }
            else
            {
                data = new
                {
                    success = false,
                    backMsg = "数据异常"
                };
            }

            JavaScriptSerializer serializer = new JavaScriptSerializer();
            string json = serializer.Serialize(data);

            return(new HttpResponseMessage
            {
                Content = new StringContent(json, System.Text.Encoding.UTF8, "application/json")
            });
        }
        public HttpResponseMessage getCompanyResidenceInfo(string id)
        {
            DataTable dt = new BLL.handleResidence().GetCompanyResidenceInfo(id);
            Object    data;

            if (dt.Rows.Count == 1)
            {
                residence residence = new residence();
                residence.id                = dt.Rows[0]["id"].ToString();
                residence.companyId         = dt.Rows[0]["companyId"].ToString();
                residence.residence_content = dt.Rows[0]["residence_content"].ToString();
                residence.create_time       = dt.Rows[0]["create_time"].ToString();

                data = new
                {
                    success  = true,
                    backData = residence
                };
            }
            else
            {
                data = new
                {
                    success = false,
                    backMsg = "数据异常"
                };
            }

            JavaScriptSerializer serializer = new JavaScriptSerializer();
            string json = serializer.Serialize(data);

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