private BusinessMessModel GetModel(bool bj_child, bool bj_father, DataRow dr, DB_OPT dbo) { BusinessMessModel model = new BusinessMessModel { Name = dr["Name"].ToString() }; if (dr["OprateOrder"].ToString() != "") { model.OprateOrder = int.Parse(dr["OprateOrder"].ToString()); } model.PK = dr["PK"].ToString(); model.Remark = dr["Remark"].ToString(); model.TacheType = dr["TacheType"].ToString(); return model; }
public override BusinessMessModel[] GetModel(string strWhere, DB_OPT dbo) { StringBuilder builder = new StringBuilder(); builder.Append(this.GetSelectSql()); if (strWhere != "") { builder.Append(" where " + strWhere); } DataSet set = dbo.BackDataSet(builder.ToString(), null); BusinessMessModel[] modelArray = null; if (set.Tables[0].Rows.Count <= 0) { return null; } modelArray = new BusinessMessModel[set.Tables[0].Rows.Count]; for (int i = 0; i < set.Tables[0].Rows.Count; i++) { modelArray[i] = new BusinessMessModel(); modelArray[i] = this.GetModel(false, false, set.Tables[0].Rows[i], dbo); } return modelArray; }
public void delete() { if ((this.gvResult.SelectedIndex >= 0) && (this.gvResult.Rows.Count >= this.gvResult.SelectedIndex)) { try { try { this.dbo = new DB_OPT(); this.bmm = new BusinessMessDal(); this.bmm.PK = ((Label)this.gvResult.Rows[this.gvResult.SelectedIndex].FindControl("labPk")).Text; this.dbo.Open(); this.bmm.Delete(this.dbo); } catch (Exception exception) { this.el = new ExceptionLog.ExceptionLog(); this.el.ErrClassName = base.GetType().ToString(); this.el.ErrMessage = exception.Message.ToString(); this.el.ErrMethod = "delete()"; this.el.WriteExceptionLog(true); Const.OpenErrorPage("操作失败,请联系系统管理员!", this.Page); } return; } finally { if (this.dbo != null) { this.dbo.Close(); } } } Const.ShowMessage("请选择一行数据再操作!", this.Page); }