コード例 #1
0
        /// <summary>
        /// 获取团队信息
        /// </summary>
        public void GetTeamInfo()
        {
            int     teamid = int.Parse(nv["teamid"].ToString());
            DataSet ds     = new T_Team().GetTeamParent(new E_Team()
            {
                TeamID = teamid, EnterpriseID = ep.EnterpriceID
            });
            JsonArrayCollection jac = new JsonArrayCollection();

            if (MLMGC.COMP.Data.DataSetIsNotNull(ds))
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    JsonObjectCollection colDR = new JsonObjectCollection();
                    colDR.Add(new JsonStringValue("text", dr["TeamName"].ToString()));
                    colDR.Add(new JsonStringValue("value", dr["TeamID"].ToString()));
                    jac.Add(colDR);
                }
            }
            else
            {
                JsonObjectCollection colDR = new JsonObjectCollection();
                colDR.Add(new JsonStringValue("text", "无"));
                colDR.Add(new JsonStringValue("value", "0"));
                jac.Add(colDR);
            }
            HttpContext.Current.Response.Write(jac.ToString());
        }
コード例 #2
0
        public static bool JsonOutput(string filename, List <Core.Node> ChildList)
        {
            JsonUtility.GenerateIndentedJsonText = true;
            JsonArrayCollection collection = new JsonArrayCollection("Map");

            foreach (var child in ChildList)
            {
                JsonObjectCollection obj = new JsonObjectCollection();
                JsonArrayCollection  array;
                float[] arrayValue;

                // class Name
                obj.Add(new JsonStringValue("Class", child.GetClassName()));
                // Object Name
                obj.Add(new JsonStringValue("Name", child.GetObjectName()));

                /////////////// Positon ///////////////
                array      = new JsonArrayCollection("Position");
                arrayValue = child.GetPosition();
                array.Add(new JsonNumericValue(null, arrayValue[0]));
                array.Add(new JsonNumericValue(null, arrayValue[1]));
                array.Add(new JsonNumericValue(null, arrayValue[2]));

                obj.Add(array);

                //////////////// Scale ////////////////
                array      = new JsonArrayCollection("Scale");
                arrayValue = child.GetScale();
                array.Add(new JsonNumericValue(null, arrayValue[0]));
                array.Add(new JsonNumericValue(null, arrayValue[1]));
                array.Add(new JsonNumericValue(null, arrayValue[2]));

                obj.Add(array);

                ///////////// Front Vector ////////////
                array      = new JsonArrayCollection("FrontVector");
                arrayValue = child.GetFrontVector();
                array.Add(new JsonNumericValue(null, arrayValue[0]));
                array.Add(new JsonNumericValue(null, arrayValue[1]));
                array.Add(new JsonNumericValue(null, arrayValue[2]));

                obj.Add(array);


                // Add This Object
                collection.Add(obj);
            }
            JsonObjectCollection root = new JsonObjectCollection();

            root.Add(collection);
            System.IO.File.WriteAllText("test.json", root.ToString());

            return(true);
        }
コード例 #3
0
        /// <summary>
        /// 获取最新微博信息
        /// </summary>
        public void NewList()
        {
            int weiboid = 0;

            if (!int.TryParse(nv["weiboid"], out weiboid))
            {
                //return;
            }
            E_Weibo data = new E_Weibo();

            data.EnterpriseID = ep.EnterpriceID;
            data.WeiboID      = weiboid;
            T_Weibo             bll = new T_Weibo();
            DataTable           dt  = bll.GetNewList(data);
            JsonArrayCollection jac = new JsonArrayCollection();

            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    JsonObjectCollection colDR = new JsonObjectCollection();
                    colDR.Add(new JsonStringValue("weiboid", dr["weiboid"].ToString()));
                    colDR.Add(new JsonStringValue("username", dr["TrueName"].ToString()));
                    colDR.Add(new JsonStringValue("date", dr["AddDate"].ToString()));
                    colDR.Add(new JsonStringValue("showdate", WEIBOHelper.ShowTime(dr["AddDate"].ToString())));
                    colDR.Add(new JsonStringValue("weibo", dr["Detail"].ToString()));
                    colDR.Add(new JsonStringValue("img", MLMGC.COMP.Config.GetEnterpriseAvatarUrl(dr["Avatar"].ToString())));
                    jac.Add(colDR);
                }
            }
            HttpContext.Current.Response.Write("{\"list\":" + jac.ToString() + "}");
        }
コード例 #4
0
        public static int Main(String[] args)
        {
            string func = string.Empty;
            string arg  = "arg";

            JsonObjectCollection collection    = new JsonObjectCollection();
            JsonArrayCollection  argCollection = new JsonArrayCollection("args");

            if (args.Length > 1)
            {
                func = args[0];
                collection.Add(new JsonStringValue("func", func));

                for (int i = 1; i < args.Length; i++)
                {
                    argCollection.Add(new JsonStringValue(arg + i, args[i]));
                }
            }
            collection.Add(argCollection);

            string s = collection.ToString();

            s = s + "<EOF>";

            Console.WriteLine(s);

            StartClient(s);

            return(0);
        }
