public static int updatemodel(information str) { Model1 mo = new Model1(); mo.Entry(str).State = System.Data.Entity.EntityState.Modified; return(mo.SaveChanges()); }
private void button3_Click(object sender, EventArgs e) { information inf = new information(); XmlSerializer xs = new XmlSerializer(inf.GetType()); FileStream fs = new FileStream(selectedtable + "1.xml", FileMode.Open); inf = (information)xs.Deserialize(fs); fs.Close(); int x, y; x = y = 0; dataGridView1.Rows.Add(); for (int i = 0; i < inf.info.Count; ++i) { if (inf.info[i] == "new row") { if (i != inf.info.Count) { dataGridView1.Rows.Add(); } ++y; x = 0; continue; } dataGridView1.Rows[y].Cells[x].Value = inf.info[i]; x++; } }
public invoice() { InitializeComponent(); WindowState = FormWindowState.Maximized; //Read the xml file to get the contract_no if (File.Exists("data.xml")) { XmlSerializer xs = new XmlSerializer(typeof(information)); FileStream read = new FileStream("data.xml", FileMode.Open, FileAccess.Read, FileShare.Read); information info = (information)xs.Deserialize(read); contract_no_sys = Convert.ToInt32(info.Contract_no); read.Close(); } DateTime dateTime = DateTime.Now.Date; invoices_tb.Text = "C" + dateTime.ToString("yyyyMM") + contract_no_sys.ToString("00000"); dt = new System.Data.DataTable(); List <String> values = df.ins_combobox_value(); //Insert the institution values to the combo box. foreach (String str in values) { ins_cb.Items.Add(str); } Debug.WriteLine(dateTime); to_cb.Items.Add("Correctional Services Department"); to_cb.SelectedIndex = 0; total_amount_tb.Text = "$0"; date_tb.Text = dateTime.ToString("yyyy/MM/dd"); }
public ActionResult EditInformation(int?id) { if (Convert.ToInt32(Session["employe_type"]) == 1 && id != null) { information information = new information(); try { information = operations.FindInformation(id); } catch (Exception) { string message = "Det går inte att hitta informationen, vänligen försök igen."; return(RedirectToAction("Error", "Home", new { message = message })); } if (information == null) { return(HttpNotFound()); } return(View(information)); } else { return(RedirectToAction("Index", "Home")); } }
public static int insert(information str) { Model1 mo = new Model1(); mo.information.Add(str); return(mo.SaveChanges()); }
public async Task <ActionResult> Index() { string sql = "Select count(id) from Orders;"; string sqlOrderSucess = " Select count(id) from Orders where FulfillmentStatus = 2;"; var total = db.Database.SqlQuery <int>(sql).Single(); var totalOrserSucess = db.Database.SqlQuery <int>(sqlOrderSucess).Single(); string api = ApiConfig.api; //string apiVps = ApiConfig.apiVps; information infor = await testAsync(); string str = infor.use.Remove(infor.use.Length - 1); string inforTotal = infor.total.Remove(infor.total.Length - 1); ViewBag.api = api; //ViewBag.apiVps = apiVps; ViewBag.total = total; ViewBag.Revenueofmonth = Revenueofmonth(DateTime.Now); ViewBag.totalOrserSucess = totalOrserSucess; ViewBag.mothPrevious = mothPrevious(); ViewBag.totalUser = totalUser(); ViewBag.information_use = str; ViewBag.information_total = inforTotal; ViewBag.Returned = Returned(DateTime.Now); //double[] IncomeOfYear_ = IncomeOfYear(); //ViewBag.IncomeOfYear = IncomeOfYear_; return(View("~/Areas/Admin/Views/Dashboard/Dashboard.cshtml")); }
public void new_invoice() { to_cb.SelectedIndex = 0; contract_no_tb.Text = ""; ins_cb.SelectedIndex = -1; docket_no_tb.Text = ""; total_amount_tb.Text = "$0"; int rowCount = item_grid.RowCount; for (int i = 0; i < rowCount; i++) { //MessageBox.Show(item_grid.Rows[0].Cells["item_code_col"].Value.ToString()+ item_grid.Rows[1].Cells["item_code_col"].Value.ToString()); if (item_grid.Rows[0].Cells["item_code_col"].Value != null) { this.item_grid.Rows.RemoveAt(0); } } if (File.Exists("data.xml")) { XmlSerializer xs = new XmlSerializer(typeof(information)); FileStream read = new FileStream("data.xml", FileMode.Open, FileAccess.Read, FileShare.Read); information info = (information)xs.Deserialize(read); contract_no_sys = Convert.ToInt32(info.Contract_no); read.Close(); } DateTime dateTime = DateTime.Now.Date; invoices_tb.Text = "C" + dateTime.ToString("yyyyMM") + contract_no_sys.ToString("00000"); date_tb.Text = dateTime.ToString("yyyy/MM/dd"); }
public static int delete(int id) { Model1 mo = new Model1(); information list = mo.information.FirstOrDefault(p => p.infoId == id); mo.Entry(list).State = System.Data.Entity.EntityState.Deleted; return(mo.SaveChanges()); }
public async Task <ActionResult> DeleteConfirmed(int id) { information information = await db.information.FindAsync(id); db.information.Remove(information); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public ActionResult insertmodel(information str) { if (Class4.insert(str) != 0) { return(RedirectToAction("Index")); } else { return(RedirectToAction("insert")); } }
public loginModels GetLoginFormModels(userData userData, string cuurip, string userAgent) { switch (string.IsNullOrWhiteSpace(userData.userid)) { case true: return(new loginModels() { status = "errorFormLogin" }); } database database = new database(); DataTable loginRows = new DataTable(); List <dbparam> dbparamlist = new List <dbparam>(); dbparamlist.Add(new dbparam("@newid", userData.userid.TrimEnd())); dbparamlist.Add(new dbparam("@externip", cuurip)); dbparamlist.Add(new dbparam("@status", "1")); loginRows = database.checkSelectSql("mssql", "epaperstring", "exec web.checkformlogin @newid,@externip,@status;", dbparamlist); switch (loginRows.Rows.Count) { case 0: return(new loginModels() { status = "nodata" }); } if (loginRows.Rows[0]["isused"].ToString().TrimEnd() == "1" && loginRows.Rows[0]["islogin"].ToString().TrimEnd() == "1") { datetime datetime = new datetime(); information information = new information(); string date = datetime.sqldate("mssql", "epaperstring"), time = datetime.sqltime("mssql", "epaperstring"); dbparamlist.Add(new dbparam("@cpu", "")); dbparamlist.Add(new dbparam("@os", information.osystem(userAgent))); dbparamlist.Add(new dbparam("@internip", "")); dbparamlist.Add(new dbparam("@indate", date)); dbparamlist.Add(new dbparam("@intime", time)); switch (database.checkActiveSql("mssql", "epaperstring", "update web.sitelog set cpu = @cpu,os = @os,internip = @internip,indate = @indate,intime = @intime where newid = @newid and externip = @externip and islogin = @status;", dbparamlist)) { case "istrue": return(new loginModels() { newid = loginRows.Rows[0]["newid"].ToString().TrimEnd(), name = loginRows.Rows[0]["username"].ToString().TrimEnd().Substring(0, 1), allname = loginRows.Rows[0]["username"].ToString().TrimEnd(), status = "istrue" }); } return(new loginModels() { status = "error" }); } return(new loginModels() { status = "islock" }); }
public async Task <ActionResult> Edit([Bind(Include = "id,usuario,identificacion,nombres,apellidos,contrasena,direccion,fechaNacimiento,celular,email")] information information) { if (ModelState.IsValid) { db.Entry(information).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(information)); }
public ActionResult updatemodel(information str) { if (Class4.updatemodel(str) != 0) { return(RedirectToAction("Index")); } else { return(RedirectToAction("update")); } }
private async Task <information> testAsync() { information infor = new information(); var client = new HttpClient(); var result = await client.GetAsync("http://171.244.141.61:8111/dataservice/getsysteminformation/"); //Console.WriteLine(result.StatusCode); var dataRespon = await result.Content.ReadAsStringAsync(); infor = JsonConvert.DeserializeObject <information>(dataRespon); return(infor); }
private information[] gatherinfo() { List <information> r = new List <information>(); switch (type) { case normalunit: { //주변 유닛 찾기 Vector2 pos = new Vector2(transform.position.x, transform.position.y); Collider2D[] obj = Physics2D.OverlapCircleAll(pos, sightrange); foreach (Collider2D c in obj) { var o = c.gameObject; if (o.GetInstanceID() == gameObject.GetInstanceID()) //자신은 제외 { continue; } if (o.tag == "Unit") { //올바른 유닛인지에 대한 검사는 나중에 구현 information newinfo = new information("Unitinfo", o.name, null); r.Add(newinfo); newinfo.addmsg("gameobject", o); Debug.Log("Unit information has been added to unitpattern"); } } //공격을 받았거나 등의 피사건이 있는지 확인 //보통은 피격되거나 했을 시점에서 unitpattern 컴포넌트를 받아서 incident에 저장하는 식으로 하는게 좋을듯 foreach (information i in incident) { if (i == null) { continue; } switch (i.type) { } } } break; } return(r.ToArray()); }
public static void Add(TextBox text1, TextBox text2, TextBox text3) { using (var context = new MyDbContext2()) { var info = new information() { Name = text1.Text, This = text2.Text, Code = text3.Text, }; context.informations.Add(info); context.SaveChanges(); } }
// GET: information/Delete/5 public async Task <ActionResult> Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } information information = await db.information.FindAsync(id); if (information == null) { return(HttpNotFound()); } return(View(information)); }
public ActionResult LogIn(Models.ViewModels.Login model) { if (!ModelState.IsValid) { return(View()); } var StrPass = creat(model.Password); var CurUser = _Context.Users.Single(x => x.UserName == model.Email && x.PasswordHash == StrPass); var RoleUser = CurUser.Roles.FirstOrDefault(); // Don't do this in production! // if (model.Email == "*****@*****.**" && model.Password == "password") JsonFormat newjson = new JsonFormat(); List <information> p = new List <information>(); information add1 = new information { controller = "Home", action = "MyInfo" }; information add2 = new information { controller = "Home", action = "MyInfo2" }; p.Add(add1); p.Add(add2); newjson.information = p; string json = JsonConvert.SerializeObject(newjson); if (CurUser != null && RoleUser != null) { var identity = new ClaimsIdentity(new[] { new Claim(ClaimTypes.UserData, CurUser.UserName), new Claim(ClaimTypes.Name, CurUser.FirstName + " " + CurUser.LastName), new Claim(ClaimTypes.Email, CurUser.Email), new Claim(ClaimTypes.Country, "Iran"), new Claim("JsonListConvert", json), new Claim(ClaimTypes.Role, RoleUser.Name) }, "ApplicationCookie"); var ctx = Request.GetOwinContext(); var authManager = ctx.Authentication; authManager.SignIn(identity); return(Redirect(GetRedirectUrl(model.ReturnUrl))); } // user authN failed ModelState.AddModelError("", "Invalid email or password"); return(View()); }
public bool compare(information dest) { if (dest == null) { return(false); } else if (dest.type == null) { return(false); } return(dest.name == name); }
public weapon getwp(weapon dest) => getwpbyindex(getwpindex(dest));//현제 게임오브젝트에 있어야 받아옴 public bool addincident(msg dest) { if (dest == null) { return(false); } information i = new information(dest.type, (string)dest.get("name", "string"), null); dest.remove("name"); i.addmsg(dest); incident.Add(i); return(true); }
//tao user public ActionResult Create(information acc) { if (ModelState.IsValid) { var dao = new employeeDao(); int id = dao.Insert(acc); if (id > 0) { return(RedirectToAction("Index", "Employee")); } else { ModelState.AddModelError("", "Thêm nhân viên thành công"); } } return(View("Index")); }
//tao user public ActionResult Edit(information acc) { if (ModelState.IsValid) { var dao = new employeeDao(); var result = dao.update(acc); if (result) { return(RedirectToAction("Index", "Employee")); } else { ModelState.AddModelError("", "Cập nhập thành công"); } } return(View("Index")); }
private void button1_Click(object sender, EventArgs e) { information inf = new information(); foreach (DataGridViewRow row in dataGridView1.Rows) { foreach (DataGridViewCell cell in row.Cells) { try { inf.info.Add(cell.Value.ToString()); } catch { } } inf.info.Add("new row"); } inf.info.RemoveAt(inf.info.Count - 1); bool append = false; TextWriter writer = null; try { var serializer = new XmlSerializer(typeof(information)); writer = new StreamWriter(selectedtable + "1.xml", append); serializer.Serialize(writer, inf); } finally { if (writer != null) { writer.Close(); } } dataGridView1.Rows.Clear(); }
public ActionResult EditInformation([Bind(Include = "information_id, information_Title, information_Text")] information information) { if (ModelState.IsValid) { try { operations.UpdateInformation(information); return(RedirectToAction("Index", "Home")); } catch (Exception) { string message = "Det går inte att uppdatera informationen, vänligen försök igen."; return(RedirectToAction("Error", "Home", new { message = message })); } } return(View(information)); }
private void FrMain_Load(object sender, EventArgs e) { chart = new DanhGiaNangLuc(); ////THHT = new TinhHinhHocTap(); QLMH = new QuanLyMonHoc(); DiemSV = new DiemSinhVien(); QLK = new QuanLyKhoa(); QLLH = new QuanLyLopHoc(); TTSV = new ThongTinSinhVien(); DMK = new DoiMatKhau(account); TTTK = new ThongTinTaiKhoan(account, DMK); inf = new information(); QLND = new QuanLyNguoiDung(); SLSVTK = new SoLuongSinhVienTheoKhoa(); this.pnlDisplay.Controls.Add(SLSVTK); this.pnlDisplay.Controls.Add(QLND); this.pnlDisplay.Controls.Add(QLMH); this.pnlDisplay.Controls.Add(DiemSV); this.pnlDisplay.Controls.Add(QLK); this.pnlDisplay.Controls.Add(QLLH); this.pnlDisplay.Controls.Add(TTSV); this.pnlDisplay.Controls.Add(TTTK); this.pnlDisplay.Controls.Add(inf); this.pnlDisplay.Controls.Add(DMK); this.pnlDisplay.Controls.Add(chart); this.SLSVTK.Visible = false; this.chart.Visible = false; this.QLND.Visible = false; this.DiemSV.Visible = false; this.QLMH.Visible = false; this.QLK.Visible = false; this.QLLH.Visible = false; this.TTSV.Visible = false; this.DMK.Visible = false; this.TTTK.Visible = false; this.inf.Visible = false; }
//update public bool update(information ennity) { try { var user = db.information.Find(ennity.Id); user.name = ennity.name; user.address = ennity.address; user.birthDay = ennity.birthDay; user.gender = ennity.gender; user.salary = ennity.salary; user.block = ennity.block; user.IdWork = ennity.IdWork; db.SaveChanges(); return(true); } catch (Exception) { return(false); } }
//读取 private void ucBtnExt4_BtnClick(object sender, EventArgs e) { //读取路径 string Save_File_Path = System.AppDomain.CurrentDomain.BaseDirectory + "Save_File.ini"; //读取赋值 this.textBoxEx3.Text = INI.ContentValue("information", "初始速度", Save_File_Path); this.textBoxEx1.Text = INI.ContentValue("information", "加速度", Save_File_Path); this.textBoxEx2.Text = INI.ContentValue("information", "减速度", Save_File_Path); this.textBoxEx4.Text = INI.ContentValue("information", "最大速度", Save_File_Path); //实例化一个对象 information objinformaiton = new information(); //对象赋值 objinformaiton.Speed = Convert.ToInt32(INI.ContentValue("information", "初始速度", Save_File_Path)); objinformaiton.Acceleration = Convert.ToInt32(INI.ContentValue("information", "加速度", Save_File_Path)); objinformaiton.Deceleration = Convert.ToInt32(INI.ContentValue("information", "减速度", Save_File_Path)); objinformaiton.Maxspeed = Convert.ToInt32(INI.ContentValue("information", "最大速度", Save_File_Path)); }
public void OnTimedEvent(object source, ElapsedEventArgs e) { MainAsync(theName, true); //calling function to update information about selected client every 30 sec try { information info = new information(); info.ClientName = theName; info.ClientEmail = email; info.ClientBackground = backg; info.ClientPlan = plan; info.ClientStart = startdate; info.ClientEnd = enddate; savedata(info, theName + ".xml"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void click_connact(UITableViewRowAction row, NSIndexPath indexPath) // Action Connect button { if (!information.isconnct) { _information.connet(cellList[indexPath.Row], PortList[indexPath.Row]); _information.Diconncet += _information_Diconncet; row.Title = "diSconncet"; row.BackgroundColor = UIColor.Gray; // Connect connect = new Connect("",9); } else { row.BackgroundColor = UIColor.Blue; _information.stop(); row.Title = library.StrForm(1); _information = null; } }
public void Create(information_Model model) { var data = Connect_Enttity.information.FirstOrDefault(x => x.Id == model.Id); if (data == null) { var entity = new information(); entity.Name = model.Name; entity.Image = model.Image; entity.Target = model.Target; entity.Content = model.Content; entity.Detail = model.Detail; entity.Position = (short)(model.Position); entity.Click = (int)(model.Click); entity.Ord = (int)(model.Ord); entity.Active = (bool)(model.Active); entity.Lang = model.Lang; entity.Title = model.Title; entity.Description = model.Description; entity.Keyword = model.Keyword; entity.Image1 = model.Image1; entity.Image2 = model.Image2; entity.Image3 = model.Image3; entity.Image4 = model.Image4; entity.Image5 = model.Image5; entity.Index = (int)(model.Index); entity.Priority = (int)(model.Priority); entity.Tag = model.Tag; entity.NameEn = model.NameEn; entity.ContentEn = model.ContentEn; entity.DetailEn = model.DetailEn; Connect_Enttity.information.Add(entity); Connect_Enttity.SaveChanges(); Dispose(); } }