using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using RNGWcfService1.ContextClass;
using RNGClassLibrary;

namespace RNGWcfService1
{

    public class Service1 : IItemMasterServices, IAdminLoginServices, ITypeMasterServices, IMetalServices,
        IProductionUnitMasterServices, IStageProcessMasterServices, IGradeMasterServices, IShiftMasterServices,
        ICustomerMasterServices, IEmployeeMasterServices, IVendorMasterServices, IOrderMasterServices, IOrderItemMasterServices,
        IFuranceLogSheetServices, IRejectionreasonServices, IMaterailPurchaseInwardServices, IOtherIssuServices,
        IRejectionEntryServices, ICASTINGHARDNESServices, IDespatchEntryServices, IDisposalEntryServices, IDailyMaltingPlanning, IDailyFoundryProduction, IHeattreatment, Icncmachine, IHardness, Ianodiszing, IGalvaniz,Iuserreight, IMachineTypeMaster, IMachineMaster, IDrawingItemMaster, IShortMachineProduction, IFettlingProduction
    {


        #region ShortMachineProduction
        public int ShortMachineProduction_AddNew(DateTime Date, string UnitId, ref int FShortMachineProductionId, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                ShortMachineProductionDbContext obj = new ShortMachineProductionDbContext();
                errorNo = obj.ShortMachineProduction_AddNew(Date, UnitId, ref FShortMachineProductionId, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public int ShortMachineProduction_Edit(int Id, DateTime Date, string UnitId, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                ShortMachineProductionDbContext obj = new ShortMachineProductionDbContext();
                errorNo = obj.ShortMachineProduction_Edit(Id, Date, UnitId, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public int ShortMachineProductionone_AddNew(int ShortMachineProductionId, string VendorId, string MachineNo, string itemId, decimal Quantity, decimal ActualWeight, decimal StdWeight,string PoNumber, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                ShortMachineProductionDbContext obj = new ShortMachineProductionDbContext();
                errorNo = obj.ShortMachineProductionone_AddNew(ShortMachineProductionId, VendorId, MachineNo, itemId, Quantity, ActualWeight, StdWeight, PoNumber, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public int ShortMachineProductionone_Edit(int Id, string VendorId, string MachineNo, string itemId, decimal Quantity, decimal ActualWeight, decimal StdWeight,string PoNumber, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                ShortMachineProductionDbContext obj = new ShortMachineProductionDbContext();
                errorNo = obj.ShortMachineProductionone_Edit(Id, VendorId, MachineNo, itemId, Quantity, ActualWeight, StdWeight, PoNumber, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public List<ShortMachineProduction> ShortMachineProduction_GetAll(int Id)
        {
            List<ShortMachineProduction> ShortMachineProduction = new List<ShortMachineProduction>();

            ShortMachineProductionDbContext obj = new ShortMachineProductionDbContext();

            ShortMachineProduction = obj.ShortMachineProduction_GetAll(Id);

            return ShortMachineProduction;
        }

        public List<ShortMachineProductionOne> ShortMachineProductionOne_GetAll(int Id, int ShortMachineProductionId)
        {
            List<ShortMachineProductionOne> ShortMachineProductionOne = new List<ShortMachineProductionOne>();

            ShortMachineProductionDbContext obj = new ShortMachineProductionDbContext();

            ShortMachineProductionOne = obj.ShortMachineProductionOne_GetAll(Id, ShortMachineProductionId);

            return ShortMachineProductionOne;
        }

        #endregion



        #region FettlingProduction
        public int FettlingProduction_AddNew(DateTime Date, string UnitId, ref int FettlingProductionId, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                FettlingProductionDbContext obj = new FettlingProductionDbContext();
                errorNo = obj.FettlingProduction_AddNew(Date, UnitId, ref FettlingProductionId, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public int FettlingProduction_Edit(int Id, DateTime Date, string UnitId, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                FettlingProductionDbContext obj = new FettlingProductionDbContext();
                errorNo = obj.FettlingProduction_Edit(Id, Date, UnitId, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public int FettlingProductionone_AddNew(int FettlingProductionId, string VendorId, string itemId, int Quantity, decimal ActualWeight, decimal StdWeight,string PoNumber, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                FettlingProductionDbContext obj = new FettlingProductionDbContext();
                errorNo = obj.FettlingProductionone_AddNew(FettlingProductionId, VendorId, itemId, Quantity, ActualWeight, StdWeight, PoNumber, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public int FettlingProductionone_Edit(int Id, string VendorId, string itemId, int Quantity, decimal ActualWeight, decimal StdWeight,string PoNumber, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                FettlingProductionDbContext obj = new FettlingProductionDbContext();
                errorNo = obj.FettlingProductionone_Edit(Id, VendorId, itemId, Quantity, ActualWeight, StdWeight, PoNumber, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public List<FettlingProduction> FettlingProduction_GetAll(int Id)
        {
            List<FettlingProduction> FettlingProduction = new List<FettlingProduction>();

            FettlingProductionDbContext obj = new FettlingProductionDbContext();

            FettlingProduction = obj.FettlingProduction_GetAll(Id);

            return FettlingProduction;
        }

        public List<FettlingProductionOne> FettlingProductionOne_GetAll(int Id, int ShortMachineProductionId)
        {
            List<FettlingProductionOne> FettlingProductionOne = new List<FettlingProductionOne>();

            FettlingProductionDbContext obj = new FettlingProductionDbContext();

            FettlingProductionOne = obj.FettlingProductionOne_GetAll(Id, ShortMachineProductionId);

            return FettlingProductionOne;
        }

        #endregion


        #region Item Master
        public int CreateNewItem(string DesignName, string Type, string MetalType, string Op_Stock, string MinimumLevel, string MaxLevel, string MeasurementUnitName, string CastWeight, string FinishedWeight, string DrawingWeight, string IsActive, string UserID, string FinalYear, string Status, DateTime CreatedDate, string PatttenOnPlate, string BoxWeight, string MetalGrade, string RequiredHardness, string ItemForIRN2, string MaterialType, string GalvanizeWeight, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                ItemMasterDbContext obj = new ItemMasterDbContext();
                errorNo = obj.ItemMaster_AddNew(DesignName, Type, MetalType, Op_Stock, MinimumLevel, MaxLevel, MeasurementUnitName, CastWeight, FinishedWeight, DrawingWeight, IsActive, UserID, FinalYear, Status, CreatedDate, PatttenOnPlate, BoxWeight, MetalGrade, RequiredHardness, ItemForIRN2, MaterialType, GalvanizeWeight, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public int EditItem(int Item_Id, string DesignName, string Type, string MetalType, string Op_Stock, string MinimumLevel, string MaxLevel, string MeasurementUnitName, string CastWeight, string FinishedWeight, string DrawingWeight, string IsActive, string UserID, string FinalYear, string Status, DateTime CreatedDate, string PatttenOnPlate, string BoxWeight, string MetalGrade, string RequiredHardness, string ItemForIRN2, string MaterialType, string GalvanizeWeight, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                ItemMasterDbContext obj = new ItemMasterDbContext();
                errorNo = obj.ItemMaster_Edit(Item_Id, DesignName, Type, MetalType, Op_Stock, MinimumLevel, MaxLevel, MeasurementUnitName, CastWeight, FinishedWeight, DrawingWeight, IsActive, UserID, FinalYear, Status, CreatedDate, PatttenOnPlate, BoxWeight, MetalGrade, RequiredHardness, ItemForIRN2, MaterialType, GalvanizeWeight, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }
            return errorNo;
        }


        public List<ItemMaster> GetAllItemMaster(int Item_Id, string IsActive)
        {
            List<ItemMaster> listCountry = new List<ItemMaster>();

            ItemMasterDbContext obj = new ItemMasterDbContext();

            listCountry = obj.ItemMaster_GetAll(Item_Id, IsActive);

            return listCountry;
        }


        #endregion

        #region Admin Login
        public virtual int AdminLogin(string UserName, string Password, ref int Admin_Id, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                AdminLoginDbContext obj = new AdminLoginDbContext();
                errorNo = obj.Admin_Login(UserName, Password, ref Admin_Id, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }
        public int AdminChangeLogin(int Admin_Id, string Password, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                AdminLoginDbContext obj = new AdminLoginDbContext();
                errorNo = obj.AdminChangeMaster_Edit(Admin_Id, Password, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        #endregion

        #region TypeMaster
        public int CreateNewTypeMaster(string TypeName, string IsActive, string UserID, string FinalYear, string Status, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                TypeMasterDbContext obj = new TypeMasterDbContext();
                errorNo = obj.TypeMaster_AddNew(TypeName, IsActive, UserID, FinalYear, Status, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public int EditTypeMaster(int Type_ID, string TypeName, string IsActive, string UserID, string FinalYear, string Status, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                TypeMasterDbContext obj = new TypeMasterDbContext();
                errorNo = obj.TypeMaster_Edit(Type_ID, TypeName, IsActive, UserID, FinalYear, Status, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }
            return errorNo;
        }


        public List<TypeMaster> GetAllTypeMaster(int Type_ID, string IsActive)
        {
            List<TypeMaster> listCountry = new List<TypeMaster>();

            TypeMasterDbContext obj = new TypeMasterDbContext();

            listCountry = obj.TypeMaster_GetAll(Type_ID, IsActive);

            return listCountry;
        }

        #endregion

        #region MetalMaster
        public int CreateNewMetalMaster(string Metal_Name, string IsActive, string UserID, string FinalYear, string Status, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                MetalDbContext obj = new MetalDbContext();
                errorNo = obj.MetalMaster_AddNew(Metal_Name, IsActive, UserID, FinalYear, Status, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public int EditMetalMaster(int Metal_ID, string Metal_Name, string IsActive, string UserID, string FinalYear, string Status, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                MetalDbContext obj = new MetalDbContext();
                errorNo = obj.MetalMaster_Edit(Metal_ID, Metal_Name, IsActive, UserID, FinalYear, Status, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }
            return errorNo;
        }


        public List<MetalMaster> GetAllMetalMaster(int Metal_ID)
        {
            List<MetalMaster> listCountry = new List<MetalMaster>();

            MetalDbContext obj = new MetalDbContext();

            listCountry = obj.MetalMaster_GetAll(Metal_ID);

            return listCountry;
        }

        #endregion

        #region ProductionUnitMaster
        public int CreateNewProductionUnitMaster(string UnitName, string IsActive, string UserID, string FinalYear, string Status, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                ProductionUnitDbcontext obj = new ProductionUnitDbcontext();
                errorNo = obj.ProductionUnitMaster_AddNew(UnitName, IsActive, UserID, FinalYear, Status, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public int EditProductionUnitMaster(int ProductionId, string UnitName, string IsActive, string UserID, string FinalYear, string Status, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                ProductionUnitDbcontext obj = new ProductionUnitDbcontext();
                errorNo = obj.UnitMaster_Edit(ProductionId, UnitName, IsActive, UserID, FinalYear, Status, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }
            return errorNo;
        }


        public List<ProductionUnitMaster> GetAllProductionUnitMaster(int ProductionId)
        {
            List<ProductionUnitMaster> listCountry = new List<ProductionUnitMaster>();

            ProductionUnitDbcontext obj = new ProductionUnitDbcontext();

            listCountry = obj.ProductionUnitMaster_GetAll(ProductionId);

            return listCountry;
        }

        #endregion

        #region StageOfProcessMaster
        public int CreateNewStageOfProcessMaster(string NameOfProcess, string IsActive, string UserID, string FinalYear, string Status, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                StageProcessMasterDbContext obj = new StageProcessMasterDbContext();
                errorNo = obj.StageProcessMaster_AddNew(NameOfProcess, IsActive, UserID, FinalYear, Status, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public int EditStageOfProcessMaster(int StageProcess_ID, string NameOfProcess, string IsActive, string UserID, string FinalYear, string Status, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                StageProcessMasterDbContext obj = new StageProcessMasterDbContext();
                errorNo = obj.StageProcessMaster_Edit(StageProcess_ID, NameOfProcess, IsActive, UserID, FinalYear, Status, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }
            return errorNo;
        }


        public List<StageProcessMaster> GetAllStageProcessMaster(int StageProcess_ID)
        {
            List<StageProcessMaster> listCountry = new List<StageProcessMaster>();

            StageProcessMasterDbContext obj = new StageProcessMasterDbContext();

            listCountry = obj.StageProcessMaster_GetAll(StageProcess_ID);

            return listCountry;
        }

        #endregion

        #region GradeMaster
        public int CreateNewGradeMaster(string Grade_Name, string IsActive, string UserID, string FinalYear, string Status, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                GradeMasterDbContext obj = new GradeMasterDbContext();
                errorNo = obj.GradeMaster_AddNew(Grade_Name, IsActive, UserID, FinalYear, Status, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public int EditGradeMaster(int Grade_ID, string Grade_Name, string IsActive, string UserID, string FinalYear, string Status, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                GradeMasterDbContext obj = new GradeMasterDbContext();
                errorNo = obj.GradeMaster_Edit(Grade_ID, Grade_Name, IsActive, UserID, FinalYear, Status, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }
            return errorNo;
        }


        public List<GradeMaster> GetAllGradeMaster(int Grade_ID)
        {
            List<GradeMaster> listCountry = new List<GradeMaster>();

            GradeMasterDbContext obj = new GradeMasterDbContext();

            listCountry = obj.GradeMaster_GetAll(Grade_ID);

            return listCountry;
        }

        #endregion

        #region ShiftMaster
        public int CreateNewShiftMaster(string ShiftName, string ShiftHours, string IsActive, string UserID, string FinalYear, string Status, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                ShiftDbContext obj = new ShiftDbContext();
                errorNo = obj.ShiftMaster_AddNew(ShiftName, ShiftHours, IsActive, UserID, FinalYear, Status, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public int EditShiftMaster(int Shift_ID, string ShiftName, string ShiftHours, string IsActive, string UserID, string FinalYear, string Status, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                ShiftDbContext obj = new ShiftDbContext();
                errorNo = obj.ShiftMaster_Edit(Shift_ID, ShiftName, ShiftHours, IsActive, UserID, FinalYear, Status, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }
            return errorNo;
        }


        public List<ShiftMaster> GetAllShiftMaster(int Shift_ID)
        {
            List<ShiftMaster> listCountry = new List<ShiftMaster>();

            ShiftDbContext obj = new ShiftDbContext();

            listCountry = obj.ShiftMaster_GetAll(Shift_ID);

            return listCountry;
        }
        #endregion

        #region CustomerMaster
        public int CreateNewCustomerMaster(string Name, string MobileNo, string EmailId, string Address, string City, string State, string Country, string Pin, string Website, string NameOfContactPerson, string Designation, string ContPersonEmailId, string ContPersonMobile, string UserName, string Password, string IsActive, string UserID, string FinalYear, string Status, string GSTNo, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                CustomerMasterDbContext obj = new CustomerMasterDbContext();
                errorNo = obj.CustomerMaster_AddNew(Name, MobileNo, EmailId, Address, City, State, Country, Pin, Website, NameOfContactPerson, Designation, ContPersonEmailId, ContPersonMobile, UserName, Password, IsActive, UserID, FinalYear, Status, GSTNo, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public int EditCustomerMaster(int CustomerId, string Name, string MobileNo, string EmailId, string Address, string City, string State, string Country, string Pin, string Website, string NameOfContactPerson, string Designation, string ContPersonEmailId, string ContPersonMobile, string UserName, string Password, string IsActive, string UserID, string FinalYear, string Status, string GSTNo, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                CustomerMasterDbContext obj = new CustomerMasterDbContext();
                errorNo = obj.CustomerMaster_Edit(CustomerId, Name, MobileNo, EmailId, Address, City, State, Country, Pin, Website, NameOfContactPerson, Designation, ContPersonEmailId, ContPersonMobile, UserName, Password, IsActive, UserID, FinalYear, Status, GSTNo, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }
            return errorNo;
        }


        public List<CustomerMaster> GetAllCustomerMaster(int CustomerId)
        {
            List<CustomerMaster> listCountry = new List<CustomerMaster>();

            CustomerMasterDbContext obj = new CustomerMasterDbContext();

            listCountry = obj.CustomerMaster_GetAll(CustomerId);

            return listCountry;
        }
        public List<ItemDetail> GetAllItemDetail(int ItemDetail_ID)
        {
            List<ItemDetail> listCountry = new List<ItemDetail>();

            CustomerMasterDbContext obj = new CustomerMasterDbContext();

            listCountry = obj.ItemDetail_GetAll(ItemDetail_ID);

            return listCountry;
        }

        public int CreateNewItemMasterDetail(string Item, string UserName, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                CustomerMasterDbContext obj = new CustomerMasterDbContext();
                errorNo = obj.ItemMasterDetail_AddNew(Item, UserName, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public virtual void ItemGetALL(string MobileNo, ref List<CustomerMaster> listOrder,
     ref List<ItemDetail> listOrderProduct)
        {


            CustomerMasterDbContext obj = new CustomerMasterDbContext();

            obj.Item_GetAll(MobileNo, ref listOrder, ref listOrderProduct);



        }
        #endregion

        #region EmployeeMaster
        public int CreateNewEmployeeMaster(string Name, string Address, string Designation, string MobileNo, string EmailId, string Password, string IsActive, string UserID, string FinalYear, string Status, string UserName, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                EmployeeMasterDbContext obj = new EmployeeMasterDbContext();
                errorNo = obj.EmployeeMaster_AddNew(Name, Address, Designation, MobileNo, EmailId, Password, IsActive, UserID, FinalYear, Status, UserName, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public int EditEmployeeMaster(int EmployeeId, string Name, string Address, string Designation, string MobileNo, string EmailId, string Password, string IsActive, string UserID, string FinalYear, string Status, string UserName, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                EmployeeMasterDbContext obj = new EmployeeMasterDbContext();
                errorNo = obj.EmployeeMaster_Edit(EmployeeId, Name, Address, Designation, MobileNo, EmailId, Password, IsActive, UserID, FinalYear, Status, UserName, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }
        public List<EmployeeMaster> GetAllEmployeeMaster(int EmployeeId)
        {
            List<EmployeeMaster> listCountry = new List<EmployeeMaster>();

            EmployeeMasterDbContext obj = new EmployeeMasterDbContext();

            listCountry = obj.EmployeeMaster_GetAll(EmployeeId);

            return listCountry;
        }
        public virtual int EmployeeLogin(string UserName, string Password, ref int EmployeeId, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                EmployeeMasterDbContext obj = new EmployeeMasterDbContext();
                errorNo = obj.EmployeeMaster_Login(UserName, Password, ref EmployeeId, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }
        public int EmployeeChangePasswordLogin(int EmployeeId, string Password, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                EmployeeMasterDbContext obj = new EmployeeMasterDbContext();
                errorNo = obj.EmployeeMasterChangePassword_Edit(EmployeeId, Password, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        #endregion

        #region VendorMaster
        public int CreateNewVendorMaster(string NameOfVendor, string Address, string Mobile, string EmailId, string Website, string NameOfContactPerson, string Designation, string ContPersonEmailID, string ContPersonMobile, string JobWork, string ItemName, string IsActive, string UserId, string FinalYear, string Status, string Pin, string GSTNo, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                VendorMasterDbContext obj = new VendorMasterDbContext();
                errorNo = obj.VendorMaster_AddNew(NameOfVendor, Address, Mobile, EmailId, Website, NameOfContactPerson, Designation, ContPersonEmailID, ContPersonMobile, JobWork, ItemName, IsActive, UserId, FinalYear, Status, Pin, GSTNo, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public int EditVendorMaster(int Vendor_Id, string NameOfVendor, string Address, string Mobile, string EmailId, string Website, string NameOfContactPerson, string Designation, string ContPersonEmailID, string ContPersonMobile, string JobWork, string ItemName, string IsActive, string UserId, string FinalYear, string Status, string Pin, string GSTNo, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                VendorMasterDbContext obj = new VendorMasterDbContext();
                errorNo = obj.VendorMaster_Edit(Vendor_Id, NameOfVendor, Address, Mobile, EmailId, Website, NameOfContactPerson, Designation, ContPersonEmailID, ContPersonMobile, JobWork, ItemName, IsActive, UserId, FinalYear, Status, Pin, GSTNo, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }
        public List<VendorMaster> GetAllVendorMaster(int Vendor_Id)
        {
            List<VendorMaster> listCountry = new List<VendorMaster>();

            VendorMasterDbContext obj = new VendorMasterDbContext();

            listCountry = obj.VendorMaster_GetAll(Vendor_Id);

            return listCountry;
        }

        public List<VendorMasterItem> GetAllVendorMasterItem(int VendorItemDetail_ID)
        {
            List<VendorMasterItem> listCountry = new List<VendorMasterItem>();

            VendorMasterDbContext obj = new VendorMasterDbContext();

            listCountry = obj.VendorMasterItem_GetAll(VendorItemDetail_ID);

            return listCountry;
        }

        public int CreateNewVendorMasterItem(string Item, string MobileNo, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                VendorMasterDbContext obj = new VendorMasterDbContext();
                errorNo = obj.VendorMasterItem_AddNew(Item, MobileNo, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }
        #endregion

        #region OrderMaster
        public int CreateNewOrderMaster(string CustomerName, string MobileNo, string EmailId, string EmailId2, string NameOfProcess, string Unit, string Shift, DateTime PaningFromDate, DateTime PaningToDate, string RNGNo, string CustomerOrderNo, string Remark, string UserId, string Status, string FinalYear, string Active, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                OrderMasterDbContext obj = new OrderMasterDbContext();
                errorNo = obj.OrderMaster_AddNew(CustomerName, MobileNo, EmailId, EmailId2, NameOfProcess, Unit, Shift, PaningFromDate, PaningToDate, RNGNo, CustomerOrderNo, Remark, UserId, Status, FinalYear, Active, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public int EditOrderMaster(int Order_Id, string CustomerName, string MobileNo, string EmailId, string EmailId2, string NameOfProcess, string Unit, string Shift, DateTime PaningFromDate, DateTime PaningToDate, string RNGNo, string CustomerOrderNo, string Remark, string UserId, string Status, string FinalYear, string Active, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                OrderMasterDbContext obj = new OrderMasterDbContext();
                errorNo = obj.OrderMaster_Edit(Order_Id, CustomerName, MobileNo, EmailId, EmailId2, NameOfProcess, Unit, Shift, PaningFromDate, PaningToDate, RNGNo, CustomerOrderNo, Remark, UserId, Status, FinalYear, Active, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }
        public List<OrderMaster> GetAllOrderMaster(string RNGNo)
        {
            List<OrderMaster> listCountry = new List<OrderMaster>();

            OrderMasterDbContext obj = new OrderMasterDbContext();

            listCountry = obj.OrderMaster_GetAll(RNGNo);

            return listCountry;
        }




        #endregion

        #region OrderItemMaster
        public int CreateNewOrderItemMaster(string RNGNo, string Item, string Spacification, string CastWeight, string FinishedWeight, string OrderQty, string StockOnFloor, string BalanceForProduction, string NoofPattenrnsforplate, string NoOfBoxNeeded, string BoxPerin150KG, string NoOfBoxPerShift, string NoOfShiftForTotalOrder, string TotalNoOfShift12hours, string BoxWeight, string TotalOredWeight, string MetalGrade, string Column1, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                OrderItemMasterDbContext obj = new OrderItemMasterDbContext();
                errorNo = obj.OrderItemMaster_AddNew(RNGNo, Item, Spacification, CastWeight, FinishedWeight, OrderQty, StockOnFloor, BalanceForProduction, NoofPattenrnsforplate, NoOfBoxNeeded, BoxPerin150KG, NoOfBoxPerShift, NoOfShiftForTotalOrder, TotalNoOfShift12hours, BoxWeight, TotalOredWeight, MetalGrade, Column1, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public int EditOrderItemMaster(int Item_ID, string RNGNo, string Item, string Spacification, string CastWeight, string FinishedWeight, string OrderQty, string StockOnFloor, string BalanceForProduction, string NoofPattenrnsforplate, string NoOfBoxNeeded, string BoxPerin150KG, string NoOfBoxPerShift, string NoOfShiftForTotalOrder, string TotalNoOfShift12hours, string BoxWeight, string TotalOredWeight, string MetalGrade, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                OrderItemMasterDbContext obj = new OrderItemMasterDbContext();
                errorNo = obj.OrderItemMaster_Edit(Item_ID, RNGNo, Item, Spacification, CastWeight, FinishedWeight, OrderQty, StockOnFloor, BalanceForProduction, NoofPattenrnsforplate, NoOfBoxNeeded, BoxPerin150KG, NoOfBoxPerShift, NoOfShiftForTotalOrder, TotalNoOfShift12hours, BoxWeight, TotalOredWeight, MetalGrade, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }
        public List<OrderItemMaster> GetAllOrderItemMaster(int Item_ID, string RNGNo)
        {
            List<OrderItemMaster> listCountry = new List<OrderItemMaster>();

            OrderItemMasterDbContext obj = new OrderItemMasterDbContext();

            listCountry = obj.OrderItemMaster_GetAll(Item_ID, RNGNo);

            return listCountry;
        }




        #endregion

        #region FuranceLogSheet
        public int CreateNewFuranceLogSheet(string UnitName, DateTime Date, string DayShiftOperator, string Shift, string StartMeterReading, string StopMeterReading, string TotalUnits, string TotalMelting, string UnitPerKg, string IsActive, string UserID, string FinalYear, string Status,
            ref int FuranceId, string NetProduction, string FloorMetal, string Rejection, string Riserweight, string SlagWeight, List<FuranceLogSheetIRN1> ListSalesFuranceLogSheetIRN1, List<FuranceLogSheetIRN2> ListSalesFuranceLogSheetIRN2, List<IRN2> ListIRN2, int ShiftMasterid,decimal BunchWeight, ref string errorDesc)
        {
            int errorNo = 0;

            FuranceLogSheetDbContext obj = new FuranceLogSheetDbContext();
            errorNo = obj.FuranceLogSheet_AddNew(UnitName, Date, DayShiftOperator, Shift, StartMeterReading, StopMeterReading, TotalUnits, TotalMelting, UnitPerKg, IsActive, UserID, FinalYear, Status, ref FuranceId, NetProduction, FloorMetal, Rejection, Riserweight, SlagWeight, ListSalesFuranceLogSheetIRN1, ListSalesFuranceLogSheetIRN2, ListIRN2, ShiftMasterid, BunchWeight, ref errorDesc);
            return errorNo;
        }


        public int EditFuranceLogSheet(int FuranceId, string UnitName, DateTime Date, string DayShiftOperator, string Shift, string StartMeterReading, string StopMeterReading, string TotalUnits, string TotalMelting, string UnitPerKg, string IsActive, string UserID, string FinalYear, string Status, string NetProduction, string FloorMetal, string Rejection, string Riserweight, string SlagWeight,
       List<FuranceLogSheetIRN1> ListSalesFuranceLogSheetIRN1, List<FuranceLogSheetIRN2> ListSalesFuranceLogSheetIRN2, List<IRN2> ListIRN2, int ShiftMasterid,decimal BunchWeight, ref string errorDesc)
        {
            int errorNo = 0;

            FuranceLogSheetDbContext obj = new FuranceLogSheetDbContext();
            errorNo = obj.FuranceLogSheet_Edit(FuranceId, UnitName, Date, DayShiftOperator, Shift, StartMeterReading, StopMeterReading, TotalUnits, TotalMelting, UnitPerKg, IsActive, UserID, FinalYear, Status, NetProduction, FloorMetal, Rejection, Riserweight, SlagWeight, ListSalesFuranceLogSheetIRN1, ListSalesFuranceLogSheetIRN2, ListIRN2, ShiftMasterid, BunchWeight, ref errorDesc);
            return errorNo;
        }


        public int Irnone_Edit(int IRN1ID, string HeatNo, string CuNo, string MetalGrade, string LiningHtNo, string StartNo, string StopTime, string VoltageInPanel, string KWInPanel, string CE, string Carbon, string Silicon, string AddedSilicon, string PouredBoxNo, string DrgNo, string TappingTemp, string Other1, string Other2, string Other3, string Other4, string startdate, string enddate, string totaltime, string totalminit, decimal AddedCarbon, decimal AddedFerroSilicon, decimal BunchWeight, decimal AddedCrcScrap, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                FuranceLogSheetDbContext obj = new FuranceLogSheetDbContext();
                errorNo = obj.Irnone_Edit(IRN1ID, HeatNo, CuNo, MetalGrade, LiningHtNo, StartNo, StopTime, VoltageInPanel, KWInPanel, CE, Carbon, Silicon, AddedSilicon, PouredBoxNo, DrgNo, TappingTemp, Other1, Other2, Other3, Other4, startdate, enddate, totaltime, totalminit,AddedCarbon,AddedFerroSilicon,BunchWeight,AddedCrcScrap, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }


        public int Irntwo_Edit(int ItemIRN2_ID, int ItemId, string ItemValue, string HeatNo, string CUNo, string Remarks, string CRCScarp, string Riser, string FloorMetal, string Turning, string RejectionScarp, string Carburiser, string FERROSILICON, string FeSiMagnesium, string Innoculant, string MsScrap, string Cooper, string FeManganase, string OtherMetal, string ChargeInKG, string Other1, string Other2, string Other3, string Other4,int Bunchweight,string Carbon,string Nikal,string Boron,string BismuthMetal,string SorelMetal, ref string errorDesc)

        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                FuranceLogSheetDbContext obj = new FuranceLogSheetDbContext();
                errorNo = obj.Irntwo_Edit(ItemIRN2_ID, ItemId, ItemValue, HeatNo, CUNo, Remarks, CRCScarp, Riser, FloorMetal, Turning, RejectionScarp, Carburiser, FERROSILICON, FeSiMagnesium, Innoculant, MsScrap, Cooper, FeManganase, OtherMetal, ChargeInKG, Other1, Other2, Other3, Other4, Bunchweight, Carbon,Nikal,Boron,BismuthMetal,SorelMetal, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }


        public List<FuranceLogSheet> GetAllFuranceLogSheet(int FuranceId)
        {
            List<FuranceLogSheet> listCountry = new List<FuranceLogSheet>();

            FuranceLogSheetDbContext obj = new FuranceLogSheetDbContext();

            listCountry = obj.FuranceLogSheet_GetAll(FuranceId);

            return listCountry;
        }

        public List<IRN2> GetAllItemIRN2(int ItemIRN2_ID, int FuranceId)
        {
            List<IRN2> listCountry = new List<IRN2>();

            FuranceLogSheetDbContext obj = new FuranceLogSheetDbContext();

            listCountry = obj.ItemIRN2_GetAll(ItemIRN2_ID, FuranceId);

            return listCountry;
        }

        public List<IRN2> GetAllItemIRN2S(int ItemIRN2_ID, int FuranceId)
        {
            List<IRN2> listCountry = new List<IRN2>();

            FuranceLogSheetDbContext obj = new FuranceLogSheetDbContext();

            listCountry = obj.ItemIRN2_GetAllS(ItemIRN2_ID, FuranceId);

            return listCountry;
        }

        public List<FuranceLogSheetIRN1> GetAllFuranceLogSheetIRN1(int IRN1ID, int FuranceId)
        {
            List<FuranceLogSheetIRN1> listCountry = new List<FuranceLogSheetIRN1>();

            FuranceLogSheetDbContext obj = new FuranceLogSheetDbContext();

            listCountry = obj.FuranceLogSheetIRN1_GetAll(IRN1ID, FuranceId);

            return listCountry;
        }

        public int furchaselogsheeteditListIRN2_AddNew(int FuranceId, List<IRN2> ListIRN2, ref string errorDesc)
        {
            int errorNo = 0;

            FuranceLogSheetDbContext obj = new FuranceLogSheetDbContext();
            errorNo = obj.furchaselogsheeteditListIRN2_AddNew(FuranceId, ListIRN2, ref errorDesc);
            return errorNo;
        }

        public int furchaselogsheeteditListIRN1_AddNew(int FuranceId, List<FuranceLogSheetIRN1> ListSalesFuranceLogSheetIRN1, ref string errorDesc)
        {
            int errorNo = 0;

            FuranceLogSheetDbContext obj = new FuranceLogSheetDbContext();
            errorNo = obj.furchaselogsheeteditListIRN1_AddNew(FuranceId, ListSalesFuranceLogSheetIRN1, ref errorDesc);
            return errorNo;
        }

        #endregion

        #region REJECTIONREASON
        public int CreateNewREJECTIONREASONMaster(string ReasonName, string IsActive, string Status, string FinalYear, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                REJECTIONREASONDbContext obj = new REJECTIONREASONDbContext();
                errorNo = obj.REJECTIONREASON_AddNew(ReasonName, IsActive, Status, FinalYear, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public int EditREJECTIONREASONMaster(int RejectionReasionId, string ReasonName, string IsActive, string Status, string FinalYear, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                REJECTIONREASONDbContext obj = new REJECTIONREASONDbContext();
                errorNo = obj.REJECTIONREASON_Edit(RejectionReasionId, ReasonName, IsActive, Status, FinalYear, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }
            return errorNo;
        }


        public List<REJECTIONREASON> GetAllREJECTIONREASONMaster(int RejectionReasionId)
        {
            List<REJECTIONREASON> listCountry = new List<REJECTIONREASON>();

            REJECTIONREASONDbContext obj = new REJECTIONREASONDbContext();

            listCountry = obj.REJECTIONREASON_GetAll(RejectionReasionId);

            return listCountry;
        }

        #endregion

        #region MaterailPurchaseInward
        public int CreateNewMaterailPurchaseInwardMaster(DateTime Date, string VendorName, string UnitName, string Item, string Qty, string Rate, string Amount, string Remarks, string IsActive, string UserID, string FinalYear, string Status, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                MaterailPurchaseInwardDbCOntext obj = new MaterailPurchaseInwardDbCOntext();
                errorNo = obj.MaterailPurchaseInward_AddNew(Date, VendorName, UnitName, Item, Qty, Rate, Amount, Remarks, IsActive, UserID, FinalYear, Status, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public int EditMaterailPurchaseInwardMaster(int MaterialPurchaseInword_ID, DateTime Date, string VendorName, string UnitName, string Item, string Qty, string Rate, string Amount, string Remarks, string IsActive, string UserID, string FinalYear, string Status, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                MaterailPurchaseInwardDbCOntext obj = new MaterailPurchaseInwardDbCOntext();
                errorNo = obj.MaterailPurchaseInward_Edit(MaterialPurchaseInword_ID, Date, VendorName, UnitName, Item, Qty, Rate, Amount, Remarks, IsActive, UserID, FinalYear, Status, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }
            return errorNo;
        }


        public List<MaterailPurchaseInward> GetAllMaterailPurchaseInwardMaster(int MaterialPurchaseInword_ID)
        {
            List<MaterailPurchaseInward> listCountry = new List<MaterailPurchaseInward>();

            MaterailPurchaseInwardDbCOntext obj = new MaterailPurchaseInwardDbCOntext();

            listCountry = obj.MaterailPurchaseInward_GetAll(MaterialPurchaseInword_ID);

            return listCountry;
        }

        #endregion

        #region OtherMetalIssue
        public int CreateNewOtherMetalIssue(DateTime date, string NameOfProcess, string UnitName, string Item, string Qty, string Remarks, string IsActive, string UserID, string FinalYear, string Status, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                OtherMetalIssueDbContext obj = new OtherMetalIssueDbContext();
                errorNo = obj.OtherMetalIssue_AddNew(date, NameOfProcess, UnitName, Item, Qty, Remarks, IsActive, UserID, FinalYear, Status, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public int EditOtherMetalIssue(int MetalIssueId, DateTime date, string NameOfProcess, string UnitName, string Item, string Qty, string Remarks, string IsActive, string UserID, string FinalYear, string Status, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                OtherMetalIssueDbContext obj = new OtherMetalIssueDbContext();
                errorNo = obj.OtherMetalIssue_Edit(MetalIssueId, date, NameOfProcess, UnitName, Item, Qty, Remarks, IsActive, UserID, FinalYear, Status, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }
            return errorNo;
        }


        public List<OtherMetalIssue> GetAllOtherMetalIssue(int MetalIssueId)
        {
            List<OtherMetalIssue> listCountry = new List<OtherMetalIssue>();

            OtherMetalIssueDbContext obj = new OtherMetalIssueDbContext();

            listCountry = obj.OtherMetalIssue_GetAll(MetalIssueId);

            return listCountry;
        }

        #endregion

        #region RejectionEntry
        public int CreateNewRejectionEntry(DateTime Date, string UnitName, string ProcessName, string Remarks, string Status, string ItemName, string IsActive, string RejectQty, string Reason, string UserID, string FinalYear, int MainId, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                RejectionEntryDbContext obj = new RejectionEntryDbContext();
                errorNo = obj.RejectionEntry_AddNew(Date, UnitName, ProcessName, Remarks, Status, ItemName, IsActive, RejectQty, Reason, UserID, FinalYear, MainId, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public int EdiRejectionEntry(int Rejection_Id, DateTime Date, string UnitName, string ProcessName, string Remarks, string ItemName, string IsActive, string RejectQty, string Reason, string UserID, string FinalYear, string Status, int MainId, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                RejectionEntryDbContext obj = new RejectionEntryDbContext();
                errorNo = obj.RejectionEntry_Edit(Rejection_Id, Date, UnitName, ProcessName, Remarks, ItemName, IsActive, RejectQty, Reason, UserID, FinalYear, Status, MainId, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }
            return errorNo;
        }


        public List<RejectionEntry> GetAllRejectionEntry(int Rejection_Id)
        {
            List<RejectionEntry> listCountry = new List<RejectionEntry>();

            RejectionEntryDbContext obj = new RejectionEntryDbContext();

            listCountry = obj.RejectionEntry_GetAll(Rejection_Id);

            return listCountry;
        }


        public List<RejectionEntry> RejectionEntryget_GetAll(int Rejection_Id)
        {
            List<RejectionEntry> listCountry = new List<RejectionEntry>();

            RejectionEntryDbContext obj = new RejectionEntryDbContext();

            listCountry = obj.RejectionEntryget_GetAll(Rejection_Id);

            return listCountry;
        }

        public List<RejactionentryOne> RejectionEntryMainid_GetAll(int Mainid)
        {
            List<RejactionentryOne> listCountry = new List<RejactionentryOne>();

            RejectionEntryDbContext obj = new RejectionEntryDbContext();

            listCountry = obj.RejectionEntryMainid_GetAll(Mainid);

            return listCountry;
        }

        public List<RejectionEntry> Sp_RejectionEntrysingle_GetAll(int Rejection_Id)
        {
            List<RejectionEntry> listCountry = new List<RejectionEntry>();

            RejectionEntryDbContext obj = new RejectionEntryDbContext();

            listCountry = obj.Sp_RejectionEntrysingle_GetAll(Rejection_Id);

            return listCountry;
        }

        #endregion

        #region CASTINGHARDNES
        public int CreateNewCASTINGHARDNES(string Date, string Unit, string ProcessName, string IsActive, string UserID, string FinalYear, string Status,
            ref int Casting_Id, List<CASTINGHARDNESItems> ListCASTINGHARDNESItems, ref string errorDesc)
        {
            int errorNo = 0;

            CASTINGHARDNESDbContext obj = new CASTINGHARDNESDbContext();
            errorNo = obj.CASTINGHARDNES_AddNew(Date, Unit, ProcessName, IsActive, UserID, FinalYear, Status, ref Casting_Id, ListCASTINGHARDNESItems, ref errorDesc);
            return errorNo;
        }


        public int EditNewCASTINGHARDNES(int Casting_Id, string Date, string Unit, string ProcessName, string IsActive, string UserID, string FinalYear, string Status,
           List<CASTINGHARDNESItems> ListCASTINGHARDNESItems, ref string errorDesc)
        {
            int errorNo = 0;

            CASTINGHARDNESDbContext obj = new CASTINGHARDNESDbContext();
            errorNo = obj.CASTINGHARDNES_Edit(Casting_Id, Date, Unit, ProcessName, IsActive, UserID, FinalYear, Status, ListCASTINGHARDNESItems, ref errorDesc);
            return errorNo;
        }
        public List<CASTINGHARDNES> GetAllCASTINGHARDNES(int Casting_Id)
        {
            List<CASTINGHARDNES> listCountry = new List<CASTINGHARDNES>();

            CASTINGHARDNESDbContext obj = new CASTINGHARDNESDbContext();

            listCountry = obj.CASTINGHARDNES_GetAll(Casting_Id);

            return listCountry;
        }

        public List<CASTINGHARDNESItems> GetAllCASTINGHARDNESItems(int CastingHardnessItem_ID, int Casting_Id)
        {
            List<CASTINGHARDNESItems> listCountry = new List<CASTINGHARDNESItems>();

            CASTINGHARDNESDbContext obj = new CASTINGHARDNESDbContext();

            listCountry = obj.CASTINGHARDNESItems_GetAll(CastingHardnessItem_ID, Casting_Id);

            return listCountry;
        }


        public int CreateNewCASTINGHARDNESItem(int Casting_Id, string Item, string ProductionDate, string TotalProductionpcs, string RequiredHardness, string AvgCheckPoint, string HeatNo, string Sample1, string Sample2,
          string Sample3, string Sample4, string Sample5, string Sample6, ref string errorDesc)
        {
            int errorNo = 0;

            CASTINGHARDNESDbContext obj = new CASTINGHARDNESDbContext();
            errorNo = obj.CASTINGHARDNESItem_AddNew(Casting_Id, Item, ProductionDate, TotalProductionpcs, RequiredHardness, AvgCheckPoint, HeatNo, Sample1, Sample2, Sample3, Sample4, Sample5, Sample6, ref errorDesc);
            return errorNo;
        }

        public int CASTINGHARDNESItem_edit(int CastingHardnessItem_ID, string Item, string ProductionDate, string TotalProductionpcs, string RequiredHardness, string AvgCheckPoint, string HeatNo, string Sample1, string Sample2,
       string Sample3, string Sample4, string Sample5, string Sample6, string Remarks, ref string errorDesc)
        {
            int errorNo = 0;

            CASTINGHARDNESDbContext obj = new CASTINGHARDNESDbContext();
            errorNo = obj.CASTINGHARDNESItem_edit(CastingHardnessItem_ID, Item, ProductionDate, TotalProductionpcs, RequiredHardness, AvgCheckPoint, HeatNo, Sample1, Sample2, Sample3, Sample4, Sample5, Sample6, Remarks, ref errorDesc);
            return errorNo;
        }



        #endregion

        #region DespatchEntry
        public int CreateNewDespatchEntry(string UnitName, DateTime date, string itemName, string qty, string VendorName, string Remarks, DateTime CreatedDate, string IsActive, string UserID, string FinalYear, string Status, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                DespatchEntryDbContext obj = new DespatchEntryDbContext();
                errorNo = obj.DespatchEntry_AddNew(UnitName, date, itemName, qty, VendorName, Remarks, CreatedDate, IsActive, UserID, FinalYear, Status, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public int EditNewDespatchEntry(int DespatchId, string UnitName, DateTime date, string itemName, string qty, string VendorName, string Remarks, string IsActive, string UserID, string FinalYear, string Status, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                DespatchEntryDbContext obj = new DespatchEntryDbContext();
                errorNo = obj.DespatchEntry_Edit(DespatchId, UnitName, date, itemName, qty, VendorName, Remarks, IsActive, UserID, FinalYear, Status, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }


        public List<DespatchEntry> GetAllDespatchEntry(int DespatchId)
        {
            List<DespatchEntry> listCountry = new List<DespatchEntry>();

            DespatchEntryDbContext obj = new DespatchEntryDbContext();

            listCountry = obj.DespatchEntry_GetAll(DespatchId);

            return listCountry;
        }
        #endregion


        
        #region DisposalEntry
        public int CreateNewDisposalEntry(string UnitName, DateTime date, string item, string Qty, string Weight, string Remarks, DateTime CreatedDate, string IsActive, string UserID, string FinalYear, string Status, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                DisposalEntryDbContext obj = new DisposalEntryDbContext();
                errorNo = obj.DisposalEntry_AddNew(UnitName, date, item, Qty, Weight, Remarks, CreatedDate, IsActive, UserID, FinalYear, Status, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public int EditNewDisposalEntry(int DisposalId, string UnitName, DateTime date, string item, string Qty, string Weight, string Remarks, string IsActive, string UserID, string FinalYear, string Status, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                DisposalEntryDbContext obj = new DisposalEntryDbContext();
                errorNo = obj.DisposalEntry_Edit(DisposalId, UnitName, date, item, Qty, Weight, Remarks, IsActive, UserID, FinalYear, Status, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }


        public List<DisposalEntry> GetAllDisposalEntry(int DisposalId)
        {
            List<DisposalEntry> listCountry = new List<DisposalEntry>();

            DisposalEntryDbContext obj = new DisposalEntryDbContext();

            listCountry = obj.DisposalEntry_GetAll(DisposalId);

            return listCountry;
        }
        #endregion



        #region DailyMalting
        public int DailyMaltingMaster_AddNew(string DocNo, DateTime Date, int Unitid, int Metaltypeid, DateTime Planningdate, int Meltingopid, int Grindingopid, int Punchingopid, string Remarks, string Furnse, string Allowmetergrade, string Allowmetergradeqty, string Ingot, string Ingotqty, string Riser, string Riserqty, string Turning, string Rejection, string Anyothermetal, string Anyothermetalqty, ref int FId, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                DailyMaltingPlanningDbContext obj = new DailyMaltingPlanningDbContext();
                errorNo = obj.DailyMaltingMaster_AddNew(DocNo, Date, Unitid, Metaltypeid, Planningdate, Meltingopid, Grindingopid, Punchingopid, Remarks, Furnse, Allowmetergrade, Allowmetergradeqty, Ingot, Ingotqty, Riser, Riserqty, Turning, Rejection, Anyothermetal,Anyothermetalqty, ref  FId, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public int  DailyMaltingMaster_Edit(int Id, string DocNo, DateTime Date, int Unitid, int Metaltypeid, DateTime Planningdate, int Meltingopid, int Grindingopid, int Punchingopid, string Remarks, string Furnse, string Allowmetergrade, string Allowmetergradeqty, string Ingot, string Ingotqty, string Riser, string Riserqty, string Turning, string Rejection, string Anyothermetal, string Anyothermetalqty, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                DailyMaltingPlanningDbContext obj = new DailyMaltingPlanningDbContext();
                errorNo = obj.DailyMaltingMaster_Edit(Id,DocNo, Date, Unitid, Metaltypeid, Planningdate, Meltingopid, Grindingopid, Punchingopid, Remarks, Furnse, Allowmetergrade, Allowmetergradeqty, Ingot, Ingotqty, Riser, Riserqty, Turning, Rejection,Anyothermetal,Anyothermetalqty, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public List<Meltingplanng> DailyMaltingMaster_GetAll(int Id)
        {
            List<Meltingplanng> listCountry = new List<Meltingplanng>();

            DailyMaltingPlanningDbContext obj = new DailyMaltingPlanningDbContext();

            listCountry = obj.DailyMaltingMaster_GetAll(Id);

            return listCountry;
        }

        public int DailyMaltingoneMaster_AddNew(string DrawingNo, int DieoperatorName, int Planqty, int Prodqty, int MaltingplanId, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                DailyMaltingPlanningDbContext obj = new DailyMaltingPlanningDbContext();
                errorNo = obj.DailyMaltingoneMaster_AddNew(DrawingNo, DieoperatorName, Planqty, Prodqty, MaltingplanId,ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }


        public List<MeltingPlanningone> DailyMaltingoneMaster_GetAll(int MaltingplanId,int Maltingplanning1)
        {
            List<MeltingPlanningone> listCountry = new List<MeltingPlanningone>();

            DailyMaltingPlanningDbContext obj = new DailyMaltingPlanningDbContext();

            listCountry = obj.DailyMaltingoneMaster_GetAll(MaltingplanId, Maltingplanning1);

            return listCountry;
        }


        public int DailyMaltingoneMaster_Edit(int Maltingplanning1, string DrawingNo, int DieoperatorName, int Planqty, int Prodqty, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                DailyMaltingPlanningDbContext obj = new DailyMaltingPlanningDbContext();
                errorNo = obj.DailyMaltingoneMaster_Edit( Maltingplanning1,DrawingNo,DieoperatorName,Planqty,Prodqty,ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        #endregion





        #region DailyFounlyProduction
        public int DailyFoundlyProduction_AddNew(DateTime Date, string DocNo, int Unitid, int MetalId, int Meltingoperatorone, int Meltingoperatortwo, int Dieoperatorone, int Dieoperatortwo, int Dieoperatorthree, string Opreading, string Clreading, string FcStarttime, string FcFinishtime, string PowerAverage, string DrossWeight, string InwardRiserWeight, string InwardTurningWeight, string InwardRejectionWeight, ref int FpId, string Dieoperatorfour, string Dieoperatorfive, string Dieoperatorsix, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                DailyFoundryProductionDbContext obj = new DailyFoundryProductionDbContext();
                errorNo = obj.DailyFoundlyProduction_AddNew( Date,  DocNo,  Unitid,  MetalId,  Meltingoperatorone,  Meltingoperatortwo,  Dieoperatorone,  Dieoperatortwo,  Dieoperatorthree,  Opreading,  Clreading,  FcStarttime,  FcFinishtime,  PowerAverage,  DrossWeight,  InwardRiserWeight,  InwardTurningWeight,  InwardRejectionWeight, ref  FpId,Dieoperatorfour,Dieoperatorfive,Dieoperatorsix, ref  errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public int DailyFoundlyProduction_Edit(int FpId, DateTime Date, string DocNo, int Unitid, int MetalId, int Meltingoperatorone, int Meltingoperatortwo, int Dieoperatorone, int Dieoperatortwo, int Dieoperatorthree, string Opreading, string Clreading, string FcStarttime, string FcFinishtime, string PowerAverage, string DrossWeight, string InwardRiserWeight, string InwardTurningWeight, string InwardRejectionWeight, string Dieoperatorfour, string Dieoperatorfive, string Dieoperatorsix, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                DailyFoundryProductionDbContext obj = new DailyFoundryProductionDbContext();
                errorNo = obj.DailyFoundlyProduction_Edit(FpId,Date, DocNo, Unitid, MetalId, Meltingoperatorone, Meltingoperatortwo, Dieoperatorone, Dieoperatortwo, Dieoperatorthree, Opreading, Clreading, FcStarttime, FcFinishtime, PowerAverage, DrossWeight, InwardRiserWeight, InwardTurningWeight, InwardRejectionWeight,  Dieoperatorfour,  Dieoperatorfive,  Dieoperatorsix, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }






        public List<DailyFoundryproduction> DailyFoundryproduction_GetAll(int FpId)
        {
            List<DailyFoundryproduction> DailyFoundryproduction = new List<DailyFoundryproduction>();

            DailyFoundryProductionDbContext obj = new DailyFoundryProductionDbContext();

            DailyFoundryproduction = obj.DailyFoundryproduction_GetAll(FpId);

            return DailyFoundryproduction;
        }



        public int DailyFoundlyProductionone_AddNew(int FpId, string HeatNo, string AlloyIngotWeight, string AlloyIngotPcs, string RejectionWeight, string ReasonForRejection, string RiserWeight, string TurningWeight, string PouringEndTime, string MetalTemp, string AtbrenorFive, string AsrtenNoofPc, string Magnesium, string N2DeGassingTime, string Gr530, string CoverAlFlux, string RejectionNo, int MetalgradId, string Atb, string Atbqty, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";
           
            try
            { 
                DailyFoundryProductionDbContext obj = new DailyFoundryProductionDbContext();
                errorNo = obj.DailyFoundlyProductionone_AddNew( FpId,  HeatNo,  AlloyIngotWeight,  AlloyIngotPcs, RejectionWeight,  ReasonForRejection,  RiserWeight,  TurningWeight, PouringEndTime,  MetalTemp,  AtbrenorFive,  AsrtenNoofPc,  Magnesium,  N2DeGassingTime,  Gr530,  CoverAlFlux, RejectionNo, MetalgradId,  Atb,  Atbqty, ref  errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }


        public int DailyFoundlyProductionone_Edit(int FqId1, string HeatNo, string AlloyIngotWeight, string AlloyIngotPcs, string RejectionWeight, string ReasonForRejection, string RiserWeight, string TurningWeight, string PouringEndTime, string MetalTemp, string AtbrenorFive, string AsrtenNoofPc, string Magnesium, string N2DeGassingTime, string Gr530, string CoverAlFlux, string RejectionNo, int MetalgradId, string Atb, string Atbqty, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                DailyFoundryProductionDbContext obj = new DailyFoundryProductionDbContext();
                errorNo = obj.DailyFoundlyProductionone_Edit(FqId1, HeatNo, AlloyIngotWeight, AlloyIngotPcs, RejectionWeight, ReasonForRejection, RiserWeight, TurningWeight, PouringEndTime, MetalTemp, AtbrenorFive, AsrtenNoofPc, Magnesium, N2DeGassingTime, Gr530, CoverAlFlux, RejectionNo,MetalgradId,Atb,Atbqty, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }









        public List<DailyFoundryproductionone> DailyFoundryproductionone_GetAll(int FqId1, int FpId)
        {
            List<DailyFoundryproductionone> DailyFoundryproductionone = new List<DailyFoundryproductionone>();

            DailyFoundryProductionDbContext obj = new DailyFoundryProductionDbContext();

            DailyFoundryproductionone = obj.DailyFoundryproductionone_GetAll(FqId1, FpId);

            return DailyFoundryproductionone;
        }









        public int DailyFoundlyProductiontwo_AddNew(int FpId, string HeatNo, string InsertCorner, int ItemNo, string NoofPcs, string WeightInKg, string RejectionPcs, string No, string Reason, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                DailyFoundryProductionDbContext obj = new DailyFoundryProductionDbContext();
                errorNo = obj.DailyFoundlyProductiontwo_AddNew(FpId,  HeatNo,  InsertCorner,  ItemNo,  NoofPcs,  WeightInKg,  RejectionPcs,  No,  Reason, ref  errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public int DailyFoundlyProductiontwo_Edit(int FqId2, string HeatNo, string InsertCorner, int ItemNo, string NoofPcs, string WeightInKg, string RejectionPcs, string No, string Reason, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                DailyFoundryProductionDbContext obj = new DailyFoundryProductionDbContext();
                errorNo = obj.DailyFoundlyProductiontwo_Edit(FqId2, HeatNo, InsertCorner, ItemNo, NoofPcs, WeightInKg, RejectionPcs, No, Reason, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public List<DailyFoundryproductiontwo> DailyFoundryproductiontwo_GetAll(int FqId2, int FpId)
        {
            List<DailyFoundryproductiontwo> DailyFoundryproductiontwo = new List<DailyFoundryproductiontwo>();

            DailyFoundryProductionDbContext obj = new DailyFoundryProductionDbContext();

            DailyFoundryproductiontwo = obj.DailyFoundryproductiontwo_GetAll(FqId2, FpId);

            return DailyFoundryproductiontwo;
        }


        public int DailyFoundlyProductionthree_AddNew(int FpId, string HeatNo, string DgasStartTime, string DgasEndTime, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                DailyFoundryProductionDbContext obj = new DailyFoundryProductionDbContext();
                errorNo = obj.DailyFoundlyProductionthree_AddNew(FpId,HeatNo,DgasStartTime,DgasEndTime, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }


        public int DailyFoundlyProductionthree_Edit(int Id, string HeatNo, string DgasStartTime, string DgasEndTime, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                DailyFoundryProductionDbContext obj = new DailyFoundryProductionDbContext();
                errorNo = obj.DailyFoundlyProductionthree_Edit(Id, HeatNo, DgasStartTime, DgasEndTime, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public List<DailyFoundryproductionthree> DailyFoundryproductionthree_GetAll(int Id, int FpId)
        {
            List<DailyFoundryproductionthree> DailyFoundryproductionthree = new List<DailyFoundryproductionthree>();

            DailyFoundryProductionDbContext obj = new DailyFoundryProductionDbContext();

            DailyFoundryproductionthree = obj.DailyFoundryproductionthree_GetAll(Id, FpId);

            return DailyFoundryproductionthree;
        }

        #endregion



        #region HeatTreatment

        public int HeatTreatment_AddNew(string DocNo, int Metaltype, DateTime Date, string DrawingNo, string Noofpcs, string wtg, string Typeofcycle, string Tempsetting, string Sokinghour, string SokingMinutes, string Startcycle, string Finishcycle, string TotalHours, string Quenchingtypeof, string Remarks, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                HeatTreatmentDbContext obj = new HeatTreatmentDbContext();

                errorNo = obj.HeatTreatment_AddNew( DocNo,  Metaltype,  Date,  DrawingNo,  Noofpcs,  wtg,  Typeofcycle,  Tempsetting,  Sokinghour,  SokingMinutes,  Startcycle,  Finishcycle,  TotalHours,  Quenchingtypeof,  Remarks, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }



        public int HeatTreatment_EditNew(int HeatId, string DocNo, int Metaltype, DateTime Date, string DrawingNo, string Noofpcs, string wtg, string Typeofcycle, string Tempsetting, string Sokinghour, string SokingMinutes, string Startcycle, string Finishcycle, string TotalHours, string Quenchingtypeof, string Remarks, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                HeatTreatmentDbContext obj = new HeatTreatmentDbContext();

                errorNo = obj.HeatTreatment_EditNew(HeatId,DocNo, Metaltype, Date, DrawingNo, Noofpcs, wtg, Typeofcycle, Tempsetting, Sokinghour, SokingMinutes, Startcycle, Finishcycle, TotalHours, Quenchingtypeof, Remarks, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }


        public List<HeatTreatment> HeatTreatment_GetAll(int HeatId)
        {
            List<HeatTreatment> heat = new List<HeatTreatment>();

            HeatTreatmentDbContext obj = new HeatTreatmentDbContext();

            heat = obj.HeatTreatment_GetAll(HeatId);

            return heat;
        }


        #endregion





        #region cncmachine
        public int Cncmachine_AddNew(string DocNo, string MetalType, DateTime Date, int dayShift, int NightShift, ref int Cmpid, int MachinMasterId, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                CncMachineDbContext obj = new CncMachineDbContext();
                errorNo = obj.Cncmachine_AddNew(DocNo,  MetalType,  Date,  dayShift,  NightShift, ref  Cmpid, MachinMasterId, ref  errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }


        public int Cncmachine_Edit(int CncId, string DocNo, string MetalType, DateTime Date, int dayShift, int NightShift, int MachinMasterId, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                CncMachineDbContext obj = new CncMachineDbContext();
                errorNo = obj.Cncmachine_Edit(CncId,DocNo, MetalType, Date, dayShift, NightShift, MachinMasterId, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public int Cncmachineone_AddNew(int CncId, string TimeFromTo, int DrawingNo, string OperatorName, int JobTitle, string CycleTimeMachin, string CycleTimeClamp, string TotalTime, string TargetQuantity, string TargetActual, string Remarks, string RequiredDimensions, string RequiredDimensionstwo, string RequiredDimensionsthree, string ActualDimensions, string ReadingOpening, string ReadingClosing, string TotalReading, string TimeFromEnd, string CycleTotalTime, string RequiredDimensionsfour, string RequiredDimensionsfive, string ActualDimensionstwo, string ActualDimensionsthree, string ActualDimensionsfour, string ActualDimensionsfive, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                CncMachineDbContext obj = new CncMachineDbContext();
                errorNo = obj.Cncmachineone_AddNew( CncId,  TimeFromTo,  DrawingNo,  OperatorName,  JobTitle,  CycleTimeMachin,  CycleTimeClamp, TotalTime,  TargetQuantity,  TargetActual,  Remarks,  RequiredDimensions, RequiredDimensionstwo, RequiredDimensionsthree, ActualDimensions,  ReadingOpening,  ReadingClosing,  TotalReading, TimeFromEnd, CycleTotalTime, RequiredDimensionsfour, RequiredDimensionsfive, ActualDimensionstwo,ActualDimensionsthree,ActualDimensionsfour,ActualDimensionsfive, ref  errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public int Cncmachineone_Edit(int CncId1, string TimeFromTo, int DrawingNo, string OperatorName, int JobTitle, string CycleTimeMachin, string CycleTimeClamp, string TotalTime, string TargetQuantity, string TargetActual, string Remarks, string RequiredDimensions, string RequiredDimensionstwo, string RequiredDimensionsthree, string ActualDimensions, string ReadingOpening, string ReadingClosing, string TotalReading, string TimeFromEnd, string CycleTotalTime, string RequiredDimensionsfour, string RequiredDimensionsfive, string ActualDimensionstwo, string ActualDimensionsthree, string ActualDimensionsfour, string ActualDimensionsfive, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                CncMachineDbContext obj = new CncMachineDbContext();
                errorNo = obj.Cncmachineone_Edit(CncId1, TimeFromTo, DrawingNo, OperatorName, JobTitle, CycleTimeMachin, CycleTimeClamp, TotalTime, TargetQuantity, TargetActual, Remarks, RequiredDimensions,RequiredDimensionstwo,RequiredDimensionsthree, ActualDimensions, ReadingOpening, ReadingClosing, TotalReading, TimeFromEnd, CycleTotalTime,RequiredDimensionsfour, RequiredDimensionsfive, ActualDimensionstwo, ActualDimensionsthree, ActualDimensionsfour, ActualDimensionsfive, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }


        public int Cncmachinetwo_AddNew(int CncId, string ToolType, string InsertCorner, string Insert, string Make, string Reason, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                CncMachineDbContext obj = new CncMachineDbContext();
                errorNo = obj.Cncmachinetwo_AddNew(CncId, ToolType, InsertCorner, Insert, Make, Reason, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public int Cncmachinetwo_Edit(int CncId2, string ToolType, string InsertCorner, string Insert, string Make, string Reason, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                CncMachineDbContext obj = new CncMachineDbContext();
                errorNo = obj.Cncmachinetwo_Edit(CncId2, ToolType, InsertCorner, Insert, Make, Reason, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }



        public List<CncMachinProduction> CncMachinProduction_GetAll(int CncId)
        {
            List<CncMachinProduction> CncMachinProduction = new List<CncMachinProduction>();

            CncMachineDbContext obj = new CncMachineDbContext();

            CncMachinProduction = obj.CncMachinProduction_GetAll(CncId);

            return CncMachinProduction;
        }

        public List<CncMachinProductionOne> CncMachinProductionOne_GetAll(int CncId1, int CncId)
        {
            List<CncMachinProductionOne> CncMachinProduction = new List<CncMachinProductionOne>();

            CncMachineDbContext obj = new CncMachineDbContext();

            CncMachinProduction = obj.CncMachinProductionOne_GetAll(CncId1, CncId);

            return CncMachinProduction;
        }


        public List<CncMachinProductiontwo> CncMachinProductiontwo_GetAll(int CncId2, int CncId)
        {
            List<CncMachinProductiontwo> CncMachinProduction = new List<CncMachinProductiontwo>();

            CncMachineDbContext obj = new CncMachineDbContext();

            CncMachinProduction = obj.CncMachinProductiontwo_GetAll(CncId2, CncId);

            return CncMachinProduction;
        }

        #endregion





        #region Hardness
        public int Hardness_AddNew(string DocNo, int MetalType, DateTime Date, string TypeofTretmentHt, string TypeofTretmentCast, string MateriyalGrade, int DrawingNo, string LotQty, string Remarks, ref int HrId, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                HardnessRecordDbContext obj = new HardnessRecordDbContext();
                errorNo = obj.Hardness_AddNew( DocNo,  MetalType,  Date,  TypeofTretmentHt,  TypeofTretmentCast,  MateriyalGrade,  DrawingNo,  LotQty,  Remarks, ref  HrId, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public int Hardness_EditNew(int HrId, string DocNo, int MetalType, DateTime Date, string TypeofTretmentHt, string TypeofTretmentCast, string MateriyalGrade, int DrawingNo, string LotQty, string Remarks, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                HardnessRecordDbContext obj = new HardnessRecordDbContext();
                errorNo = obj.Hardness_EditNew(HrId,  DocNo,  MetalType,  Date,  TypeofTretmentHt,  TypeofTretmentCast,  MateriyalGrade,  DrawingNo,  LotQty,  Remarks, ref  errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public int HardnessLotQty_AddNew(string PerLotQty, string HardnesObtain, int HrId, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                HardnessRecordDbContext obj = new HardnessRecordDbContext();
                errorNo = obj.HardnessLotQty_AddNew(PerLotQty,  HardnesObtain,  HrId, ref  errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public int HardnessLotQty_Edit(int HlId, string PerLotQty, string HardnesObtain, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                HardnessRecordDbContext obj = new HardnessRecordDbContext();
                errorNo = obj.HardnessLotQty_Edit(HlId,  PerLotQty,  HardnesObtain, ref  errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }


        public List<HardnessRecord> HardnessRecord_GetAll(int HrId)
        {
            List<HardnessRecord> HardnessRecord = new List<HardnessRecord>();

        HardnessRecordDbContext obj = new HardnessRecordDbContext();

        HardnessRecord =  obj.HardnessRecord_GetAll(HrId);

            return HardnessRecord;
        }


        public List<HardnessLotQty> HardnessLotQty_GetAll(int HlId, int HrId)
        {
            List<HardnessLotQty> HardnessRecord = new List<HardnessLotQty>();

            HardnessRecordDbContext obj = new HardnessRecordDbContext();

            HardnessRecord = obj.HardnessLotQty_GetAll(HlId, HrId);

            return HardnessRecord;
        }




        #endregion





        #region anodiszing
        public int Anodiszing_AddNew(int Metaltype, DateTime Date, string Aluwire, string Titaniumbolts, string Dmwater, string SulphuricAcid, string Nitricacid, string CausticSoda, string Starttimeofchillingplant, string StartEnergyreading, string CloseEnergyreading, ref int Anodiszingid, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                AnodiszingDbContext obj = new AnodiszingDbContext();
                errorNo = obj.Anodiszing_AddNew(Metaltype,  Date,  Aluwire,  Titaniumbolts,  Dmwater,  SulphuricAcid,  Nitricacid,  CausticSoda,  Starttimeofchillingplant,  StartEnergyreading,  CloseEnergyreading, ref  Anodiszingid, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }


        public int Anodiszingone_AddNew(int Anodiszingid, string StartTime, string FinishTime, string Temp, string Qty, string WeightPerPices, string ThicknessMicron, string OkPices, string Rework, string Remark, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                AnodiszingDbContext obj = new AnodiszingDbContext();
                errorNo = obj.Anodiszingone_AddNew(Anodiszingid,  StartTime,  FinishTime,  Temp,  Qty,  WeightPerPices,  ThicknessMicron,  OkPices,  Rework,  Remark, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public int Anodiszingone_Edit(int Anodiszingidone, string StartTime, string FinishTime, string Temp, string Qty, string WeightPerPices, string ThicknessMicron, string OkPices, string Rework, string Remark, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                AnodiszingDbContext obj = new AnodiszingDbContext();
                errorNo = obj.Anodiszingone_Edit(Anodiszingidone, StartTime, FinishTime, Temp, Qty, WeightPerPices, ThicknessMicron, OkPices, Rework, Remark, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public int Anodiszing_Edit(int Anodiszingidone, int Metaltype, DateTime Date, string Aluwire, string Titaniumbolts, string Dmwater, string SulphuricAcid, string Nitricacid, string CausticSoda, string Starttimeofchillingplant, string StartEnergyreading, string CloseEnergyreading, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                AnodiszingDbContext obj = new AnodiszingDbContext();
                errorNo = obj.Anodiszing_Edit(Anodiszingidone, Metaltype, Date, Aluwire, Titaniumbolts, Dmwater, SulphuricAcid, Nitricacid, CausticSoda, Starttimeofchillingplant, StartEnergyreading, CloseEnergyreading, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public List<Anodiszing> Anodiszing_GetAlll(int Anodiszingid)
        {
            List<Anodiszing> Anodiszings = new List<Anodiszing>();

            AnodiszingDbContext obj = new AnodiszingDbContext();

            Anodiszings = obj.Anodiszing_GetAlll(Anodiszingid);

            return Anodiszings;
        }

        public List<Anodiszingone> Anodiszingone_GetAll(int Anodiszingidone, int Anodiszingid)
        {
            List<Anodiszingone> Anodiszingone = new List<Anodiszingone>();

            AnodiszingDbContext obj = new AnodiszingDbContext();

            Anodiszingone = obj.Anodiszingone_GetAll(Anodiszingidone, Anodiszingid);

            return Anodiszingone;
        }


        #endregion







        #region Galvaniz
        public int Galvaniz_AddNew(string DocNo, int MetalType, DateTime Date, string furancestarttime, string furancemelttime, string stoptime, string tempwhenstartrts, string tempwhenmelt, string tempwhenstops, string energymtroread, string energymtrmeltread, string cread, ref int GalvanizId, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                GalvanizDbContext obj = new GalvanizDbContext();
                errorNo = obj.Galvaniz_AddNew( DocNo,  MetalType,  Date,  furancestarttime,  furancemelttime,  stoptime,  tempwhenstartrts,  tempwhenmelt,  tempwhenstops,  energymtroread,  energymtrmeltread,  cread, ref  GalvanizId, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public int Galvaniz_Edit(int GalvanizId, string DocNo, int MetalType, DateTime Date, string furancestarttime, string furancemelttime, string stoptime, string tempwhenstartrts, string tempwhenmelt, string tempwhenstops, string energymtroread, string energymtrmeltread, string cread, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                GalvanizDbContext obj = new GalvanizDbContext();
                errorNo = obj.Galvaniz_Edit(GalvanizId,DocNo, MetalType, Date, furancestarttime, furancemelttime, stoptime, tempwhenstartrts, tempwhenmelt, tempwhenstops, energymtroread, energymtrmeltread, cread, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }


        public List<Galvaniz> Galvaniz_GetAll(int GalvanizId)
        {
            List<Galvaniz> Anodiszingone = new List<Galvaniz>();

            GalvanizDbContext obj = new GalvanizDbContext();

            Anodiszingone = obj.Galvaniz_GetAll(GalvanizId);

            return Anodiszingone;
        }

        public int Galvanizproduction_AddNew(int DrawingNo, string Qty, string mcweight, string glweight, string coatingthickness, int GalvanizId, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                GalvanizDbContext obj = new GalvanizDbContext();
                errorNo = obj.Galvanizproduction_AddNew( DrawingNo,  Qty,  mcweight,  glweight,  coatingthickness,  GalvanizId, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public int Galvanizproduction_Edit(int GalvanizproductId, int DrawingNo, string Qty, string mcweight, string glweight, string coatingthickness, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                GalvanizDbContext obj = new GalvanizDbContext();
                errorNo = obj.Galvanizproduction_Edit(GalvanizproductId, DrawingNo, Qty, mcweight, glweight, coatingthickness, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }



        public List<production> production_GetAll(int GalvanizproductId, int GalvanizId)
        {
            List<production> Anodiszingone = new List<production>();

            GalvanizDbContext obj = new GalvanizDbContext();

            Anodiszingone = obj.production_GetAll(GalvanizproductId, GalvanizId);

            return Anodiszingone;
        }



        public int Galvanizbreckdown_AddNew(int GalvanizId, string Starttime, string StopTime, string Reason, string partchange, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                GalvanizDbContext obj = new GalvanizDbContext();
                errorNo = obj.Galvanizbreckdown_AddNew( GalvanizId,  Starttime,  StopTime,  Reason,  partchange, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }


        public int Galvanizbreckdown_Edit(int GalvanizbreakkId, string Starttime, string StopTime, string Reason, string partchange, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                GalvanizDbContext obj = new GalvanizDbContext();
                errorNo = obj.Galvanizbreckdown_Edit(GalvanizbreakkId, Starttime, StopTime, Reason, partchange, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }


        public List<breckdown> breckdown_GetAll(int GalvanizbreakkId, int GalvanizId)
        {
            List<breckdown> Anodiszingone = new List<breckdown>();

            GalvanizDbContext obj = new GalvanizDbContext();

            Anodiszingone = obj.breckdown_GetAll(GalvanizbreakkId, GalvanizId);

            return Anodiszingone;
        }


        public int materialstock_AddNew(int GalvanizId, string Itemname, string received, string issue, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                GalvanizDbContext obj = new GalvanizDbContext();
                errorNo = obj.materialstock_AddNew(GalvanizId, Itemname, received, issue, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }

        public int materialstock_Edit(int GalvanizMaterialId, string Itemname, string received, string issue, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                GalvanizDbContext obj = new GalvanizDbContext();
                errorNo = obj.materialstock_Edit(GalvanizMaterialId, Itemname, received, issue, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }


        public List<materiyalstock> materiyalstock_GetAll(int GalvanizMaterialId, int GalvanizId)
        {
            List<materiyalstock> Anodiszingone = new List<materiyalstock>();

            GalvanizDbContext obj = new GalvanizDbContext();

            Anodiszingone = obj.materiyalstock_GetAll(GalvanizMaterialId, GalvanizId);

            return Anodiszingone;
        }

        #endregion





        #region anodiszing
        public int Userreight_AddNew(int EmployId, string ItemTypeMaster, string MetalMaster, string MetalGradeMaster, string ShiftMaster, string ProductionUnitMaster, string StageProcessMaster, string RejectionReasonMaster, string ItemMaster, string CustomerMaster, string EmployeeMaster, string VendorMaster, string ChangePassword, string HeatTreatment, string DailyFoundryProduction, string MeltingPlanning, string MaterialPurchaseInward, string OrderIRNForProductionPlaning, string OtherMetalIssue, string FuranceLogSheet, string CastingHardness, string RejectionEntry, string DisposalEntry, string DespatchEntry, string IRNforProductionPlaning, string IRNeightCastingHardness, string IRNoneFurnaceLogSheet, string IRNtwoFurnaceLogSheet, string IRNsixPageone, string IRNsixPagetwo, string IRNnineRejectionEntry, string DailyProductionSummary, string materialIssue, string IrnsevenDailyItemSummary, string CastingMonth, string DespatchReport, string MonthStocktotalUnit, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                UserReightsDbContext obj = new UserReightsDbContext();
                errorNo = obj.Userreight_AddNew(EmployId,  ItemTypeMaster,  MetalMaster,  MetalGradeMaster,  ShiftMaster,  ProductionUnitMaster,  StageProcessMaster,  RejectionReasonMaster,  ItemMaster,  CustomerMaster,  EmployeeMaster,  VendorMaster,  ChangePassword,  HeatTreatment,  DailyFoundryProduction,  MeltingPlanning,  MaterialPurchaseInward,  OrderIRNForProductionPlaning,  OtherMetalIssue,  FuranceLogSheet,  CastingHardness,  RejectionEntry,  DisposalEntry,  DespatchEntry,  IRNforProductionPlaning,  IRNeightCastingHardness,  IRNoneFurnaceLogSheet,  IRNtwoFurnaceLogSheet,  IRNsixPageone,  IRNsixPagetwo,  IRNnineRejectionEntry,  DailyProductionSummary,  materialIssue,  IrnsevenDailyItemSummary,  CastingMonth,  DespatchReport,  MonthStocktotalUnit, ref  errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }


        public int Userreight_EditNew(int Id, int EmployId, string ItemTypeMaster, string MetalMaster, string MetalGradeMaster, string ShiftMaster, string ProductionUnitMaster, string StageProcessMaster, string RejectionReasonMaster, string ItemMaster, string CustomerMaster, string EmployeeMaster, string VendorMaster, string ChangePassword, string HeatTreatment, string DailyFoundryProduction, string MeltingPlanning, string MaterialPurchaseInward, string OrderIRNForProductionPlaning, string OtherMetalIssue, string FuranceLogSheet, string CastingHardness, string RejectionEntry, string DisposalEntry, string DespatchEntry, string IRNforProductionPlaning, string IRNeightCastingHardness, string IRNoneFurnaceLogSheet, string IRNtwoFurnaceLogSheet, string IRNsixPageone, string IRNsixPagetwo, string IRNnineRejectionEntry, string DailyProductionSummary, string materialIssue, string IrnsevenDailyItemSummary, string CastingMonth, string DespatchReport, string MonthStocktotalUnit, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                UserReightsDbContext obj = new UserReightsDbContext();
                errorNo = obj.Userreight_EditNew(Id,EmployId, ItemTypeMaster, MetalMaster, MetalGradeMaster, ShiftMaster, ProductionUnitMaster, StageProcessMaster, RejectionReasonMaster, ItemMaster, CustomerMaster, EmployeeMaster, VendorMaster, ChangePassword, HeatTreatment, DailyFoundryProduction, MeltingPlanning, MaterialPurchaseInward, OrderIRNForProductionPlaning, OtherMetalIssue, FuranceLogSheet, CastingHardness, RejectionEntry, DisposalEntry, DespatchEntry, IRNforProductionPlaning, IRNeightCastingHardness, IRNoneFurnaceLogSheet, IRNtwoFurnaceLogSheet, IRNsixPageone, IRNsixPagetwo, IRNnineRejectionEntry, DailyProductionSummary, materialIssue, IrnsevenDailyItemSummary, CastingMonth, DespatchReport, MonthStocktotalUnit, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }


        public List<UserRight> UserRight_GetAll(int EmployId)
        {
            List<UserRight> listCountry = new List<UserRight>();

            UserReightsDbContext obj = new UserReightsDbContext();

            listCountry = obj.UserRight_GetAll(EmployId);

            return listCountry;
        }

        public List<UserRight> UserRight_GetAlluser(int Id)
        {
            List<UserRight> listCountry = new List<UserRight>();

            UserReightsDbContext obj = new UserReightsDbContext();

            listCountry = obj.UserRight_GetAlluser(Id);

            return listCountry;
        }

        #endregion









        #region MachinTypeMaster
        public int MachinTypeMaster_AddNew(string MachineType, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                MachinTypeMasterDbContext obj = new MachinTypeMasterDbContext();
                errorNo = obj.MachinTypeMaster_AddNew(MachineType, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }


        public int MachinTypeMaster_Edit(int Id, string MachineType, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                MachinTypeMasterDbContext obj = new MachinTypeMasterDbContext();
                errorNo = obj.MachinTypeMaster_Edit(Id, MachineType, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }


        public List<MachinTypeMaster> MachinTypeMaster_GetAll(int Id)
        {
            List<MachinTypeMaster> MachinTypeMasters = new List<MachinTypeMaster>();

            MachinTypeMasterDbContext obj = new MachinTypeMasterDbContext();

            MachinTypeMasters = obj.MachinTypeMaster_GetAll(Id);

            return MachinTypeMasters;
        }



        #endregion


        #region MachinTypeMaster
        public int MachinMaster_AddNew(int MachinTypeId, string MachinName, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                MachinMasterDbContext obj = new MachinMasterDbContext();
                errorNo = obj.MachinMaster_AddNew(MachinTypeId, MachinName, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }


        public int MachinMaster_Edit(int Id, int MachinTypeId, string MachinName, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                MachinMasterDbContext obj = new MachinMasterDbContext();
                errorNo = obj.MachinMaster_Edit(Id, MachinTypeId, MachinName, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }


        public List<MachinMaster> MachinMaster_GetAll(int Id)
        {
            List<MachinMaster> MachinMaster = new List<MachinMaster>();

            MachinMasterDbContext obj = new MachinMasterDbContext();

            MachinMaster = obj.MachinMaster_GetAll(Id);

            return MachinMaster;
        }



        #endregion

        #region DrawingItemMaster
        public int DrawingItemMaster_AddNew(int ItemId, int MachinMasterId, int StageProcessId, string MachineTime, string ClampintTime, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                DrawingItemMasterDbContext obj = new DrawingItemMasterDbContext();
                errorNo = obj.DrawingItemMaster_AddNew(ItemId, MachinMasterId,StageProcessId, MachineTime, ClampintTime, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }


        public int DrawingItemMaster_Edit(int Id, int ItemId, int MachinMasterId, int StageProcessId, string MachineTime, string ClampintTime, ref string errorDesc)
        {
            int errorNo = 0;
            errorDesc = "";

            try
            {
                DrawingItemMasterDbContext obj = new DrawingItemMasterDbContext();
                errorNo = obj.DrawingItemMaster_Edit(Id, ItemId, MachinMasterId, StageProcessId, MachineTime, ClampintTime, ref errorDesc);
            }
            catch (Exception Exe)
            {
                errorNo = -1;
                errorDesc = Exe.Message;
            }

            return errorNo;
        }


        public List<DrawingItemMaster> DrawingItemMaster_GetAll(int Id)
        {
            List<DrawingItemMaster> DrawingItemMaster = new List<DrawingItemMaster>();

            DrawingItemMasterDbContext obj = new DrawingItemMasterDbContext();

            DrawingItemMaster = obj.DrawingItemMaster_GetAll(Id);

            return DrawingItemMaster;
        }

        #endregion

    }
}