コード例 #5
0
        public static void SaveDatabase(List <Idol> idols)
        {
            CheckDirectory();

            JsonArrayCollection root = new JsonArrayCollection();

            foreach (Idol idol in idols)
            {
                JsonObjectCollection obj = new JsonObjectCollection();
                obj.Add(new JsonNumericValue("Id", idol.Id));
                obj.Add(new JsonStringValue("Rarity", idol.Rarity.ToString()));
                obj.Add(new JsonNumericValue("RarityNumber", idol.RarityNumber));
                obj.Add(new JsonStringValue("Type", idol.Type.ToString()));
                obj.Add(new JsonNumericValue("Vocal", idol.Vocal));
                obj.Add(new JsonNumericValue("Dance", idol.Dance));
                obj.Add(new JsonNumericValue("Visual", idol.Visual));
                obj.Add(new JsonStringValue("Name", idol.Name));
                obj.Add(new JsonStringValue("OriginalName", idol.OriginalName));
                obj.Add(new JsonStringValue("CenterSkill", idol.CenterSkill.ToString()));
                obj.Add(new JsonStringValue("CenterSkillType", idol.CenterSkillType.ToString()));
                obj.Add(new JsonStringValue("CenterSkillCondition", idol.CenterSkillCondition.ToString()));
                obj.Add(new JsonStringValue("Skill", idol.Skill.ToString()));
                root.Add(obj);
            }

            using (StreamWriter sw = new StreamWriter(DataPath)) {
                sw.Write(root);
            }
        }
コード例 #6
0
ファイル: EP.ashx.cs プロジェクト: i-sync/minglubao
        /// <summary>
        /// 获取当前显示的预约客户
        /// </summary>
        private void GetNowReservation()
        {
            string ids = nv["ids"];

            if (!string.IsNullOrEmpty(ids) && !MLMGC.COMP.StringUtil.IsStringArrayList(ids))
            {
                HttpContext.Current.Response.Write("Error");
                return;
            }
            DataTable dt = new T_ClientInfoHelper().GetReservationNow(new E_Reservation()
            {
                EnterpriseID  = bp.EnterpriceID,
                EPUserTMRID   = bp.EPUserTMRID,
                ClientInfoIDs = ids
            });
            JsonArrayCollection jac = new JsonArrayCollection();

            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    JsonObjectCollection colDR = new JsonObjectCollection();
                    colDR.Add(new JsonStringValue("nid", dr["ReservationID"].ToString()));
                    colDR.Add(new JsonStringValue("id", dr["ClientInfoID"].ToString()));
                    colDR.Add(new JsonStringValue("name", dr["ClientName"].ToString()));
                    colDR.Add(new JsonStringValue("date", Convert.ToDateTime(dr["ReservationDate"].ToString()).ToString("yyyy-MM-dd HH:mm")));
                    colDR.Add(new JsonStringValue("minute", dr["AdvanceMinute"].ToString()));
                    colDR.Add(new JsonStringValue("type", dr["ReType"].ToString()));
                    jac.Add(colDR);
                }
            }
            HttpContext.Current.Response.Write(jac.ToString());
        }
コード例 #7
0
        public static JsonObjectCollection ConvertStatisticToJson(SpeedStatistics statistic, string statisticName)
        {
            JsonObjectCollection jsonTest         = new JsonObjectCollection(statisticName);
            JsonArrayCollection  jsonRecords      = new JsonArrayCollection("Records");
            JsonArrayCollection  jsonTime         = new JsonArrayCollection("Time");
            JsonArrayCollection  jsonAverageSpeed = new JsonArrayCollection("AverageSpeed");
            JsonArrayCollection  jsonMomentSpeed  = new JsonArrayCollection("MomentSpeed");

            for (int i = 0; i < BenchmarkTest.INTERVAL_COUNT; i++)
            {
                // Number of records & timespan.
                var rec = statistic.GetRecordAt(i);
                jsonRecords.Add(new JsonNumericValue(rec.Key));
                jsonTime.Add(new JsonNumericValue(rec.Value.TotalMilliseconds));

                // Average speed.
                var averageSpeed = statistic.GetAverageSpeedAt(i);
                jsonAverageSpeed.Add(new JsonNumericValue(averageSpeed));


                // Moment write speed.
                var momentSpeed = statistic.GetMomentSpeedAt(i);
                jsonMomentSpeed.Add(new JsonNumericValue(momentSpeed));
            }

            jsonTest.Add(jsonRecords);
            jsonTest.Add(jsonTime);
            jsonTest.Add(jsonAverageSpeed);
            jsonTest.Add(jsonMomentSpeed);

            return(jsonTest);
        }
コード例 #8
0
ファイル: RealTimeMeth.cs プロジェクト: leejh0317/Capstone
        public void RealTimeDownload(List <string> chatDownloadList)   //채티방 접속 중 실시간 다운로드 함수
        {
            JsonObjectCollection jsonDownloadObject  = new JsonObjectCollection();
            JsonArrayCollection  jsonArrayCollection = new JsonArrayCollection("uploadList");

            jsonDownloadObject.Add(new JsonStringValue("userId", UserInfo.userId));
            jsonDownloadObject.Add(new JsonStringValue("roomId", Chat_Form.roomId));

            for (int i = 0; i < chatDownloadList.Count; i++)
            {
                jsonArrayCollection.Add(new JsonStringValue(null, chatDownloadList[i]));
                JsonSend.fileName = chatDownloadList[i];
            }

            JsonSend jsonSend = new JsonSend();

            jsonDownloadObject.Add(jsonArrayCollection);

            string jsonStringRT = jsonDownloadObject.ToString();
            string jsonResultRT = jsonSend.JsonSendToServer(jsonStringRT, 6);

            Debug.WriteLine("<Chat_Form> real time download json send : " + jsonStringRT);
            Debug.WriteLine("<Chat_Form> real time download json response : " + jsonResultRT);

            if (jsonResultRT.Equals("created file"))
            {
                Debug.WriteLine("실시간 파일 생성 완료");
            }

            chatDownloadList.Clear();
        }
