Exemplo n.º 1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.fmd060 GetModel(string PM, string PH, string CLBH)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  ");
            strSql.Append(" PM,PH,CLBH,JLDW,FLH,ZXKC,ZDKC,CPMS,XDSLBZ,DDSLBZ,XQF,XSLBZ,ZXBZ,RLZBH,RLR,RLSJ,RLDMM,GXZBH,GXR,GXSJ,GXDMM ");
            strSql.Append(" from fmd060 ");
            strSql.Append(" where PM='" + PM + "' and PH='" + PH + "' and CLBH='" + CLBH + "' ");
            Model.fmd060 model = new Model.fmd060();
            DataSet      ds    = DbHelperMySql.Query(strSql.ToString());

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public string AddSql(Model.fmd060 model)
        {
            StringBuilder strSql  = new StringBuilder();
            StringBuilder strSql1 = new StringBuilder();
            StringBuilder strSql2 = new StringBuilder();

            if (model.PM != null)
            {
                strSql1.Append("PM,");
                strSql2.Append("'" + model.PM + "',");
            }
            if (model.PH != null)
            {
                strSql1.Append("PH,");
                strSql2.Append("'" + model.PH + "',");
            }
            if (model.CLBH != null)
            {
                strSql1.Append("CLBH,");
                strSql2.Append("'" + model.CLBH + "',");
            }
            if (model.JLDW != null)
            {
                strSql1.Append("JLDW,");
                strSql2.Append("'" + model.JLDW + "',");
            }
            if (model.FLH != null)
            {
                strSql1.Append("FLH,");
                strSql2.Append("'" + model.FLH + "',");
            }
            if (model.ZXKC != null)
            {
                strSql1.Append("ZXKC,");
                strSql2.Append("" + model.ZXKC + ",");
            }
            if (model.ZDKC != null)
            {
                strSql1.Append("ZDKC,");
                strSql2.Append("" + model.ZDKC + ",");
            }
            if (model.CPMS != null)
            {
                strSql1.Append("CPMS,");
                strSql2.Append("'" + model.CPMS + "',");
            }
            if (model.XDSLBZ != null)
            {
                strSql1.Append("XDSLBZ,");
                strSql2.Append("" + model.XDSLBZ + ",");
            }
            if (model.DDSLBZ != null)
            {
                strSql1.Append("DDSLBZ,");
                strSql2.Append("" + model.DDSLBZ + ",");
            }
            if (model.XQF != null)
            {
                strSql1.Append("XQF,");
                strSql2.Append("'" + model.XQF + "',");
            }
            if (model.XSLBZ != null)
            {
                strSql1.Append("XSLBZ,");
                strSql2.Append("" + model.XSLBZ + ",");
            }
            if (model.ZXBZ != null)
            {
                strSql1.Append("ZXBZ,");
                strSql2.Append("'" + model.ZXBZ + "',");
            }
            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 + "',");
            }


            if (model.ECLH != null)
            {
                strSql1.Append("RCLH,");
                strSql2.Append("'" + model.ECLH + "',");
            }



            strSql.Append("insert into fmd060(");
            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;
            //}
            return(strSql.ToString());
        }
