Example #1
0
        public async Task <ResultPT> InsertAsync(Service_Sales_DetailsDTO objService_Sales_DetailsDTO)
        {
            try
            {
                objResultPT = new ResultPT();
                using (Service_Sales_DetailsDAL objService_Sales_DetailsDAL = new Service_Sales_DetailsDAL())
                {
                    objResultPT.ReturnObject = await objService_Sales_DetailsDAL.InsertAsync(objService_Sales_DetailsDTO);

                    if (Convert.ToInt32(objResultPT.ReturnObject) == 2)
                    {
                        objResultPT.ResultMsg         = string.Format(Messages.ObjectExist, "Service_Sales_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);
        }
Example #2
0
        public async Task <ResultPT> GetAllAsync( )
        {
            try
            {
                objResultPT = new ResultPT();
                using (Service_Sales_DetailsDAL objService_Sales_DetailsDAL = new Service_Sales_DetailsDAL())
                {
                    objResultPT.ReturnObject = await objService_Sales_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);
        }
Example #3
0
////    public async Task<ResultPT> DeleteAllAsync()
////    {
////		try
////        {
////			objResultPT = new ResultPT();
////			using (Service_Sales_DetailsDAL objService_Sales_DetailsDAL = new Service_Sales_DetailsDAL())
////            {
////                 objResultPT.ReturnObject = objService_Sales_DetailsDAL.DeleteAll();
////                objResultPT.TransactionStatus = Enums.ResultStatus.Success;
////                objResultPT.ResultMsg = "success";
////            }
////			return objResultPT;
////		}
////        catch (Exception Ex)
////        {
////            ////log error message into database.
////            await this.LogError(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> GetByIDAsync(long ID)
        {
            try
            {
                objResultPT = new ResultPT();
                using (Service_Sales_DetailsDAL objService_Sales_DetailsDAL = new Service_Sales_DetailsDAL())
                {
                    DataSet dset = await objService_Sales_DetailsDAL.GetByIDAsync(ID);

                    if (dset.Tables.Count > 0 && dset.Tables[0].Rows.Count > 0)
                    {
                        DataTable dt = dset.Tables[0];
                        objResultPT.ReturnObject      = CommonFunctions.FillProperties <Service_Sales_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);
        }