コード例 #9
0
        /// <summary>
        /// 获取最新微博信息
        /// </summary>
        public void TopList()
        {
            int weiboid = 0;

            if (!int.TryParse(nv["weiboid"], out weiboid))
            {
                return;
            }
            T_Weibo   bll = new T_Weibo();
            DataTable dt  = bll.GetMainList(new E_Weibo()
            {
                WeiboID = weiboid, Count = 5
            });
            JsonArrayCollection jac = new JsonArrayCollection();

            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    JsonObjectCollection colDR = new JsonObjectCollection();
                    colDR.Add(new JsonStringValue("weiboid", dr["weiboid"].ToString()));
                    colDR.Add(new JsonStringValue("username", dr["RealName"].ToString()));
                    colDR.Add(new JsonStringValue("date", dr["AddDate"].ToString()));
                    colDR.Add(new JsonStringValue("showdate", WEIBOHelper.ShowTime(dr["AddDate"].ToString())));
                    colDR.Add(new JsonStringValue("weibo", dr["Detail"].ToString()));
                    colDR.Add(new JsonStringValue("img", MLMGC.COMP.Config.GetPersonalAvatarUrl(dr["Avatar"].ToString())));
                    jac.Add(colDR);
                }
            }
            HttpContext.Current.Response.Write("{\"list\":" + jac.ToString() + "}");
        }
コード例 #10
0
        /// <summary>
        /// 自动分配
        /// </summary>
        private void AutoAllot()
        {
            int amount = 0, type = 0;

            int.TryParse(nv["num"], out amount);
            string sort = nv["orderby"];

            int.TryParse(nv["type"], out type);

            //---------------验证数据是否正确---------------
            if (amount <= 0)
            {
                HttpContext.Current.Response.Write("参数错误");
                HttpContext.Current.Response.End();
            }
            if (!(new string[] { "asc", "desc" }).Contains(sort))
            {
                HttpContext.Current.Response.Write("参数错误");
                HttpContext.Current.Response.End();
            }
            if (type < 2 || type > 6)
            {
                HttpContext.Current.Response.Write("参数错误");
                HttpContext.Current.Response.End();
            }

            E_Allot data = new E_Allot();

            data.EnterpriseID = bp.EnterpriceID;
            data.TeamID       = bp.TeamID;
            data.AllotAmount  = amount;
            data.AllotSort    = sort;
            data.SetMode      = type;
            T_Allot   bll = new T_Allot();
            DataTable dt  = bll.AutoAllot(data);

            new MLMGC.BLL.Enterprise.T_Log().Add(new MLMGC.DataEntity.Enterprise.E_Log()
            {
                EnterpriseID = bp.EnterpriceID, UserID = bp.UserID, LogTitle = "自动分配", IP = MLMGC.COMP.Requests.GetRealIP()
            });

            JsonArrayCollection jac = new JsonArrayCollection();

            if (dt != null)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    jac.Add(new JsonObjectCollection()
                    {
                        new JsonStringValue("objName", dr[0].ToString()), new JsonStringValue("Amount", dr[1].ToString())
                    });
                }
                HttpContext.Current.Response.Write("succ");
            }
            else
            {
                HttpContext.Current.Response.Write("error");
            }
        }
コード例 #11
0
ファイル: Setting.cs プロジェクト: shimika/Simplist3
        public static void SaveSetting()
        {
            JsonObjectCollection root = new JsonObjectCollection();

            JsonArrayCollection archive = new JsonArrayCollection("Archive");

            foreach (ArchiveData data in Data.DictArchive.Values.ToList())
            {
                JsonObjectCollection obj = new JsonObjectCollection();

                obj.Add(new JsonStringValue("Title", data.Title));
                obj.Add(new JsonStringValue("Episode", data.Episode.ToString()));

                if (data.SeasonTitle != null)
                {
                    obj.Add(new JsonStringValue("SeasonTitle", data.SeasonTitle));
                }

                archive.Add(obj);
            }

            JsonArrayCollection season = new JsonArrayCollection("Season");

            foreach (SeasonData data in Data.DictSeason.Values.ToList())
            {
                JsonObjectCollection obj = new JsonObjectCollection();

                obj.Add(new JsonStringValue("Title", data.Title));
                obj.Add(new JsonStringValue("Week", data.Week.ToString()));
                obj.Add(new JsonStringValue("TimeString", data.TimeString));
                obj.Add(new JsonStringValue("Keyword", data.Keyword));

                if (data.ArchiveTitle != null)
                {
                    obj.Add(new JsonStringValue("ArchiveTitle", data.ArchiveTitle));
                }

                season.Add(obj);
            }

            JsonObjectCollection setting = new JsonObjectCollection("Setting");

            setting.Add(new JsonStringValue("SaveDirectory", SaveDirectory));
            setting.Add(new JsonStringValue("Tray", Tray.ToString()));
            setting.Add(new JsonStringValue("NoQuestion", NoQuestion.ToString()));
            setting.Add(new JsonStringValue("OldVersion", Version.NowVersion));
            setting.Add(new JsonStringValue("ShowRaws", ShowRaws.ToString()));

            root.Add(archive);
            root.Add(season);
            root.Add(setting);

            lock (locker) {
                using (StreamWriter sw = new StreamWriter(FileSetting)) {
                    sw.Write(root);
                }
            }
        }
