/// <summary> /// 查询所有数据并返回数据集 /// </summary> public static DataTable GetTbuserDT(string strWhere) { string sql = "select * from [Tbuser]"; sql = (strWhere.Length > 0) ? sql += " where " + strWhere : sql; DataTable dt = DBM.getTable(sql); return(dt); }
/// <summary> /// 查询所有数据并返回数据集 /// </summary> public static DataTable GetTbsusheTop(int i, string strWhere) { string sql = "select top " + i + " [id],[ssname],'~/Upload/'+[pic] as pic from [Tbsushe]"; sql = (strWhere.Length > 0) ? sql += " where " + strWhere : sql; sql += " order by id desc "; DataTable dt = DBM.getTable(sql); return(dt); }
/// <summary> /// 查询所有数据并返回数据集 /// </summary> public static List <AdminInfo> GetAdmin(string strWhere) { string sql = "select * from [Admin]"; sql = (strWhere.Length > 0) ? sql += " where " + strWhere : sql; DataTable dt = DBM.getTable(sql); List <AdminInfo> list = new List <AdminInfo>(); foreach (DataRow dr in dt.Rows) { AdminInfo model = new AdminInfo(); model.Id = int.Parse(dr["Id"].ToString()); model.Name = dr["Name"].ToString(); model.Pass = dr["Pass"].ToString(); list.Add(model); } return(list); }
/// <summary> /// 查询所有数据并返回数据集 /// </summary> public static List <TbsusheInfo> GetTbsushe(string strWhere) { string sql = "select * from [Tbsushe]"; sql = (strWhere.Length > 0) ? sql += " where " + strWhere : sql; DataTable dt = DBM.getTable(sql); List <TbsusheInfo> list = new List <TbsusheInfo>(); foreach (DataRow dr in dt.Rows) { TbsusheInfo model = new TbsusheInfo(); model.Id = int.Parse(dr["Id"].ToString()); model.Ssname = dr["Ssname"].ToString(); model.Remark = dr["Remark"].ToString(); model.Pic = "Upload/" + dr["Pic"].ToString(); list.Add(model); } return(list); }
/// <summary> /// 查询所有数据并返回数据集 /// </summary> public static List <TbruzhuInfo> GetTbruzhu(string strWhere) { string sql = "select * from [Tbruzhu]"; sql = (strWhere.Length > 0) ? sql += " where " + strWhere : sql; DataTable dt = DBM.getTable(sql); List <TbruzhuInfo> list = new List <TbruzhuInfo>(); foreach (DataRow dr in dt.Rows) { TbruzhuInfo model = new TbruzhuInfo(); model.Id = int.Parse(dr["Id"].ToString()); model.Chuangid = int.Parse(dr["Chuangid"].ToString()); model.Userid = int.Parse(dr["Userid"].ToString()); model.Ruzhudate = dr["Ruzhudate"].ToString(); model.Tuchudate = dr["Tuchudate"].ToString(); model.State = int.Parse(dr["State"].ToString()); list.Add(model); } return(list); }
/// <summary> /// 查询所有数据并返回数据集 /// </summary> public static List <TbuserInfo> GetTbuser(string strWhere) { string sql = "select * from [Tbuser]"; sql = (strWhere.Length > 0) ? sql += " where " + strWhere : sql; DataTable dt = DBM.getTable(sql); List <TbuserInfo> list = new List <TbuserInfo>(); foreach (DataRow dr in dt.Rows) { TbuserInfo model = new TbuserInfo(); model.Id = int.Parse(dr["Id"].ToString()); model.Name = dr["Name"].ToString(); model.Pwd = dr["Pwd"].ToString(); model.Sex = dr["Sex"].ToString(); model.Phone = dr["Phone"].ToString(); model.Address = dr["Address"].ToString(); model.Email = dr["Email"].ToString(); model.Remark = dr["Remark"].ToString(); model.Uname = dr["Uname"].ToString(); list.Add(model); } return(list); }
///GetPK /// <summary> /// 根据数据表主键更新数据 /// </summary> /// <param name="Admin">数据表实体对象</param> public static Exception Update(AdminInfo Admin) { string sql = string.Format("update [Admin] set[Name]='{0}',[pass]='{1}' where[ID]='{2}'", Admin.Name, Admin.Pass, Admin.Id); return(DBM.Execute(sql)); }
/// <summary> /// 添加数据 /// </summary> /// <param name="Admin">数据表实体对象</param> public static Exception Add(AdminInfo Admin) { string sql = string.Format("insert into [Admin] values ('{0}','{1}')", Admin.Name, Admin.Pass); return(DBM.Execute(sql)); }
///GetPK /// <summary> /// 根据数据表主键更新数据 /// </summary> /// <param name="Tbchuang">数据表实体对象</param> public static Exception Update(TbchuangInfo Tbchuang) { string sql = string.Format("update [Tbchuang] set[chuangNum]='{0}',[susheid]='{1}',[remark]='{2}',[pic]='{3}' where[id]='{4}'", Tbchuang.Chuangnum, Tbchuang.Susheid, Tbchuang.Remark, Tbchuang.Pic, Tbchuang.Id); return(DBM.Execute(sql)); }
/// <summary> /// 添加数据 /// </summary> /// <param name="Tbruzhu">数据表实体对象</param> public static Exception Add(TbruzhuInfo Tbruzhu) { string sql = string.Format("insert into [Tbruzhu] values ('{0}','{1}','{2}','{3}','{4}')", Tbruzhu.Chuangid, Tbruzhu.Userid, Tbruzhu.Ruzhudate, Tbruzhu.Tuchudate, Tbruzhu.State); return(DBM.Execute(sql)); }
///GetPK /// <summary> /// 根据数据表主键更新数据 /// </summary> /// <param name="Tbuser">数据表实体对象</param> public static Exception Update(TbuserInfo Tbuser) { string sql = string.Format("update [Tbuser] set[name]='{0}',[pwd]='{1}',[sex]='{2}',[phone]='{3}',[address]='{4}',[email]='{5}',[remark]='{6}',[uname]='{7}' where[id]='{8}'", Tbuser.Name, Tbuser.Pwd, Tbuser.Sex, Tbuser.Phone, Tbuser.Address, Tbuser.Email, Tbuser.Remark, Tbuser.Uname, Tbuser.Id); return(DBM.Execute(sql)); }
//执行调用 DAO调用 public Exception Execute() { return(DBM.CallProc(this)); }
///GetPK /// <summary> /// 根据数据表主键更新数据 /// </summary> /// <param name="Tbsushe">数据表实体对象</param> public static Exception Update(TbsusheInfo Tbsushe) { string sql = string.Format("update [Tbsushe] set[ssname]='{0}',[remark]='{1}',[pic]='{2}' where[id]='{3}'", Tbsushe.Ssname, Tbsushe.Remark, Tbsushe.Pic, Tbsushe.Id); return(DBM.Execute(sql)); }
/// <summary> /// 添加数据 /// </summary> /// <param name="Tbsushe">数据表实体对象</param> public static Exception Add(TbsusheInfo Tbsushe) { string sql = string.Format("insert into [Tbsushe] values ('{0}','{1}','{2}')", Tbsushe.Ssname, Tbsushe.Remark, Tbsushe.Pic); return(DBM.Execute(sql)); }
///GetPK /// <summary> /// 根据数据表主键更新数据 /// </summary> /// <param name="Tbruzhu">数据表实体对象</param> public static Exception Update(TbruzhuInfo Tbruzhu) { string sql = string.Format("update [Tbruzhu] set[chuangid]='{0}',[userid]='{1}',[ruzhudate]='{2}',[tuchudate]='{3}',[state]='{4}' where[id]='{5}'", Tbruzhu.Chuangid, Tbruzhu.Userid, Tbruzhu.Ruzhudate, Tbruzhu.Tuchudate, Tbruzhu.State, Tbruzhu.Id); return(DBM.Execute(sql)); }
/// <summary> /// 添加数据 /// </summary> /// <param name="Tbuser">数据表实体对象</param> public static Exception Add(TbuserInfo Tbuser) { string sql = string.Format("insert into [Tbuser] values ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}')", Tbuser.Name, Tbuser.Pwd, Tbuser.Sex, Tbuser.Phone, Tbuser.Address, Tbuser.Email, Tbuser.Remark, Tbuser.Uname); return(DBM.Execute(sql)); }
public DataSet ExecuteWithDataSet() { return(DBM.CallProcWithDataSet(this)); }
/// <summary> /// 根据数据表主键删除数据 /// </summary> /// <param name="pkId">数据表实体对象</param> public static Exception Delete(object pkId) { string sql = "delete from [Tbuser] where [id]=" + pkId.ToString(); return(DBM.Execute(sql)); }
/// <summary> /// 添加数据 /// </summary> /// <param name="Tbchuang">数据表实体对象</param> public static Exception Add(TbchuangInfo Tbchuang) { string sql = string.Format("insert into [Tbchuang] values ('{0}','{1}','{2}','{3}')", Tbchuang.Chuangnum, Tbchuang.Susheid, Tbchuang.Remark, Tbchuang.Pic); return(DBM.Execute(sql)); }