Ejemplo n.º 1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public TDTK.PlatForm.MVC4.Model.TT_TwoPrintLog DataRowToModel(DataRow row)
 {
     TDTK.PlatForm.MVC4.Model.TT_TwoPrintLog model = new TDTK.PlatForm.MVC4.Model.TT_TwoPrintLog();
     if (row != null)
     {
         if (row["LogID"] != null)
         {
             model.LogID = row["LogID"].ToString();
         }
         if (row["LogType"] != null)
         {
             model.LogType = row["LogType"].ToString();
         }
         if (row["Operator"] != null)
         {
             model.Operator = row["Operator"].ToString();
         }
         if (row["PrintDate"] != null && row["PrintDate"].ToString() != "")
         {
             model.PrintDate = DateTime.Parse(row["PrintDate"].ToString());
         }
         if (row["PrintTable"] != null)
         {
             model.PrintTable = row["PrintTable"].ToString();
         }
         if (row["PrintWeightCode"] != null)
         {
             model.PrintWeightCode = row["PrintWeightCode"].ToString();
         }
     }
     return model;
 }
Ejemplo n.º 2
0
        public Model.TT_TwoPrintLog GetModel(Model.TT_TwoPrintLog t)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 LogID,LogType,Operator,PrintDate,PrintTable,PrintWeightCode from TT_TwoPrintLog ");
            strSql.Append(" where LogID=@LogID ");
            SqlParameter[] parameters = {
					new SqlParameter("@LogID", SqlDbType.VarChar,32)			};
            parameters[0].Value = t.LogID;

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