/// <summary> /// 返回一条记录 /// </summary> /// <param name="id">键值</param> public MBL_User GetList(int id) { MBL_User str = null; SqlParameter parm = new SqlParameter(PARM_UID, SqlDbType.Int, 4); parm.Value = id; using (SqlDataReader rdr = SqlHelper.ExecuteReader(ConnectionInfo.DBConnStr, CommandType.Text, SqlstrbyID, parm)) { if (rdr.Read()) { MBL_User info = new MBL_User(Convert.ToInt32(rdr.GetValue(0).Equals(DBNull.Value)?"0":rdr.GetValue(0).ToString()),Convert.ToInt32(rdr.GetValue(1).Equals(DBNull.Value)?"0":rdr.GetValue(1).ToString()),Convert.ToInt32(rdr.GetValue(2).Equals(DBNull.Value)?"0":rdr.GetValue(2).ToString()),Convert.ToInt32(rdr.GetValue(3).Equals(DBNull.Value)?"0":rdr.GetValue(3).ToString()),rdr.GetValue(4).ToString(),rdr.GetValue(5).ToString(),rdr.GetValue(6).ToString(),rdr.GetValue(7).ToString(),Convert.ToBoolean(rdr.GetValue(8).Equals(DBNull.Value)?"0":rdr.GetValue(8).ToString()),rdr.GetValue(9).ToString(),rdr.GetValue(10).ToString(),Convert.ToDateTime(rdr.GetValue(11).Equals(DBNull.Value)?"1900-01-01":rdr.GetValue(11).ToString()),rdr.GetValue(12).ToString(),Convert.ToInt32(rdr.GetValue(13).Equals(DBNull.Value)?"0":rdr.GetValue(13).ToString()),rdr.GetValue(14).ToString(),Convert.ToBoolean(rdr.GetValue(15).Equals(DBNull.Value)?"0":rdr.GetValue(15).ToString()),rdr.GetValue(16).ToString(),rdr.GetValue(17).ToString(),rdr.GetValue(18).ToString(),rdr.GetValue(19).ToString(),Convert.ToDateTime(rdr.GetValue(20).Equals(DBNull.Value)?"1900-01-01":rdr.GetValue(20).ToString()),rdr.GetValue(22).ToString(),rdr.GetValue(23).ToString(),rdr.GetValue(24).ToString(),rdr.GetValue(25).ToString(),rdr.GetValue(26).ToString(),rdr.GetValue(27).ToString(),rdr.GetValue(28).ToString(),Convert.ToDateTime(rdr.GetValue(30).Equals(DBNull.Value)?"1900-01-01":rdr.GetValue(30).ToString()),rdr.GetValue(32).ToString(),rdr.GetValue(33).ToString(),rdr.GetValue(34).ToString()); str = info; } else { MBL_TeamInfo info = new MBL_TeamInfo(); str = info; } } return str; }
/// <summary> /// 修改一条记录 /// </summary> public void Modify(MBL_User info) { SqlParameter[] orderParms = GetOrderParameters(); SqlCommand cmd = new SqlCommand(); orderParms[0].Value = info.UID; orderParms[1].Value = info.RID; orderParms[2].Value = info.UGID; orderParms[3].Value = info.ManageGradeID; orderParms[4].Value = info.PersonCode; orderParms[5].Value = info.UserName; orderParms[6].Value = info.Pwd; orderParms[7].Value = info.NameEN; orderParms[8].Value = info.Sex; orderParms[9].Value = info.FormerName; orderParms[10].Value = info.Nationality; orderParms[11].Value = info.Birthday; orderParms[12].Value = info.NativePlace; orderParms[13].Value = info.Education; orderParms[14].Value = info.JobTitle; orderParms[15].Value = info.IsGuide; orderParms[16].Value = info.SystemPermission; orderParms[17].Value = info.LinePermission; orderParms[18].Value = info.SupplierPermission; orderParms[19].Value = info.CoparterPermission; orderParms[20].Value = info.CreateDate; orderParms[21].Value = info.State; orderParms[22].Value = info.Telephone; orderParms[23].Value = info.Fax; orderParms[24].Value = info.MobilePhone; orderParms[25].Value = info.PictureURL; orderParms[26].Value = info.QQ; orderParms[27].Value = info.WeChatNumber; orderParms[28].Value = info.Language; orderParms[29].Value = info.GuideDegree; orderParms[30].Value = info.StartWorkDate; orderParms[31].Value = info.CertificateGrade; orderParms[32].Value = info.Remarks; orderParms[33].Value = info.DefaultLoadPage; orderParms[34].Value = info.YYCode; foreach (SqlParameter parm in orderParms) { cmd.Parameters.Add(parm); } using (SqlConnection conn = new SqlConnection(ConnectionInfo.DBConnStr)) { conn.Open(); cmd.Connection = conn; cmd.CommandType = CommandType.Text; cmd.CommandText = ModifySqlstr; obj = cmd.ExecuteNonQuery(); cmd.Parameters.Clear(); } }
public IList<MBL_User> GetListsByFilterString(string FilterString, string OrderByString) { IList<MBL_User> strs = new List<BL_User>(); using (SqlDataReader rdr = SqlHelper.ExecuteReader(ConnectionInfo.DBConnStr, CommandType.Text, "Select * From BL_TeamInfo Where " + FilterString + " order by " + OrderByString, null)) { while (rdr.Read()) { MBL_User info = new MBL_User(Convert.ToInt32(rdr.GetValue(0).Equals(DBNull.Value)?"0":rdr.GetValue(0).ToString()),Convert.ToInt32(rdr.GetValue(1).Equals(DBNull.Value)?"0":rdr.GetValue(1).ToString()),Convert.ToInt32(rdr.GetValue(2).Equals(DBNull.Value)?"0":rdr.GetValue(2).ToString()),Convert.ToInt32(rdr.GetValue(3).Equals(DBNull.Value)?"0":rdr.GetValue(3).ToString()),rdr.GetValue(4).ToString(),rdr.GetValue(5).ToString(),rdr.GetValue(6).ToString(),rdr.GetValue(7).ToString(),Convert.ToBoolean(rdr.GetValue(8).Equals(DBNull.Value)?"0":rdr.GetValue(8).ToString()),rdr.GetValue(9).ToString(),rdr.GetValue(10).ToString(),Convert.ToDateTime(rdr.GetValue(11).Equals(DBNull.Value)?"1900-01-01":rdr.GetValue(11).ToString()),rdr.GetValue(12).ToString(),Convert.ToInt32(rdr.GetValue(13).Equals(DBNull.Value)?"0":rdr.GetValue(13).ToString()),rdr.GetValue(14).ToString(),Convert.ToBoolean(rdr.GetValue(15).Equals(DBNull.Value)?"0":rdr.GetValue(15).ToString()),rdr.GetValue(16).ToString(),rdr.GetValue(17).ToString(),rdr.GetValue(18).ToString(),rdr.GetValue(19).ToString(),Convert.ToDateTime(rdr.GetValue(20).Equals(DBNull.Value)?"1900-01-01":rdr.GetValue(20).ToString()),rdr.GetValue(22).ToString(),rdr.GetValue(23).ToString(),rdr.GetValue(24).ToString(),rdr.GetValue(25).ToString(),rdr.GetValue(26).ToString(),rdr.GetValue(27).ToString(),rdr.GetValue(28).ToString(),Convert.ToDateTime(rdr.GetValue(30).Equals(DBNull.Value)?"1900-01-01":rdr.GetValue(30).ToString()),rdr.GetValue(32).ToString(),rdr.GetValue(33).ToString(),rdr.GetValue(34).ToString()); strs.Add(info); } } return strs; }
/// <summary> /// 以指定排序条件返回所有数据IList /// </summary> /// <param name="OrderByString">排序字段</param> /// <returns></returns> public IList<MBL_User> GetLists(string OrderByString) { IList<MBL_User> strs = new List<BL_User>(); using (SqlDataReader rdr = SqlHelper.ExecuteReader(ConnectionInfo.DBConnStr, CommandType.Text, Sqlstrall + (OrderByString.Trim().Length > 0 ? " Order by " + OrderByString : ""), null)) { while (rdr.Read()) { MBL_User info = new MBL_User(Convert.ToInt32(rdr.GetValue(0).Equals(DBNull.Value)?"0":rdr.GetValue(0).ToString()),Convert.ToInt32(rdr.GetValue(1).Equals(DBNull.Value)?"0":rdr.GetValue(1).ToString()),Convert.ToInt32(rdr.GetValue(2).Equals(DBNull.Value)?"0":rdr.GetValue(2).ToString()),Convert.ToInt32(rdr.GetValue(3).Equals(DBNull.Value)?"0":rdr.GetValue(3).ToString()),rdr.GetValue(4).ToString(),rdr.GetValue(5).ToString(),rdr.GetValue(6).ToString(),rdr.GetValue(7).ToString(),Convert.ToBoolean(rdr.GetValue(8).Equals(DBNull.Value)?"0":rdr.GetValue(8).ToString()),rdr.GetValue(9).ToString(),rdr.GetValue(10).ToString(),Convert.ToDateTime(rdr.GetValue(11).Equals(DBNull.Value)?"1900-01-01":rdr.GetValue(11).ToString()),rdr.GetValue(12).ToString(),Convert.ToInt32(rdr.GetValue(13).Equals(DBNull.Value)?"0":rdr.GetValue(13).ToString()),rdr.GetValue(14).ToString(),Convert.ToBoolean(rdr.GetValue(15).Equals(DBNull.Value)?"0":rdr.GetValue(15).ToString()),rdr.GetValue(16).ToString(),rdr.GetValue(17).ToString(),rdr.GetValue(18).ToString(),rdr.GetValue(19).ToString(),Convert.ToDateTime(rdr.GetValue(20).Equals(DBNull.Value)?"1900-01-01":rdr.GetValue(20).ToString()),rdr.GetValue(22).ToString(),rdr.GetValue(23).ToString(),rdr.GetValue(24).ToString(),rdr.GetValue(25).ToString(),rdr.GetValue(26).ToString(),rdr.GetValue(27).ToString(),rdr.GetValue(28).ToString(),Convert.ToDateTime(rdr.GetValue(30).Equals(DBNull.Value)?"1900-01-01":rdr.GetValue(30).ToString()),rdr.GetValue(32).ToString(),rdr.GetValue(33).ToString(),rdr.GetValue(34).ToString()); strs.Add(info); } } return strs; }
/// <summary> /// 修改一条记录 /// </summary> public void Modify(MBL_User info) { DAL.Modify(info); }
/// <summary> /// 增加一条记录 /// </summary> public object Insert(MBL_User info) { return DAL.Insert(info); }