Exemplo n.º 3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Model.fmd060 DataRowToModel(DataRow row)
 {
     Model.fmd060 model = new Model.fmd060();
     if (row != null)
     {
         if (row["PM"] != null)
         {
             model.PM = row["PM"].ToString();
         }
         if (row["PH"] != null)
         {
             model.PH = row["PH"].ToString();
         }
         if (row["CLBH"] != null)
         {
             model.CLBH = row["CLBH"].ToString();
         }
         if (row["JLDW"] != null)
         {
             model.JLDW = row["JLDW"].ToString();
         }
         if (row["FLH"] != null)
         {
             model.FLH = row["FLH"].ToString();
         }
         if (row["ZXKC"] != null && row["ZXKC"].ToString() != "")
         {
             model.ZXKC = decimal.Parse(row["ZXKC"].ToString());
         }
         if (row["ZDKC"] != null && row["ZDKC"].ToString() != "")
         {
             model.ZDKC = decimal.Parse(row["ZDKC"].ToString());
         }
         if (row["CPMS"] != null)
         {
             model.CPMS = row["CPMS"].ToString();
         }
         if (row["XDSLBZ"] != null && row["XDSLBZ"].ToString() != "")
         {
             model.XDSLBZ = int.Parse(row["XDSLBZ"].ToString());
         }
         if (row["DDSLBZ"] != null && row["DDSLBZ"].ToString() != "")
         {
             model.DDSLBZ = int.Parse(row["DDSLBZ"].ToString());
         }
         if (row["XQF"] != null)
         {
             model.XQF = row["XQF"].ToString();
         }
         if (row["XSLBZ"] != null && row["XSLBZ"].ToString() != "")
         {
             model.XSLBZ = int.Parse(row["XSLBZ"].ToString());
         }
         if (row["ZXBZ"] != null)
         {
             model.ZXBZ = row["ZXBZ"].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);
 }
Exemplo n.º 4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public string UpdateSql(Model.fmd060 model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update fmd060 set ");
            if (model.JLDW != null)
            {
                strSql.Append("JLDW='" + model.JLDW + "',");
            }
            else
            {
                strSql.Append("JLDW= null ,");
            }
            if (model.FLH != null)
            {
                strSql.Append("FLH='" + model.FLH + "',");
            }
            else
            {
                strSql.Append("FLH= null ,");
            }
            if (model.ZXKC != null)
            {
                strSql.Append("ZXKC=" + model.ZXKC + ",");
            }
            else
            {
                strSql.Append("ZXKC= null ,");
            }
            if (model.ZDKC != null)
            {
                strSql.Append("ZDKC=" + model.ZDKC + ",");
            }
            else
            {
                strSql.Append("ZDKC= null ,");
            }
            if (model.CPMS != null)
            {
                strSql.Append("CPMS='" + model.CPMS + "',");
            }
            else
            {
                strSql.Append("CPMS= null ,");
            }
            if (model.XDSLBZ != null)
            {
                strSql.Append("XDSLBZ=" + model.XDSLBZ + ",");
            }
            else
            {
                strSql.Append("XDSLBZ= null ,");
            }
            if (model.DDSLBZ != null)
            {
                strSql.Append("DDSLBZ=" + model.DDSLBZ + ",");
            }
            else
            {
                strSql.Append("DDSLBZ= null ,");
            }
            if (model.XQF != null)
            {
                strSql.Append("XQF='" + model.XQF + "',");
            }
            else
            {
                strSql.Append("XQF= null ,");
            }
            if (model.XSLBZ != null)
            {
                strSql.Append("XSLBZ=" + model.XSLBZ + ",");
            }
            else
            {
                strSql.Append("XSLBZ= null ,");
            }
            if (model.ZXBZ != null)
            {
                strSql.Append("ZXBZ='" + model.ZXBZ + "',");
            }
            else
            {
                strSql.Append("ZXBZ= 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 ,");
            }


            if (model.ECLH != null)
            {
                strSql.Append("RCLH='" + model.ECLH + "',");
            }
            else
            {
                strSql.Append("RCLH= null ,");
            }

            int n = strSql.ToString().LastIndexOf(",");

            strSql.Remove(n, 1);
            strSql.Append(" where PM='" + model.PM + "' and PH='" + model.PH + "' and CLBH='" + model.CLBH + "' ");
            // int rowsAffected=DbHelperMySql.ExecuteSql(strSql.ToString());

            return(strSql.ToString());
        }
Exemplo n.º 5
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Model.fmd060 GetModel(string PM,string PH,string CLBH)
 {
     StringBuilder strSql=new StringBuilder();
     strSql.Append("select  ");
     strSql.Append(" PM,PH,CLBH,JLDW,FLH,ZXKC,ZDKC,CPMS,XDSLBZ,DDSLBZ,XQF,XSLBZ,ZXBZ,RLZBH,RLR,RLSJ,RLDMM,GXZBH,GXR,GXSJ,GXDMM ");
     strSql.Append(" from fmd060 ");
     strSql.Append(" where PM='"+PM+"' and PH='"+PH+"' and CLBH='"+CLBH+"' " );
     Model.fmd060 model=new Model.fmd060();
     DataSet ds=DbHelperMySql.Query(strSql.ToString());
     if(ds.Tables[0].Rows.Count>0)
     {
         return DataRowToModel(ds.Tables[0].Rows[0]);
     }
     else
     {
         return null;
     }
 }
Exemplo n.º 6
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Model.fmd060 DataRowToModel(DataRow row)
 {
     Model.fmd060 model=new Model.fmd060();
     if (row != null)
     {
         if(row["PM"]!=null)
         {
             model.PM=row["PM"].ToString();
         }
         if(row["PH"]!=null)
         {
             model.PH=row["PH"].ToString();
         }
         if(row["CLBH"]!=null)
         {
             model.CLBH=row["CLBH"].ToString();
         }
         if(row["JLDW"]!=null)
         {
             model.JLDW=row["JLDW"].ToString();
         }
         if(row["FLH"]!=null)
         {
             model.FLH=row["FLH"].ToString();
         }
         if(row["ZXKC"]!=null && row["ZXKC"].ToString()!="")
         {
             model.ZXKC=decimal.Parse(row["ZXKC"].ToString());
         }
         if(row["ZDKC"]!=null && row["ZDKC"].ToString()!="")
         {
             model.ZDKC=decimal.Parse(row["ZDKC"].ToString());
         }
         if(row["CPMS"]!=null)
         {
             model.CPMS=row["CPMS"].ToString();
         }
         if(row["XDSLBZ"]!=null && row["XDSLBZ"].ToString()!="")
         {
             model.XDSLBZ=int.Parse(row["XDSLBZ"].ToString());
         }
         if(row["DDSLBZ"]!=null && row["DDSLBZ"].ToString()!="")
         {
             model.DDSLBZ=int.Parse(row["DDSLBZ"].ToString());
         }
         if(row["XQF"]!=null)
         {
             model.XQF=row["XQF"].ToString();
         }
         if(row["XSLBZ"]!=null && row["XSLBZ"].ToString()!="")
         {
             model.XSLBZ=int.Parse(row["XSLBZ"].ToString());
         }
         if(row["ZXBZ"]!=null)
         {
             model.ZXBZ=row["ZXBZ"].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;
 }