Esempio n. 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);
        }
Esempio n. 2
0
        public string GetTplDetai()
        {
            string jsonDetailTpl = string.Empty;

            try
            {
                var        token = Session["token"] == null ? "XXXXXXX" : Session["token"].ToString();
                TplRequest tr    = new TplRequest();
                //TplDetailResponse tpl10 = new TplDetailResponse();
                //TplDetailResponse tpl11 = new TplDetailResponse();
                TplDetailResponse        tpldetail     = new TplDetailResponse();
                List <TplDetailResponse> listTplDetail = new List <TplDetailResponse>();
                TplListResponse          tpllist       = tr.TplList(token, "", "");
                foreach (var tpl in tpllist.data.data)
                {
                    tpldetail = tr.TplDetail(token, tpl.id);
                    if (tpldetail.code == 0)
                    {
                        //if (tpldetail.data.id == "10" || tpldetail.data.id == "11" || tpldetail.data.id == "12")
                        //{
                        //tpldetail.data.tpl_detail.Sort((left, right) => (Convert.ToInt32(left.sharpid) - Convert.ToInt32(right.sharpid)));
                        //tpldetail.data.tpl_detail.Sort((left, right) => (Convert.ToInt32(left.sharpid2) - Convert.ToInt32(right.sharpid2)));
                        ////tpldetail.data.tpl_detail.Sort((left, right) => (Convert.ToInt32(left.termid) - Convert.ToInt32(right.termid)));



                        tpldetail.data.tpl_detail.Sort((left, right) => (Convert.ToInt32(left.termid) - Convert.ToInt32(right.termid)));
                        tpldetail.data.tpl_detail.Sort((left, right) => (Convert.ToInt32(left.sharpid2) - Convert.ToInt32(right.sharpid2)));
                        tpldetail.data.tpl_detail.Sort((left, right) => (Convert.ToInt32(left.sharpid) - Convert.ToInt32(right.sharpid)));

                        listTplDetail.Add(tpldetail);
                        //}
                    }
                }


                //tpl10 = tr.TplDetail(token, "10");
                //tpl11 = tr.TplDetail(token, "11");
                //if (tpl10.code == 0)
                //{
                //    tpl10.data.tpl_detail.Sort((left, right) => (Convert.ToInt32(left.sharpid) + Convert.ToInt32(left.sharpid2)) - (Convert.ToInt32(right.sharpid) + Convert.ToInt32(right.sharpid2)));
                //    listTplDetail.Add(tpl10);
                //}
                //if (tpl11.code == 0)
                //{
                //    tpl11.data.tpl_detail.Sort((left, right) => (Convert.ToInt32(left.sharpid) + Convert.ToInt32(left.sharpid2)) - (Convert.ToInt32(right.sharpid) + Convert.ToInt32(right.sharpid2)));
                //    listTplDetail.Add(tpl11);
                //}

                jsonDetailTpl         = JsonHelper.SerializeObject(listTplDetail);
                ViewBag.listTplDetail = jsonDetailTpl;
            }
            catch (Exception ex)
            {
                AppLog.Instance.Write("GetTplDetai", AppLog.LogMessageType.Error, ex);
            }

            return(jsonDetailTpl);
        }
Esempio n. 3
0
        public string GetTplListByKindId(string kindid)
        {
            string strJson = string.Empty;

            try
            {
                var             token   = Session["token"] == null ? "XXXXXXX" : Session["token"].ToString();
                TplRequest      tr      = new TplRequest();
                TplListResponse tpllist = tr.TplList(token, kindid, "");
                strJson = JsonHelper.SerializeObject(tpllist);
            }
            catch (Exception ex)
            {
                AppLog.Instance.Write("GetTplListByKindId", AppLog.LogMessageType.Error, ex);
            }
            return(strJson);
        }