using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Reflection;
using System.Text;
using MESClassLibrary.BLL.Log;
using MESClassLibrary.Model;

namespace MESClassLibrary.DAL.ExchangeCenter
{
    public class PartRecordDAL
    {
        public bool AddInfo(PartRecordModel md)
        {
            try
            {
                string sql =@"insert into tb_PartRecord (ID,PartNo,TaskID,CommandType) values(@ID,@PartNo,@TaskID,@CommandType)";

                SqlParameter[] param=new SqlParameter[4];

                param[0] = new SqlParameter("@ID", SqlDbType.VarChar);
                param[0].Value = md.ID;

                param[1] = new SqlParameter("@PartNo", SqlDbType.VarChar);
                param[1].Value = md.PartNo;

                param[3] = new SqlParameter("@TaskID", SqlDbType.VarChar);
                param[3].Value = md.TaskID;

                param[4] = new SqlParameter("@CommandType", SqlDbType.VarChar);
                param[4].Value = md.CommandType;

                SqlHelper.ExecuteNonQuery(SqlHelper.GetConnSting(), CommandType.Text, sql, param);

                return true;
            }
            catch (Exception ex)
            {
                LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
                return false;
            }
        }
    }
}