Ejemplo n.º 1
0
        private void getData()
        {
            if (residentBaseInfos == null)
            {
                residentBaseInfos = new List <ResidentBaseInfo>();
            }
            else
            {
                residentBaseInfos.Clear();
            }
            StringObjectDictionary param = new { OrderByClause = " OperatedOn desc ", AreaIdSub = "", KeyWord = "", PageNo = 1, PageSize = 30 }.ToStringObjectDictionary();

            HttpAdapter.postSyncAsJSON(GovVar.DataPointOfManage + "/Bas/ResidentBaseInfoService/GetResidentBaseInfo", param,
                                       (ret, res) =>
            {
                if ((bool)ret.Success)
                {
                    foreach (var row in ret.rows)
                    {
                        dynamic item = new ExpandoObject();
                        DynamicAdapter.Parse(item, XElement.Parse(row.ToString()));
                        ResidentBaseInfo dtItem = (item.StringObjectDictionary as IDictionary <string, object>).FromDynamic <ResidentBaseInfo>();
                        residentBaseInfos.Add(dtItem);
                    }
                }
            });
        }
        private void getData(string areaIdSub)
        {
            if (residentBaseInfos == null)
            {
                residentBaseInfos = new List <ResidentBaseInfo>();
            }
            else
            {
                residentBaseInfos.Clear();
            }

            StringObjectDictionary param = new { Order = " desc ", Sort = " OperatedOn ", AreaId = areaIdSub, KeyWord = txbKeyWord.Text.Trim(), PageNo = _pageCurrent, PageSize = _pageSize }.ToStringObjectDictionary();

            HttpAdapter.postSyncAsJSON(GovVar.DataPointOfManage + "/Bas/ResidentBaseInfoService/GetResidentBaseInfo", param, new { ConnectId = GovVar.ConnectId }.ToStringObjectDictionary(),
                                       (ret, res) =>
            {
                if ((bool)ret.Success)
                {
                    foreach (var row in ret.rows)
                    {
                        dynamic item = new ExpandoObject();
                        DynamicAdapter.Parse(item, XElement.Parse(row.ToString()));
                        ResidentBaseInfo dtItem = (item.StringObjectDictionary as IDictionary <string, object>).FromDynamic <ResidentBaseInfo>();
                        residentBaseInfos.Add(dtItem);
                    }
                    var total  = ret.total.Value;
                    _nMax      = (int)total;
                    _pageCount = _nMax / _pageSize;
                    _pageCount = (_nMax % _pageSize) == 0 ? _pageCount : _pageCount + 1;
                }
                else
                {
                    _nMax      = 0;
                    _pageCount = 0;
                }
            });


            dgvResidentBaseInfo.DataSource = null;
            dgvResidentBaseInfo.DataSource = residentBaseInfos;
            dgvResidentBaseInfo.ScrollBars = ScrollBars.Both;

            txbPageTo.Text      = _pageCurrent.ToString();
            lblPageCount.Text   = "共 " + _pageCount.ToString() + " 页";
            lblRecordCount.Text = "总共 " + _nMax + " 条;当前第 " + _pageCurrent + " 页;共 " + _pageCount + " 页,每页 " + _pageSize + " 条";
            //bdngBaseInfo.BindingSource = null;
            //bdngBaseInfo.BindingSource = residentBaseInfos;
        }
        private bool checkIDNo()
        {
            bool   result  = false;
            string strIDNo = txbIDNo.Text.Trim();

            //新增和修改之前查看身份证号位数是否正确
            if ((strIDNo.Length != 15) && (strIDNo.Length != 18))
            {
                //MessageBox.Show("输入的身份证号位数错误");
            }
            else
            {
                HttpAdapter.getSyncTo(GovVar.DataPointOfManage + "/Bas/ResidentBaseInfoService/IDNoDuplicatesForCS", null, new { ConnectId = GovVar.ConnectId, IDNo = strIDNo, Status = 0 }.ToStringObjectDictionary(), (ret, res) =>
                {
                    if ((bool)ret.Success.Value)
                    {
                        string strResidentId = lblResidentId.Text;
                        string strOldManName = "";
                        for (int i = 0; i < ret.rows.Count; i++)
                        {
                            dynamic item = new ExpandoObject();
                            DynamicAdapter.Parse(item, XElement.Parse(ret.rows[i].ToString()));
                            ResidentBaseInfo dtItem = (item.StringObjectDictionary as IDictionary <string, object>).FromDynamic <ResidentBaseInfo>();

                            if (dtItem.ResidentId.ToLower() != strResidentId.ToLower())
                            {
                                strOldManName += dtItem.ResidentName;
                            }
                        }
                        if (strOldManName == "")
                        {
                            result = true;
                        }
                        else
                        {
                            MessageBox.Show(strOldManName + "已使用此身份证号码");
                        }
                    }
                    else
                    {
                        MessageBox.Show("身份证号码验证失败");
                    }
                });
            }
            return(result);
        }