public async Task <ResultPT> InsertAsync(Purchase_DetailsDTO objPurchase_DetailsDTO)
        {
            try
            {
                objResultPT = new ResultPT();
                using (Purchase_DetailsDAL objPurchase_DetailsDAL = new Purchase_DetailsDAL())
                {
                    objResultPT.ReturnObject = await objPurchase_DetailsDAL.InsertAsync(objPurchase_DetailsDTO);

                    if (Convert.ToInt32(objResultPT.ReturnObject) == 2)
                    {
                        objResultPT.ResultMsg         = string.Format(Messages.ObjectExist, "Purchase_Details");
                        objResultPT.TransactionStatus = Enums.ResultStatus.Warning;
                    }
                    else if (Convert.ToInt32(objResultPT.ReturnObject) > 0)
                    {
                        objResultPT.ResultMsg         = Messages.Success;
                        objResultPT.TransactionStatus = Enums.ResultStatus.Success;
                    }
                    else if (Convert.ToInt32(objResultPT.ReturnObject) == 0)
                    {
                        objResultPT.ResultMsg         = Messages.NoDataFound;
                        objResultPT.TransactionStatus = Enums.ResultStatus.Information;
                    }
                    else
                    {
                        objResultPT.ResultMsg         = Messages.Error;
                        objResultPT.TransactionStatus = Enums.ResultStatus.Failure;
                    }
                }
                return(objResultPT);
            }
            catch (Exception Ex)
            {
                ////log error message into database.
                await this.LogErrorAsync(ErrorLog.ApplicationName.BAL, System.Reflection.MethodBase.GetCurrentMethod().Name, Ex.Message, Ex.StackTrace);

                objResultPT.TransactionStatus = Enums.ResultStatus.Failure;
                objResultPT.ResultMsg         = Ex.Message;
            }

            return(objResultPT);
        }
        public async Task <ResultPT> GetAllAsync( )
        {
            try
            {
                objResultPT = new ResultPT();
                using (Purchase_DetailsDAL objPurchase_DetailsDAL = new Purchase_DetailsDAL())
                {
                    objResultPT.ReturnObject = await objPurchase_DetailsDAL.GetAllAsync();
                }
                return(objResultPT);
            }
            catch (Exception Ex)
            {
                ////log error message into database.
                await this.LogErrorAsync(ErrorLog.ApplicationName.BAL, System.Reflection.MethodBase.GetCurrentMethod().Name, Ex.Message, Ex.StackTrace);

                objResultPT.TransactionStatus = Enums.ResultStatus.Failure;
                objResultPT.ResultMsg         = Ex.Message;
            }

            return(objResultPT);
        }
////    public async Task<ResultPT> DeleteAllAsync()
////    {
////		try
////        {
////			objResultPT = new ResultPT();
////			using (Purchase_DetailsDAL objPurchase_DetailsDAL = new Purchase_DetailsDAL())
////            {
////                 objResultPT.ReturnObject = objPurchase_DetailsDAL.DeleteAll();
////                objResultPT.TransactionStatus = Enums.ResultStatus.Success;
////                objResultPT.ResultMsg = "success";
////            }
////			return objResultPT;
////		}
////        catch (Exception Ex)
////        {
////            ////log error message into database.
////            await this.LogError(ErrorLog.application.BAL, System.Reflection.MethodBase.GetCurrentMethod().Name, Ex.Message, Ex.StackTrace);
////            objResultPT.TransactionStatus = Enums.ResultStatus.Failure;
////            objResultPT.ResultMsg = Ex.Message;
////        }
////		 return objResultPT;
////    }

        public async Task <ResultPT> GetByIDAsync(long ID)
        {
            try
            {
                objResultPT = new ResultPT();
                using (Purchase_DetailsDAL objPurchase_DetailsDAL = new Purchase_DetailsDAL())
                {
                    DataSet dset = await objPurchase_DetailsDAL.GetByIDAsync(ID);

                    if (dset.Tables.Count > 0 && dset.Tables[0].Rows.Count > 0)
                    {
                        DataTable dt = dset.Tables[0];
                        objResultPT.ReturnObject      = CommonFunctions.FillProperties <Purchase_DetailsDTO>(dt.Rows[0]);
                        objResultPT.ResultMsg         = Messages.Success;
                        objResultPT.TransactionStatus = Enums.ResultStatus.Success;
                    }
                    else
                    {
                        objResultPT.ReturnObject      = "";
                        objResultPT.ResultMsg         = Messages.NoDataFound;
                        objResultPT.TransactionStatus = Enums.ResultStatus.NodData;
                    }
                }
                return(objResultPT);
            }
            catch (Exception Ex)
            {
                ////log error message into database.
                await this.LogErrorAsync(ErrorLog.ApplicationName.BAL, System.Reflection.MethodBase.GetCurrentMethod().Name, Ex.Message, Ex.StackTrace);

                objResultPT.TransactionStatus = Enums.ResultStatus.Failure;
                objResultPT.ResultMsg         = Ex.Message;
            }

            return(objResultPT);
        }