public static void AddProjectInfo() { using (var db = new MasterContext()) { var project = new ProjectList(); { Console.WriteLine("Enter Project Title"); project.ProjectTitle = Console.ReadLine(); Console.WriteLine("Enter Project Definition"); project.ProjectDefinition = Console.ReadLine(); var check = db.ProjectList.Where(t => t.ProjectTitle == project.ProjectTitle); if (check != null) { Console.WriteLine("This Project Info is Existing!!"); } else { db.ProjectList.Add(project); db.SaveChanges(); Console.WriteLine("Project Information is Successfully added!!"); } } } }
public ActionResult Product_Group_List() { MasterContext mContext = new MasterContext(); var Product_Group = mContext.Product_Gruop.ToList(); return(View(Product_Group)); }
public IList <DatabaseInfo> ListDatabases() { using (var context = new MasterContext(ConnStrName)) { return(context.Database.SqlQuery <DatabaseInfo>(DatabaseInfo.Query).ToList()); } }
public List <Product> GetProducts() { using (var context = new MasterContext()) { return(context.Products.ToList()); } }
public ActionResult Product_List() { MasterContext mContext = new MasterContext(); var Product = mContext.Product.ToList(); return(View(Product)); }
public ActionResult ContactList() { MasterContext mContext = new MasterContext(); var contactList = mContext.Contact.ToList(); return(View(contactList)); }
public ActionResult SlidersList() { MasterContext mContext = new MasterContext(); var slidersList = mContext.HomeSlider.ToList(); return(View(slidersList)); }
public UnitOfWork(MasterContext context) { if (context != null) { masterContext = context; } }
public List <Client> GetClients() { using (var context = new MasterContext()) { return(context.Clients.ToList()); } }
public override void Cancel() { if (s_subContextBegan) { s_subContextBegan = false; MasterContext.Cancel(); return; } if (IsMasterContext) { foreach (GameContext subContext in m_gameDocumentRegistry.SubDocuments.AsIEnumerable <GameContext>()) { subContext.Cancel(); } } if (!InTransaction) { base.Undo(); } base.Cancel(); if (m_savedSelection != null) { MasterContext.SetRange(m_savedSelection); m_savedSelection = null; } }
public override void End() { if (UndoingOrRedoing) { base.End(); m_savedSelection = null; return; } if (s_subContextBegan) { s_subContextBegan = false; MasterContext.End(); return; } if (IsMasterContext) { foreach (GameContext subContext in m_gameDocumentRegistry.SubDocuments.AsIEnumerable <GameContext>()) { subContext.End(); } } if (TransactionOperations.Count == 0) { TransactionOperations.Add(new Nop()); } base.End(); m_savedSelection = null; }
public IEnumerable <Student> GetStudents() { List <Student> _students = new List <Student>(); MasterContext mc = new MasterContext(); return(mc.Student .OrderBy(s => s.FirstName) .ToList().AsEnumerable()); //using (SqlConnection con = new SqlConnection(connectionString)) //{ // using (var com = new SqlCommand("Select * From Student")) // { // com.Connection = con; // con.Open(); // var dr = com.ExecuteReader(); // while (dr.Read()) // { // var st = new Student(); // st.FirstName = dr["FirstName"].ToString(); // st.LastName = dr["LastName"].ToString(); // st.IndexNumber = dr["IndexNumber"].ToString(); // //... // _students.Add(st); // } // } //} }
protected void bttnSign_Click(object sender, EventArgs e) { if (Page.IsValid) { try { using (MasterContext context = new MasterContext()) { Hasta yeniKayit = new Hasta(); yeniKayit.Isim = txtBoxName.Text; yeniKayit.Soyisim = txtBoxSurrname.Text; yeniKayit.TckNo = txtBoxTckNo.Text; yeniKayit.Adres = txtBoxAdress.Text; yeniKayit.Telefon = txtBoxPhoneNum.Text; yeniKayit.Mail = txtBoxMail.Text; yeniKayit.Sifre = txtBoxUserPass.Text; context.Hasta.Add(yeniKayit); context.SaveChanges(); } Response.Redirect("Anasayfa.aspx"); } catch { Response.Write("Kayıt başarısız!"); } } }
public bootstrap(MasterContext context) { _context = context; if (_context.Operations.Count() == 0) { OperationsMDP op = new OperationsMDP("desc1", "name1", 10, 1); OperationsMDP op2 = new OperationsMDP("desc2", "name2", 150, 2); _context.Operations.Add(op); _context.Operations.Add(op2); _context.SaveChanges(); } if (_context.ManufacturingPlans.Count() == 0) { List <OperationsMDP> lista1 = new List <OperationsMDP>(); List <OperationsMDP> lista2 = new List <OperationsMDP>(); lista1.Add(_context.Operations.Find(1)); lista2.Add(_context.Operations.Find(2)); _context.ManufacturingPlans.Add(new ManufacturingPlan(DateTime.Today, lista1)); _context.ManufacturingPlans.Add(new ManufacturingPlan(DateTime.Today, lista2)); _context.SaveChanges(); } if (_context.Products.Count() == 0) { _context.Products.Add(new Product(new Name("Product1"), _context.ManufacturingPlans.Find(1))); _context.Products.Add(new Product(new Name("Product2"), _context.ManufacturingPlans.Find(2))); _context.SaveChanges(); } }
public IList <ColumnInfo> ListColumns(string tableName) { using (var context = new MasterContext(ConnStrName)) { return(context.ListColumns(tableName)); } }
public IList <TableInfo> ListTables() { using (var context = new MasterContext(ConnStrName)) { return(context.ListTables()); } }
public ActionResult DynamicAddOrEdit(owl_DynamicPage model) { try { if (model.Id == 0) { MasterContext dynamicadd = new MasterContext(); owl_DynamicPage dynamicPages = new owl_DynamicPage() { Name = model.Name, Info = model.Info, }; dynamicadd.DynamicPage.Add(dynamicPages); dynamicadd.SaveChanges(); ViewBag.message = "Dynamic Sayfa Eklendi"; ModelState.Clear(); return(Redirect("/Dynamic/DynamicList")); } else { MasterContext synamicadd = new MasterContext(); synamicadd.Entry(model).State = System.Data.Entity.EntityState.Modified; synamicadd.SaveChanges(); return(Redirect("/Dynamic/DynamicList")); } } catch (Exception) { throw; } }
public ActionResult NewsList() { MasterContext mContext = new MasterContext(); var newsList = mContext.News.ToList(); return(View(newsList)); }
public void GetGridColumn() { try { string moudel = Request["moudel"]; var CurrentMaster = new MasterContext().Master; if (!string.IsNullOrEmpty(CurrentMaster.Id)) { DataSet ds = new BllSysRole().GetGridColumn(moudel, CurrentMaster.Id); if (ds.Tables[0].Rows.Count > 0) { Hashtable ht = new Hashtable(); ht.Add("UserId", ds.Tables[0].Rows[0]["UserId"].ToString()); ht.Add("ModelId", ds.Tables[0].Rows[0]["ModelId"].ToString()); ht.Add("ColumnId", ds.Tables[0].Rows[0]["ColumnId"].ToString()); json.success = true; json.msg = "设置成功!"; json.data = JsonHelper.ToJson(ht); } } else { json.success = false; json.msg = "用户信息已过期,请重新登陆!"; } } catch (Exception ex) { json.success = false; json.msg = "操作失败!" + ex.Message; } Response.Write(new JavaScriptSerializer().Serialize(json).ToString()); Response.End(); }
public ActionResult DynamicList() { MasterContext mContext = new MasterContext(); var dynamicList = mContext.DynamicPage.ToList(); return(View(dynamicList)); }
/// <summary> /// 上级单位 首页 /// </summary> /// <returns></returns> public ActionResult ParentIndex() { var master = new MasterContext().Master; if (master == null) { return(Redirect("/Temple/LoginError")); } else { //获取通知公告 XMLHealper XmlColl = new XMLHealper(Server.MapPath("~") + "Project\\Template\\notice.xml"); string notice = ""; foreach (XmlNode Nodes in XmlColl.GetXmlRoot().SelectNodes("tice")) { notice = Nodes.Attributes["value"].InnerText; } ViewData["Notice"] = notice; ViewData["WebSiteName"] = ConfigurationManager.AppSettings["WebSiteName"];//系统站点名称 ViewData["Version"] = ConfigurationManager.AppSettings["Version"]; ViewData["copyright"] = ""; var model = new BllSysCompany().LoadData(key); if (model != null) { ViewData["copyright"] = model.Name; } int UserCount = 0; //系统用户 int CompanyCount = 0; //使用单位 int EventCount = 0; //设备总量 int LostEvent = 0; //过期设备 int LostTime = 0; //超期未检 DataSet ds = new BllSysAppointed().Total(new MasterContext().Master.Cid); if (ds.Tables[0].Rows.Count > 0) { UserCount = int.Parse(ds.Tables[0].Rows[0]["UserCount"].ToString()); CompanyCount = int.Parse(ds.Tables[0].Rows[0]["CompanyCount"].ToString()); EventCount = int.Parse(ds.Tables[0].Rows[0]["EventCount"].ToString()); LostEvent = int.Parse(ds.Tables[0].Rows[0]["LostEvent"].ToString()); LostTime = int.Parse(ds.Tables[0].Rows[0]["LostTime"].ToString()); } //查询广告列表 BllEDynamic bllDynamic = new BllEDynamic(); List <ModEDynamic> list = bllDynamic.getListAll(9); //查询待办任务 List <ModSysFlow> Flowlist = new BllSysFlow().getListAll(7, " and CompanyId='" + new MasterContext().Master.Cid + "'"); ViewData["UserCount"] = UserCount; ViewData["CompanyCount"] = CompanyCount; ViewData["EventCount"] = EventCount; ViewData["LostEvent"] = LostEvent; ViewData["LostTime"] = LostTime; ViewData["list"] = list; ViewData["Flowlist"] = Flowlist; return(View()); } }
public void GetTree() { string childId = Request["id"]; var master = new MasterContext().Master; if (master != null) { //获取菜单访问权限 if (master.IsMain) //超级管理员,不用控权 { InitAdminTree(childId, master); } else { InitRoleTree(childId, master); } } else { var json = new ModJsonResult(); json.success = false; json.errorCode = (int)SystemError.用户过期错误; Response.Write(new JavaScriptSerializer().Serialize(json).ToString()); Response.End(); } }
private void EagerMigration() { //Ensuring migration for MasterContext var context = new MasterContext(); // ReSharper disable once UnusedVariable : Required for eager migration var eagerMigration = context.Products.ToList(); }
/// <summary> /// 获取用户信息 /// </summary> public void GetLoginUser() { var master = new MasterContext().Master; var json = new ModJsonResult(); if (master != null) { ModSysMaster userInfo = master; //var userId = Request["userId"] == null ? "" : Request["userId"].ToString(CultureInfo.InvariantCulture); //if (userId.Length > 0) //{ // var masterLogic = new BllSysMaster(); // userInfo = masterLogic.LoadData(userId); // masterLogic.LoadMasterPower(userInfo); //} //else //{ // userInfo = master; //} json.success = true; json.msg = JsonHelper.ToJson(userInfo); } else { json.errorCode = (int)SystemError.用户过期错误; json.success = false; json.msg = "用户信息已过期,请重新登录!"; } Response.Write(new JavaScriptSerializer().Serialize(json).ToString()); Response.End(); }
protected void bttnSign_Click(object sender, EventArgs e) { if (Page.IsValid) { try { using (MasterContext context = new MasterContext()) { Models.EFCore.Hekim yeniKayit = new Models.EFCore.Hekim(); yeniKayit.Isim = txtBoxName.Text; yeniKayit.Soyisim = txtBoxSurrname.Text; yeniKayit.TckNo = txtBoxTckNo.Text; yeniKayit.Adres = txtBoxAdress.Text; yeniKayit.Telefon = txtBoxPhoneNum.Text; yeniKayit.Mail = txtBoxMail.Text; yeniKayit.Sifre = txtBoxUserPass.Text; yeniKayit.PolikinlikId = Convert.ToInt32(polikinlikDDL.SelectedValue); context.Hekim.Add(yeniKayit); context.SaveChanges(); } Response.Redirect("Goruntule.aspx"); } catch { Response.Write("Kayıt başarısız!"); } } }
public List <Punct4> GetPoint4() { using (var context = new MasterContext()) { return(context.Point4.ToList()); } }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, MasterContext masterContext) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/Error"); app.UseHsts(); } Logger.Configure(); Logger.Info("Application Started."); Thread.Sleep(TimeSpan.FromSeconds(30)); masterContext.Database.Migrate(); app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseCookiePolicy(); app.UseAuthentication(); app.UseSession(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Login}/{action=LoginIndex}/{id?}"); }); }
public EventListViewModelBase( IEventAggregator eventAggregator, MasterContext masterContext ) : base(eventAggregator) { this.masterContext = masterContext; var eventsOccured = this.masterContext.EventsOccured.OrderByDescending(e => e.Date).Take(20).ToList(); this.Events = eventsOccured.Select(eo => { switch (eo.Type) { case Data.Master.Model.EventType.FillUp: var evModel = this.masterContext.FillUps.Find(eo.EntityId); var fillUp = new FillUpEntity() { Id = evModel.Id, Name = eo.Title, Expense = eo.Expense, Profit = eo.Profit, LiterCost = evModel.LiterCost, Litres = evModel.LitresValue, Mileage = eo.Mileage, OccuredDate = eo.Date }; return(fillUp); default: return(new EventOccuredEntity()); } }); this.DisplayName = "Events"; }
protected void bttnSignIn_Click(object sender, EventArgs e) { if (Page.IsValid) { try { using (MasterContext context = new MasterContext()) { var user = context.Hasta.FirstOrDefault(x => x.TckNo == txtBoxTckNo.Text && x.Sifre == txtBoxPass.Text); if (user != null) { // kullanıcı var Transporter transporter = new Transporter(); transporter.Id = user.Id; transporter.TckNo = user.TckNo; transporter.Sifre = user.Sifre; Session.Add("Account", transporter); Page.Response.Write("kullanıcı var session oluşturuldu, yönlendirme sayfası yazılmadı"); } else { Page.Response.Write("böyle bir kullanıcı yok yönlendirme sayfası yazılmadı"); } } } catch { Page.Response.Write("Oturum açma hatası!!!"); } } }
public UsersService(MasterContext context, IRepository <User> userRepo, IRepository <Activation_Code> activationCodeRepo, IRepository <PasswordToken> passwordTokenRepo) { _context = context; _userRepo = userRepo; _activationCodeRepo = activationCodeRepo; _passwordTokenRepo = passwordTokenRepo; }//CONSTRUCTOR
public SimpleMembershipInitializer() { Database.SetInitializer<MasterContext>(null); try { using (var context = new MasterContext()) { if (!context.Database.Exists()) { // Create the SimpleMembership database without Entity Framework migration schema ((IObjectContextAdapter)context).ObjectContext.CreateDatabase(); } } WebSecurity.InitializeDatabaseConnection("DefaultConnection", "UserProfile", "UserId", "UserName", autoCreateTables: true); } catch (Exception ex) { throw new InvalidOperationException("The ASP.NET Simple Membership database could not be initialized. For more information, please see http://go.microsoft.com/fwlink/?LinkId=256588", ex); } }