static void Main(string[] args) { //DumpCILOpCodes(); //DumpAvmInstructions(); //RunTemplates(); //GenerateMDB(); //GenerateAvmInstructionsWikiTable(); var cl = CommandLine.Parse(args); if (cl == null) { cl = new CommandLine(); } string srcdir = cl.GetOption(null, "src", "srcdir"); try { QA.GenerateNUnitTestFixtures(srcdir); } catch (Exception e) { Console.WriteLine(e); } }
internal bool SetQuestion(QuestionModel model) { try { // it's ok if category is null. Then it is "other" and does not yet exist. var category = dbService.Category.FirstOrDefault(c => c.Id == model.CategoryId); var question = new QA { Question = model.Question, Answer = null, UpVotes = 0, DownVotes = 0, Email = model.Email, Category = category }; dbService.Add(question); dbService.SaveChanges(); return(true); } catch (Exception e) { return(false); } }
void SetLbQuestions() { LbQuestions.ItemsSource = null; var obj = db.QUESTION.Where(d => d.TESTID == _IdTest).OrderBy(f => f.QUESTIONID); List <QUESTION> listQuest = new List <QUESTION>(); foreach (var f in obj) { QUESTION row = new QUESTION(); row.QA = new List <QA>(); row.TEST = new TEST(); row.QUESTIONTEXT = f.QUESTIONTEXT; row.QUESTIONID = f.QUESTIONID; row.TEST.TESTID = _IdTest; var qa = db.QA.Where(l => l.QUESTIONID == f.QUESTIONID); foreach (var item in qa) { var a = db.ANSWER.Where(l => l.ANSWERID == item.ANSWERID).First(); QA qaNew = new QA { ANSWERID = item.ANSWERID, CORRECTANSWER = item.CORRECTANSWER, QUESTIONID = row.QUESTIONID, ANSWER = a }; row.QA.Add(qaNew); } listQuest.Add(row); } LbQuestions.ItemsSource = listQuest; }
private static void InputFromSpreadsheet(out Developer[] devs, out QA[] qas, out JiraTask[] tasks) { var sheet = Spreadsheets .Spreadsheet(Gant) .Sheet(SetupSheet); var devCount = int.Parse(sheet[1, 0]); var qaCount = int.Parse(sheet[1, 1]); devs = new Developer[devCount]; qas = new QA[qaCount]; for (var id = 0; id < devCount; id++) { devs[id] = new Developer(id); } for (var id = 0; id < qaCount; id++) { qas[id] = new QA(id); } tasks = sheet.Rows .Skip(3) .Select(x => new JiraTask(x[0], int.Parse(x[1]), int.Parse(x[2]))) .ToArray(); }
public IHttpActionResult PutQA(int id, QA qA) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != qA.Id) { return(BadRequest()); } db.Entry(qA).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!QAExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <ActionResult <QA> > PostQA(QA qA) { _context.QandA.Add(qA); await _context.SaveChangesAsync(); return(CreatedAtAction("GetQA", new { id = qA.ID }, qA)); }
public void OnAdd(object sender, EventArgs e) { if (Page.IsValid) { using (DBDataContext db = new DBDataContext()) { int catID = int.Parse(ddlCategories.SelectedValue); var qa = new QA() { Quester = txtName.Text.Trim(), Question = txtQuestion.Text.Trim(), Header = txtQuestion.Text.Trim(), Phone = string.IsNullOrEmpty(txtPhone.Text.Trim()) ? null : txtPhone.Text.Trim(), Date = DateTime.Now, CategoryId = catID }; db.QA.InsertOnSubmit(qa); db.SubmitChanges(); mvQA.SetActiveView(vQuestion); txtName.Text = ""; txtQuestion.Text = ""; txtPhone.Text = ""; lblMessage.Text = "Спасибо за Ваш вопрос. В ближайшее время мы постараемся дать Вам ответ."; } } }
public async Task <QA> AddAsync(QA entity) { DataContext.Set <QA>().Add(entity); await DataContext.SaveChangesAsync(); return(entity); }
public static void Test() { var qa = new QA(); // action for void functions Action <Employee, string, int> action = populateEmployee; populateEmployee(qa, "Peter", 22); // func for return methods Func <Employee, string, int, string> func = populateAndShowEmployee; var info = func(qa, "Tony", 23); ////Lambda expresion //(input - parameters) => expression Action <Employee, string, int> lambdaAction = (employee, name, age) => { employee.Name = name; employee.Age = age; }; Func <Employee, string, int, string> lambdaFunc = (employee, name, age) => { employee.Name = name; employee.Age = age; return($"{employee.GetInfo()} and {employee.Skill()}"); }; var dev = new Developer(); lambdaAction(dev, "Stan", 65); var devInfo = lambdaFunc(dev, "Stan", 65); }
// Use this for initialization void Awake() { if (sqMode == false) { SqBt.GetComponent <Image> ().color = Color.white; } else { SqBt.GetComponent <Image> ().color = Color.green; } if (INVENCIBLE == false) { if (invButton != null) { invButton.GetComponent <Image> ().color = Color.white; } } else { if (invButton != null) { invButton.GetComponent <Image> ().color = Color.green; } } s = this; }
public ActionResult Ask(string page, string kw, string aid) { User user = UserUtil.getCurUser(); int tid = 0; int.TryParse(aid, out tid); QA qa = QAService.GetInstance().Get(tid); if (qa != null && user != null && qa.username.Equals(user.username) && qa.status != QA.VALIDATE) { ViewData["qa"] = qa; } string username = user == null ? string.Empty : user.username; int ipage = 0; int.TryParse(page, out ipage); ipage = ipage < 1 ? 1 : ipage; IList <QA> qalist = QAService.GetInstance().Search(kw, QA.VALIDATE, string.IsNullOrEmpty(kw) ? username : string.Empty); if (string.IsNullOrEmpty(username)) { qalist = qalist.Where(m => m.isRecommend).ToList <QA>(); } Pager pager = new Pager(); ViewData["page"] = pager; pager.PageSize = 10; pager.PageIndex = ipage; pager.RecordCount = qalist.Count; qalist = qalist.Skip((ipage - 1) * pager.PageSize).Take(pager.PageSize).ToList <QA>(); return(View(qalist)); }
public ActionResult _PartialViewLoad(Int64 id, int type) { switch (type) { case 1: { return(PartialView("_PVcreatesecurityquestion")); } case 2: { ViewBag.button = null; QA qa = qaData.GetQAForUpdate(id); return(PartialView("_PVeditsecurityquestion", qa)); } case 3: { ViewBag.button = "disabled"; QA qa = qaData.GetQAForUpdate(id); return(PartialView("_PVeditsecurityquestion", qa)); } } return(PartialView()); }
public async Task <IActionResult> Create([Bind("QAId,Question,Answer,Notes")] QA qA) { //Remove user and userid ModelState.Remove("UserId"); ModelState.Remove("User"); if (ModelState.IsValid) { //Get Current User var user = await GetCurrentUserAsync(); //Add user to model qA.User = user; //Add userId to Model qA.UserId = user.Id; _context.Add(qA); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["UserId"] = new SelectList(_context.ApplicationUsers, "Id", "Id", qA.UserId); return(View(qA)); }
/// <summary> /// /// </summary> /// <param name="name"></param> /// <param name="inParameters"></param> /// <param name="outParameters"></param> public override void Execute(string name, QA.Interface.ParameterCollection inParameters, QA.Interface.ParameterCollection outParameters) { //MessageBox.Show(name); Form f = GetForm(); f.Activate(); f.Text = DateTime.Now.ToString() + name; }
private static void ChainOfResponsibilityPattern() { #region ProjectDelivery Requirment r1 = new Requirment { Name = "Projet 1", IsDesingNeeded = true }; Requirment r2 = new Requirment { Name = "Project 2", areUIChangesNeeded = true }; IHandler architect = new Architect(); IHandler uiDeveloper = new UIDeveloper(); IHandler dba = new DBA(); IHandler appDeveloper = new AppDeveloper(); IHandler qa = new QA(); architect.SetNextHandler(uiDeveloper); uiDeveloper.SetNextHandler(dba); dba.SetNextHandler(appDeveloper); appDeveloper.SetNextHandler(qa); architect.Handle(r1); architect.Handle(r2); #endregion ProjectDelivery #region Leave Aprroval ILeaveHandler teamLead = new TeamLead(); ILeaveHandler projectManager = new ProjectManager(); ILeaveHandler hr = new DeliveryManager(); teamLead.SetNextHandler(projectManager); projectManager.SetNextHandler(hr); teamLead.LeaveApproval("Chandra", 8); #endregion Leave Aprroval #region Logger LoggerHandler info = new Info(); LoggerHandler warning = new Warning(); LoggerHandler error = new Error(); info.SetNextLoggerHandler(warning); warning.SetNextLoggerHandler(error); info.Log("Error"); #endregion Logger }
public void PublishQuestionWithAnswers() { QA newQA = gameController.questionsAsked.Last(); string question = LitJson.JsonMapper.ToJson(newQA); dictSockets[PUB_QUESTION].SendMessage(MessagePassing.PUB_SUB_QUESTION + " " + question); logger.LogToConsole("PUB_QUESTION", MessagePassing.PUB_SUB_QUESTION + " " + question); }
public ActionResult DeleteConfirmed(string id) { QA qA = db.QA.Find(id); db.QA.Remove(qA); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult DeleteConfirmed(int id) { QA qa = db.QAs.Find(id); db.QAs.Remove(qa); db.SaveChanges(); return(RedirectToAction("Index")); }
private IEnumerator ShowAnswer(QA qa, float time) { yield return(new WaitForSeconds(time)); ballText.text = qa.Answer; inputfield.interactable = true; inputfield.Select(); inputfield.ActivateInputField(); }
private async Task AskQuestion() { _currentQuestion = _triviaData.Pop(); _turn++; _isAnswered = (int)Answered.No; await _channel.SendMessageAsync(_currentQuestion.Question); _questionTimer.Change(TimeSpan.FromSeconds(20), Timeout.InfiniteTimeSpan); }
public ActionResult Edit([Bind(Include = "Question,Id,Q_Content,Q_Type,Answer,Analysis,Cat_Id,Add_Time,Img_Path,Flag,Weight,From_Source,Add_Name,For_Exame,Q_Md5")] QA qA) { if (ModelState.IsValid) { db.Entry(qA).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(qA)); }
private static void GameLoop_UpdateTicked(object sender, UpdateTickedEventArgs e) { foreach (QueuedAction QA in QueuedActions.OrderByDescending(x => x.Priority)) { if (QA.GameLoop_UpdateTicked()) { QueuedActions.Remove(QA); } } }
public IHttpActionResult GetQA(int id) { QA qA = db.QA.Find(id); if (qA == null) { return(NotFound()); } return(Ok(qA)); }
static void Main(string[] args) { QA tester1 = new QA("Marko", "Markovski", 26); Devops devopsLead = new Devops("Nebojsa", "Zafirovski", 45); Console.WriteLine(devopsLead.CheckHTTPRequest(400)); tester1.Code(); Developer someDeveloper = new Developer("Petre", "Arsovski", 25); someDeveloper.FindTheProject(tester1); }
public async Task <ActionResult> Edit(QA QA) { if (ModelState.IsValid) { await MobileService.GetTable <QA>().UpdateAsync(QA); return(RedirectToAction("Index")); } return(View(QA)); }
protected void BindModel() { QAInfo model = new QA().Select(QAID); if (model != null) { tbName.Text = model.QATitle; tbContent.Text = model.QAContent; ddlCat.SelectedValue = model.CatName; } }
public void give_correctAnswer() { global.currentGameType = "Shooter"; //Each correct answer gives +50 score int oldScore = global.Score; QA customQuestion = new QA("1+1 = ?", "2", "3"); global.CurrentQA = customQuestion; global.inputField.text = "2"; global.checkAnswer(); Assert.AreEqual(global.Score, oldScore + 50); }
public void give_incorrectAnswer() { global.currentGameType = "Platformer"; int oldHearts = global.Hearts; //Hearts_are decreased when player gives wrong answer QA customQuestion = new QA("1+1 = ?", "2", "3"); global.CurrentQA = customQuestion; global.inputField.text = "wrong"; global.checkAnswer(); Assert.Less(global.Hearts, oldHearts); }
public IHttpActionResult PostQA(QA qA) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.QA.Add(qA); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = qA.Id }, qA)); }
private void OnConnected(NetworkMessage netMsg) { Debug.LogWarning("Connected !"); if (reqMaster) { } else { QA.Invoke <int>("Connected", ClientCommand.identity.connectionId); client.Send(ImServices.MSG_COMMAND, ClientCommand.identity); } }
/// <summary> /// 处理用户登录请求 /// </summary> /// <param name="context"></param> public static void Login(HttpContext context) { string name = context.Request.Form["n"]; string pwd = context.Request.Form["p"]; if (UserAccount.Login(name, pwd)) { string from = QA.GetCookie(SC.CK_LOGIN_FROM); if (from == null || from.Contains("login")) from = "/home"; context.Response.Write(JU.Build(true, from)); } else context.Response.Write(JU.Build(false, "")); }
public string answer(string input) { for (int i = 0; i < qaList.Count; i++) { QA qa = qaList[i]; string answer = qa.answer(input); if (answer != null) { return(answer); } } return("然後呢?"); }
private void Form1_Load(object sender, EventArgs e) { // label1.Text = Program.name; this.MaximumSize = this.MinimumSize = this.Size; string[] arr = File.ReadAllLines("ques.txt"); string[] arr2 = File.ReadAllLines("ans.txt"); b = new bst(); for (int i = 0; i < arr.Length; i++) { QA ab = new QA(arr[i],arr2[i]); b.add(ab); } }
public void add(QA e) { node n = new node(e); if (root == null) { root = n; } else { node temp = root; while (true) { int x = e.Question1.CompareTo(root.value.Question1); if (x == 1) { if (temp.right != null) { temp = temp.right; } else { temp.right = n; break; } } else { if (temp.left != null) { temp = temp.left; } else { temp.left = n; break; } } } } }
private void ApplicationBarIcon_Click_Forward(object sender, EventArgs e) { if (((ApplicationBarIconButton)ApplicationBar.Buttons[1]).Text == "Вперед") { if ((Application.Current as App).current_qa!=null) { int index = (Application.Current as App).current_qas.IndexOf(current_qa); current_qa = (Application.Current as App).current_qas[index + 1]; current_post = new Post(current_qa.id, "http://habrahabr.ru"+current_qa.url, current_qa.Name, ""); }else{ int index = (Application.Current as App).current_posts.IndexOf(current_post); current_post = (Application.Current as App).current_posts[index + 1]; } LoadPost(current_post); updateNavButtons(); } else { userInfoPopup.IsOpen = false; RestoreAppBarButtons(); ApplicationBar.IsVisible = true; } }
public override void Execute(string name, QA.Interface.ParameterCollection inParameters, QA.Interface.ParameterCollection outParameters) { }
private void ApplicationBarIcon_Click_Back(object sender, EventArgs e) { if (((ApplicationBarIconButton)ApplicationBar.Buttons[0]).Text == "Назад") { if ((Application.Current as App).current_qa != null) { int index = (Application.Current as App).current_qas.IndexOf(current_qa); current_qa = (Application.Current as App).current_qas[index - 1]; current_post = new Post(current_qa.id, "http://habrahabr.ru" + current_qa.url, current_qa.Name, ""); } else { current_post = (Application.Current as App).current_posts[(Application.Current as App).current_posts.IndexOf(current_post) - 1]; } LoadPost(current_post); updateNavButtons(); } else { // user info apply SaveUserInfo(loginTxt.Text, passwordTxt.Password); ApplicationBar.IsVisible = true; } }
public void Print(ListBox lb, string Question) { if (lb.Items.Count > 2) { if (lb.Items[lb.Items.Count - 1].ToString() != "I cannot understand your Question, Please train me." && lb.Items[lb.Items.Count - 2].ToString() != "I cannot understand your Question, Please train me.") { _Ques = Question; string Answer = string.Empty; InOrder(root, ref Answer, Question); if (string.IsNullOrEmpty(Answer)) { lb.Items.Add("Mad com : " + "I cannot understand your Question, Please train me."); } else { lb.Items.Add("Mad com : " + Answer); } } else { QA newInformation = new QA(_Ques, lb.Items[lb.Items.Count - 1].ToString()); add(newInformation); lb.Items.Add("Mad com : " + "Thank you for Training"); } } else { _Ques = Question; string Answer = string.Empty; InOrder(root, ref Answer, Question); if (string.IsNullOrEmpty(Answer)) { lb.Items.Add("Mad com : " + "I cannot understand your Question, Please train me."); } else { lb.Items.Add("Mad com : " + Answer); } } }
private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e) { progBar.IsEnabled = true; var app = (Application.Current as App); current_post = app.current_post; if (current_post==null) { current_post = new Post(app.current_qa.id, "http://habrahabr.ru"+app.current_qa.url, app.current_qa.Name, ""); current_qa = app.current_qa; //app.current_qa; } LoadPost(current_post); updateNavButtons(); string tmp; AppSettings.TryGetSetting<string>("uname", out tmp); if (tmp != null) loginTxt.Text = tmp; AppSettings.TryGetSetting<string>("upwd", out tmp); if (tmp != null) passwordTxt.Password = tmp; ObservableCollection<Post> fav = null; AppSettings.TryGetSetting("favorites", out fav); fav_button = ((ApplicationBarIconButton)ApplicationBar.Buttons[3]); if (fav.Contains(current_post)) { fav_button.Text = "Удалить"; fav_button.IconUri = new Uri("/icons/appbar.favs.remove.rest.png", UriKind.Relative); }else{ fav_button.Text = "Добавить"; fav_button.IconUri = new Uri("/icons/appbar.favs.addto.rest.png", UriKind.Relative); } }
public node(QA element) { this.value = element; this.right = null; this.left = null; }