public async Task <ActionResult> Create([Bind(Include = "ProcedureID,HistoryID,Content,Number")] history history) { int countSteps = 0; List <history> historyInfo = new List <history>(); // Send request to find web api REST service for steps HttpResponseMessage getResponse = await client.GetAsync(urlPath); // Check if response is successful if (getResponse.IsSuccessStatusCode) { var responseDetail = getResponse.Content.ReadAsStringAsync().Result; // Deserialise to find all steps belonging to chosen procedure historyInfo = JsonConvert.DeserializeObject <List <history> >(responseDetail).FindAll(x => x.ProcedureID == ProcedureController.procID); if (historyInfo.Count() == 0) { countSteps = 1; } else { countSteps = historyInfo.Select(x => (int)x.Number).ToList().Max() + 1; } } //history.Content = Server.HtmlEncode(history.Content); history.ProcedureID = ProcedureController.procID; history.Number = countSteps; HttpResponseMessage response = await client.PostAsJsonAsync(urlPath, history); response.EnsureSuccessStatusCode(); return(RedirectToAction("Details", "Procedure", new { id = ProcedureController.procID })); }
/// <summary> /// Converts this instance of <see cref="history"/> to an instance of <see cref="historyDto"/>. /// </summary> /// <param name="entity"><see cref="history"/> to convert.</param> public static historyDto ToDTO(this history entity) { if (entity == null) { return(null); } var dto = new historyDto(); dto.v_HistoryId = entity.v_HistoryId; dto.v_PersonId = entity.v_PersonId; dto.d_StartDate = entity.d_StartDate; dto.d_EndDate = entity.d_EndDate; dto.v_Organization = entity.v_Organization; dto.v_TypeActivity = entity.v_TypeActivity; dto.i_GeografixcaHeight = entity.i_GeografixcaHeight; dto.v_workstation = entity.v_workstation; dto.b_RubricImage = entity.b_RubricImage; dto.b_FingerPrintImage = entity.b_FingerPrintImage; dto.t_RubricImageText = entity.t_RubricImageText; dto.i_IsDeleted = entity.i_IsDeleted; dto.i_InsertUserId = entity.i_InsertUserId; dto.d_InsertDate = entity.d_InsertDate; dto.i_UpdateUserId = entity.i_UpdateUserId; dto.d_UpdateDate = entity.d_UpdateDate; dto.i_TypeOperationId = entity.i_TypeOperationId; entity.OnDTO(dto); return(dto); }
public async Task <ActionResult> EditSequence(string history, Dictionary <string, string> updates) { // USE TWO LISTS // Only send query to db to update and no need for server to send back updated list every time. // First list will be used to update on server. List <history> listOfHistory = new List <history>(); // Second list will be used to update list on the client-side display. No need to get new updated list from server. List <history> passListToView = JsonConvert.DeserializeObject <List <history> >(history); // Initialise empty row to store our row to be updated history rowNumber = new history(); foreach (KeyValuePair <string, string> item in updates) { if (int.TryParse(item.Key, out int key) && int.TryParse(item.Value, out int value)) { listOfHistory = JsonConvert.DeserializeObject <List <history> >(history); rowNumber = listOfHistory.FirstOrDefault(x => x.Number == key); rowNumber.Number = value; HttpResponseMessage response = await client.PutAsJsonAsync(String.Format("{0}/{1}", urlPath, rowNumber.HistoryID.ToString()), rowNumber); response.EnsureSuccessStatusCode(); if (response.IsSuccessStatusCode) { passListToView.FirstOrDefault(x => x.HistoryID == rowNumber.HistoryID).Number = value; } } } return(Json(JsonConvert.SerializeObject(passListToView), JsonRequestBehavior.AllowGet)); }
public void History_write(string user_id, string _page, string _state) { db_e db = new db_e(); string user_name = UserData.user_get(user_id, "user_name"); string department_id = UserData.user_get(user_id, "department_id"); string department_name = UserData.user_get(user_id, "department_name"); string company_id = UserData.user_get(user_id, "company_id"); string company_name = UserData.user_get(user_id, "company_name"); string auth = UserData.user_get(user_id, "auth"); var _insert = new history { user_id = user_id, company_id = company_id, department_id = department_id, user_ip = "", pre_page = "", connect_agent = company_name, connect_host = auth, connect_path = user_name, memo = department_name, connect_date = DateTime.Now, state = _state, page = _page }; db.history.Add(_insert); db.SaveChanges(); // 실제로 저장 }
public void edit(string ma, string hoatdong) { history td = (from a in db.histories select a).Single(t => t.ma == ma); td.hoatdong = hoatdong; db.SubmitChanges(); }
public void add(string ma, string hoatdong) { td = new t_tudong(); int so2; string check2 = "HS" + Biencucbo.donvi; var lst = (from b in db.tudongs where b.maphieu == check2 select b); var lst2 = (from a in db.tudongs select a).FirstOrDefault(t => t.maphieu == check2); if (lst.Count() == 0) { so2 = 1; td.themtudong(check2, 2); } else { so2 = int.Parse(lst2.so.ToString()); td.suatudong(check2, so2 + 1); } history hs = new history(); hs.donvi = Biencucbo.donvi; hs.ma = ma; hs.hoatdong = hoatdong; hs.nguoi = Biencucbo.idnv.Trim() + "-" + Biencucbo.ten; hs.may = "Computer: " + Biencucbo.hostname + "/ IP: " + Biencucbo.IPaddress; hs.thoigian = DateTime.Now; hs.id = "HS" + Biencucbo.donvi.Trim() + "_" + so2.ToString(); db.histories.InsertOnSubmit(hs); db.SubmitChanges(); }
/// <summary> /// Converts this instance of <see cref="historyDto"/> to an instance of <see cref="history"/>. /// </summary> /// <param name="dto"><see cref="historyDto"/> to convert.</param> public static history ToEntity(this historyDto dto) { if (dto == null) { return(null); } var entity = new history(); entity.v_HistoryId = dto.v_HistoryId; entity.v_PersonId = dto.v_PersonId; entity.d_StartDate = dto.d_StartDate; entity.d_EndDate = dto.d_EndDate; entity.v_Organization = dto.v_Organization; entity.v_TypeActivity = dto.v_TypeActivity; entity.i_GeografixcaHeight = dto.i_GeografixcaHeight; entity.v_workstation = dto.v_workstation; entity.b_RubricImage = dto.b_RubricImage; entity.b_FingerPrintImage = dto.b_FingerPrintImage; entity.t_RubricImageText = dto.t_RubricImageText; entity.i_IsDeleted = dto.i_IsDeleted; entity.i_InsertUserId = dto.i_InsertUserId; entity.d_InsertDate = dto.d_InsertDate; entity.i_UpdateUserId = dto.i_UpdateUserId; entity.d_UpdateDate = dto.d_UpdateDate; entity.i_TypeOperationId = dto.i_TypeOperationId; dto.OnEntity(entity); return(entity); }
public List <history> getAll(string userName) { List <history> historyList = new List <history>(); try { String query = "select * from history where username='******'"; DataTable dataTable = new DataProvider().excuteQuery(query); List <history> list = new List <history>(); for (int i = 0; i < dataTable.Rows.Count; i++) { history h = new history(); h.UserName = dataTable.Rows[i].ItemArray[0].ToString(); h.BookID = Int32.Parse(dataTable.Rows[i].ItemArray[1].ToString()); h.ReadDate = DateTime.Parse(dataTable.Rows[i].ItemArray[2].ToString()); list.Add(h); } return(list); } catch (Exception ex) { Console.WriteLine(ex.Message + "Load Account"); } return(null); }
void Redo() { history h = redo.Pop(); if (actionMode != h.mode) { UpdateMode(h.mode); } if (!h.action) { removeTile(h.x, h.y); } else { if (h.mode == 1) { selectedEntity = tilemap.Entities[viewIndexToId[h.index]]; } if (h.mode == 2) { selectedImage = h.index; } addTile(h.x, h.y); } if (redo.Count == 0) { btnredo.Enabled = false; } }
public ActionResult DeleteConfirmed(int id) { history history = db.histories.Find(id); db.histories.Remove(history); db.SaveChanges(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "ProcedureID,HistoryID,Content,Number")] history history) { history.ProcedureID = ProcedureController.procID; history.Content = Server.HtmlDecode(history.Content); HttpResponseMessage response = await client.PutAsJsonAsync(String.Format("{0}/{1}", urlPath, history.HistoryID.ToString()), history); response.EnsureSuccessStatusCode(); return(RedirectToAction("Details", "Procedure", new { id = ProcedureController.procID })); }
public void CreateTableHistory(String ID, String TrackID, DateTime DateTimeListen, int ListenYesNo) { var db = GetConnection("ownradio.db"); var toHistory = new history { id = ID, trackid = TrackID, datetimelisten = DateTimeListen.ToString(), listenyesno = ListenYesNo }; db.CreateTable <history>(); }
public IHistory GetById(int id) { using (var context = new EPEntities()) { history history = context.history.Find(id); context.Entry(history).Reference(h => h.subscription); return(history); } }
public ActionResult Edit(history history) { if (ModelState.IsValid) { db.Entry(history).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(history)); }
// // GET: /Default1/Delete/5 public ActionResult Delete(int id = 0) { history history = db.history.Find(id); if (history == null) { return(HttpNotFound()); } return(View(history)); }
public void Submit() { Check(); bool flag = true; for (int i = 0; i < answer.Length; i++) { if (answer[i] == null) { flag = false; break; } } if (!flag) { DialogResult dr = MessageBoxEx.Show(this, "试卷未完成,无法交卷", "提示"); } else { DialogResult dr = MessageBoxEx.Show(this, "确认交卷?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dr.ToString() == "Yes") { int sum = sumScore(); MessageBoxEx.Show(this, "交卷完毕\n得分:" + sum); history[] h = new history[answer.Length]; score s = new score(); countdao cd = new countdao(); int tpcount = cd.getTpCount(); s.tpid = tpcount; s.sc = sum; s.username = this.username; historydao hd = new historydao(); for (int i = 0; i < h.Length; i++) { h[i] = new history(); h[i].username = this.username; h[i].questionid = this.q[i].questionid; h[i].useranswer = this.answer[i]; if (answer[i] != this.q[i].answer) { h[i].rightorwrong = 0; } else { h[i].rightorwrong = 1; } h[i].tpid = tpcount; hd.insterHistory(h[i]); } scoredao sd = new scoredao(); sd.insertScore(s); this.Close(); } } }
private void ImportPatients() { List <string> data = File.ReadLines(@"F:\ЯндексДиск\работяга\Четвёртый курс\Второй семак\WSR\WSR_Laboratory\ImportData\patients.txt").ToList(); data.ForEach((item) => { string[] itemData = item.Split('\t'); string InsuranceName = itemData[14]; string InsuranceAddress = itemData[15]; insurance insurance = Laboratory.GetContext().insurance.Where(p => p.name == InsuranceName && p.address == InsuranceAddress).FirstOrDefault(); if (insurance == null) { insurance = new insurance(); insurance.name = itemData[14]; insurance.address = itemData[15]; insurance.inn = decimal.Parse(itemData[16]); insurance.payment_account = decimal.Parse(itemData[18]); insurance.bik = decimal.Parse(itemData[19]); Laboratory.GetContext().insurance.Add(insurance); Laboratory.GetContext().SaveChanges(); } user user = new user(); user.login = itemData[1]; user.password = itemData[2]; user.id_user_type = 5; Laboratory.GetContext().user.Add(user); patient patient = new patient(); patient.full_name = itemData[0]; patient.email = itemData[4]; patient.social_number = decimal.Parse(itemData[5]); patient.ein = itemData[6]; patient.social_type = itemData[7] == "oms"; patient.phone = itemData[8]; patient.passport_series = decimal.Parse(itemData[9]); patient.passport_number = decimal.Parse(itemData[10]); patient.birthday = DateTimeOffset.FromUnixTimeMilliseconds(long.Parse(itemData[11].Replace("-", ""))).DateTime; patient.country = itemData[13]; patient.user = user; patient.insurance = insurance; Laboratory.GetContext().patient.Add(patient); history history = new history(); history.user = user; history.ip = itemData[17]; history.login = user.login; history.has_entered = true; history.date_time = DateTime.Now; Laboratory.GetContext().history.Add(history); }); Laboratory.GetContext().SaveChanges(); }
public ActionResult Edit([Bind(Include = "id,patient_id,patientNhsNo,historyDetails")] history history) { if (ModelState.IsValid) { db.Entry(history).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.patient_id = new SelectList(db.patients, "id", "patientNhsNo", history.patient_id); return(View(history)); }
public ActionResult Create(history history) { if (ModelState.IsValid) { db.history.Add(history); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(history)); }
public ActionResult Create([Bind(Include = "id,patient_id,patientNhsNo,historyDetails")] history history) { if (ModelState.IsValid) { db.histories.Add(history); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.patient_id = new SelectList(db.patients, "id", "patientNhsNo", history.patient_id); return(View(history)); }
public string PreparePaypal() { if (Session["user"] != null) { var cart = Session["cart"] as List <Cart>; if (cart == null) { cart = new List <Cart>(); } var t = 0f; cart.ForEach(it => t += it.Qty * it.Price); var code = Base64Encode(CurrentTime().ToString()); code = code.Substring(0, code.Length - 2); var history = new history { id_customer = (Session["user"] as customer).id, status = status.FirstOrDefault(it => it.Value == "pending").Key, payment_method = 2, create_at = CurrentTime().ToString(), update_at = CurrentTime().ToString(), total = Math.Round(t, 2), trade_code = code }; data.histories.InsertOnSubmit(history); data.SubmitChanges(); var list = new List <history_detail>(); foreach (var item in cart) { list.Add(new history_detail { id_history = history.id, id_service = item.services.id, price = item.Price, qty = item.Qty }); } data.history_details.InsertAllOnSubmit(list); data.SubmitChanges(); Session["cart"] = null; return(history.id.ToString()); } return("falid"); }
// GET: History/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } history history = db.histories.Find(id); if (history == null) { return(HttpNotFound()); } return(View(history)); }
public bool insterHistory(history h) { string sql = "INSERT INTO history(username,questionid,useranswer,rightorwrong,tpid) VALUES('" + h.username + "','" + h.questionid + "','" + h.useranswer + "','" + h.rightorwrong + "','" + h.tpid + "');"; int i = MySqlHelper.ExecuteNonQuery(MySqlHelper.Conn, System.Data.CommandType.Text, sql, null); if (i > 0) { return(true); } else { return(false); } }
public ActionResult DeleteConfirmed(int id) { apiController a = new apiController(); ViewBag.cur1 = "USD/TRY: " + a.get("getlatest", "usd", "try"); ViewBag.cur2 = "EUR/TRY: " + a.get("getlatest", "eur", "try"); ViewBag.cur3 = "GBP/TRY: " + a.get("getlatest", "gbp", "try"); history history = db.history.Find(id); db.history.Remove(history); db.SaveChanges(); return(RedirectToAction("Index")); }
private void ImportEmployee() { List <string> data = File.ReadLines(@"F:\ЯндексДиск\работяга\Четвёртый курс\Второй семак\WSR\WSR_Laboratory\ImportData\users.txt").ToList(); data.ForEach((item) => { string[] itemData = item.Split('\t'); user user = new user(); user.login = itemData[2]; user.password = itemData[3]; user.id_user_type = int.Parse(itemData[7]); Laboratory.GetContext().user.Add(user); employee employee = new employee(); employee.full_name = itemData[1]; employee.user = user; Laboratory.GetContext().employee.Add(employee); history history = new history(); history.user = user; history.ip = itemData[4]; history.has_entered = true; history.login = user.login; string[] date = itemData[5].Split('.'); history.date_time = DateTime.Parse($"{date[1]}.{date[0]}.{date[2]}"); Laboratory.GetContext().history.Add(history); string[] services = itemData[6].Replace("\"", "").Split(';'); if (services.Length == 0) { services = new string[] { itemData[6].Replace("\"", "") }; } foreach (string serviceCode in services) { decimal code = decimal.Parse(serviceCode); service service = Laboratory.GetContext().service.Where(p => p.code == code).FirstOrDefault(); if (service == null) { continue; } employee_service employee_service = new employee_service(); employee_service.employee = employee; employee_service.service = service; Laboratory.GetContext().employee_service.Add(employee_service); } }); Laboratory.GetContext().SaveChanges(); }
// GET: History/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } history history = db.histories.Find(id); if (history == null) { return(HttpNotFound()); } ViewBag.patient_id = new SelectList(db.patients, "id", "patientNhsNo", history.patient_id); return(View(history)); }
public HttpResponseMessage Post(StudentPackage studentPackage) { DateTime dateTime = DateTime.Now; int timeNow = (dateTime.Hour * 60) + dateTime.Minute; session session = barkode_ProjectEntities.session.Where(x => x.session_content == studentPackage.content).FirstOrDefault(); if (session != null) { DateTime dt = (DateTime)session.session_expiration_time; int sessionTime = (dt.Hour * 60) + dt.Minute; if (timeNow - sessionTime > 0) { message = Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Session Kayıt Basarisiz"); return(message); } student student2 = barkode_ProjectEntities.student.Where(x => x.student_id == studentPackage.student.student_id).SingleOrDefault(); if (student2 != null) { List <student_lesson> student_Lesson = barkode_ProjectEntities.student_lesson.Where(x => x.student_id == student2.student_id).ToList(); foreach (var item in student_Lesson) { if (item.lesson_id == session.lesson_id) { break; } } history history = barkode_ProjectEntities.history.Where(x => x.student_id == student2.student_id && x.session_id == session.session_id).FirstOrDefault(); if (history == null) { history = new history(); history.session = session; history.student = student2; barkode_ProjectEntities.history.Add(history); barkode_ProjectEntities.SaveChanges(); message = Request.CreateResponse(HttpStatusCode.OK, student2); return(message); //return student2; } message = Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Oturumda Daha Önce Kayıt Oldunuz."); } message = Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Session Kayıt Basarisiz"); } return(message); }
// // GET: /HistoryItem/Edit/5 public ActionResult Edit(int id = 0) { int _userid = (Session["id"] != null) ? Convert.ToInt32(Session["id"].ToString()) : -1; apiController a = new apiController(); ViewBag.cur1 = "USD/TRY: " + a.get("getlatest", "usd", "try"); ViewBag.cur2 = "EUR/TRY: " + a.get("getlatest", "eur", "try"); ViewBag.cur3 = "GBP/TRY: " + a.get("getlatest", "gbp", "try"); history history = db.history.Find(id); if (history == null || history.userId != _userid) { return(HttpNotFound()); } return(View(history)); }
public async Task <ActionResult> Details(int?id) { history historyInfo = new history(); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } HttpResponseMessage response = await client.GetAsync(String.Format("{0}/{1}", urlPath, id.ToString())); if (response.IsSuccessStatusCode) { var responseDetail = response.Content.ReadAsStringAsync().Result; historyInfo = JsonConvert.DeserializeObject <history>(responseDetail); } return(View(historyInfo)); }
public ActionResult close(int bid, Modelclass model) { datamodel data = new datamodel(); bugpool bugs = data.bugpools.Where(i => i.bugid == bid).Select(i => i).FirstOrDefault(); history hist = new history(); bugs.status = "Closed"; data.SaveChanges(); hist.bugid = bugs.bugid; hist.ModifieduserId = (int)Session["id"]; hist.comment = model.comments; hist.status = bugs.status; hist.time = DateTime.Now; data.historys.Add(hist); data.SaveChanges(); return(Redirect("/testing/dashboard")); }
/// <summary> /// Получение истории сообщений с пользователем /// </summary> /// <param name="uid">ID пользователя</param> /// <param name="count">Количество сообщений (не более 100 за раз)</param> public void getHistory(uint uid, int count) { string s, text; // Текст сообщения uint mid, // Номер сообщения outId; // ID отправителя double date; // Дата Hashtable jsonResp = new Hashtable(), data; string uri = "messages.getHistory?count=" + count + "&format=JSON&uid=" + uid; s = vk_call(uri); if (s != "" && s.IndexOf("error") == -1) { jsonResp = (Hashtable)JSON.JsonDecode(s); ArrayList msg = (ArrayList)jsonResp["response"]; if (Convert.ToUInt32(msg[0]) < count) count = Convert.ToInt32(msg[0]); history getHist = new history(GeneralMethods.printMsg); for (int i = count; i > 0; i--) // Начинаем с конца, потому что сервер возвращает сообщения от текущей даты и далее { data = (Hashtable)msg[i]; text = Convert.ToString(data["body"]); mid = Convert.ToUInt32(data["mid"]); outId = Convert.ToUInt32(data["from_id"]); date = Convert.ToDouble(data["date"]); if (!ChatForm.chat.textbox.ContainsKey(uid)) break; ChatForm.chat.Invoke(getHist, uid, text, outId, date); } } else return; }