/// <summary> /// 得到列表 /// </summary> /// <param name="ent"></param> /// <returns></returns> public List<ayjz_xxtsInfo> Getayjz_xxtsList(string Where) { List<ayjz_xxtsInfo> list = new List<ayjz_xxtsInfo>(); using(DbDataReader reader = DataBaseManage.ExecuteReader(DalSql+Where)) { while (reader.Read()) { ayjz_xxtsInfo ent = new ayjz_xxtsInfo(); SetEnt(ent, reader); list.Add(ent); } } return list; }
public bool Add(ayjz_xxtsInfo info, List<string> users) { TranAction t = new TranAction(); List<ayjz_xxtsInfo> list = new List<ayjz_xxtsInfo>(); foreach (string o in users) { ayjz_xxtsInfo a = new ayjz_xxtsInfo(); a.FSR = info.FSR; a.FSSJ = info.FSSJ; a.FSNR = info.FSNR; a.JSR = o; t.Add(a); } return t.Excute() > 0; }
protected void btnSave_Click(object sender, EventArgs e) { ayjz_xxtsInfo info = new ayjz_xxtsInfo(); info.CLJG = rblCLJG.SelectedValue; info.QLSJ = DateTime.Now; if (logic.Update(info) > 0) { Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('处理成功!');</script>"); Query(); Clear(); TabContainer1.ActiveTabIndex = 0; } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('处理失败!');</script>"); } }
/// <summary> /// 根据Id得到 /// </summary> /// <param name="ent"></param> /// <returns></returns> public ayjz_xxtsInfo Getayjz_xxts( long ID) { ayjz_xxtsInfo ent = null; string sql = DalSql; sql = sql + " And ID=@ID "; MySqlParameter[] paras = new MySqlParameter[] { new MySqlParameter("ID",ID) }; using(DbDataReader reader = DataBaseManage.ExecuteReader(sql, paras)) { if (reader.Read()) { ent = new ayjz_xxtsInfo(); SetEnt(ent, reader); } } return ent; }
private ayjz_xxtsInfo SetInfo() { ayjz_xxtsInfo info = new ayjz_xxtsInfo(); info.FSNR = txtFSNR.Text; info.FSSJ = DateTime.Now; info.FSR = Authentication.GetUserCode(); return info; }
protected void gvTable_RowEditing(object sender, GridViewEditEventArgs e) { string id = gvTable.DataKeys[e.NewEditIndex].Value.ToString(); ayjz_xxtsInfo info = new ayjz_xxtsInfo(); info.ID = Convert.ToInt64(id); info.BJ = "1"; logic.Update(info); info = logic.Getayjz_xxts(Convert.ToInt64(id)); txtID.Text = id; if (info != null) { txtFSNR.Text = info.FSNR; lblFSSJ.Text = info.FSSJ.HasValue ? info.FSSJ.Value.ToString("yyyy-MM-dd HH;mm:ss") : ""; TabContainer1.ActiveTabIndex = 1; btnSave.Visible = true; } }
public int Update(ayjz_xxtsInfo ent) { return dao.Update(ent, null); }
public bool Delete(string id) { ayjz_xxtsInfo info = new ayjz_xxtsInfo(); info.ID = Convert.ToInt64(id); return dao.Delete(info, null)>0; }
public bool Add(ayjz_xxtsInfo info, List<string> users) { return dao.Add(info, users); }
private int RunCommandWithTransatcion(ayjz_xxtsInfo ent, string vSql, IDbTransaction TRANS) { if (null == TRANS) { MySqlParameter[] paras = new MySqlParameter[ent.Column.Count]; for (int i = 0; i < ent.Column.Count; i++) { paras[i] = new MySqlParameter(); paras[i].ParameterName = ent.Column[i].FieldName; paras[i].DbType = ent.Column[i].FieldType; paras[i].Value = ent.Column[i].FieldValue; } return DataBaseManage.ExecuteSql(vSql, paras); } else { System.Data.IDbCommand CM = TRANS.Connection.CreateCommand(); CM.CommandText = vSql; CM.CommandType = CommandType.Text; CM.Transaction = TRANS; GetEntityDeleteParameter(CM, ent); try { return CM.ExecuteNonQuery(); } catch (System.Exception e) { if (isDebug) throw new Exception(e.Message); return 0; } } }
public void SetEnt(ayjz_xxtsInfo ent, IDataReader dr) { ent.ID = MyConvert.ToLong(dr["ID"]); ent.FSR = MyConvert.ToString(dr["FSR"]); ent.FSSJ = MyConvert.ToDateTime(dr["FSSJ"]); ent.FSNR = MyConvert.ToString(dr["FSNR"]); ent.JSR = MyConvert.ToString(dr["JSR"]); ent.QLSJ = MyConvert.ToDateTime(dr["QLSJ"]); ent.CLJG = MyConvert.ToString(dr["CLJG"]); ent.BJ = MyConvert.ToString(dr["BJ"]); }