示例#1
0
        public async Task <ResultPT> InsertAsync(Cat_MasterDTO objCat_MasterDTO)
        {
            try
            {
                objResultPT = new ResultPT();
                using (Cat_MasterDAL objCat_MasterDAL = new Cat_MasterDAL())
                {
                    objResultPT.ReturnObject = await objCat_MasterDAL.InsertAsync(objCat_MasterDTO);

                    if (Convert.ToInt32(objResultPT.ReturnObject) == 2)
                    {
                        objResultPT.ResultMsg         = string.Format(Messages.ObjectExist, "Cat_Master");
                        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);
        }
示例#2
0
        public async Task <ResultPT> GetAllAsync( )
        {
            try
            {
                objResultPT = new ResultPT();
                using (Cat_MasterDAL objCat_MasterDAL = new Cat_MasterDAL())
                {
                    objResultPT.ReturnObject = await objCat_MasterDAL.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);
        }
示例#3
0
////    public async Task<ResultPT> DeleteAllAsync()
////    {
////		try
////        {
////			objResultPT = new ResultPT();
////			using (Cat_MasterDAL objCat_MasterDAL = new Cat_MasterDAL())
////            {
////                 objResultPT.ReturnObject = objCat_MasterDAL.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 (Cat_MasterDAL objCat_MasterDAL = new Cat_MasterDAL())
                {
                    DataSet dset = await objCat_MasterDAL.GetByIDAsync(ID);

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