Example #1
0
        /// <summary>
        /// 根据个人档案下载家庭
        /// </summary>
        /// <param name="pm"></param>
        /// <param name="callback"></param>
        public void DownJTByPerson(PersonModel pm, Action <string> callback)
        {
            try
            {
                CommonBusiness.CommonBusiness cb = new CommonBusiness.CommonBusiness();
                if (pm != null && !string.IsNullOrEmpty(pm.idNumber))
                {
                    if (!string.IsNullOrEmpty(pm.fid))
                    {
                        GetJtPeopleInfo(pm.fid, 1, callback);
                    }
                }

                callback("下载-家庭信息信息档案..." + currentIndex + "/" + totalRows);
                currentIndex++;
            }
            catch (Exception ex)
            {
                if (ex.Message.IndexOf("登录超时") > -1)
                {
                    callback("EX-“登录超时”、“该用户在别处登录”或者“当前用户信息被上级用户修改”导致用户无法操作,请您重新登录!");

                    throw;
                }

                CommonExtensions.WriteLog(ex.Message);
                CommonExtensions.WriteLog(ex.StackTrace);
            }
        }
Example #2
0
        public void DownJTByIds(string ids, Action <string> callback)
        {
            try
            {
                CommonBusiness.CommonBusiness cb = new CommonBusiness.CommonBusiness();

                var idsa = ids.Split(',');
                currentIndex = 1;
                foreach (var id in idsa)
                {
                    string jtKey = GetJTKeyByID(id);

                    if (string.IsNullOrEmpty(jtKey))
                    {
                        callback("下载-家庭信息信息档案..." + currentIndex + "/" + idsa.Length);
                        currentIndex++;
                        continue;
                    }

                    GetJtPeopleInfo(jtKey, 1, callback);

                    callback("下载-家庭信息信息档案..." + currentIndex + "/" + idsa.Length);
                    currentIndex++;
                }
            }
            catch (Exception ex)
            {
                if (ex.Message.IndexOf("登录超时") > -1)
                {
                    callback("EX-“登录超时”、“该用户在别处登录”或者“当前用户信息被上级用户修改”导致用户无法操作,请您重新登录!");

                    throw;
                }

                CommonExtensions.WriteLog(ex.Message);
                CommonExtensions.WriteLog(ex.StackTrace);
            }
        }
Example #3
0
        private void TrySaveFamily(string idNumber, DataSet ds, int tryCount, Action <string> callback)
        {
            try
            {
                //家庭档案号
                string jtKey = GetJTKeyByID(idNumber);

                if (!string.IsNullOrEmpty(jtKey))
                {
                    // 修改家庭信息
                    EditJT(jtKey, ds);

                    DataTable dt = ds.Tables["memBer"];

                    foreach (DataRow row in dt.Rows)
                    {
                        string idcardno         = row["IDCardNo"].ToString();
                        string strHouseRelation = row["HouseRelation"].ToString();

                        // 户主时跳过
                        if (idcardno.ToUpper() == idNumber.ToUpper())
                        {
                            continue;
                        }

                        CommonBusiness.CommonBusiness cb = new CommonBusiness.CommonBusiness();

                        PersonModel person = cb.GetGrdaByIDCardNo(idcardno, loginKey, SysCookieContainer);

                        if (person == null)
                        {
                            continue;
                        }

                        string merberID = "";

                        // 没有家庭的,则直接增加
                        if (person.fid == "")
                        {
                            merberID = GetMemID(jtKey, person.pid);

                            if (!string.IsNullOrEmpty(merberID))
                            {
                                AddJTMem(merberID, strHouseRelation, jtKey);
                            }

                            continue;
                        }

                        // 若是已经存在,则不操作。(关系未修改)
                        if (person.fid.ToUpper() == jtKey.ToUpper())
                        {
                            continue;
                        }

                        JTClass jtclass = GetJtXXInfo(person.fid);

                        if (string.IsNullOrEmpty(jtclass.JTKey))
                        {
                            continue;
                        }

                        // 户主变更,删除当前家庭中人员
                        foreach (var p in jtclass.JTPeoples)
                        {
                            if (p.houseRelation == "1")
                            {
                                continue;
                            }

                            DelJTMem(p.pid, p.houseRelation, jtclass.JTKey, jtclass.JTCount);

                            jtclass.JTCount--;
                        }

                        // 删除户主
                        var tmpM = jtclass.JTPeoples.Where(m => m.houseRelation == "1").FirstOrDefault();

                        if (tmpM != null)
                        {
                            DelJTMem(tmpM.pid, tmpM.houseRelation, jtclass.JTKey, 1);
                        }

                        merberID = GetMemID(jtKey, person.pid);

                        if (!string.IsNullOrEmpty(merberID))
                        {
                            AddJTMem(merberID, strHouseRelation, jtKey);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                if (ex.Message.IndexOf("登录超时") > -1)
                {
                    callback("EX-“登录超时”、“该用户在别处登录”或者“当前用户信息被上级用户修改”导致用户无法操作,请您重新登录!");

                    throw;
                }

                CommonExtensions.WriteLog(ex.Message);
                CommonExtensions.WriteLog(ex.StackTrace);

                if (tryCount < MaxtryCount)
                {
                    callback("EX-家庭信息:身份证[" + idNumber + "]:上传家庭信息失败。重新尝试获取第" + tryCount + "次...");

                    System.Threading.Thread.Sleep(SleepMilliseconds);
                    tryCount++;
                    TrySaveFamily(idNumber, ds, tryCount, callback);
                }
                else
                {
                    callback("EX-家庭信息:身份证[" + idNumber + "]:上传家庭信息失败。请确保网路畅通。");
                }
            }
        }