private void btnFill_Click(object sender, EventArgs e) { UsersBean ub = DBFast.Find <UsersBean>(txtUserID); MDataRow.CreateFrom(ub).SetToAll(this); OutMsg(); }
private void btnInsert_Click(object sender, EventArgs e) { MDataRow row = MDataRow.CreateFrom(new UsersBean()); row.LoadFrom(false, this); DBFast.Insert <UsersBean>(row.ToEntity <UsersBean>(), InsertOp.ID, chbInsertID.Checked); LoadData(); OutMsg(); }
private void btnUpdate_Click(object sender, EventArgs e) { MDataRow row = MDataRow.CreateFrom(new UsersBean()); row.LoadFrom(false, this); DBFast.Update <UsersBean>(row.ToEntity <UsersBean>()); LoadData(); OutMsg(); }
public void BindPhotoList() { PhotoClass pc = DBFast.Find <PhotoClass>(Query <string>("id")); if (pc != null) { View.Set("title", pc.Name + " - Taurus.MVC"); } using (Photo a = new Photo()) { a.Select("CateID=" + Query <string>("id")).Bind(View); } }
public void BindTopArticle() { ArticleClass ac = DBFast.Find <ArticleClass>("Name='行业资讯' or Name='最新资讯'"); if (ac != null) { View.Set("lnkMore", SetType.Href, "/articlelist?id=" + ac.ID); using (Article a = new Article()) { View.OnForeach += View_OnForeach; a.Select(3, "CateID=" + ac.ID + " order by id desc").Bind(View); } } }
public void Dispose() { string key = StaticTool.GetTransationKey(UsingConnBean.ConnName); if (DBFast.HasTransation(key)) { return;//全局事务由全局控制(全局事务会在移除key后重新调用)。 } if (_con != null) { CloseCon(); _con = null; } if (_com != null) { _com.Dispose(); _com = null; } if (_watch != null) { _watch = null; } }
/// <summary> /// 简单工厂(Factory Method) /// </summary> public static DalBase CreateDal(string connNameOrString) { string key = StaticTool.GetTransationKey(connNameOrString); //检测是否开启了全局事务; bool isTrans = DBFast.HasTransation(key); if (isTrans) { if (dalBaseDic.ContainsKey(key)) { return(dalBaseDic[key]); } } DalBase dal = CreateDalBase(connNameOrString); if (isTrans) { dal.TranLevel = DBFast.GetTransationLevel(key); dal.IsOpenTrans = true; dalBaseDic.Add(key, dal); } return(dal); }
private void btn_Click(object sender, EventArgs e) { DBFast.Exists <UsersBean>(txtName); OutMsg(); }
private void btnDelete_Click(object sender, EventArgs e) { DBFast.Delete <UsersBean>(txtUserID); LoadData(); OutMsg(); }
private void LoadData() { dgvUsers.DataSource = DBFast.Select <UsersBean>(); }