/// <summary> /// 分页获取数据列表 /// </summary> public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex) { StringBuilder strSql = new StringBuilder(); strSql.Append("SELECT * FROM ( "); strSql.Append(" SELECT ROW_NUMBER() OVER ("); if (!string.IsNullOrEmpty(orderby.Trim())) { strSql.Append("order by T." + orderby); } else { strSql.Append("order by T.Exp_No desc"); } strSql.Append(")AS Row, T.* from ps_pumpstation T "); if (!string.IsNullOrEmpty(strWhere.Trim())) { strSql.Append(" WHERE " + strWhere); } strSql.Append(" ) TT"); strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex); return(DbHelperMySQL.Query(strSql.ToString())); }
/// <summary> /// 分页获取数据列表 /// </summary> public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex) { StringBuilder strSql = new StringBuilder(); strSql.Append("SELECT * FROM ( "); strSql.Append(" SELECT @row_number:=@row_number + 1 AS ROW, T.* FROM test T, (SELECT @row_number:= 0) AS aaccc "); //if (!string.IsNullOrEmpty(orderby.Trim())) //{ // strSql.Append("order by T." + orderby); //} //else //{ // strSql.Append("order by T.id desc"); //} //strSql.Append(")AS Row, T.* from test T "); if (!string.IsNullOrEmpty(strWhere.Trim())) { strSql.Append(" WHERE " + strWhere); } strSql.Append(" ) TT"); strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex); return(DbHelperMySQL.Query(strSql.ToString())); }
/// <summary> /// 得到菜单节点 /// </summary> /// <param name="NodeID"></param> /// <returns></returns> public Jium.Model.SysNode GetNode(int NodeID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select * from S_Tree "); strSql.Append(" where NodeID=" + NodeID); Jium.Model.SysNode node = new Jium.Model.SysNode(); DataSet ds = DbHelperMySQL.Query(strSql.ToString()); if (ds.Tables[0].Rows.Count > 0) { node.NodeID = int.Parse(ds.Tables[0].Rows[0]["NodeID"].ToString()); node.Text = ds.Tables[0].Rows[0]["text"].ToString(); if (ds.Tables[0].Rows[0]["ParentID"].ToString() != "") { node.ParentID = int.Parse(ds.Tables[0].Rows[0]["ParentID"].ToString()); } node.Location = ds.Tables[0].Rows[0]["Location"].ToString(); if (ds.Tables[0].Rows[0]["OrderID"].ToString() != "") { node.OrderID = int.Parse(ds.Tables[0].Rows[0]["OrderID"].ToString()); } node.Comment = ds.Tables[0].Rows[0]["comment"].ToString(); node.Url = ds.Tables[0].Rows[0]["url"].ToString(); if (ds.Tables[0].Rows[0]["PermissionID"].ToString() != "") { node.PermissionID = int.Parse(ds.Tables[0].Rows[0]["PermissionID"].ToString()); } node.ImageUrl = ds.Tables[0].Rows[0]["ImageUrl"].ToString(); return(node); } else { return(null); } }
/// <summary> /// 获取用户角色权限按钮 /// </summary> /// <param name="rolecode"></param> /// <param name="menucode"></param> /// <returns></returns> public string GetRoleMenuButton(string rolecode, string menucode) { string t_sql = "select btncode from sys_rolemenu where rolecode='" + rolecode + "' and menucode='" + menucode + "'"; DataTable dt = DbHelperMySQL.Query(t_sql).Tables[0]; if (dt != null && dt.Rows.Count == 1) { string btn_code_list = string.Empty; foreach (string btncode in dt.Rows[0]["btncode"].ToString().Trim().Split(',')) { btn_code_list += "'" + btncode.Trim() + "',"; } t_sql = "select btnmethod from sys_buttoninfo where isenable=1 and btncode in(" + btn_code_list.Substring(0, btn_code_list.Length - 1) + ") order by btnsort asc"; DataTable b_dt = DbHelperMySQL.Query(t_sql).Tables[0]; if (b_dt != null && b_dt.Rows.Count > 0) { string btn_method = ""; for (int i = 0; i < b_dt.Rows.Count; i++) { if (i > 0) { btn_method += ","; } btn_method += b_dt.Rows[i]["btnmethod"].ToString(); } return(btn_method); } else { return(string.Empty); } } else { return(string.Empty); } }
/// <summary> /// 得到一个对象实体 /// </summary> public ALS.Model.warnrange GetModel(int ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select ID,PaccUpperUpper,PaccUpperLower,PaccLowerUpper,PaccLowerLower,PartUpperUpper,PartUpperLower,PartLowerUpper,PartLowerLower,TMPUpperUpper,TMPUpperLower,TMPLowerUpper,TMPLowerLower,PvenUpperUpper,PvenUpperLower,PvenLowerUpper,PvenLowerLower,P1stUpperUpper,P1stUpperLower,P1stLowerUpper,P1stLowerLower,P2ndUpperUpper,P2ndUpperLower,P2ndLowerUpper,P2ndLowerLower,P3rdUpperUpper,P3rdUpperLower,P3rdLowerUpper,P3rdLowerLower from tb_warnrange "); strSql.Append(" where ID=@ID"); MySqlParameter[] parameters = { new MySqlParameter("@ID", MySqlDbType.Int32) }; parameters[0].Value = ID; ALS.Model.warnrange model = new ALS.Model.warnrange(); DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public QA.Model.qa_grade GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select id,name,hours from qa_grade "); strSql.Append(" where id=@id "); MySqlParameter[] parameters = { new MySqlParameter("@id", MySqlDbType.Int32, 11) }; parameters[0].Value = id; QA.Model.qa_grade model = new QA.Model.qa_grade(); DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.ps_weir GetModel(string Exp_No) { StringBuilder strSql = new StringBuilder(); strSql.Append("select Prj_No,Prj_Name,Exp_No,MapCode,SewageSystem_ID,StormSystem_ID,Type,X,Y,High,Top_Ele,Bot_Ele,Width,Code,Address,PointPosition,DataSource,Visibility,Sunit,Sdate,UpdateTime,Mdate,DataListID,Status,Ename,Design_Dept,Conster_Dept,Belong,Operator,Note,Exp_NoOri,FileName,Uploadtime from ps_weir "); strSql.Append(" where Exp_No=@Exp_No "); MySqlParameter[] parameters = { new MySqlParameter("@Exp_No", MySqlDbType.VarChar, 100) }; parameters[0].Value = Exp_No; Maticsoft.Model.ps_weir model = new Maticsoft.Model.ps_weir(); DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public WK.Model.sys_user GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select id,code,pwd,name,sex,is_delete,remark,create_by,create_date,update_by,update_date from sys_user "); strSql.Append(" where id=@id"); MySqlParameter[] parameters = { new MySqlParameter("@id", MySqlDbType.Int32) }; parameters[0].Value = id; WK.Model.sys_user model = new WK.Model.sys_user(); DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public XHD.Model.ecs_attribute GetModel(int attr_id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select attr_id,cat_id,attr_name,attr_input_type,attr_type,attr_values,attr_index,sort_order,is_linked,attr_group,is_show,is_show_send from ecs_attribute "); strSql.Append(" where attr_id=@attr_id"); MySqlParameter[] parameters = { new MySqlParameter("@attr_id", MySqlDbType.Int16) }; parameters[0].Value = attr_id; XHD.Model.ecs_attribute model = new XHD.Model.ecs_attribute(); DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public YueYePlat.Model.refueling GetModel(int Id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select Id,VehicleID,DeliveryId,Longitude,Latitude,PetrolStation,Money,Quantity,RefuelTime,InvoicePhoto,DriverId,IfVerifyed,VerfielId from refueling "); strSql.Append(" where Id=@Id"); MySqlParameter[] parameters = { new MySqlParameter("@Id", MySqlDbType.Int32) }; parameters[0].Value = Id; YueYePlat.Model.refueling model = new YueYePlat.Model.refueling(); DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.parts GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select id,PN,name,jobnum,ARef,size,sm,Barcode from parts "); strSql.Append(" where id=@id"); MySqlParameter[] parameters = { new MySqlParameter("@id", MySqlDbType.Int32) }; parameters[0].Value = id; Maticsoft.Model.parts model = new Maticsoft.Model.parts(); DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public YueYePlat.Model.vehicleupkeep GetModel(int Id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select Id,VehicleId,Kilometres,UpkeepDescribe,UpkeepMoneys,UpkeepTime,UpkeepMan,UpkeepLocation,InvoicePhoto from vehicleupkeep "); strSql.Append(" where Id=@Id"); MySqlParameter[] parameters = { new MySqlParameter("@Id", MySqlDbType.Int32) }; parameters[0].Value = Id; YueYePlat.Model.vehicleupkeep model = new YueYePlat.Model.vehicleupkeep(); DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public login_log GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select id,openid,login_time,login_state from login_log "); strSql.Append(" where id=@id "); MySqlParameter[] parameters = { new MySqlParameter("@id", MySqlDbType.Int32, 10) }; parameters[0].Value = id; login_log model = new login_log(); DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public MultiColorPen.Model.b_promotions GetModel(string promotioncode) { StringBuilder strSql = new StringBuilder(); strSql.Append("select id,promotioncode,caragentcode,caragentname,brandcode,brandname,seriescode,seriesname,title,detail,url,keywords,begintime,endtime,isenable,sort,remark,createtime,createman,updatetime,updateman from b_promotions "); strSql.Append(" where promotioncode=?promotioncode "); MySqlParameter[] parameters = { new MySqlParameter("?promotioncode", MySqlDbType.VarChar, 30) }; parameters[0].Value = promotioncode; MultiColorPen.Model.b_promotions model = new MultiColorPen.Model.b_promotions(); DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Gunark.Model.group GetModel(string GROUP_ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select GROUP_ID,GROUP_LEADER,AVAILABLE from gunark_group "); strSql.Append(" where GROUP_ID=@GROUP_ID "); MySqlParameter[] parameters = { new MySqlParameter("@GROUP_ID", MySqlDbType.VarChar, 50) }; parameters[0].Value = GROUP_ID; Gunark.Model.group model = new Gunark.Model.group(); DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public XHD.Model.ecs_suppliers GetModel(int suppliers_id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select * from ecs_suppliers "); strSql.Append(" where suppliers_id=@suppliers_id"); MySqlParameter[] parameters = { new MySqlParameter("@suppliers_id", MySqlDbType.Int32) }; parameters[0].Value = suppliers_id; XHD.Model.ecs_suppliers model = new XHD.Model.ecs_suppliers(); DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public XHD.Model.ims.ims_check_rule GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select id,Factory_Id,rule_name,rule_categoryId,rule_category,rule_classify,check_cycle,check_empId,check_empName,check_emp_depId,apply_depId,apply_userId,apply_userName,creat_empId,create_empName,create_date,rule_object from ims_check_rule "); strSql.Append(" where id=@id "); MySqlParameter[] parameters = { new MySqlParameter("@id", MySqlDbType.Int32, 11) }; parameters[0].Value = id; XHD.Model.ims.ims_check_rule model = new XHD.Model.ims.ims_check_rule(); DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public DBPlayer(string ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select ID,playerID,playerName,direction "); strSql.Append(" FROM to3d_nomode_players "); strSql.Append(" where playerID=@ID "); //strSql.Append(" where ID=@ID "); MySqlParameter[] parameters = { new MySqlParameter("@ID", MySqlDbType.VarChar) }; parameters[0].Value = ID; DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["ID"] != null) { this.ID = ds.Tables[0].Rows[0]["ID"].ToString(); } if (ds.Tables[0].Rows[0]["playerID"] != null) { this.playerID = ds.Tables[0].Rows[0]["playerID"].ToString(); } if (ds.Tables[0].Rows[0]["playerName"] != null) { this.playerName = ds.Tables[0].Rows[0]["playerName"].ToString(); } if (ds.Tables[0].Rows[0]["direction"] != null && ds.Tables[0].Rows[0]["direction"].ToString() != "") { this.direction = int.Parse(ds.Tables[0].Rows[0]["direction"].ToString()); } } }
/// <summary> /// 得到一个对象实体 /// </summary> public Topicsys.Model.t_topic GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select id,topic_id,topic_teacher_gh,topic_class_id,topic_name,topic_note,topic_stat,topic_num from t_topic "); strSql.Append(" where id=@id"); MySqlParameter[] parameters = { new MySqlParameter("@id", MySqlDbType.Int32) }; parameters[0].Value = id; Topicsys.Model.t_topic model = new Topicsys.Model.t_topic(); DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 获得表中的某一个值 /// </summary> /// <param name="columnname">字段,如:姓名</param> /// <param name="strWhere">条件,如:年龄>12 and 性别='女'</param> /// <returns>如果读取不到值,则返回 空字符串</returns> public string GetValue(string columnname, string strWhere) { StringBuilder strSql = new StringBuilder(); strSql.Append("select "); strSql.Append(" " + columnname + " "); strSql.Append(" FROM 业务_订单信息表 "); if (strWhere.Trim() != "") { strSql.Append(" where " + strWhere); } DataSet ds = new DataSet(); ds = DbHelperMySQL.Query(strSql.ToString()); string tempstr = ""; if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { tempstr = ds.Tables[0].Rows[0][0].ToString(); } return(tempstr); }
/// <summary> /// 得到一个对象实体 /// </summary> public Topicsys.Model.t_dept GetModel(string id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select id,dept_id,dept_name,dept_note,dept_stat from t_dept "); strSql.Append(" where dept_id=@id"); MySqlParameter[] parameters = { new MySqlParameter("@id", MySqlDbType.VarChar) }; parameters[0].Value = id; Topicsys.Model.t_dept model = new Topicsys.Model.t_dept(); DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.t_unit_goods_list GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select id,unit_id,goods_id,goods_name_new,number,guid,random_num,ping_string,MD5_1,MD5_2,MD5_3,MD5_4,MD5_5,goods_number,isSell,sell_time,isSend,express_fee,status_code,create_time,update_time from t_unit_goods_list "); strSql.Append(" where id=@id"); MySqlParameter[] parameters = { new MySqlParameter("@id", MySqlDbType.Int32) }; parameters[0].Value = id; Maticsoft.Model.t_unit_goods_list model = new Maticsoft.Model.t_unit_goods_list(); DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public WalleProject.Model.t_salarytaxrate GetModel(int Str_ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select Sta_threshold,Str_date,Str_aged,Str_ID,Str_medical,Str_unemployment,Str_housing,Sta_supplement,Sta_individualTax from t_salarytaxrate "); strSql.Append(" where Str_ID=@Str_ID"); MySqlParameter[] parameters = { new MySqlParameter("@Str_ID", MySqlDbType.Int32) }; parameters[0].Value = Str_ID; WalleProject.Model.t_salarytaxrate model = new WalleProject.Model.t_salarytaxrate(); DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public YueYePlat.Model.usercontrolinfo GetModel(int Id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select Id,UserControlId,UserControlName from usercontrolinfo "); strSql.Append(" where Id=@Id"); MySqlParameter[] parameters = { new MySqlParameter("@Id", MySqlDbType.Int32) }; parameters[0].Value = Id; YueYePlat.Model.usercontrolinfo model = new YueYePlat.Model.usercontrolinfo(); DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public MultiColorPen.Model.b_caragentseries GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select id,caragentcode,seriescode,brandcode,brandname,isenable,sort,remark,createtime,createman,isdelete,deletetime,deleteman from b_caragentseries "); strSql.Append(" where id=?id "); MySqlParameter[] parameters = { new MySqlParameter("?id", MySqlDbType.Int32, 11) }; parameters[0].Value = id; MultiColorPen.Model.b_caragentseries model = new MultiColorPen.Model.b_caragentseries(); DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public XHD.Model.crm_offersheetpdf GetModel(long id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select id,Factory_Id,brand_id,brand_name,provider_id,provider_name,file_name,file_path,upload_date,creater_id,creater_name from crm_offersheetpdf "); strSql.Append(" where id=@id"); MySqlParameter[] parameters = { new MySqlParameter("@id", MySqlDbType.Int64) }; parameters[0].Value = id; XHD.Model.crm_offersheetpdf model = new XHD.Model.crm_offersheetpdf(); DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public WalleProject.Model.t_pricerecord GetModel(int pri_ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select pri_date,pri_price,pri_com_ID,pri_ID from t_pricerecord "); strSql.Append(" where pri_ID=@pri_ID"); MySqlParameter[] parameters = { new MySqlParameter("@pri_ID", MySqlDbType.Int32) }; parameters[0].Value = pri_ID; WalleProject.Model.t_pricerecord model = new WalleProject.Model.t_pricerecord(); DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.measures GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select id,step, Tools,position,standardv,up,down from measures "); strSql.Append(" where id=@id"); MySqlParameter[] parameters = { new MySqlParameter("@id", MySqlDbType.Int32) }; parameters[0].Value = id; Maticsoft.Model.measures model = new Maticsoft.Model.measures(); DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public ManagePhones.Model.Users GetModel(int Id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select Id,username,password from users "); strSql.Append(" where Id=@Id"); MySqlParameter[] parameters = { new MySqlParameter("@Id", MySqlDbType.Int32) }; parameters[0].Value = Id; ManagePhones.Model.Users model = new ManagePhones.Model.Users(); DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public t_procurement_records GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select id,goodsName,kind,buyTime,buyCount,buyPrice,freight,otherMoney,totalPrice,averagePrice,sellPrice,isArrive from t_procurement_records "); strSql.Append(" where id=@id "); MySqlParameter[] parameters = { new MySqlParameter("@id", MySqlDbType.Int32, 10) }; parameters[0].Value = id; t_procurement_records model = new t_procurement_records(); DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }