Exemplo n.º 1
0
        public async Task <ResultPT> InsertAsync(User_MasterDTO objUser_MasterDTO)
        {
            try
            {
                objResultPT = new ResultPT();
                using (User_MasterDAL objUser_MasterDAL = new User_MasterDAL())
                {
                    objResultPT.ReturnObject = await objUser_MasterDAL.InsertAsync(objUser_MasterDTO);

                    if (Convert.ToInt32(objResultPT.ReturnObject) == 2)
                    {
                        objResultPT.ResultMsg         = string.Format(Messages.ObjectExist, "User_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);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Releases unmanaged resources and performs other cleanup operations before the
        /// <see cref="Txn_DocFilesBAL"/> is reclaimed by garbage collection.
        /// </summary>
        /// <remarks>We must implement a finalizer to guarantee that our unmanaged resource is cleaned up</remarks>

        ///

        public async Task <ResultPT> LogIN(string username, string password)
        {
            try
            {
                objResultPT = new ResultPT();
                using (User_MasterDAL objUser_MasterDAL = new User_MasterDAL())
                {
                    DataSet dset = await objUser_MasterDAL.Login(username, password);

                    if (dset.Tables.Count > 0 && dset.Tables[0].Rows.Count > 0 && dset.Tables[0].Rows.Count > 0)
                    {
                        DataTable dt = dset.Tables[0];
                        objResultPT.ReturnObject      = CommonFunctions.FillProperties <User_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.ReturnObject      = Ex.Message;
                objResultPT.TransactionStatus = Enums.ResultStatus.Failure;
                objResultPT.ResultMsg         = Ex.Message;
            }

            return(objResultPT);
        }