using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using MESClassLibrary.BLL.Log;
using MESClassLibrary.DAL.Mistake247;
using MESClassLibrary.Model;

namespace MESClassLibrary.BLL.Mistake247
{
    public class AssemblyBLL
    {
        public bool AddInfo(AssemblyModel md)
        {
            AssemblyDAL da = new AssemblyDAL();
            try
            {
                return da.AddInfo(md);
            }
            catch (Exception ex)
            {
                LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
                return false;
            }
        }

        public bool UpdateInfo(AssemblyModel md)
        {
            AssemblyDAL da = new AssemblyDAL();
            try
            {
                return da.UpdateInfo(md);
            }
            catch (Exception ex)
            {
                LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
                return false;
            }
        }

        public DataTable SearchCount( string PartNo)
        {
            AssemblyDAL da = new AssemblyDAL();
            try
            {
                return da.SearchCount(PartNo);
            }
            catch (Exception ex)
            {
                LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
                return null;
            }
        }

        public bool UpdatePrintFlag(AssemblyModel md)
        {
            AssemblyDAL da = new AssemblyDAL();
            try
            {
                return da.UpdatePrintFlag(md);
            }
            catch (Exception ex)
            {
                LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
                return false;
            }
        }

        public bool UpdatePrintFlag1(string partno)
        {
            AssemblyDAL da = new AssemblyDAL();
            try
            {
                return da.UpdatePrintFlag1(partno);
            }
            catch (Exception ex)
            {
                LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
                return false;
            }
        }

        public DataTable searchPartNo(string partno)
        {
            AssemblyDAL da = new AssemblyDAL();
            try
            {
                return da.searchPartNo(partno);
            }
            catch (Exception ex)
            {
                LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
                return null;
            }
        }
    }
}