コード例 #12
0
        private void PluralPostData(string message)
        {
            string postData = string.Empty;

            int count = this.DicDeviceID.Count;

            if (count > APPLY_COUNT)
            {
                int nCount = 0;

                JsonObjectCollection totalCollection = new JsonObjectCollection();
                JsonObjectCollection Collection      = new JsonObjectCollection("data");
                JsonArrayCollection  arrayCollection = new JsonArrayCollection("registration_ids");

                //Collection.Add(new JsonStringValue("type", type));
                Collection.Add(new JsonStringValue("msg", message));

                foreach (KeyValuePair <Int64, DeviceInfo> each in this.DicDeviceID)
                {
                    if (nCount > APPLY_COUNT)
                    {
                        totalCollection.Add(arrayCollection);
                        totalCollection.Add(Collection);

                        SendGCMNotification(API_KEY, totalCollection.ToString());

                        arrayCollection.Clear();
                        nCount = 0;
                    }
                    arrayCollection.Add(new JsonStringValue(null, each.Value.deviceid));
                    nCount++;
                }
                totalCollection.Add(arrayCollection);
                totalCollection.Add(Collection);

                SendGCMNotification(API_KEY, totalCollection.ToString());
            }
            else
            {
                JsonObjectCollection Collection      = new JsonObjectCollection("data");
                JsonObjectCollection totalCollection = new JsonObjectCollection();
                JsonArrayCollection  arrayCollection = new JsonArrayCollection("registration_ids");

                foreach (KeyValuePair <Int64, DeviceInfo> each in this.DicDeviceID)
                {
                    arrayCollection.Add(new JsonStringValue(null, each.Value.deviceid));
                }

                Collection.Add(new JsonStringValue(null, message));
                totalCollection.Add(arrayCollection);
                totalCollection.Add(Collection);

                SendGCMNotification(API_KEY, totalCollection.ToString());
            }

            SendGCMNotification(API_KEY, postData);
        }
コード例 #13
0
        public static JsonArrayCollection IllustratorText(object source, JsonArrayCollection existingData, bool saveJson)
        {
            JsonArrayCollection data = new JsonArrayCollection();

            Contents.Text.Illustrator.Format textUIFormat = (Contents.Text.Illustrator.Format)source;
            string chipId;

            foreach (Contents.Text.Illustrator.Information information in textUIFormat.Information)
            {
                JsonObjectCollection savedItem = default(JsonObjectCollection);
                JsonObjectCollection item      = new JsonObjectCollection();

                chipId = ((Contents.Text.Assign.TypeInt)information.Assign).Param.ToString(CultureInfo.InvariantCulture);

                if (existingData != null)
                {
                    int Count = existingData.Count;
                    for (int idx = 0; idx < Count; idx++)
                    {
                        if (existingData[idx] != null &&
                            existingData[idx]["jp_name"] == information.Name)
                        {
                            savedItem = (JsonObjectCollection)existingData[idx];
                            existingData.RemoveAt(idx);
                            break;
                        }
                    }
                }

                item["chip"]    = chipId;
                item["jp_CV"]   = information.CV;
                item["tr_CV"]   = "";
                item["jp_name"] = information.Name;
                item["tr_name"] = "";

                if (savedItem != default(JsonObjectCollection))
                {
                    if (!String.IsNullOrEmpty(savedItem["tr_name"]))
                    {
                        information.Name = savedItem["tr_name"];
                        item["tr_name"]  = savedItem["tr_name"];
                    }
                    if (!String.IsNullOrEmpty(savedItem["tr_CV"]))
                    {
                        information.CV = savedItem["tr_CV"];
                        item["tr_CV"]  = savedItem["tr_CV"];
                    }
                }
                if (saveJson)
                {
                    data.Add(item);
                }
            }
            return(data);
        }
コード例 #14
0
        public string ConvertTo(object obj)
        {
            if (obj == null)
            {
                return("");
            }

            string             rtn = "";
            UnitDataCollection udc = null;

            if (obj is UnitDataCollection)
            {
                udc = (UnitDataCollection)obj;
            }
            else
            {
                throw new Exception("QueryByPage2Json无法转化" + obj.GetType().FullName + "类型数据!");
            }

            if (udc.QueryTable != null)
            {
                JsonObjectCollection jsonrtn = new JsonObjectCollection();
                //jsonrtn.Add(new JsonStringValue("Count_Of_OnePage", udc.Count_Of_OnePage + ""));
                jsonrtn.Add(new JsonStringValue("page", udc.CurrentPage + ""));
                //jsonrtn.Add(new JsonStringValue("total", udc.TotalPage + ""));
                jsonrtn.Add(new JsonStringValue("total", udc.TotalRow + ""));

                DataTableStd        dts     = udc.QueryTable;
                JsonArrayCollection jsonobj = new JsonArrayCollection("rows");
                for (int j = 0; j < dts.RowLength; j++)
                {
                    JsonObjectCollection jac = new JsonObjectCollection();
                    foreach (string colname in dts.ColumnNames)
                    {
                        if (dts.ColumnDateType(colname).FullName == typeof(DateTime).FullName)
                        {
                            DateTimeStd dtime = DateTimeStd.ParseStd(dts[j, colname]);
                            jac.Add(new JsonStringValue(colname, dtime != null ? dtime.Value.ToString("yyyy/MM/dd HH:mm:ss") : ""));
                        }
                        else
                        {
                            jac.Add(new JsonStringValue(colname, ComFunc.nvl(dts[j, colname])));
                        }
                    }
                    jsonobj.Add(jac);
                }
                jsonrtn.Add(jsonobj);



                rtn = jsonrtn.ToString();
            }

            return(rtn);
        }
