/// <summary> /// 得到一个对象实体 /// </summary> public Model.ffd010 GetModel(long ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select "); strSql.Append(" ID,RKQF,LHRQ,HLPCLOTNO,JPRQ,CLBH,PM,PH,HGSL,BLSL,XDSLBZ,YRKID,RKZF,YLHR,LHBGZNO,LHBGRQ,DMQF,RLZBH,RLR,RLSJ,RLDMM,GXZBH,GXR,GXSJ,GXDMM "); strSql.Append(" from ffd010 "); strSql.Append(" where ID=" + ID + ""); Model.ffd010 model = new Model.ffd010(); 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.ffd010 GetModel(long ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select "); strSql.Append(" ID,RKQF,LHRQ,HLPCLOTNO,JPRQ,CLBH,PM,PH,HGSL,BLSL,XDSLBZ,YRKID,RKZF,YLHR,LHBGZNO,LHBGRQ,DMQF,RLZBH,RLR,RLSJ,RLDMM,GXZBH,GXR,GXSJ,GXDMM "); strSql.Append(" from ffd010 "); strSql.Append(" where ID=" + ID + ""); Model.ffd010 model = new Model.ffd010(); 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.ffd010 DataRowToModel(DataRow row) { Model.ffd010 model = new Model.ffd010(); if (row != null) { if (row["ID"] != null && row["ID"].ToString() != "") { model.ID = long.Parse(row["ID"].ToString()); } if (row["LHRQ"] != null) { model.LHRQ = row["LHRQ"].ToString(); } if (row["HLPCLOTNO"] != null) { model.HLPCLOTNO = row["HLPCLOTNO"].ToString(); } if (row["JPRQ"] != null) { model.JPRQ = row["JPRQ"].ToString(); } if (row["CLBH"] != null) { model.CLBH = row["CLBH"].ToString(); } if (row["PM"] != null) { model.PM = row["PM"].ToString(); } if (row["PH"] != null) { model.PH = row["PH"].ToString(); } if (row["HGSL"] != null && row["HGSL"].ToString() != "") { model.HGSL = int.Parse(row["HGSL"].ToString()); } if (row["BLSL"] != null && row["BLSL"].ToString() != "") { model.BLSL = int.Parse(row["BLSL"].ToString()); } if (row["XDSLBZ"] != null && row["XDSLBZ"].ToString() != "") { model.XDSLBZ = int.Parse(row["XDSLBZ"].ToString()); } if (row["YRKID"] != null && row["YRKID"].ToString() != "") { model.YRKID = int.Parse(row["YRKID"].ToString()); } if (row["RKZF"] != null) { model.RKZF = row["RKZF"].ToString(); } if (row["YLHR"] != null) { model.YLHR = row["YLHR"].ToString(); } if (row["LHBGZNO"] != null) { model.LHBGZNO = row["LHBGZNO"].ToString(); } if (row["LHBGRQ"] != null) { model.LHBGRQ = row["LHBGRQ"].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> public string UpdateStrSQL(Model.ffd010 model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update ffd010 set "); if (model.LHRQ != null) { strSql.Append("LHRQ='" + model.LHRQ + "',"); } else { strSql.Append("LHRQ= null ,"); } if (model.HLPCLOTNO != null) { strSql.Append("HLPCLOTNO='" + model.HLPCLOTNO + "',"); } else { strSql.Append("HLPCLOTNO= null ,"); } if (model.JPRQ != null) { strSql.Append("JPRQ='" + model.JPRQ + "',"); } else { strSql.Append("JPRQ= null ,"); } if (model.CLBH != null) { strSql.Append("CLBH='" + model.CLBH + "',"); } else { strSql.Append("CLBH= null ,"); } if (model.PM != null) { strSql.Append("PM='" + model.PM + "',"); } else { strSql.Append("PM= null ,"); } if (model.PH != null) { strSql.Append("PH='" + model.PH + "',"); } else { strSql.Append("PH= null ,"); } if (model.MAXXDZF != null) { strSql.Append("MAXXDZF=" + model.MAXXDZF + ","); } else { strSql.Append("MAXXDZF= MAXXDZF ,"); } if (model.MAXDDZF != null) { strSql.Append("MAXDDZF=" + model.MAXDDZF + ","); } else { strSql.Append("MAXDDZF= MAXDDZF ,"); } if (model.MAXXZF != null) { strSql.Append("MAXXZF=" + model.MAXXZF + ","); } else { strSql.Append("MAXXZF= MAXXZF ,"); } if (model.HGSL != null) { strSql.Append("HGSL=" + model.HGSL + ","); } else { strSql.Append("HGSL= null ,"); } if (model.BLSL != null) { strSql.Append("BLSL=" + model.BLSL + ","); } else { strSql.Append("BLSL= null ,"); } if (model.XDSLBZ != null) { strSql.Append("XDSLBZ=" + model.XDSLBZ + ","); } else { strSql.Append("XDSLBZ= null ,"); } if (model.YRKID != null) { strSql.Append("YRKID=" + model.YRKID + ","); } else { strSql.Append("YRKID= null ,"); } if (model.RKZF != null) { strSql.Append("RKZF='" + model.RKZF + "',"); } else { strSql.Append("RKZF= null ,"); } if (model.YLHR != null) { strSql.Append("YLHR='" + model.YLHR + "',"); } else { strSql.Append("YLHR= null ,"); } if (model.LHBGZNO != null) { strSql.Append("LHBGZNO='" + model.LHBGZNO + "',"); } else { strSql.Append("LHBGZNO= null ,"); } if (model.LHBGRQ != null) { strSql.Append("LHBGRQ='" + model.LHBGRQ + "',"); } else { strSql.Append("LHBGRQ= null ,"); } if (model.DMQF != null) { strSql.Append("DMQF='" + model.DMQF + "',"); } else { strSql.Append("DMQF= null ,"); } if (model.RLZBH != null) { strSql.Append("GXZBH='" + model.RLZBH + "',"); } else { strSql.Append("GXZBH= null ,"); } if (model.RLR != null) { strSql.Append("GXR='" + model.RLR + "',"); } else { strSql.Append("GXR= null ,"); } if (model.RLSJ != null) { strSql.Append("GXSJ='" + model.RLSJ + "',"); } else { strSql.Append("GXSJ= null ,"); } if (model.RLDMM != null) { strSql.Append("GXDMM='" + model.RLDMM + "',"); } else { strSql.Append("GXDMM= null ,"); } int n = strSql.ToString().LastIndexOf(","); strSql.Remove(n, 1); strSql.Append(" where ID=" + model.ID + ""); return(strSql.ToString()); }
/// <summary> /// 增加一条数据 /// </summary> public string AddStrSQL(Model.ffd010 model) { StringBuilder strSql = new StringBuilder(); StringBuilder strSql1 = new StringBuilder(); StringBuilder strSql2 = new StringBuilder(); if (model.ID != 0 || model.ID != null) { strSql1.Append("ID,"); strSql2.Append("" + model.ID + ","); } if (model.LHRQ != null) { strSql1.Append("LHRQ,"); strSql2.Append("'" + model.LHRQ + "',"); } if (model.HLPCLOTNO != null) { strSql1.Append("HLPCLOTNO,"); strSql2.Append("'" + model.HLPCLOTNO + "',"); } if (model.JPRQ != null) { strSql1.Append("JPRQ,"); strSql2.Append("'" + model.JPRQ + "',"); } if (model.CLBH != null) { strSql1.Append("CLBH,"); strSql2.Append("'" + model.CLBH + "',"); } if (model.PM != null) { strSql1.Append("PM,"); strSql2.Append("'" + model.PM + "',"); } if (model.PH != null) { strSql1.Append("PH,"); strSql2.Append("'" + model.PH + "',"); } if (model.HGSL != null) { strSql1.Append("HGSL,"); strSql2.Append("" + model.HGSL + ","); } if (model.BLSL != null) { strSql1.Append("BLSL,"); strSql2.Append("" + model.BLSL + ","); } if (model.XDSLBZ != null) { strSql1.Append("XDSLBZ,"); strSql2.Append("" + model.XDSLBZ + ","); } if (model.YRKID != null) { strSql1.Append("YRKID,"); strSql2.Append("" + model.YRKID + ","); } if (model.RKZF != null) { strSql1.Append("RKZF,"); strSql2.Append("'" + model.RKZF + "',"); } if (model.YLHR != null) { strSql1.Append("YLHR,"); strSql2.Append("'" + model.YLHR + "',"); } if (model.LHBGZNO != null) { strSql1.Append("LHBGZNO,"); strSql2.Append("'" + model.LHBGZNO + "',"); } if (model.LHBGRQ != null) { strSql1.Append("LHBGRQ,"); strSql2.Append("'" + model.LHBGRQ + "',"); } if (model.DMQF != null) { strSql1.Append("DMQF,"); strSql2.Append("'" + model.DMQF + "',"); } if (model.MAXXDZF != null) { strSql1.Append("MAXXDZF,"); strSql2.Append("" + model.MAXXDZF + ","); } if (model.MAXDDZF != null) { strSql1.Append("MAXDDZF,"); strSql2.Append("" + model.MAXDDZF + ","); } if (model.MAXXZF != null) { strSql1.Append("MAXXZF,"); strSql2.Append("" + model.MAXXZF + ","); } 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 ffd010("); strSql.Append(strSql1.ToString().Remove(strSql1.Length - 1)); strSql.Append(")"); strSql.Append(" values ("); strSql.Append(strSql2.ToString().Remove(strSql2.Length - 1)); strSql.Append(")"); return(strSql.ToString()); }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.ffd010 DataRowToModel(DataRow row) { Model.ffd010 model = new Model.ffd010(); if (row != null) { if (row["ID"] != null && row["ID"].ToString() != "") { model.ID = long.Parse(row["ID"].ToString()); } if (row["LHRQ"] != null) { model.LHRQ = row["LHRQ"].ToString(); } if (row["HLPCLOTNO"] != null) { model.HLPCLOTNO = row["HLPCLOTNO"].ToString(); } if (row["JPRQ"] != null) { model.JPRQ = row["JPRQ"].ToString(); } if (row["CLBH"] != null) { model.CLBH = row["CLBH"].ToString(); } if (row["PM"] != null) { model.PM = row["PM"].ToString(); } if (row["PH"] != null) { model.PH = row["PH"].ToString(); } if (row["HGSL"] != null && row["HGSL"].ToString() != "") { model.HGSL = int.Parse(row["HGSL"].ToString()); } if (row["BLSL"] != null && row["BLSL"].ToString() != "") { model.BLSL = int.Parse(row["BLSL"].ToString()); } if (row["XDSLBZ"] != null && row["XDSLBZ"].ToString() != "") { model.XDSLBZ = int.Parse(row["XDSLBZ"].ToString()); } if (row["YRKID"] != null && row["YRKID"].ToString() != "") { model.YRKID = int.Parse(row["YRKID"].ToString()); } if (row["RKZF"] != null) { model.RKZF = row["RKZF"].ToString(); } if (row["YLHR"] != null) { model.YLHR = row["YLHR"].ToString(); } if (row["LHBGZNO"] != null) { model.LHBGZNO = row["LHBGZNO"].ToString(); } if (row["LHBGRQ"] != null) { model.LHBGRQ = row["LHBGRQ"].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); }