private static void ParseJSON() { //string example = @"{""name"":""John Doe"",""age"":20}"; //OR string example = "{ \"name\":\"John Doe\",\"age\":\"20\" }"; // 1st Way Dictionary <string, string> ObjJSON1 = new JavaScriptSerializer().Deserialize <Dictionary <string, string> >(example); Console.WriteLine(string.Concat("1st Way : ", ObjJSON1["name"], " " + ObjJSON1["age"])); Console.WriteLine(); // 2nd Way dynamic ObjJSON2 = JObject.Parse(example); Console.WriteLine(string.Concat("2nd Way : ", ObjJSON2.name, " " + ObjJSON2.age)); Console.WriteLine(string.Concat("2nd Way : ", ObjJSON2["name"], " " + ObjJSON2["age"])); Console.WriteLine(); // 3rd Way MyDetail ObjJSON3 = JsonConvert.DeserializeObject <MyDetail>(example); Console.WriteLine(string.Concat("3rd Way : ", ObjJSON3.name, " " + ObjJSON3.age)); Console.WriteLine(); // 4th Way DataContractJsonSerializer JSONSerializer = new DataContractJsonSerializer(typeof(MyDetail)); MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(example)); stream.Position = 0; MyDetail ObjJSON4 = (MyDetail)JSONSerializer.ReadObject(stream); Console.WriteLine(string.Concat("4th Way : ", ObjJSON4.name, " " + ObjJSON4.age)); Console.WriteLine(); }
private void initDate() { var vm = this.DataContext as HISGUIMedicineVM; if (vm.CurrentMaterialCheckStore != null) { this.myTableEdit.ClearAllDetails(); if (vm.CurrentMaterialCheckStore.MaterialCheckStoreDetails != null) { List <MyDetail> list = new List <MyDetail>(); foreach (var tem in vm.CurrentMaterialCheckStore.MaterialCheckStoreDetails) { MyDetail myDetail = new MyDetail(); myDetail.ID = tem.StoreRoomMaterialNumID; //myDetail.ExpirationDate = tem.ExpirationDate; //myDetail.BatchID = tem.Batch; myDetail.SingleDose = tem.Num; //if (tem.Material != null) //{ // myDetail.SingleDoseUnit = tem.Material.Unit; // myDetail.Name = tem.Material.Name; // myDetail.Manufacturer = tem.Material.Manufacturer; // myDetail.Specifications = tem.Material.Specifications; //} myDetail.SellPrice = tem.SellPrice; myDetail.StockPrice = tem.StorePrice; myDetail.Total = tem.Num * tem.StorePrice; list.Add(myDetail); } this.myTableEdit.SetAllDetails(list); } } }
void Start() { rb = GetComponent <Rigidbody>(); rb.freezeRotation = true; p_loc_x = (rb.transform.position.x / game_mech.p_x_scale) + game_mech.oriiginx; p_loc_y = (rb.transform.position.z / game_mech.y_scale) + game_mech.oriiginy; MyDetail md = new MyDetail(); md.longitude = p_loc_x; md.latitude = p_loc_y; md.player_id = ros2.id; // md.topic ="/w_personcoordinates"; StringBuilder sb = new StringBuilder(); using (StringWriter sw = new StringWriter(sb)) using (JsonTextWriter writer = new JsonTextWriter(sw)) { writer.QuoteChar = '\''; JsonSerializer ser = new JsonSerializer(); ser.Serialize(writer, md); } // Debug.Log(sb.ToString()); p_location = sb.ToString(); }
private void OnTriggerEnter(Collider other) { // Debug.Log("entered"); //speed = 1; // counter.timeLeft = counter.timeLeft-100; //hdz = true; ++checkhdz; if (checkhdz == 1) { MyDetail md = new MyDetail(); md.player_id = Convert.ToInt32(ros2.id); md.point = -5; // md.topic = "/w_ddzcoordinates"; StringBuilder sb = new StringBuilder(); using (StringWriter sw = new StringWriter(sb)) using (JsonTextWriter writer = new JsonTextWriter(sw)) { writer.QuoteChar = '\''; JsonSerializer ser = new JsonSerializer(); ser.Serialize(writer, md); } playerpointdeductdz = sb.ToString(); playerpointdeductionbool = true; } }
public object updateMyDetail(MyDetail data) { if (data.password != null) { data.password = loginFn.GetMD5((loginAcc + data.password)); } return(cudAjaxResult(Repository.UpdateMyDetail((int)loginID, data))); }
public int UpdateMyDetail(int loginID, MyDetail data) { using (var trans = _DbContext.Database.BeginTransaction()){ var oDic = new Dictionary <string, string> { }; var nDic = new Dictionary <string, string> { }; var opLog = new OperateLog() { operateID = loginID, employeeID = loginID, active = "更新", category = "員工資料", createTime = definePara.dtNow() }; int psCount = 0, agCount = 0; try { if (data.password != null) { var context = _DbContext.accounts.FirstOrDefault(b => b.ID == loginID); if (context != null) { context.password = data.password; context.lastOperaAccID = loginID; context.updateTime = definePara.dtNow(); psCount = _DbContext.SaveChanges(); } } var context2 = _DbContext.employeedetails.FirstOrDefault(b => b.accountID == loginID); if (context2 != null) { toNameFn.AddUpEmployeeDetail_convertToDic(ref oDic, context2); context2.myAgentID = data.myAgentID; context2.agentEnable = data.agentEnable; context2.lastOperaAccID = loginID; context2.updateTime = definePara.dtNow(); agCount = _DbContext.SaveChanges(); setPrincipalAgent(loginID, context2.myAgentID, context2.agentEnable); } if (psCount == 1 || agCount == 1) { if (agCount == 1) { toNameFn.AddUpEmployeeDetail_convertToDic(ref nDic, context2); } opLog.content += psCount == 0?"" : $"修改了密碼,"; opLog.content += (agCount == 1? toNameFn.AddUpEmployeeDetail_convertTotext(nDic, oDic) : ""); saveOperateLog(opLog); } trans.Commit(); } catch (Exception ex) { recordError(ex); return(0); } return((psCount == 1 || agCount == 1)? 1 : 0); } }
private void ShowDetails(CommContracts.MedicineDoctorAdvice doctorAdvice, CommContracts.DoctorAdviceContentEnum doctorAdviceContentEnum) { if (doctorAdvice == null) { return; } CommClient.Medicine myd = new CommClient.Medicine(); CommContracts.Medicine medicine = new CommContracts.Medicine(); List <MyDetail> list = new List <MyDetail>(); foreach (var tem in doctorAdvice.MedicineDoctorAdviceDetails) { MyDetail doctorAdviceDetail = new MyDetail(); //doctorAdviceDetail.GroupNum = tem.GroupNum; doctorAdviceDetail.ID = tem.MedicineID; medicine = myd.GetMedicine(tem.MedicineID); doctorAdviceDetail.Name = medicine.Name; doctorAdviceDetail.Specifications = medicine.Specifications; doctorAdviceDetail.SingleDose = tem.AllNum; //doctorAdviceDetail.SingleDose = tem.SingleDose; //doctorAdviceDetail.Usage = tem.Usage; //doctorAdviceDetail.DDDS = tem.DDDS; //doctorAdviceDetail.DaysNum = tem.DaysNum; //doctorAdviceDetail.IntegralDose = tem.IntegralDose; //doctorAdviceDetail.Illustration = tem.Illustration; list.Add(doctorAdviceDetail); } if (doctorAdviceContentEnum == CommContracts.DoctorAdviceContentEnum.西药成药) { this.XiChengDoctorAdviceMsg.Text = doctorAdvice.ToString(); myXiChengTableEdit.SetAllDetails(list); myXiChengTableEdit.IsEnabled = false; } else if (doctorAdviceContentEnum == CommContracts.DoctorAdviceContentEnum.中药) { this.ZhongDoctorAdviceMsg.Text = doctorAdvice.ToString(); myZhongTableEdit.SetAllDetails(list); myZhongTableEdit.IsEnabled = false; } }
// Update is called once per frame void Update() { if (stop == 0) { hcs = GameObject.FindGameObjectsWithTag("hhc"); hdcs = GameObject.FindGameObjectsWithTag("hdz"); foundclues = new int[game_mech.counter2]; stop++; // Debug.Log(hcs.Length); // Debug.Log(hdcs.Length); } if (counter.timeLeft > 0) { move = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical")); transform.position += move * speed * Time.deltaTime; // Debug.Log(speed); p_loc_x = (rb.transform.position.x / game_mech.p_x_scale) + game_mech.oriiginx; p_loc_y = (rb.transform.position.z / game_mech.y_scale) + game_mech.oriiginy; MyDetail md = new MyDetail(); md.longitude = p_loc_x; md.latitude = p_loc_y; md.player_id = ros2.id; // md.topic ="/w_personcoordinates"; StringBuilder sb = new StringBuilder(); using (StringWriter sw = new StringWriter(sb)) using (JsonTextWriter writer = new JsonTextWriter(sw)) { writer.QuoteChar = '\''; JsonSerializer ser = new JsonSerializer(); ser.Serialize(writer, md); } // Debug.Log(sb.ToString()); p_location = sb.ToString(); // Debug.Log(p_location); //p_location = "Longitude: " + p_loc_x.ToString() + " Latitude: " + p_loc_y.ToString(); } }
private void ShowDetails(CommContracts.TherapyDoctorAdvice therapy) { if (therapy == null) { return; } List <MyDetail> list = new List <MyDetail>(); foreach (var tem in therapy.TherapyDoctorAdviceDetails) { MyDetail recipeDetail = new MyDetail(); recipeDetail.ID = tem.TherapyID; recipeDetail.Name = tem.Therapy.Name; recipeDetail.SingleDose = tem.AllNum; recipeDetail.Illustration = tem.Remarks; list.Add(recipeDetail); } this.TherapyMsg.Text = therapy.ToString(); this.myTableEdit.SetAllDetails(list); this.myTableEdit.IsEnabled = false; }
private void initDate() { var vm = this.DataContext as HISGUIMedicineVM; if (vm.CurrentMedicineOutStore != null) { this.myTableEdit.ClearAllDetails(); //if (vm.CurrentMedicineOutStore.FromSupplier != null) // this.SupplierEdit.Text = vm.CurrentMedicineOutStore.FromSupplier.Name; // 界面上的没起作用 if (vm.CurrentMedicineOutStore.MedicineOutStoreDetails != null) { List <MyDetail> list = new List <MyDetail>(); foreach (var tem in vm.CurrentMedicineOutStore.MedicineOutStoreDetails) { MyDetail myDetail = new MyDetail(); myDetail.ID = tem.ID; myDetail.SingleDose = tem.Num; if (tem.StoreRoomMedicineNum != null) { myDetail.ExpirationDate = tem.StoreRoomMedicineNum.ExpirationDate; myDetail.BatchID = tem.StoreRoomMedicineNum.Batch; if (tem.StoreRoomMedicineNum.Medicine != null) { myDetail.SingleDoseUnit = tem.StoreRoomMedicineNum.Medicine.Unit; myDetail.Name = tem.StoreRoomMedicineNum.Medicine.Name; myDetail.Manufacturer = tem.StoreRoomMedicineNum.Medicine.Manufacturer; myDetail.Specifications = tem.StoreRoomMedicineNum.Medicine.Specifications; } } myDetail.SellPrice = tem.SellPrice; myDetail.StockPrice = tem.StorePrice; myDetail.Total = tem.Num * tem.StorePrice; list.Add(myDetail); } this.myTableEdit.SetAllDetails(list); } } }
private void ShowDetails(CommContracts.MaterialDoctorAdvice materialBill) { if (materialBill == null) { return; } List <MyDetail> list = new List <MyDetail>(); foreach (var tem in materialBill.MaterialDoctorAdviceDetails) { MyDetail recipeDetail = new MyDetail(); recipeDetail.ID = tem.MaterialDoctorAdviceID; recipeDetail.Name = tem.Material.Name; recipeDetail.SingleDose = tem.AllNum; recipeDetail.Illustration = tem.Remarks; list.Add(recipeDetail); } MaterialDoctorAdviceMsg.Text = materialBill.ToString(); this.myTableEdit.SetAllDetails(list); this.myTableEdit.IsEnabled = false; }
private void ShowDetails(CommContracts.AssayDoctorAdvice assay) { if (assay == null) { return; } List <MyDetail> list = new List <MyDetail>(); foreach (var tem in assay.AssayDoctorAdviceDetails) { MyDetail assayDetail = new MyDetail(); assayDetail.ID = tem.AssayID; assayDetail.Name = tem.Assay.Name; assayDetail.SingleDose = tem.AllNum; assayDetail.Illustration = tem.Remarks; list.Add(assayDetail); } this.AssayMsg.Text = assay.ToString(); this.myTableEdit.SetAllDetails(list); this.myTableEdit.IsEnabled = false; }
void OnCollisionEnter(Collision collision) { if (collision.gameObject.tag == "wall") // or if(gameObject.CompareTag("YourWallTag")) { clue = false; ++checkcollision; rb.velocity = Vector3.zero; rb.angularVelocity = Vector3.zero; move = Vector3.zero; bound_x1 = (collision.gameObject.GetComponent <MeshFilter>().mesh.bounds.center.x - collision.gameObject.GetComponent <MeshFilter>().mesh.bounds.extents.x) * -1; bound_x2 = (collision.gameObject.GetComponent <MeshFilter>().mesh.bounds.center.x + collision.gameObject.GetComponent <MeshFilter>().mesh.bounds.extents.x) * -1; bound_z1 = (collision.gameObject.GetComponent <MeshFilter>().mesh.bounds.center.z - collision.gameObject.GetComponent <MeshFilter>().mesh.bounds.extents.z) * -1; bound_z2 = (collision.gameObject.GetComponent <MeshFilter>().mesh.bounds.center.z + collision.gameObject.GetComponent <MeshFilter>().mesh.bounds.extents.z) * -1; foreach (GameObject hc in hcs) { // Debug.Log(bound_x1); // Debug.Log(bound_x2); // Debug.Log(bound_z1); // Debug.Log(bound_z2); // Debug.Log(hc.transform.localPosition); // Debug.Log(hc.transform.position.x); // Debug.Log(hc.transform.position.y); // Debug.Log(hc.transform.position.z); if (bound_x2 < hc.transform.position.x && hc.transform.position.x < bound_x1 && bound_z2 < hc.transform.position.z && hc.transform.position.z < bound_z1) { if (hc.GetComponent <Text>().text == "Treasure") { clue = true; GameObject.Find("gamestatus").GetComponent <Text>().text = "You found the treasure!!!"; ++treasurefound; if (treasurefound == 1) { MyDetail md = new MyDetail(); md.player_id = Convert.ToInt32(ros2.id); md.point = 20; // md.topic = "/w_ddzcoordinates"; StringBuilder sb = new StringBuilder(); using (StringWriter sw = new StringWriter(sb)) using (JsonTextWriter writer = new JsonTextWriter(sw)) { writer.QuoteChar = '\''; JsonSerializer ser = new JsonSerializer(); ser.Serialize(writer, md); } playerpointaddition = sb.ToString(); playerpointadditionbool = true; } } else { if (foundclues.Count(x => x == Convert.ToInt32(getBetween(hc.GetComponent <Text>().text, "\'", "\'"))) == 0) { clue = true; //Debug.Log("here in the clue"); foundclues[foundcluescounter] = Convert.ToInt32(getBetween(hc.GetComponent <Text>().text, "\'", "\'")); ++foundcluescounter; if (GameObject.Find("Clues").GetComponent <Text>().text == "Clues Placeholder") { GameObject.Find("Clues").GetComponent <Text>().text = hc.GetComponent <Text>().text.Substring(hc.GetComponent <Text>().text.LastIndexOf(':') + 1); MyDetail md = new MyDetail(); md.player_id = Convert.ToInt32(ros2.id); md.point = 10; // md.topic = "/w_ddzcoordinates"; StringBuilder sb = new StringBuilder(); using (StringWriter sw = new StringWriter(sb)) using (JsonTextWriter writer = new JsonTextWriter(sw)) { writer.QuoteChar = '\''; JsonSerializer ser = new JsonSerializer(); ser.Serialize(writer, md); } playerpointaddition = sb.ToString(); playerpointadditionbool = true; } else { clue = true; GameObject.Find("Clues").GetComponent <Text>().text = GameObject.Find("Clues").GetComponent <Text>().text + ", " + hc.GetComponent <Text>().text.Substring(hc.GetComponent <Text>().text.LastIndexOf(':') + 1); MyDetail md = new MyDetail(); md.player_id = Convert.ToInt32(ros2.id); md.point = 10; // md.topic = "/w_ddzcoordinates"; StringBuilder sb = new StringBuilder(); using (StringWriter sw = new StringWriter(sb)) using (JsonTextWriter writer = new JsonTextWriter(sw)) { writer.QuoteChar = '\''; JsonSerializer ser = new JsonSerializer(); ser.Serialize(writer, md); } playerpointaddition = sb.ToString(); playerpointadditionbool = true; } } } } } if (checkcollision == 1 && clue == false) { // Debug.Log("here out the clue"); // Debug.Log("Entered"); playerpointadditionbool = true; MyDetail md = new MyDetail(); md.player_id = Convert.ToInt32(ros2.id); md.point = -2; // md.topic = "/w_ddzcoordinates"; StringBuilder sb = new StringBuilder(); using (StringWriter sw = new StringWriter(sb)) using (JsonTextWriter writer = new JsonTextWriter(sw)) { writer.QuoteChar = '\''; JsonSerializer ser = new JsonSerializer(); ser.Serialize(writer, md); } playerpointaddition = sb.ToString(); } } }
public MyMasterPage() { Master = new MyMenu(); Detail = new MyDetail(); }