示例#1
0
        public static JObject getZzsReportData(string table_name)
        {
            JObject   return_json = new JObject();
            string    StrTaskName = "增值税一般纳税人申报";
            string    id          = "";
            GTXResult resultq     = GTXMethod.GetHeBeiYSBQC();

            if (resultq.IsSuccess)
            {
                List <GDTXHeBeiUserYSBQC> ysbqclist = JsonConvert.DeserializeObject <List <GDTXHeBeiUserYSBQC> >(resultq.Data.ToString());
                if (ysbqclist.Count > 0)
                {
                    foreach (GDTXHeBeiUserYSBQC item in ysbqclist)
                    {
                        if (item.TaskName == StrTaskName)
                        {
                            id = item.Id.ToString();
                        }
                    }
                }
            }

            GTXResult gr = GTXMethod.GetUserReportData(id, table_name);

            if (gr.IsSuccess == true)
            {
                JArray jarr = new JArray();
                jarr = JsonConvert.DeserializeObject <JArray>(gr.Data.ToString());

                if (jarr.Count > 0)
                {
                    byte[]  bytes     = Convert.FromBase64String(jarr[0]["dataValue"].ToString().Replace(" ", "+"));
                    string  dataValue = Encoding.Default.GetString(bytes);
                    JObject jv        = JsonConvert.DeserializeObject <JObject>(dataValue);

                    return_json = jv;
                }
            }
            return(return_json);
        }
示例#2
0
        public static bool zzsSave(string table_name, string ReportData)
        {
            string StrTaskName = "增值税一般纳税人申报";

            string    id      = "";
            string    TBZT    = "";
            GTXResult resultq = GTXMethod.GetHeBeiYSBQC();

            if (resultq.IsSuccess)
            {
                List <GDTXHeBeiUserYSBQC> ysbqclist = JsonConvert.DeserializeObject <List <GDTXHeBeiUserYSBQC> >(resultq.Data.ToString());
                if (ysbqclist.Count > 0)
                {
                    foreach (GDTXHeBeiUserYSBQC item in ysbqclist)
                    {
                        if (item.TaskName == StrTaskName)
                        {
                            id   = item.Id.ToString();
                            TBZT = item.TBZT;
                        }
                    }
                }
            }

            List <GTXNameValue> nameList = new List <GTXNameValue>();
            GTXNameValue        nv       = new GTXNameValue();

            nv.key = "data";
            byte[] bytes   = Encoding.Default.GetBytes(ReportData);
            string _result = Convert.ToBase64String(bytes);

            nv.value = _result;
            nameList.Add(nv);
            GTXResult saveresult = GTXMethod.SaveUserReportData(JsonConvert.SerializeObject(nameList), id, table_name);

            if (saveresult.IsSuccess)
            {
                JArray  ja     = new JArray();
                JObject add_jo = new JObject();

                if (table_name == "001")
                {
                    XmlDocument xd        = new XmlDocument();
                    JObject     input_jo  = JsonConvert.DeserializeObject <JObject>(ReportData);
                    JValue      j3xmlData = (JValue)input_jo["jsonData"]["j3xmlData"];

                    JArray j     = JsonConvert.DeserializeObject <JArray>(j3xmlData.ToString());
                    string bbxml = j[0]["bbxml"].ToString();
                    xd.LoadXml(bbxml);

                    XmlNodeList xml_zbGridlbVO = xd.SelectSingleNode("zzssyyybnsr_zb").SelectSingleNode("zbGrid").SelectNodes("zbGridlbVO");
                    XmlNode     xml_bqybtse    = xml_zbGridlbVO[0]["bqybtse"];
                    string      bqybtse        = xml_bqybtse.InnerText;

                    GTXMethod.UpdateSBSE(id, bqybtse);
                }

                if (TBZT != null)
                {
                    ja = JsonConvert.DeserializeObject <JArray>(TBZT);
                    foreach (JObject jo in ja)
                    {
                        if (jo["bbid"].ToString().Equals(table_name))
                        {
                            jo["status"] = 1;
                            GTXMethod.UpdateYSBQCtbzt(id, "", JsonConvert.SerializeObject(ja));
                            return(true);
                        }
                    }

                    add_jo.Add("bbid", table_name);
                    add_jo.Add("status", 1);
                    ja.Add(add_jo);

                    GTXMethod.UpdateYSBQCtbzt(id, "", JsonConvert.SerializeObject(ja));
                }
                else
                {
                    add_jo.Add("bbid", table_name);
                    add_jo.Add("status", 1);
                    ja.Add(add_jo);

                    GTXMethod.UpdateYSBQCtbzt(id, "", JsonConvert.SerializeObject(ja));
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }