Beispiel #1
0
        public string TplChange(string strListTplDetail)
        {
            List <TplDetailResponse> listTplDetail = JsonHelper.DeserializeJsonToObject <List <TplDetailResponse> >(strListTplDetail);
            var             token      = Session["token"] == null ? "XXXXXXX" : Session["token"].ToString();
            TplRequest      tplRequest = new TplRequest();
            string          strJson    = string.Empty;
            APIResponseBase ai         = new APIResponseBase {
                code = 0, message = ""
            };

            strJson = JsonHelper.SerializeObject(ai);
            foreach (TplDetailResponse tpl in listTplDetail)
            {
                string termids    = string.Empty;
                string ids        = string.Empty;
                string editbypats = string.Empty;

                foreach (TplDetail_DetailInfo tpldetail in tpl.data.tpl_detail)
                {
                    termids    += tpldetail.termid + ",";
                    ids        += tpldetail.id + ",";
                    editbypats += tpldetail.editbypat + ",";
                }

                string            reponse = tplRequest.TplChange(tpl.data.id, tpl.data.period, tpl.data.freqs, termids.Trim(','), ids.Trim(','), editbypats.Trim(','), token);
                TplChangeResponse tcr     = JsonHelper.DeserializeJsonToObject <TplChangeResponse>(reponse);
                if (tcr.code != 0)
                {
                    return(reponse);
                }
            }

            return(strJson);
        }
Beispiel #2
0
        /// <summary>
        /// 19、	模板变换(修改)
        /// </summary>
        /// <param name="period">data中的period周期</param>
        /// <param name="freqs">data中的freqs频次</param>
        /// <param name="termids">tpl_detail中的termid数组</param>
        /// <param name="ids">tpl_detail中的id数组</param>
        /// <param name="editbypats">tpl_detail中的editbypat数组</param>
        /// <param name="token"></param>
        /// <returns></returns>
        /// Gerry Ge
        public string TplChange(string id, string period, string freqs, string termids, string ids, string editbypats, string token)
        {
            string            strResponse = string.Empty;
            TplChangeResponse response    = new TplChangeResponse();

            try
            {
                Dictionary <string, string> sPara = new Dictionary <string, string>();

                sPara.Add("period", period);
                sPara.Add("freqs", freqs);

                Dictionary <string, string[]> sParas = new Dictionary <string, string[]>();
                string[] Tpltermids    = termids.Split(',');
                string[] Tplids        = ids.Split(',');
                string[] Tpleditbypats = editbypats.Split(',');
                sParas.Add("id[]", Tplids);
                sParas.Add("termid[]", Tpltermids);
                sParas.Add("editbypat[]", Tpleditbypats);

                strResponse = F8YLSubmit.BuildRequest(sParas, sPara, "tpl/change?token=" + token + "&id=" + id);

                //response = JsonHelper.DeserializeJsonToObject<TplChangeResponse>(strResponse);

                return(strResponse);
            }
            catch
            {
                throw;
            }
        }