コード例 #15
0
        public static JsonArrayCollection UIText(object source, JsonArrayCollection existingData, bool saveJson)
        {
            JsonArrayCollection data = new JsonArrayCollection();

            Contents.Text.UI.Format textUIFormat = (Contents.Text.UI.Format)source;
            string currentAssign;

            foreach (Contents.Text.UI.Information information in textUIFormat.Information)
            {
                JsonObjectCollection savedItem = default(JsonObjectCollection);
                JsonObjectCollection item      = new JsonObjectCollection();
                if (information.Assign.GetType() == typeof(Contents.Text.Assign.TypeInt))
                {
                    currentAssign = ((Contents.Text.Assign.TypeInt)information.Assign).Param.ToString(CultureInfo.InvariantCulture);
                }
                else
                {
                    currentAssign = ((Contents.Text.Assign.TypeString)information.Assign).Param.Trim();
                }

                if (existingData != null)
                {
                    int Count = existingData.Count;
                    for (int idx = 0; idx < Count; idx++)
                    {
                        if (existingData[idx] != null &&
                            existingData[idx]["jp_text"] == information.Text)
                        {
                            savedItem = (JsonObjectCollection)existingData[idx];
                            existingData.RemoveAt(idx);
                            break;
                        }
                    }
                }

                item["assign"]  = currentAssign;
                item["jp_text"] = information.Text;
                item["tr_text"] = "";

                if (savedItem != default(JsonObjectCollection))
                {
                    if (!String.IsNullOrEmpty(savedItem["tr_text"]))
                    {
                        information.Text = savedItem["tr_text"];
                        item["tr_text"]  = savedItem["tr_text"];
                    }
                }
                if (saveJson)
                {
                    data.Add(item);
                }
            }
            return(data);
        }
コード例 #16
0
ファイル: Back.aspx.cs プロジェクト: sx81128/AppInOneBPM
    //{"data":{ "retFlag": 0, "message": "登录成功。", "userID": 1, "userName": "******", "realName": "管理员", "userType": 1, "roleIDS": "", "email": "", "staffID": 21, "staffName": "管理员", "deptID": 105, "deptName": "", "orgID": 0, "orgName": "", "myDeptIDS": "" },"response":"Checklogin"}
    //private string getJson<MyTable>(MyTable item) where MyTable : ITableImplement, new()
    //{
    //    return getJsonObj(item).ToString();
    //}
    private JsonArrayCollection getJsonObj <MyTable>(List <MyTable> list, string jsonName) where MyTable : ITableImplement, new()
    {
        JsonArrayCollection arrs = new JsonArrayCollection();

        foreach (MyTable item in list)
        {
            arrs.Add(getJsonObj(item, ""));
        }
        arrs.Name = jsonName;
        return(arrs);
    }
コード例 #17
0
        public string Refreshnickarrayinfo(string[] fnickarray)
        {
            JsonObjectCollection ret       = new JsonObjectCollection();
            JsonArrayCollection  jsonArray = new JsonArrayCollection("refreshnickarray");

            for (int i = 0; i < fnickarray.Length; i++)
            {
                jsonArray.Add(new JsonStringValue(null, fnickarray[i]));
            }
            ret.Add(jsonArray);
            return(ret.ToString());
        }
コード例 #18
0
        public static JsonArrayCollection SeraphyRoom(object source, JsonArrayCollection existingData, bool saveJson)
        {
            JsonArrayCollection data = new JsonArrayCollection();

            Contents.Text.SeraphyRoom.Format seraphyFormat = (Contents.Text.SeraphyRoom.Format)source;
            if (seraphyFormat != null)
            {
                Contents.Text.SeraphyRoom.Information information = seraphyFormat.Information[0];
                if (information.Assign != null)
                {
                    foreach (Contents.Text.SeraphyRoom.Information innerInformation in seraphyFormat.Information)
                    {
                        JsonObjectCollection savedItem = default(JsonObjectCollection);
                        JsonObjectCollection item      = new JsonObjectCollection();

                        if (existingData != null)
                        {
                            int Count = existingData.Count;
                            for (int idx = 0; idx < Count; idx++)
                            {
                                if (existingData[idx] != null &&
                                    existingData[idx]["jp_text"] == innerInformation.Text)
                                {
                                    savedItem = (JsonObjectCollection)existingData[idx];
                                    existingData.RemoveAt(idx);
                                    break;
                                }
                            }
                        }


                        item["text_id"] = innerInformation.TextId;
                        item["jp_text"] = innerInformation.Text;
                        item["tr_text"] = "";

                        if (savedItem != default(JsonObjectCollection))
                        {
                            if (!String.IsNullOrEmpty(savedItem["tr_text"]))
                            {
                                innerInformation.Text = savedItem["tr_text"];
                                item["tr_text"]       = savedItem["tr_text"];
                            }
                        }

                        if (saveJson)
                        {
                            data.Add(item);
                        }
                    }
                }
            }
            return(data);
        }
