public int Update(PTDZYJCYLXRFZModel model) { StringBuilder builder = new StringBuilder(); builder.Append("update PT_DZYJ_CYLXRFZ set "); builder.Append("UserCode='" + model.UserCode + "',"); builder.Append("GroupName='" + model.GroupName + "',"); builder.Append("IsValid='" + model.IsValid + "'"); builder.Append(" where RecordID=" + model.RecordID + " "); return(publicDbOpClass.ExecSqlString(builder.ToString())); }
public int Add(PTDZYJCYLXRFZModel model) { StringBuilder builder = new StringBuilder(); builder.Append("insert into PT_DZYJ_CYLXRFZ("); builder.Append("UserCode,GroupName,IsValid"); builder.Append(")"); builder.Append(" values ("); builder.Append("'" + model.UserCode + "',"); builder.Append("'" + model.GroupName + "',"); builder.Append("'" + model.IsValid + "'"); builder.Append(")"); builder.Append(";select @@IDENTITY"); return(publicDbOpClass.ExecSqlString(builder.ToString())); }
public PTDZYJCYLXRFZModel GetModel(int RecordID) { StringBuilder builder = new StringBuilder(); builder.Append("select "); builder.Append(" RecordID,UserCode,GroupName,IsValid "); builder.Append(" from PT_DZYJ_CYLXRFZ "); builder.Append(" where RecordID=" + RecordID + " "); PTDZYJCYLXRFZModel model = new PTDZYJCYLXRFZModel(); DataSet set = publicDbOpClass.DataSetQuary(builder.ToString()); if (set.Tables[0].Rows.Count <= 0) { return(null); } if (set.Tables[0].Rows[0]["RecordID"].ToString() != "") { model.RecordID = int.Parse(set.Tables[0].Rows[0]["RecordID"].ToString()); } model.UserCode = set.Tables[0].Rows[0]["UserCode"].ToString(); model.GroupName = set.Tables[0].Rows[0]["GroupName"].ToString(); model.IsValid = set.Tables[0].Rows[0]["IsValid"].ToString(); return(model); }