/// <summary> /// Converts an <see cref="HD"/> instance to an <see cref="AssigningAuthority"/> instance. /// </summary> /// <param name="id">The id value to be converted.</param> /// <returns>Returns the converted assigning authority.</returns> public static AssigningAuthority ConvertAssigningAuthority(HD id, List <IResultDetail> details) { var assigningAuthorityRepositoryService = ApplicationContext.Current.GetAssigningAuthorityService(); AssigningAuthority assigningAuthority = null; if (id == null) { details.Add(new MandatoryElementMissingResultDetail(ResultDetailType.Error, null, null)); return(null); } if (!string.IsNullOrEmpty(id.NamespaceID.Value)) { assigningAuthority = assigningAuthorityRepositoryService.Find(a => a.Name == id.NamespaceID.Value).FirstOrDefault(); } if (!string.IsNullOrEmpty(id.UniversalID.Value)) { assigningAuthority = assigningAuthorityRepositoryService.Find(a => a.Oid == id.UniversalID.Value).FirstOrDefault(); } if (!string.IsNullOrEmpty(id.UniversalIDType.Value) && id.UniversalIDType.Value != "ISO") { details.Add(new NotImplementedResultDetail(ResultDetailType.Warning, ApplicationContext.Current.GetLocaleString("MSGW016"), null)); } return(assigningAuthority); }
/// <summary> /// Convert assigning authortiy to v2 /// </summary> public static HD FromModel(this HD me, AssigningAuthority authority) { me.NamespaceID.Value = authority.DomainName; me.UniversalID.Value = authority.Oid; me.UniversalIDType.Value = !String.IsNullOrEmpty(authority.Oid) ? "ISO" : null; return(me); }
public ActionResult DeletarComputador(ComputadorViewModelExclui computadorViewModelExclui) { try { Computador computador = Mapper.Map <Computador>(computadorViewModelExclui); Fonte fonte = Mapper.Map <Fonte>(computadorViewModelExclui); HD hd = Mapper.Map <HD>(computadorViewModelExclui); MemoriaRAM memoriaRAM = Mapper.Map <MemoriaRAM>(computadorViewModelExclui); PlacaMae placaMae = Mapper.Map <PlacaMae>(computadorViewModelExclui); Processador processador = Mapper.Map <Processador>(computadorViewModelExclui); servicoComputador.Deletar(computador); servicoFonte.Deletar(fonte); servicoHD.Deletar(hd); servicoMemoriaRAM.Deletar(memoriaRAM); servicoPlacaMae.Deletar(placaMae); servicoProcessador.Deletar(processador); TempData["MensagemSucesso"] = "Computador deletado com sucesso!"; return(RedirectToAction("Index")); } catch (Exception ex) { ViewBag.MensagemErro = "Ocorreu um erro, tente novamente ou entre em contato com nosso suporte. Detalhe do erro: " + ex.Message; return(View()); } }
public static void LoadAssetBundleAsync(List <string> sUrlList, UtilLoadAssetsFunction sSucceed, UtilLoadAssetsFunction sError) { UtilLoadAssetsDataAssetBundle assetload = null; List <string> dependencies = new List <string>(); for (int index = 0; index < sUrlList.Count; index++) { string url = string.Intern(sUrlList[index].ToLower()); if (!_hash_list.ContainsKey(url)) { assetload = new UtilLoadAssetsDataAssetBundle(url); _assets_will_load.Add(assetload); /// 地址指针指向这个数组 _hash_list.Add(url, _assets_will_load); _hash_data.Add(url, assetload); /// 对依赖文件进行处理操作 LoadAssetBundleDependencies(url, dependencies); } } /// 对 回调处理 if (null != sSucceed || null != sError) { HD hd = new HD(sUrlList, sSucceed, sError); hd.dependencies = dependencies; _list_hd.Add(hd); } }
public ComputadorFacade() { _memoria = new Memoria(); _hd = new HD(); _cpu = new CPU(); _so = new SO(); _acessorios = new Acessorios(); }
public ActionResult DeleteConfirmed(int id) { HD hd = db.HDs.Find(id); db.HDs.Remove(hd); db.SaveChanges(); return(RedirectToAction("Index")); }
/// <summary> /// 创建fieldtype,如CE,XCN等 /// </summary> /// <param name="parent"></param> /// <param name="product"></param> /// <param name="name"></param> /// <returns></returns> public override abstractType Create(compositeType parent, Enum product, string name) { abstractType tmp = null; switch (product) { case enumField.CE: tmp = new CE(parent, name); break; case enumField.CM: tmp = new CM(parent, name); break; case enumField.CWE: tmp = new CWE(parent, name); break; case enumField.CX: tmp = new CX(parent, name); break; case enumField.DLN: tmp = new DLN(parent, name); break; case enumField.EI: tmp = new EI(parent, name); break; case enumField.ELD: tmp = new ELD(parent, name); break; case enumField.FN: tmp = new FN(parent, name); break; case enumField.HD: tmp = new HD(parent, name); break; case enumField.MSG: tmp = new MSG(parent, name); break; case enumField.PT: tmp = new PT(parent, name); break; case enumField.VID: tmp = new VID(parent, name); break; case enumField.XAD: tmp = new XAD(parent, name); break; case enumField.XCN: tmp = new XCN(parent, name); break; case enumField.XPN: tmp = new XPN(parent, name); break; case enumField.XTN: tmp = new XTN(parent, name); break; case enumField.ERL: tmp = new ERL(parent, name); break; case enumField.FC: tmp = new FC(parent, name); break; case enumField.XON: tmp = new XON(parent, name); break; case enumField.PL: tmp = new PL(parent, name); break; case enumField.CP: tmp = new CP(parent, name); break; case enumField.JCC: tmp = new JCC(parent, name); break; case enumField.TQ: tmp = new TQ(parent, name); break; case enumField.CQ: tmp = new CQ(parent, name); break; default: throw new NotSupportedException(); } return(tmp); }
protected void ResetInputs() { vehicule.Clear(); dateDepart.Clear(); HD.Clear(); dateArivee.Clear(); HA.Clear(); trajet.Clear(); }
//反填活动相册 public HD FanHDxiangce(int Id) { string sql = $"select * from HDxiangce where XZid={Id}"; var dt = DBHelper.ExecuteQuery(sql, System.Data.CommandType.Text); string str = JsonConvert.SerializeObject(dt); HD h = JsonConvert.DeserializeObject <List <HD> >(str).FirstOrDefault(); return(h); }
private static void PopulateMSH( MSH msh, string type, string @event, string id, Identifier sendingApplication, Identifier sendingFacility, Identifier receivingAppliation, Identifier receivingFacility) { // MSH-1 msh.FieldSeparator.Value = "|"; // MSH-2 msh.EncodingCharacters.Value = "^~\\&"; // MSH-3 HD hd = msh.SendingApplication; hd.NamespaceID.Value = sendingApplication.NamespaceId; hd.UniversalID.Value = sendingApplication.UniversalId; hd.UniversalIDType.Value = sendingApplication.UniversalIdType; // MSH-4 hd = msh.SendingFacility; hd.NamespaceID.Value = sendingFacility.NamespaceId; hd.UniversalID.Value = sendingFacility.UniversalId; hd.UniversalIDType.Value = sendingFacility.UniversalIdType; // MSH-5 hd = msh.ReceivingApplication; hd.NamespaceID.Value = receivingAppliation.NamespaceId; hd.UniversalID.Value = receivingAppliation.UniversalId; hd.UniversalIDType.Value = receivingAppliation.UniversalIdType; // MSH-6 hd = msh.ReceivingFacility; hd.NamespaceID.Value = receivingFacility.NamespaceId; hd.UniversalID.Value = receivingFacility.UniversalId; hd.UniversalIDType.Value = receivingFacility.UniversalIdType; // MSH-7 msh.DateTimeOfMessage.TimeOfAnEvent.SetShortDate(DateTime.Now); // MSH-9 msh.MessageType.MessageType.Value = type; msh.MessageType.TriggerEvent.Value = @event; // MSH-10 msh.MessageControlID.Value = GenerateControlId(); // MSH-11 msh.ProcessingID.ProcessingID.Value = "P"; // MSH-12 msh.VersionID.VersionID.Value = "2.3.1"; }
public string VerificaRegistro() { //Variáveis. DA = null; DA = new SqlCeDataAdapter("Select * from CH_Hardware", SQLConn); //Instância DataAdapter com o cod a executar e a conexão TBCH = null; TBCH = new DataTable(); DA.Fill(TBCH); //preenche tabela string Processador, HD, MAC; if (TBCH.Rows.Count == 0) //Se igual a zero, insere na tabela. { SQLConn.Close(); InsereDados(); retorno = "C"; } else //Senão, faz a comparação com o arquivo local. { InformacaoHD("IDHD"); InformacaoHD("Capacidade"); InformacaoHD("EspacoLivre"); InformacaoProcessador("IDProcessador"); InformacaoProcessador("Nome"); InformacaoProcessador("Arquitetura"); InformacaoMemoria("Capacidade"); InformacaoRede(); Processador = TBCH.Rows[0]["SERIALPROCESSADOR"].ToString(); HD = TBCH.Rows[0]["SERIALHD"].ToString(); MAC = TBCH.Rows[0]["EnderecoMAC"].ToString(); if ((Processador.Length <= 1) || (HD.Length <= 1) || (MAC.Length <= 1)) { ExcluirTabela(); CriaTabelaChaveHardware(); //InsereDados(); return("C"); } //Faz a comparação. if ((IDProcessador.Trim() == Processador.Trim()) && (SerialHD.Trim() == HD.Trim()) && (MACRede.Trim() == MAC.Trim())) { retorno = "C"; } else if (MACRede == "") { retorno = "C"; } else { retorno = "N"; } } return(retorno); }
// GET: Computador/EditarrHD/5 public ActionResult EditarHD(int id) { HD hd = servicoHD.RetornarPorID(id); HDViewModelEdita hdViewModelEdita = Mapper.Map <HDViewModelEdita>(hd); hdViewModelEdita.IDComputador = hd.Computadores[0].IDComputador; return(View(hdViewModelEdita)); }
public ActionResult Edit([Bind(Include = "HDId,Nome,Preco")] HD hd) { if (ModelState.IsValid) { db.Entry(hd).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(hd)); }
public ActionResult Create([Bind(Include = "HDId,Nome,Preco")] HD hd) { if (ModelState.IsValid) { db.HDs.Add(hd); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(hd)); }
public void Should_Serialize_FirstComponent() { var field = new HD { NamespaceId = new IS { Value = "HD.NamespaceId" } }; Assert.AreEqual(First, field.ToString()); }
public void Should_Serialize_LastComponent() { var field = new HD { UniversalIdType = new ID { Value = "HD.UniversalIdType" } }; Assert.AreEqual(Last, field.ToString()); }
public void Deletar() { try { HD hd = servico.RetornarPorID(1); servico.Deletar(hd); } catch (Exception ex) { Assert.Fail(ex.Message); } }
private void Selection_Hd(object sender, SelectionChangedEventArgs e) { DataGrid dg = ((DataGrid)sender); HD hd = (HD)dg.Items[dg.SelectedIndex]; EditarHd edit = new EditarHd(hd); edit.Show(); this.Close(); }
///<summary> /// Returns a single repetition of Master File Application Identifier(MFI-2). /// throws HL7Exception if the repetition number is invalid. /// <param name="rep">The repetition number (this is a repeating field)</param> ///</summary> public HD GetMasterFileApplicationIdentifier(int rep) { HD ret = null; try { IType t = this.GetField(2, rep); ret = (HD)t; } catch (System.Exception ex) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected problem obtaining field value. This is a bug.", ex); throw new System.Exception("An unexpected error ocurred", ex); } return(ret); }
public static void CriarHd(string nome, int buffer, bool atualizaMain = false) { Stream saida = File.Open(nome + ".txt", FileMode.Create); HD hd = new HD(); hd.NomeHd = nome; hd.Tamanho = buffer; hd.Imagem = new Imagem(); hd.StatusHd = new StatusHD(); JsonSerializer serializer = new JsonSerializer(); serializer.Converters.Add(new JavaScriptDateTimeConverter()); serializer.NullValueHandling = NullValueHandling.Ignore; serializer.Formatting = Formatting.Indented; using (StreamWriter sw = new StreamWriter(saida, Encoding.UTF8, buffer)) using (JsonWriter writer = new JsonTextWriter(sw)) { serializer.Serialize(writer, hd); } if (atualizaMain) { List <string> main = new List <string>(); saida = File.Open("MainHd.txt", FileMode.Open); using (StreamReader sw = new StreamReader(saida)) { string linha = sw.ReadLine(); while (linha != null) { main.Add(linha); linha = sw.ReadLine(); } } saida = File.Open("MainHd.txt", FileMode.OpenOrCreate); main[0] = (int.Parse(main[0]) + 1) + ""; main.Add(nome); using (StreamWriter sw = new StreamWriter(saida)) { foreach (var item in main) { sw.WriteLine(item); } } } }
private void removeHDButton_Click(object sender, EventArgs e) { { for (int i = 0; i < hdPanel.Controls.Count; i++) { if (((CheckBox)hdPanel.Controls[i]).Checked == true) { HD toBeDeleted = data.getHD(i); data.removeHD(toBeDeleted); } } loadHDs(); } }
private void timer_Main_Tick(object sender, EventArgs e) { float fCPU = CPU.NextValue(); cir_CPU.Value = (int)fCPU; lb_CPU.Text = string.Format("{0:00.0}%", fCPU); float fHD = HD.NextValue(); cir_HD.Value = (int)fHD; lb_HD.Text = string.Format("{0:00.0}GB", fHD); datetime_calendar.Value = DateTime.Now; }
public void TestHashtableDocumentRepresentationWithDot() { var d = new HD { Id = 1, Data = new Hashtable { { "a.b", 1 } } }; var expected = "{ '_id' : 1, 'Data' : { 'a.b' : 1 } }".Replace("'", "\""); var json = d.ToJson(); Assert.AreEqual(expected, json); Assert.Throws <BsonSerializationException>(() => { _collection.Insert(d); }); }
public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } HD hd = db.HDs.Find(id); if (hd == null) { return(HttpNotFound()); } return(View(hd)); }
public static void CriaHdComJson(HD hd, string hdAbir, int buffer) { var saida = File.Open(hdAbir + ".txt", FileMode.CreateNew); JsonSerializer serializer = new JsonSerializer(); serializer.Converters.Add(new JavaScriptDateTimeConverter()); serializer.NullValueHandling = NullValueHandling.Ignore; serializer.Formatting = Formatting.Indented; using (StreamWriter sw = new StreamWriter(saida, Encoding.UTF8, buffer)) using (JsonWriter writer = new JsonTextWriter(sw)) { serializer.Serialize(writer, hd); } }
public void Atualizar() { try { HD hd = servico.RetornarPorID(1); hd.Quantidade = 5; hd.Capacidade = "1TB"; servico.Atualizar(hd); } catch (Exception ex) { Assert.Fail(ex.Message); } }
public void Inserir() { try { HD hd = new HD(); hd.Quantidade = 5; hd.Capacidade = "1TB"; servico.Inserir(hd); } catch (Exception ex) { Assert.Fail(ex.Message); } }
public ActionResult DeleteConfirmed(string id) { var decode = Encryption.decrypt(id); int x = int.Parse(decode); HD hD = db.HD.Find(x); try { db.HD.Remove(hD); db.SaveChanges(); return(View("XoáTCHD")); } catch { return(View("LỗiKhiXóaHD")); } }
public void Should_Serialize_AllComponents() { var field = new HD { NamespaceId = new IS { Value = "HD.NamespaceId" }, UniversalId = new ST { Value = "HD.UniversalId" }, UniversalIdType = new ID { Value = "HD.UniversalIdType" } }; Assert.AreEqual(All, field.ToString()); }
// GET: HDs/Details/5 public ActionResult Details(string id) { var decode = Encryption.decrypt(id); int x = int.Parse(decode); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } HD hD = db.HD.Find(x); if (hD == null) { return(HttpNotFound()); } return(View(hD)); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(HD.PWManage.Model.Config model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Config("); strSql.Append("CName,CInfo)"); strSql.Append(" values ("); strSql.Append("@CName,@CInfo)"); OleDbParameter[] parameters = { new OleDbParameter("@CName", OleDbType.VarChar,255), new OleDbParameter("@CInfo", OleDbType.VarChar,255)}; parameters[0].Value = model.CName; parameters[1].Value = model.CInfo; int rows = DbHelperOleDb.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return true; } else { return false; } }
public void TestHashtableDocumentRepresentationWithDot() { var d = new HD { Id = 1, Data = new Hashtable { { "a.b", 1 } } }; var expected = "{ '_id' : 1, 'Data' : { 'a.b' : 1 } }".Replace("'", "\""); var json = d.ToJson(); Assert.AreEqual(expected, json); Assert.Throws<BsonSerializationException>(() => { _collection.Insert(d); }); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(HD.PWManage.Model.Config model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update Config set "); strSql.Append("CName=@CName,"); strSql.Append("CInfo=@CInfo"); strSql.Append(" where ID=@ID"); OleDbParameter[] parameters = { new OleDbParameter("@CName", OleDbType.VarChar,255), new OleDbParameter("@CInfo", OleDbType.VarChar,255), new OleDbParameter("@ID", OleDbType.Integer,4)}; parameters[0].Value = model.CName; parameters[1].Value = model.CInfo; parameters[2].Value = model.ID; int rows = DbHelperOleDb.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return true; } else { return false; } }
public static int Main_old(String[] args) { try { HD hd = new HD(Delegate_TestClass_delegate26.Hello); int i = 1; IAsyncResult ar = hd.BeginInvoke(out i, null, null); i = 1; hd.EndInvoke(out i, ar); if (0 == i) Log.Comment("PASS"); else Log.Comment("FAIL, i==" + i.ToString()); return i; } catch (System.Exception) { return 1; } return 0; }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(HD.PWManage.Model.Config model) { return dal.Add(model); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(HD.PWManage.Model.Config model) { return dal.Update(model); }