コード例 #19
0
        public string Refreshchatnickarrayinfo(List <string> chatnickarray)
        {
            JsonObjectCollection ret       = new JsonObjectCollection();
            JsonArrayCollection  jsonArray = new JsonArrayCollection("refreshchatnickarray");

            for (int i = 0; i < chatnickarray.Count; i++)
            {
                jsonArray.Add(new JsonStringValue(null, chatnickarray[i]));
            }
            ret.Add(jsonArray);
            return(ret.ToString());
        }
コード例 #20
0
        public static JsonArrayCollection Awakening_Skill_Info(object source, JsonArrayCollection existingData, bool saveJson)
        {
            JsonArrayCollection data = new JsonArrayCollection();

            Contents.Text.ChipAwakeningInfos.Format skillAwakenFormat = (Contents.Text.ChipAwakeningInfos.Format)source;

            foreach (Contents.Text.ChipAwakeningInfos.Information information in skillAwakenFormat.Information)
            {
                JsonObjectCollection savedItem = default(JsonObjectCollection);
                JsonObjectCollection item      = new JsonObjectCollection();

                if (existingData != null)
                {
                    int Count = existingData.Count;
                    for (int idx = 0; idx < Count; idx++)
                    {
                        if (existingData[idx] != null &&
                            existingData[idx]["jp_name"] == information.Name)
                        {
                            savedItem = (JsonObjectCollection)existingData[idx];
                            existingData.RemoveAt(idx);
                            break;
                        }
                    }
                }

                item["id"]      = information.SkillId;
                item["jp_name"] = information.Name;
                item["tr_name"] = "";
                item["jp_desc"] = information.Description;
                item["tr_desc"] = "";

                if (savedItem != default(JsonObjectCollection))
                {
                    if (!String.IsNullOrEmpty(savedItem["tr_desc"]))
                    {
                        information.Description = savedItem["tr_desc"];
                        item["tr_desc"]         = savedItem["tr_desc"];
                    }
                    if (!String.IsNullOrEmpty(savedItem["tr_name"]))
                    {
                        information.Name = savedItem["tr_name"];
                        item["tr_name"]  = savedItem["tr_name"];
                    }
                }
                if (saveJson)
                {
                    data.Add(item);
                }
            }
            return(data);
        }
コード例 #21
0
        public static JsonArrayCollection Title(object source, JsonArrayCollection existingData, bool saveJson)
        {
            JsonArrayCollection data = new JsonArrayCollection();

            Contents.Story.Title.Format storyTitle = (Contents.Story.Title.Format)source;
            if (storyTitle != null)
            {
                foreach (Contents.Story.Title.Information information in storyTitle.Information)
                {
                    int i = 0;
                    for (int idx = 0; idx < information.TitleList.Length; idx++)
                    {
                        JsonObjectCollection savedItem = default(JsonObjectCollection);
                        var param = information.TitleList[idx];
                        JsonObjectCollection item = new JsonObjectCollection();

                        if (existingData != null)
                        {
                            int Count = existingData.Count;
                            for (int idy = 0; idy < Count; idy++)
                            {
                                if (existingData[idy] != null &&
                                    existingData[idy]["jp_title"] == param)
                                {
                                    savedItem = (JsonObjectCollection)existingData[idy];
                                    existingData.RemoveAt(idy);
                                    break;
                                }
                            }
                        }

                        item["title_id"] = information.TitleID;
                        item["jp_title"] = param;
                        item["tr_title"] = "";
                        if (savedItem != default(JsonObjectCollection))
                        {
                            if (!String.IsNullOrEmpty(savedItem["tr_title"]))
                            {
                                information.TitleList[idx] = savedItem["tr_title"];
                                item["tr_title"]           = savedItem["tr_title"];
                            }
                        }
                        i++;
                        if (saveJson)
                        {
                            data.Add(item);
                        }
                    }
                }
            }
            return(data);
        }
コード例 #22
0
ファイル: e.aspx.cs プロジェクト: i-sync/minglubao
        /// <summary>
        /// 房间列表
        /// </summary>
        protected void RoomList()
        {
            JsonArrayCollection jac = new JsonArrayCollection();

            for (var i = 0; i < 4; i++)
            {
                JsonObjectCollection colDR = new JsonObjectCollection();
                colDR.Add(new JsonStringValue("roomid", "1000" + i));
                colDR.Add(new JsonStringValue("roomname", "团队1000" + i));
                jac.Add(colDR);
            }
            Response.Write(string.Format("{0}({1})", nv["jsoncallback"], "[{\"roomid\": \"10000\",\"roomname\": \"团队10000\"},{\"roomid\": \"10001\",\"roomname\": \"团队10001\"}]"));
        }
