コード例 #1
0
 public Model.TT_PitheadBill DataRowToModel(DataRow row)
 {
     TDTK.PlatForm.MVC4.Model.TT_PitheadBill model = new TDTK.PlatForm.MVC4.Model.TT_PitheadBill();
     if (row != null)
     {
         if (row["PBid"] != null && row["PBid"].ToString() != "")
         {
             model.PBid = int.Parse(row["PBid"].ToString());
         }
         if (row["StartIedition"] != null)
         {
             model.StartIedition = row["StartIedition"].ToString();
         }
         if (row["EndIedition"] != null)
         {
             model.EndIedition = row["EndIedition"].ToString();
         }
         if (row["StartNumber"] != null)
         {
             model.StartNumber = row["StartNumber"].ToString();
         }
         if (row["EndNumber"] != null)
         {
             model.EndNumber = row["EndNumber"].ToString();
         }
         if (row["Changnumber"] != null && row["Changnumber"].ToString() != "")
         {
             model.Changnumber = int.Parse(row["Changnumber"].ToString());
         }
         if (row["BalanceNum"] != null && row["BalanceNum"].ToString() != "")
         {
             model.BalanceNum = int.Parse(row["BalanceNum"].ToString());
         }
         if (row["Remark"] != null)
         {
             model.Remark = row["Remark"].ToString();
         }
         if (row["PBDate"] != null && row["PBDate"].ToString() != "")
         {
             model.PBDate = DateTime.Parse(row["PBDate"].ToString());
         }
     }
     return model;
 }
コード例 #2
0
        public Model.TT_PitheadBill GetModel(Model.TT_PitheadBill t)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 PBid,StartIedition,EndIedition,StartNumber,EndNumber,Changnumber,BalanceNum,Remark,PBDate from TT_PitheadBill ");
            strSql.Append(" where PBid=@PBid ");
            SqlParameter[] parameters = {
					new SqlParameter("@PBid", SqlDbType.Int,4)			};
            parameters[0].Value = t.PBid;

            TDTK.PlatForm.MVC4.Model.TT_PitheadBill model = new TDTK.PlatForm.MVC4.Model.TT_PitheadBill();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }