/// <summary> /// 用户名密码为空删除 /// </summary> /// <param name="model"></param> /// <returns></returns> public string DdeleteYongHu_KongYM(Model.fmd020 model) { StringBuilder StrSQL = new StringBuilder(); StrSQL.Append("delete from FMD020 "); StrSQL.Append("where username = '******' and DMQF='" + model.DMQF + "' "); return(StrSQL.ToString()); }
/// <summary> /// 插入用户权限 /// </summary> /// <param name="model"></param> /// <returns></returns> public string InsertUserInfo(Model.fmd020 model) { StringBuilder StrSQL = new StringBuilder(); StrSQL.Append("INSERT INTO FMD020(USERNAME,PASSWORD,PGID,DMQF,RLZBH,RLR,RLSJ,RLDMM,GXZBH,GXR,GXSJ,GXDMM) "); StrSQL.Append("VALUES('" + model.USERNAME + "','" + model.PASSWORD + "','" + model.PGID + "','" + model.DMQF + "','" + model.RLZBH + "','" + model.RLR + "','" + model.RLSJ + "','" + model.RLDMM + "','" + model.GXZBH + "','" + model.GXR + "','" + model.GXSJ + "','" + model.GXZBH + "')"); return(StrSQL.ToString()); }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.fmd020 DataRowToModel(DataRow row) { Model.fmd020 model = new Model.fmd020(); if (row != null) { if (row["USERNAME"] != null) { model.USERNAME = row["USERNAME"].ToString(); } if (row["PASSWORD"] != null) { model.PASSWORD = row["PASSWORD"].ToString(); } if (row["PGID"] != null) { model.PGID = row["PGID"].ToString(); } if (row["DMQF"] != null) { model.DMQF = row["DMQF"].ToString(); } if (row["RLZBH"] != null) { model.RLZBH = row["RLZBH"].ToString(); } if (row["RLR"] != null) { model.RLR = row["RLR"].ToString(); } if (row["RLSJ"] != null) { model.RLSJ = row["RLSJ"].ToString(); } if (row["RLDMM"] != null) { model.RLDMM = row["RLDMM"].ToString(); } if (row["GXZBH"] != null) { model.GXZBH = row["GXZBH"].ToString(); } if (row["GXR"] != null) { model.GXR = row["GXR"].ToString(); } if (row["GXSJ"] != null) { model.GXSJ = row["GXSJ"].ToString(); } if (row["GXDMM"] != null) { model.GXDMM = row["GXDMM"].ToString(); } } return(model); }
/// <summary> /// 权限表去用户权限 /// </summary> /// <param name="model"></param> /// <returns></returns> public DataTable GetQuanxian_YongHu(Model.fmd020 model) { StringBuilder StrSQL = new StringBuilder(); if (model.DMQF.Equals("0") == true) { StrSQL.Append("select a.pgid,b.p_name from FMD020 a left join Project b on a.pgid = b.p_porname "); StrSQL.Append("where a.username = '******' and a.DMQF='" + model.DMQF + "'"); } else { StrSQL.Append(" select a.pgid,b.M_NAME p_name from FMD020 a left join menupro b on a.pgid = b.M_ID "); StrSQL.Append(" where a.username = '******' and a.DMQF='" + model.DMQF + "' "); } return(DbHelperMySql.Query(StrSQL.ToString()).Tables[0]); }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.fmd020 GetModel(string USERNAME, string PGID, string DMQF) { StringBuilder strSql = new StringBuilder(); strSql.Append("select "); strSql.Append(" USERNAME,PASSWORD,PGID,DMQF,RLZBH,RLR,RLSJ,RLDMM,GXZBH,GXR,GXSJ,GXDMM "); strSql.Append(" from fmd020 "); strSql.Append(" where USERNAME='******' and PGID='" + PGID + "' and DMQF='" + DMQF + "' "); Model.fmd020 model = new Model.fmd020(); DataSet ds = DbHelperMySql.Query(strSql.ToString()); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Model.fmd020 model) { StringBuilder strSql = new StringBuilder(); StringBuilder strSql1 = new StringBuilder(); StringBuilder strSql2 = new StringBuilder(); if (model.USERNAME != null) { strSql1.Append("USERNAME,"); strSql2.Append("'" + model.USERNAME + "',"); } if (model.PASSWORD != null) { strSql1.Append("PASSWORD,"); strSql2.Append("'" + model.PASSWORD + "',"); } if (model.PGID != null) { strSql1.Append("PGID,"); strSql2.Append("'" + model.PGID + "',"); } if (model.DMQF != null) { strSql1.Append("DMQF,"); strSql2.Append("'" + model.DMQF + "',"); } if (model.RLZBH != null) { strSql1.Append("RLZBH,"); strSql2.Append("'" + model.RLZBH + "',"); } if (model.RLR != null) { strSql1.Append("RLR,"); strSql2.Append("'" + model.RLR + "',"); } if (model.RLSJ != null) { strSql1.Append("RLSJ,"); strSql2.Append("'" + model.RLSJ + "',"); } if (model.RLDMM != null) { strSql1.Append("RLDMM,"); strSql2.Append("'" + model.RLDMM + "',"); } if (model.GXZBH != null) { strSql1.Append("GXZBH,"); strSql2.Append("'" + model.GXZBH + "',"); } if (model.GXR != null) { strSql1.Append("GXR,"); strSql2.Append("'" + model.GXR + "',"); } if (model.GXSJ != null) { strSql1.Append("GXSJ,"); strSql2.Append("'" + model.GXSJ + "',"); } if (model.GXDMM != null) { strSql1.Append("GXDMM,"); strSql2.Append("'" + model.GXDMM + "',"); } strSql.Append("insert into fmd020("); strSql.Append(strSql1.ToString().Remove(strSql1.Length - 1)); strSql.Append(")"); strSql.Append(" values ("); strSql.Append(strSql2.ToString().Remove(strSql2.Length - 1)); strSql.Append(")"); int rows = DbHelperMySql.ExecuteSql(strSql.ToString()); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Model.fmd020 model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update fmd020 set "); if (model.PASSWORD != null) { strSql.Append("PASSWORD='******',"); } else { strSql.Append("PASSWORD= null ,"); } if (model.RLZBH != null) { strSql.Append("RLZBH='" + model.RLZBH + "',"); } else { strSql.Append("RLZBH= null ,"); } if (model.RLR != null) { strSql.Append("RLR='" + model.RLR + "',"); } else { strSql.Append("RLR= null ,"); } if (model.RLSJ != null) { strSql.Append("RLSJ='" + model.RLSJ + "',"); } else { strSql.Append("RLSJ= null ,"); } if (model.RLDMM != null) { strSql.Append("RLDMM='" + model.RLDMM + "',"); } else { strSql.Append("RLDMM= null ,"); } if (model.GXZBH != null) { strSql.Append("GXZBH='" + model.GXZBH + "',"); } else { strSql.Append("GXZBH= null ,"); } if (model.GXR != null) { strSql.Append("GXR='" + model.GXR + "',"); } else { strSql.Append("GXR= null ,"); } if (model.GXSJ != null) { strSql.Append("GXSJ='" + model.GXSJ + "',"); } else { strSql.Append("GXSJ= null ,"); } if (model.GXDMM != null) { strSql.Append("GXDMM='" + model.GXDMM + "',"); } else { strSql.Append("GXDMM= null ,"); } int n = strSql.ToString().LastIndexOf(","); strSql.Remove(n, 1); strSql.Append(" where USERNAME='******' and PGID='" + model.PGID + "' and DMQF='" + model.DMQF + "' "); int rowsAffected = DbHelperMySql.ExecuteSql(strSql.ToString()); if (rowsAffected > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.fmd020 GetModel(string USERNAME,string PGID,string DMQF) { StringBuilder strSql=new StringBuilder(); strSql.Append("select "); strSql.Append(" USERNAME,PASSWORD,PGID,DMQF,RLZBH,RLR,RLSJ,RLDMM,GXZBH,GXR,GXSJ,GXDMM "); strSql.Append(" from fmd020 "); strSql.Append(" where USERNAME='******' and PGID='"+PGID+"' and DMQF='"+DMQF+"' " ); Model.fmd020 model=new Model.fmd020(); DataSet ds=DbHelperMySql.Query(strSql.ToString()); if(ds.Tables[0].Rows.Count>0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.fmd020 DataRowToModel(DataRow row) { Model.fmd020 model=new Model.fmd020(); if (row != null) { if(row["USERNAME"]!=null) { model.USERNAME=row["USERNAME"].ToString(); } if(row["PASSWORD"]!=null) { model.PASSWORD=row["PASSWORD"].ToString(); } if(row["PGID"]!=null) { model.PGID=row["PGID"].ToString(); } if(row["DMQF"]!=null) { model.DMQF=row["DMQF"].ToString(); } if(row["RLZBH"]!=null) { model.RLZBH=row["RLZBH"].ToString(); } if(row["RLR"]!=null) { model.RLR=row["RLR"].ToString(); } if(row["RLSJ"]!=null) { model.RLSJ=row["RLSJ"].ToString(); } if(row["RLDMM"]!=null) { model.RLDMM=row["RLDMM"].ToString(); } if(row["GXZBH"]!=null) { model.GXZBH=row["GXZBH"].ToString(); } if(row["GXR"]!=null) { model.GXR=row["GXR"].ToString(); } if(row["GXSJ"]!=null) { model.GXSJ=row["GXSJ"].ToString(); } if(row["GXDMM"]!=null) { model.GXDMM=row["GXDMM"].ToString(); } } return model; }