コード例 #23
0
        public static JsonArrayCollection ChipAwakeningExplainTokens(object source, JsonArrayCollection existingData, bool saveJson)
        {
            JsonArrayCollection data = new JsonArrayCollection();

            Contents.Text.ChipAwakeningExplainTokens.Format tokensTitle = (Contents.Text.ChipAwakeningExplainTokens.Format)source;
            if (tokensTitle != null)
            {
                foreach (Contents.Text.ChipAwakeningExplainTokens.Information information in tokensTitle.Information)
                {
                    int i = 0;
                    for (int idx = 0; idx < information.Tokens.Length; idx++)
                    {
                        JsonObjectCollection savedItem = default(JsonObjectCollection);
                        var param = information.Tokens[idx];
                        JsonObjectCollection item = new JsonObjectCollection();

                        if (existingData != null)
                        {
                            int Count = existingData.Count;
                            for (int idy = 0; idy < Count; idy++)
                            {
                                if (existingData[idy] != null &&
                                    existingData[idy]["jp_token"] == param)
                                {
                                    savedItem = (JsonObjectCollection)existingData[idy];
                                    existingData.RemoveAt(idy);
                                    break;
                                }
                            }
                        }

                        item["jp_token"] = param;
                        item["tr_token"] = "";
                        if (savedItem != default(JsonObjectCollection))
                        {
                            if (!String.IsNullOrEmpty(savedItem["tr_token"]))
                            {
                                information.Tokens[idx] = savedItem["tr_token"];
                                item["tr_token"]        = savedItem["tr_token"];
                            }
                        }
                        i++;
                        if (saveJson)
                        {
                            data.Add(item);
                        }
                    }
                }
            }
            return(data);
        }
コード例 #24
0
        public object Json_RQ4RateCheck(string rateKey)
        {
            JsonObjectCollection res = new JsonObjectCollection();

            JsonArrayCollection  rooms       = new JsonArrayCollection("rooms");
            JsonObjectCollection rateKeyItem = new JsonObjectCollection();

            rateKeyItem.Add(new JsonStringValue("rateKey", rateKey));
            rooms.Add(new JsonObjectCollection(null, rateKeyItem));

            res.Add(rooms);

            return(res);
        }
コード例 #25
0
ファイル: JsonHelp.cs プロジェクト: jqmtony/FatTalkClient
        public string makechatnickinfo(string[] makechatarray, string nickname)
        {
            JsonObjectCollection ret = new JsonObjectCollection();

            ret.Add(new JsonStringValue(Jsonname.Nickname, nickname));
            JsonArrayCollection jsonArray = new JsonArrayCollection("makechatarray");

            for (int i = 0; i < makechatarray.Length; i++)
            {
                jsonArray.Add(new JsonStringValue(null, makechatarray[i]));
            }
            ret.Add(jsonArray);
            return(ret.ToString());
        }
コード例 #26
0
ファイル: DataSet2Json.cs プロジェクト: redwolf0817/EFFC3.0
        public string ConvertTo(object obj)
        {
            string rtn = "";

            if (obj == null)
            {
                return("");
            }

            DataSet ds = null;

            if (obj is DataSet)
            {
                ds = (DataSetStd)obj;
            }
            else
            {
                throw new Exception("DataSet2Json无法转化" + obj.GetType().FullName + "类型数据!");
            }

            JsonObjectCollection jsonrtn = new JsonObjectCollection();

            for (int i = 0; i < ds.Tables.Count; i++)
            {
                DataTableStd        dts     = DataTableStd.ParseStd(ds.Tables[i]);
                JsonArrayCollection jsonobj = new JsonArrayCollection("TableData" + i);
                for (int j = 0; j < dts.RowLength; j++)
                {
                    JsonObjectCollection jac = new JsonObjectCollection();
                    foreach (string colname in dts.ColumnNames)
                    {
                        if (dts.ColumnDateType(colname).FullName == typeof(DateTime).FullName)
                        {
                            DateTimeStd dtime = DateTimeStd.ParseStd(dts[j, colname]);
                            jac.Add(new JsonStringValue(colname, dtime != null ? dtime.Value.ToString("yyyy/MM/dd HH:mm:ss") : ""));
                        }
                        else
                        {
                            jac.Add(new JsonStringValue(colname, ComFunc.nvl(dts[j, colname])));
                        }
                    }
                    jsonobj.Add(jac);
                }
                jsonrtn.Add(jsonobj);
            }

            rtn = "{" + jsonrtn.ToString() + "}";
            return(rtn);
        }
