/// <summary> /// 添加新闻 /// </summary> /// <param name="article"></param> /// <param name="relaInfo"></param> public void AddNews(BasicInformation article, Relations relaInfo) { _efDb.Add(article); article.Type = NewsType.TextNews; relaInfo.NewsId = article.ID; _efDb.Add(relaInfo); }
[ActionName("Edit")] //重名处理 public ActionResult EditArticle() { var basicInformation = new BasicInformation(); var relations = new Relations(); //使用白名单更新实体,防止表单绑定分配漏洞 var basicInformationWhite = new[] { "PublishTime", "ExpireDate", "Title", "Description", "Content", "Source", "KeyWords", "IsExtURL", "ExtURL", "Author", "AuthorFirst", "AuthorPhoto", "AuthorCompany", "Image", "AttachFile", "Hits", "SubTitle" //Hits Status Type }; var relationsWhite = new[] { "IsSortTop", "SortTopExpireDate", "Order" //NewsId }; var isValid = TryUpdateModel(basicInformation, basicInformationWhite); isValid = isValid && TryUpdateModel(relations, relationsWhite); if (isValid) { _service.AddNews(basicInformation, relations); return(RedirectToAction("List")); } else { var newsViewWhite = new[] { "PublishTime", "ExpireDate", "Title", "Description", "Content", "Source", "KeyWords", "IsExtURL", "ExtURL", "Author", "AuthorFirst", "AuthorPhoto", "AuthorCompany", "Image", "AttachFile", "Hits", "SubTitle", "IsSortTop", "SortTopExpireDate", "Order" //Hits Status Type }; var news = new NewsView(); isValid = TryUpdateModel(news, newsViewWhite); return(View(news));//返回带错误信息的模型 } //TryValidateModel(basicInformation); }
public ActionResult CreateExperience() { DBmanager dBmanager = new DBmanager(); BasicInformation basicInformation = dBmanager.GetBasicInformationID(); return(View(basicInformation)); }
public static void doAnalyze(Resume resume) { Console.WriteLine("Parsing begin..."); basicInformation = new BasicInformation(); string className = basicInformation.GetType().Name; string mappingKey = formatClassName(className); foreach (string keyword in getMappingDictionaryValue(mappingKey)) { //get zh_section_content regex items. IEnumerable <RegexItem> sectionRegexItems = getRegexItems(resume.Language, "section", "content"); //parser content by section regex items. IEnumerable <Section> sections = getSectionsByKey(resume, sectionRegexItems, keyword); foreach (Section section in sections) { Section_2 section2 = section.newSection2(mappingKey); // schema_0.vmethod_0(section2); } } Console.WriteLine("Parsing done!"); Console.Write("Press any key to exit . . . "); Console.ReadKey(true); }
private void timerReadQueue_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { lock (portColletion) { BasicInformation connection = portColletion.Get(); if (connection == null) { return; } ParameterizedMap param = new ParameterizedMap(); param.Add("base", connection); string responseOut = string.Empty; Worker.IPipeline currentWorker = ObjectPool.Instance.Resolve <Worker.IPipeline>(); if (currentWorker != null) { responseOut = currentWorker.Pull(param); if (!string.IsNullOrEmpty(responseOut) && (responseOut != "[]")) { OnDataReceived(responseOut); } } } }
public ActionResult EditCard(BasicInformation basicInformation) { DBmanager dBmanager = new DBmanager(); dBmanager.UpdateCard(basicInformation); return(RedirectToAction("Index")); }
// Update is called once per frame void Update() { float HPRemain_Length = HP_UI_Length * (BasicInformation.GetRateHP() - 1f); float IntellectRemain_Length = Intellect_UI_Length * (BasicInformation.GetRateIntellect() - 1f); //Debug.Log(BasicInformation.GetRateHP()); HP_Sprite_UI.GetComponent <UISprite>().rightAnchor.absolute = (int)HPRemain_Length; Intellect_Sprite_UI.GetComponent <UISprite>().rightAnchor.absolute = (int)IntellectRemain_Length; //Debug.Log(BasicInformation.GetRemainHP()); if (BasicInformation.GetRemainHP() <= 0.5) { BasicInformation.IsDie = true; BasicInformation.HP = 1; } if (BasicInformation.Day > 15) { if (MissionController.CheckMissionState(24) == 1) { SceneManager.LoadScene("EndVideo"); } else { Debug.Log("请完成任务"); } } if (BasicInformation.Health <= 0) { Debug.Log("Game Over"); DieInterface.SetActive(true); } }
public static async Task <BasicInformation> GetBasicInfoAsync() { try { CloudTable table = await CreateTableAsync("BasicInformation"); TableOperation retrieveOperation = TableOperation.Retrieve <BasicInformation>("BasicInfo", "School"); TableResult result = await table.ExecuteAsync(retrieveOperation); BasicInformation info = result.Result as BasicInformation; if (info != null) { return(info); } else { return(new BasicInformation("School", "Error", "Error", "Error", "https://3.files.edl.io/26ba/18/12/07/184007-50217c07-a14a-4b23-8fb5-0b59a2b3146d.jpg", "41490")); } } catch (StorageException e) { Debug.WriteLine(e.Message); return(new BasicInformation("School", "Error", "Error", "Error", "https://3.files.edl.io/26ba/18/12/07/184007-50217c07-a14a-4b23-8fb5-0b59a2b3146d.jpg", "41490")); } }
public static BasicInformation BasicInformation() { var basicInfoXml = WebClient.XmlGet("api/device/basic_information"); BasicInformation basicInformation = XmlSerialization.Deserialize <BasicInformation>(basicInfoXml); return(basicInformation); }
public ActionResult AddBasicInformation(BasicInformation model, HttpPostedFileBase Image) { if (Session["UserId"] == null) { return(RedirectToAction("Login", "Home")); } if (ModelState.IsValid) { var m = model; DateTime dateTime = DateTime.Now; var userId = Convert.ToInt32(Session["UserId"]); if (Image != null) { string image1 = Image.FileName; string pre = dateTime.Ticks.ToString() + "_" + userId.ToString(); image1 = pre + "_" + image1; model.Image = image1; var image1Path = Path.Combine(Server.MapPath("~/Uploads/Images"), image1); Image.SaveAs(image1Path); } var student = db.Students.Where(s => s.StudentId == userId).FirstOrDefault(); student.BasicInformation = model; db.SaveChanges(); TempData["msg"] = "Information Updated!"; return(RedirectToAction("EditBasicInformation", "Home")); } return(View(model)); }
public void Enter_ResourceArea() { if (BasicInformation.Day > 0 && BasicInformation.FirstEnterResourceArea && BasicInformation.NowWhere == 0) { BasicInformation.EnterResourceArea(); BasicInformation.SetPlace(1); } }
public void Enter_LabArea() { if (BasicInformation.NowWhere != 0) { BasicInformation.EnterLabArea(); BasicInformation.SetPlace(0); } }
public override global::System.Data.DataSet Clone() { BasicInformation cln = ((BasicInformation)(base.Clone())); cln.InitVars(); cln.SchemaSerializationMode = this.SchemaSerializationMode; return(cln); }
public Request() { SellerDetails = new SellerDetails(); BasicInformation = new BasicInformation(); BuyerDetails = new BuyerDetails(); GoodsDetails = new List <GoodsItem>(); TaxDetails = new List <TaxDetail>(); Summary = new Summary(); PayWay = new List <Payment>(); Extend = new Extend(); }
private void RaiseError(BasicInformation connection, Exception ex, string location) { portColletion.Add(connection); if (portColletion.Count > 0) { Console.WriteLine("connection has been restored."); } IErrorLogging log = ObjectPool.Instance.Resolve <IErrorLogging>(); log.Write(string.Format("{0} - {1}", ex, location)); }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) { BasicInformation ds = new BasicInformation(); global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny(); any.Namespace = ds.Namespace; sequence.Items.Add(any); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte()));) { ; } if ((s1.Position == s1.Length)) { return(type); } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return(type); }
protected bool Validate(ParameterizedMap map) { if ((map != null)) { BasicInformation connection = map.TryGet <BasicInformation>("base"); if (connection != null) { return(true); } } return(false); }
public NdisNetworkInterfaceManager() { this._basicInformation = HuaweiWebApi.BasicInformation(); this.NetworkInterface = NetworkInterface .GetAllNetworkInterfaces() .FirstOrDefault(ni => ni.Description.Contains("NDIS")); this.IpAddress = NetworkInterface?.GetIPProperties().UnicastAddresses .FirstOrDefault(ua => ua.PrefixOrigin == PrefixOrigin.Dhcp)?.Address; IPAddress remoteIp = IPAddress.Parse("1.1.1.1"); this.GatewayIpAddress = TraceRoute.GetTraceRoute(this.IpAddress, remoteIp).First().MapToIPv4(); }
public ActionResult EditCard(int id) { DBmanager dBmanager = new DBmanager(); BasicInformation basicInformation = dBmanager.GetByID(id); DBmanager S = new DBmanager(); List <Supervisors> Supervisors = S.GetSupervisors(); ViewBag.supervisor = Supervisors; DBmanager dB = new DBmanager(); List <Departments> departments = dB.GetDepartments(); ViewBag.department = departments; return(View(basicInformation)); }
public ActionResult CreateCard(BasicInformation basicInformation) { DBmanager dBmanager = new DBmanager(); try { dBmanager.NewCard(basicInformation); } catch (Exception e) { Console.WriteLine(e.ToString()); } return(RedirectToAction("CreateEducation")); }
public int?FindID(string name, int cvr, string nameSecondary, out BasicInformation obj) { try { obj = this.dbContext.BasicInformations.First( x => x.Name == name & x.CVR == cvr & x.NameSecondary == nameSecondary); return(obj.ID); } catch (Exception) { obj = null; return(null); } }
public BaseResult <GenericTypeResult <List <string> > > GetPossibleCharacterSet(ParameterizedMap map) { UnboxParameterizedMap param = new UnboxParameterizedMap(map); BasicInformation basic = param.TryGet <BasicInformation>("base"); BaseResult <GenericTypeResult <List <string> > > result = basic.GetPossibleCharacterSet(); result.ID = param.TryGet <string>("id"); IInternalLogging logging = ObjectPool.Instance.Resolve <IInternalLogging>(); if (logging != null) { logging.Write(result); } return(result); }
public BaseResult <GenericTypeResult <bool> > SetErrorMessageFormat(ParameterizedMap map) { UnboxParameterizedMap param = new UnboxParameterizedMap(map); BasicInformation basic = param.TryGet <BasicInformation>("base"); BaseResult <GenericTypeResult <bool> > result = basic.SetErrorMessageFormat(param.TryGet <int>("format")); result.ID = param.TryGet <string>("id"); IInternalLogging logging = ObjectPool.Instance.Resolve <IInternalLogging>(); if (logging != null) { logging.Write(result); } return(result); }
public BaseResult <GenericTypeResult <bool> > SetFunctionality(ParameterizedMap map) { UnboxParameterizedMap param = new UnboxParameterizedMap(map); BasicInformation basic = param.TryGet <BasicInformation>("base"); BaseResult <GenericTypeResult <bool> > result = basic.SetFunctionality((FunctionalityLevel)Convert.ToInt32(param.TryGet <string>("level"))); result.ID = param.TryGet <string>("id"); IInternalLogging logging = ObjectPool.Instance.Resolve <IInternalLogging>(); if (logging != null) { logging.Write(result); } return(result); }
public OperationResult Create(CreateBasicInfo command) { var operation = new OperationResult(); var persianResume = _fileUploader.Upload(command.PersianResume, "PersianResume"); var englishResume = _fileUploader.Upload(command.EnglishResume, "EnglishResume"); var recommendationLetter = _fileUploader.Upload(command.RecommendationLetters, "RecommendationLetters"); var basicInfo = new BasicInformation(command.Name, command.Family, command.Age, command.Nationality, command.Job, command.Address, command.Email, command.Mobile, command.Instagram, command.Language, command.Experience, command.CompleteProject, command.HappyCustomers, command.Articles, persianResume, englishResume, recommendationLetter); _basicInfoRepository.Create(basicInfo); _basicInfoRepository.SaveChanges(); return(operation.Succedded()); }
private void InitSerialPort(BasicInformation connection) { //// let the connection remains open until the server is closed/disposed connection.Connector.Open(); connection.OnBeginExecuting(); BaseResult <GenericTypeResult <string> > manufacturer = connection.GetManufacturer(); if (!string.IsNullOrEmpty(manufacturer.Response.Result)) { connection.GetServiceCenter(); connection.SetErrorMessageFormat(1); connection.GetOperator(); PhoneBook pb = new PhoneBook(connection); pb.SetPhoneBookMemory(MemoryStorage.SIMOwnNumber); pb.GetInfo(); SMS sms = new SMS(connection); sms.SetMessageStorage(MemoryStorage.MobilePhonebook, MemoryStorage.MobilePhonebook, MemoryStorage.MobilePhonebook); sms.SetMessageFormat(connection.PDUMode); string prefixOwnNumber = string.Empty; if (string.IsNullOrEmpty(prefixOwnNumber)) { GSMServer.Configuration.IConfiguration configuration = ObjectPool.Instance.Resolve <GSMServer.Configuration.IConfiguration>(); prefixOwnNumber = ((ApplicationSettings)configuration).General.PrefixOwnNumber; } BaseResult <GenericTypeResult <List <PhoneNumberInfo> > > list = pb.ReadPhoneBook(MemoryStorage.SIMOwnNumber, 1, -1); if (list.Response.Result.Count > 0) { foreach (PhoneNumberInfo info in list.Response.Result) { if (info.Name.Equals(prefixOwnNumber)) { connection.OwnNumber = info.PhoneNumber; break; } } } portColletion.Add(connection); } connection.OnEndExecuting(); }
void Attack() { if (Attackable) { Debug.Log("Attack"); BasicInformation.Damage(Damage); Attackable = false; ani.Play("AttackUpper", 0, 0); Audio_Enemy.PlayOneShot(AudioClip_Attack, 1f); } else if (!Attackable && AttackTimeCounter < AttackCD) { AttackTimeCounter += Time.deltaTime; } else if (!Attackable && AttackTimeCounter >= AttackCD) { Attackable = true; AttackTimeCounter = 0; } }
public bool Add(int usersID, string name, int cvr, string nameSecondary) { try { var obj = new BasicInformation(); obj.Name = name; obj.CVR = cvr; obj.NameSecondary = nameSecondary; obj.OwnedBy = usersID; this.dbContext.BasicInformations.Add(obj); this.dbContext.SaveChanges(); } catch (Exception) { return(false); } return(true); }
public void SaveBaseInfo(BasicInformation b, IContext context) { if (b.UserId == 0) { b.UserId = context.User.UserId; } using (var db = DbInstance) { var bi = db.BasicInformation.FirstOrDefault(c => c.UserId == b.UserId); if (null == bi) { return; } bi.Name = b.Name; bi.Sex = b.Sex; bi.Birthday = b.Birthday; bi.ProvinceId = b.ProvinceId; bi.CityId = b.CityId; bi.ShowLevel = b.ShowLevel; db.SaveChanges(); } }
private void ReleaseResources() { if (timerReadQueue != null) { timerReadQueue.Stop(); timerReadQueue.Elapsed -= timerReadQueue_Elapsed; timerReadQueue.Dispose(); } if (timerProcessRequestQueue != null) { timerProcessRequestQueue.Stop(); timerProcessRequestQueue.Elapsed -= TimerProcessingRequest_Elapsed; timerProcessRequestQueue.Dispose(); } lock (portColletion) { BasicInformation port = null; while (portColletion.Count > 0) { Thread.Sleep(200); port = portColletion.Get(); if (port != null) { port.Dispose(); } } } portColletion.Clear(); workerPoolManager.Clear(); pluginMap.Close(); base.PacketReceived -= OnPacketReceived; base.Connected -= OnClientConnected; base.Disconnected -= OnClientDisconnect; base.Closed -= OnClosed; base.Open -= OnOpen; }