public string Added(FormCollection form) { var stateInfo = GeneralHandler.StateSuccess; if (AddedByCheck(form, out stateInfo)) { DawnAuthUserMDL dataInfo = new DawnAuthUserMDL(); dataInfo.DptId = TypeHelper.TypeToTinyInt(form["sltDepart"], 1); dataInfo.UserTime = DateTime.Now; dataInfo.UserStatus = 1; dataInfo.UserGrade = TypeHelper.TypeToTinyInt(form["ddlGrade"], 1); dataInfo.UserSurname = form["txtSurname"]; dataInfo.UserName = form["txtName"]; dataInfo.UserPwd = CryptoHelper.MD5(form["txtPwd"], true); dataInfo.UserMobile = form["txtMobile"]; dataInfo.UserEmail = form["txtEmail"]; dataInfo.UserDesc = form["txtDesc"]; bool added = DawnAuthUserBLL.Exists(string.Format("user_name='{0}'", dataInfo.UserName)); if (added) { stateInfo = GeneralHandler.StateAdded; } else { DawnAuthUserBLL.Insert(dataInfo); } } return(stateInfo); }
/// <summary> /// 向数据表DawnAuthUser修改一条记录 /// </summary> /// <param name="dawnAuthUser">dawnAuthUser实体对象</param> /// <returns></returns> public int UpdateEditor(DawnAuthUserMDL dawnAuthUser) { StringBuilder sb = new StringBuilder(); sb.Append("update dawn_auth_user set "); sb.Append("user_grade=@UserGrade"); sb.Append(",user_surname=@UserSurname"); sb.Append(",user_mobile=@UserMobile"); sb.Append(",user_email=@UserEmail"); sb.Append(",user_desc=@UserDesc"); sb.Append(" where user_id=@UserId"); SqlParameter[] param = { new SqlParameter("@UserId", SqlDbType.Int), new SqlParameter("@UserGrade", SqlDbType.TinyInt), new SqlParameter("@UserSurname", SqlDbType.NVarChar, 20), new SqlParameter("@UserMobile", SqlDbType.VarChar, 15), new SqlParameter("@UserEmail", SqlDbType.VarChar, 50), new SqlParameter("@UserDesc", SqlDbType.NVarChar, 300) }; param[0].Value = dawnAuthUser.UserId; param[1].Value = dawnAuthUser.UserGrade; param[2].Value = dawnAuthUser.UserSurname; param[3].Value = dawnAuthUser.UserMobile; param[4].Value = dawnAuthUser.UserEmail; param[5].Value = dawnAuthUser.UserDesc; return(SqlHelper.ExecuteNonQuery(Conn.SqlConn, sb.ToString(), param)); }
/// <summary> /// 向数据表DawnAuthUser修改一条记录 /// </summary> /// <param name="dawnAuthUser">DawnAuthUser实体对象</param> /// <returns></returns> public static int UpdateEditor(DawnAuthUserMDL dawnAuthUser) { if (dawnAuthUser == null) { return(0); } return(DawnAuthUserBLL._dal.UpdateEditor(dawnAuthUser)); }
/// <summary> /// 向数据表DawnAuthUser中插入一条新记录。带事务 /// </summary> /// <param name="sp">事务对象</param> /// <param name="dawnAuthUser">DawnAuthUser实体对象</param> /// <returns>ı</returns> public static int Insert(SqlTransaction sp, DawnAuthUserMDL dawnAuthUser) { if (dawnAuthUser == null) { return(0); } return(DawnAuthUserBLL._dal.Insert(sp, dawnAuthUser)); }
/// <summary> /// 向数据表DawnAuthUser中插入一条新记录 /// </summary> /// <param name="dawnAuthUser">DawnAuthUser实体对象</param> /// <returns></returns> public static int Insert(DawnAuthUserMDL dawnAuthUser) { if (dawnAuthUser == null) { return(0); } return(DawnAuthUserBLL._dal.Insert(dawnAuthUser)); }
/// <summary> /// 根据ID,返回一个DawnAuthUser实体对象 /// </summary> /// <param name="userId">系统编号</param> /// <returns>DawnAuthUser实体对象</returns> public DawnAuthUserMDL Select(int userId) { DawnAuthUserMDL obj = null; SqlParameter[] param = { new SqlParameter("@UserId", SqlDbType.Int) }; param[0].Value = userId; string sqlCommand = "DawnAuthUserSelect"; using (SqlDataReader dr = SqlHelper.ExecuteReader(Conn.SqlConn, CommandType.StoredProcedure, sqlCommand, param)) { while (dr.Read()) { obj = this.Select(dr); } } return(obj); }
public string Editored(FormCollection form) { if (TypeHelper.TypeToInt32(form["hidUserId"], -1) < 0) { return(GeneralHandler.FBaseInfo); } var stateInfo = GeneralHandler.StateSuccess; if (EditoredByCheck(form, out stateInfo)) { DawnAuthUserMDL dataInfo = new DawnAuthUserMDL(); dataInfo.UserId = int.Parse(form["hidUserId"]); dataInfo.DptId = TypeHelper.TypeToTinyInt(form["sltDepart"], 1); dataInfo.UserGrade = TypeHelper.TypeToTinyInt(form["ddlGrade"], 1); dataInfo.UserSurname = form["txtSurname"]; dataInfo.UserMobile = form["txtMobile"]; dataInfo.UserEmail = form["txtEmail"]; dataInfo.UserDesc = form["txtDesc"]; DawnAuthUserBLL.UpdateEditor(dataInfo); } return(stateInfo); }
/// <summary> /// 得到DawnAuthUser实体对象 /// </summary> /// <param name="row">row</param> /// <returns>DawnAuthUser实体对象</returns> public DawnAuthUserMDL Select(DataRow row) { DawnAuthUserMDL obj = new DawnAuthUserMDL(); if (row != null) { try { obj.UserId = ((row["user_id"]) == DBNull.Value)?0:Convert.ToInt32(row["user_id"]); } catch { } try { obj.DptId = ((row["dpt_id"]) == DBNull.Value)?0:Convert.ToInt32(row["dpt_id"]); } catch { } try { obj.UserTime = ((row["user_time"]) == DBNull.Value)?DateTime.MinValue:Convert.ToDateTime(row["user_time"]); } catch { } try { obj.UserStatus = ((row["user_status"]) == DBNull.Value)?Convert.ToByte(0):Convert.ToByte(row["user_status"]); } catch { } try { obj.UserGrade = ((row["user_grade"]) == DBNull.Value)?Convert.ToByte(0):Convert.ToByte(row["user_grade"]); } catch { } try { obj.UserSurname = row["user_surname"].ToString(); } catch { } try { obj.UserName = row["user_name"].ToString(); } catch { } try { obj.UserPwd = row["user_pwd"].ToString(); } catch { } try { obj.UserMobile = row["user_mobile"].ToString(); } catch { } try { obj.UserEmail = row["user_email"].ToString(); } catch { } try { obj.UserDesc = row["user_desc"].ToString(); } catch { } try { obj.UserFieldOne = ((row["user_field_one"]) == DBNull.Value)?0:Convert.ToInt32(row["user_field_one"]); } catch { } try { obj.UserFieldTwo = ((row["user_field_two"]) == DBNull.Value)?0:Convert.ToInt32(row["user_field_two"]); } catch { } try { obj.UserFieldThree = ((row["user_field_three"]) == DBNull.Value)?Convert.ToByte(0):Convert.ToByte(row["user_field_three"]); } catch { } try { obj.UserFieldFour = ((row["user_field_four"]) == DBNull.Value)?Convert.ToByte(0):Convert.ToByte(row["user_field_four"]); } catch { } try { obj.UserFieldFive = row["user_field_five"].ToString(); } catch { } try { obj.UserFieldSix = row["user_field_six"].ToString(); } catch { } } else { return(null); } return(obj); }
/// <summary> /// 删除数据表DawnAuthUser中的一条记录,带事务 /// </summary> /// <param name="sp">事务对象</param> /// <param name="dawnAuthUser">DawnAuthUser实体对象</param> /// <returns></returns> public int Delete(SqlTransaction sp, DawnAuthUserMDL dawnAuthUser) { return(DawnAuthUserBLL._dal.Delete(sp, dawnAuthUser)); }
/// <summary> /// 删除数据表DawnAuthUser中的一条记录 /// </summary> /// <param name="dawnAuthUser">DawnAuthUser实体对象</param> /// <returns></returns> public static int Delete(DawnAuthUserMDL dawnAuthUser) { return(DawnAuthUserBLL._dal.Delete(dawnAuthUser)); }