コード例 #27
0
    protected void Page_Load(object sender, EventArgs e)
    {
        JsonObjectCollection root = new JsonObjectCollection();

        SqlConnection objConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString);
        string        strCmd;

        strCmd = @"SELECT 
                     TASKID,PROCESSNAME,PROCESSVERSION,INCIDENT,STEPID,STEPLABEL,RECIPIENT,RECIPIENTTYPE,TASKUSER,ASSIGNEDTOUSER,
                     STATUS,SUBSTATUS,STARTTIME,ENDTIME 
                     FROM ultimusdba.TASKS" + condition();

        objConnection.Open();
        SqlCommand cmd = new SqlCommand(strCmd, objConnection);

        SqlDataReader dr = cmd.ExecuteReader();

        JsonArrayCollection list = new JsonArrayCollection("tasks");

        while (dr.Read())
        {
            {
                JsonObjectCollection sub = new JsonObjectCollection();
                sub.Add(new JsonStringValue("taskid", dr["TASKID"].ToString()));
                sub.Add(new JsonStringValue("processname", dr["PROCESSNAME"].ToString()));
                sub.Add(new JsonStringValue("processversion", dr["PROCESSVERSION"].ToString()));
                sub.Add(new JsonStringValue("incident", dr["INCIDENT"].ToString()));
                sub.Add(new JsonStringValue("stepid", dr["STEPID"].ToString()));
                sub.Add(new JsonStringValue("steplabel", dr["STEPLABEL"].ToString()));
                sub.Add(new JsonStringValue("recipient", dr["RECIPIENT"].ToString()));
                sub.Add(new JsonStringValue("recipienttype", dr["RECIPIENTTYPE"].ToString()));
                sub.Add(new JsonStringValue("taskuser", dr["TASKUSER"].ToString()));
                sub.Add(new JsonStringValue("assignedtouser", dr["ASSIGNEDTOUSER"].ToString()));
                sub.Add(new JsonStringValue("status", dr["STATUS"].ToString()));
                sub.Add(new JsonStringValue("substatus", dr["SUBSTATUS"].ToString()));
                sub.Add(new JsonStringValue("starttime", dr["STARTTIME"].ToString()));
                sub.Add(new JsonStringValue("endtime", dr["ENDTIME"].ToString()));
                sub.Add(new JsonStringValue("url", task(int.Parse(dr["INCIDENT"].ToString()), dr["PROCESSNAME"].ToString())));
                list.Add(sub);
            }
        }
        root.Add(list);
        objConnection.Close();

        Response.AppendHeader("contnet-type", "text/json");
        Response.Write(root.ToString());
        Response.End();
    }
コード例 #28
0
        public object Json_RQ4HotelList()
        {
            JsonObjectCollection res = new JsonObjectCollection();

            JsonObjectCollection stay = new JsonObjectCollection("stay");

            stay.Add(new JsonStringValue("checkIn", String.Format("{0:yyyy-MM-dd}", Convert.ToDateTime(CheckIn.Text))));
            stay.Add(new JsonStringValue("checkOut", String.Format("{0:yyyy-MM-dd}", Convert.ToDateTime(CheckOut.Text))));
            res.Add(stay);

            JsonArrayCollection  occupancies = new JsonArrayCollection("occupancies");
            JsonObjectCollection room1       = new JsonObjectCollection();

            ComboBoxItem roomNumCombo = (ComboBoxItem)RoomNum_CB.SelectedItem;
            int          rooms        = int.Parse(roomNumCombo.Content.ToString());

            ComboBoxItem adultNumCombo = (ComboBoxItem)AdultNum_CB.SelectedItem;
            int          adults        = int.Parse(adultNumCombo.Content.ToString());


            room1.Add(new JsonNumericValue("rooms", rooms));
            room1.Add(new JsonNumericValue("adults", adults));
            room1.Add(new JsonNumericValue("children", 0));
            occupancies.Add(new JsonObjectCollection(null, room1));
            res.Add(occupancies);


            JsonObjectCollection hotels = new JsonObjectCollection("hotels");

            JsonArrayCollection hotel = new JsonArrayCollection("hotel");

            string[] hotel_codes = HotelCodes_TB.Text.ToString().Split(',');



            foreach (string hotel_code in hotel_codes)
            {
                hotel.Add(new JsonNumericValue(null, int.Parse(hotel_code)));
            }


            hotels.Add(hotel);
            res.Add(hotels);

            return(res);
        }
コード例 #29
0
        /// <summary>
        /// 获取分配对象
        /// </summary>
        private void GetObj()
        {
            JsonArrayCollection jac = new JsonArrayCollection();
            //------绑定用户列表------
            DataTable dt = new T_Team().GetTeamMember(new E_Team {
                EnterpriseID = bp.EnterpriceID, TeamID = bp.TeamID
            });

            foreach (DataRow dr in dt.Rows)
            {
                JsonObjectCollection colDR = new JsonObjectCollection();
                colDR.Add(new JsonStringValue("text", string.Format("【{0}】{1}", dr["RoleName"], dr["TrueName"])));
                colDR.Add(new JsonStringValue("value", dr["EPUserTMRID"].ToString()));
                jac.Add(colDR);
            }
            HttpContext.Current.Response.Write(jac.ToString());
        }
コード例 #30
0
        public JsonCollection ConvertTo(object obj)
        {
            if (obj == null)
            {
                return(new JsonObjectCollection());
            }

            DataTableStd dtt = null;

            if (obj is DataTable)
            {
                dtt = DataTableStd.ParseStd(obj);
            }
            else if (obj is DataTableStd)
            {
                dtt = (DataTableStd)obj;
            }
            else
            {
                throw new Exception("DataTable2Json无法转化" + obj.GetType().FullName + "类型数据!");
            }

            JsonArrayCollection jsonobj = new JsonArrayCollection("rows");

            for (int i = 0; i < dtt.RowLength; i++)
            {
                JsonObjectCollection jac = new JsonObjectCollection();
                foreach (string colname in dtt.ColumnNames)
                {
                    if (dtt.ColumnDateType(colname).FullName == typeof(DateTime).FullName)
                    {
                        DateTimeStd dtime = DateTimeStd.ParseStd(dtt[i, colname]);
                        jac.Add(new JsonStringValue(colname, dtime != null ? dtime.Value.ToString("yyyy/MM/dd HH:mm:ss") : ""));
                    }
                    else
                    {
                        jac.Add(new JsonStringValue(colname, ComFunc.nvl(dtt[i, colname])));
                    }
                }
                jsonobj.Add(jac);
            }


            return(jsonobj);
        }