Пример #1
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public bool Update(MesWeb.Model.T_CodeUsed model)
        {
            int rowsAffected = 0;

            SqlParameter[] parameters =
            {
                new SqlParameter("@CodeUsedID",    SqlDbType.Int,       4),
                new SqlParameter("@CodeNumber",    SqlDbType.NChar,     1),
                new SqlParameter("@Axis_No",       SqlDbType.NVarChar,  1),
                new SqlParameter("@GeneratorTime", SqlDbType.DateTime),
                new SqlParameter("@MachineID",     SqlDbType.Int, 4)
            };
            parameters[0].Value = model.CodeUsedID;
            parameters[1].Value = model.CodeNumber;
            parameters[2].Value = model.Axis_No;
            parameters[3].Value = model.GeneratorTime;
            parameters[4].Value = model.MachineID;

            DbHelperSQL.RunProcedure("T_CodeUsed_Update", parameters, out rowsAffected);
            if (rowsAffected > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MesWeb.Model.T_CodeUsed DataRowToModel(DataRow row)
 {
     MesWeb.Model.T_CodeUsed model = new MesWeb.Model.T_CodeUsed();
     if (row != null)
     {
         if (row["CodeUsedID"] != null && row["CodeUsedID"].ToString() != "")
         {
             model.CodeUsedID = int.Parse(row["CodeUsedID"].ToString());
         }
         if (row["CodeNumber"] != null)
         {
             model.CodeNumber = row["CodeNumber"].ToString();
         }
         if (row["Axis_No"] != null)
         {
             model.Axis_No = row["Axis_No"].ToString();
         }
         if (row["GeneratorTime"] != null && row["GeneratorTime"].ToString() != "")
         {
             model.GeneratorTime = DateTime.Parse(row["GeneratorTime"].ToString());
         }
         if (row["MachineID"] != null && row["MachineID"].ToString() != "")
         {
             model.MachineID = int.Parse(row["MachineID"].ToString());
         }
     }
     return(model);
 }
Пример #3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MesWeb.Model.T_CodeUsed GetModel(int CodeUsedID)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@CodeUsedID", SqlDbType.Int, 4)
            };
            parameters[0].Value = CodeUsedID;

            MesWeb.Model.T_CodeUsed model = new MesWeb.Model.T_CodeUsed();
            DataSet ds = DbHelperSQL.RunProcedure("T_CodeUsed_GetModel", parameters, "ds");

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Пример #4
0
        /// <summary>
        ///  增加一条数据
        /// </summary>
        public int Add(MesWeb.Model.T_CodeUsed model)
        {
            int rowsAffected;

            SqlParameter[] parameters =
            {
                new SqlParameter("@CodeUsedID",    SqlDbType.Int,       4),
                new SqlParameter("@CodeNumber",    SqlDbType.NChar,     1),
                new SqlParameter("@Axis_No",       SqlDbType.NVarChar,  1),
                new SqlParameter("@GeneratorTime", SqlDbType.DateTime),
                new SqlParameter("@MachineID",     SqlDbType.Int, 4)
            };
            parameters[0].Direction = ParameterDirection.Output;
            parameters[1].Value     = model.CodeNumber;
            parameters[2].Value     = model.Axis_No;
            parameters[3].Value     = model.GeneratorTime;
            parameters[4].Value     = model.MachineID;

            DbHelperSQL.RunProcedure("T_CodeUsed_ADD", parameters, out rowsAffected);
            return((int)parameters[0].Value);
        }