/// <summary>
        /// 批量删除数据(启用事务
        /// </summary>
        /// <param name="json"></param>
        /// <returns></returns>
        public bool DeleteBatchResidenceCommunity(string json)
        {
            ResidenceCommunity bll  = new ResidenceCommunity();
            IList <object>     list = (IList <object>)JsonConvert.DeserializeObject(json);

            return(bll.DeleteBatch(list));
        }
        private void Bind(ref string myDataAppend)
        {
            string error = "";

            try
            {
                if (!Id.Equals(Guid.Empty))
                {
                    Page.Title = "编辑物业公司信息";
                    ResidenceCommunity     bll   = new ResidenceCommunity();
                    ResidenceCommunityInfo model = bll.GetModelByJoin(Id);
                    if (model != null)
                    {
                        txtName.Value    = model.CommunityName;
                        txtAddress.Value = model.Address;
                        txtaDescri.Value = model.AboutDescri;
                        myDataAppend    += "{ \"Id\":\"" + model.Id + "\",\"ProvinceCityId\":\"" + model.ProvinceCityId + "\",\"PropertyCompanyId\":\"" + model.PropertyCompanyId + "\",\"CompanyName\":\"" + model.CompanyName + "\"}";
                    }
                }
            }
            catch (Exception ex)
            {
                error = ex.Message;
            }

            if (!string.IsNullOrEmpty(error))
            {
                MessageBox.Messager(Page, error, MessageContent.AlertTitle_Ex_Error, "error");
            }
        }
        /// <summary>
        /// 获取数据分页列表,并返回所有记录数
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="totalRecords"></param>
        /// <param name="sqlWhere"></param>
        /// <param name="cmdParms"></param>
        /// <returns></returns>
        public string GetResidenceCommunityList(int pageIndex, int pageSize, out int totalRecords, string sqlWhere, params SqlParameter[] cmdParms)
        {
            ResidenceCommunity            bll  = new ResidenceCommunity();
            List <ResidenceCommunityInfo> list = bll.GetList(pageIndex, pageSize, out totalRecords, sqlWhere, cmdParms);

            if (list == null || list.Count == 0)
            {
                return("[]");
            }
            return(JsonConvert.SerializeObject(list));
        }
        /// <summary>
        /// 获取数据列表
        /// </summary>
        /// <returns></returns>
        public string GetResidenceCommunityList()
        {
            ResidenceCommunity            bll  = new ResidenceCommunity();
            List <ResidenceCommunityInfo> list = bll.GetList();

            if (list == null || list.Count == 0)
            {
                return("[]");
            }
            return(JsonConvert.SerializeObject(list));
        }
        /// <summary>
        /// 获取满足当前条件的数据列表
        /// </summary>
        /// <param name="sqlWhere"></param>
        /// <param name="cmdParms"></param>
        /// <returns></returns>
        public string GetResidenceCommunityList(string sqlWhere, params SqlParameter[] cmdParms)
        {
            ResidenceCommunity            bll  = new ResidenceCommunity();
            List <ResidenceCommunityInfo> list = bll.GetList(sqlWhere, cmdParms);

            if (list == null || list.Count == 0)
            {
                return("[]");
            }
            return(JsonConvert.SerializeObject(list));
        }
        private void GetJsonForDatagrid(HttpContext context)
        {
            int totalRecords = 0;
            int pageIndex    = 1;
            int pageSize     = 10;

            int.TryParse(context.Request.QueryString["page"], out pageIndex);
            int.TryParse(context.Request.QueryString["rows"], out pageSize);
            string       sqlWhere = string.Empty;
            ParamsHelper parms    = null;

            if (!string.IsNullOrEmpty(context.Request.QueryString["communityName"]))
            {
                sqlWhere = "and CommunityName like @CommunityName ";
                SqlParameter parm = new SqlParameter("@CommunityName", SqlDbType.NVarChar, 50);
                parm.Value = "%" + context.Request.QueryString["communityName"].Trim() + "%";
                if (parms == null)
                {
                    parms = new ParamsHelper();
                }
                parms.Add(parm);
            }
            if (!string.IsNullOrEmpty(context.Request.QueryString["companyId"]))
            {
                Guid companyId = Guid.Parse(context.Request.QueryString["companyId"]);
                sqlWhere = "and PropertyCompanyId = @PropertyCompanyId ";
                SqlParameter parm = new SqlParameter("@PropertyCompanyId", SqlDbType.UniqueIdentifier);
                parm.Value = companyId;
                if (parms == null)
                {
                    parms = new ParamsHelper();
                }
                parms.Add(parm);
            }

            ResidenceCommunity bll = new ResidenceCommunity();
            var list = bll.GetList(pageIndex, pageSize, out totalRecords, sqlWhere, parms != null ? parms.ToArray() : null);

            if (list == null || list.Count == 0)
            {
                context.Response.Write("{\"total\":0,\"rows\":[]}");
                return;
            }
            StringBuilder sb = new StringBuilder();

            foreach (var model in list)
            {
                sb.Append("{\"Id\":\"" + model.Id + "\",\"CommunityName\":\"" + model.CommunityName + "\",\"Address\":\"" + model.Address + "\"},");
            }
            context.Response.Write("{\"total\":" + totalRecords + ",\"rows\":[" + sb.ToString().Trim(',') + "]}");
        }
        private void Bind()
        {
            //查询条件
            GetSearchItem();

            List <ResidenceCommunityInfo> list = null;
            int totalRecords = 0;

            ResidenceCommunity bll = new ResidenceCommunity();

            if (parms != null && parms.Count() > 0)
            {
                list = bll.GetListByJoin(pageIndex, pageSize, out totalRecords, sqlWhere, parms == null ? null : parms.ToArray());
            }
            else
            {
                list = bll.GetListByJoin(pageIndex, pageSize, out totalRecords, "", null);
            }

            rpData.DataSource = list;
            rpData.DataBind();

            myDataAppend += "<div id=\"myDataForPage\" style=\"display:none;\">[{\"PageIndex\":\"" + pageIndex + "\",\"PageSize\":\"" + pageSize + "\",\"TotalRecord\":\"" + totalRecords + "\",\"QueryStr\":\"" + queryStr + "\"}]</div>";
        }
        /// <summary>
        /// 获取对应的数据
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public ResidenceCommunityInfo GetResidenceCommunityModel(object Id)
        {
            ResidenceCommunity bll = new ResidenceCommunity();

            return(bll.GetModel(Id));
        }
        /// <summary>
        /// 删除对应数据
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public int DeleteResidenceCommunity(object Id)
        {
            ResidenceCommunity bll = new ResidenceCommunity();

            return(bll.Delete(Id));
        }
        /// <summary>
        /// 修改数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int UpdateResidenceCommunity(ResidenceCommunityInfo model)
        {
            ResidenceCommunity bll = new ResidenceCommunity();

            return(bll.Update(model));
        }
        /// <summary>
        /// 添加数据到数据库
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int InsertResidenceCommunity(ResidenceCommunityInfo model)
        {
            ResidenceCommunity bll = new ResidenceCommunity();

            return(bll.Insert(model));
        }