public async Task AddAsync(PostShare entity)
        {
            await DbContextManager.BeginTransactionAsync();

            var spParameters = new SqlParameter[2];

            spParameters[0] = new SqlParameter()
            {
                ParameterName = "userid", Value = entity.UserId
            };
            spParameters[1] = new SqlParameter()
            {
                ParameterName = "postid", Value = entity.PostId
            };

            await DbContextManager.StoreProc <StoreProcResult>("[dbo].spInsertShare", spParameters);

            try
            {
                await DbContextManager.CommitAsync();
            }
            catch (Exception)
            {
                DbContextManager.RollbackTransaction();
            }
        }
        public async Task AddAsync(ChatMessage entity)
        {
            await DbContextManager.BeginTransactionAsync();

            var spParameters = new SqlParameter[3];

            spParameters[0] = new SqlParameter()
            {
                ParameterName = "sender", Value = entity.SenderId
            };
            spParameters[1] = new SqlParameter()
            {
                ParameterName = "receiver", Value = entity.ReceiverId
            };
            spParameters[2] = new SqlParameter()
            {
                ParameterName = "chat", Value = entity.Message
            };

            await DbContextManager.StoreProc <StoreProcResult>("[dbo].spInsertChatMessage", spParameters);

            try
            {
                await DbContextManager.CommitAsync();
            }
            catch (Exception e)
            {
                DbContextManager.RollbackTransaction();
            }
        }
Beispiel #3
0
        public async Task AddAsync(BookIssue parameters)
        {
            var spParameters = new SqlParameter[4];

            spParameters[0] = new SqlParameter()
            {
                ParameterName = "StudentId", Value = parameters.StudentId
            };
            spParameters[1] = new SqlParameter()
            {
                ParameterName = "BookDetailId", Value = parameters.BookDetailId
            };
            spParameters[2] = new SqlParameter()
            {
                ParameterName = "IssueDate", Value = parameters.IssueDate
            };
            spParameters[3] = new SqlParameter()
            {
                ParameterName = "ReturnDate", Value = parameters.ReturnDate
            };


            await DbContextManager.StoreProc <StoreProcResult>("[dbo].spIssueBook ", spParameters);

            try
            {
                await DbContextManager.CommitAsync();
            }
            catch (Exception e)
            {
                DbContextManager.RollbackTransaction();
            }
        }
        public async Task AddAsync(HotelBooking entity)
        {
            var spParameters = new SqlParameter[4];

            spParameters[0] = new SqlParameter()
            {
                ParameterName = "UserId", Value = entity.UserId
            };
            spParameters[1] = new SqlParameter()
            {
                ParameterName = "HotelId", Value = entity.HotelId
            };
            spParameters[2] = new SqlParameter()
            {
                ParameterName = "CheckIn", Value = entity.UserCheckInDate
            };
            spParameters[3] = new SqlParameter()
            {
                ParameterName = "CheckOut", Value = entity.UserCheckOutDate
            };

            await DbContextManager.StoreProc <StoreProcResult>("[dbo].spHotelBooking ", spParameters);

            try
            {
                await DbContextManager.CommitAsync();
            }
            catch (Exception)
            {
                DbContextManager.RollbackTransaction();
            }
        }
        public async Task AddAsync(BookEntery parameters)
        {
            var spParameters = new SqlParameter[4];

            spParameters[0] = new SqlParameter()
            {
                ParameterName = "BookTitle", Value = parameters.BookTitle
            };
            spParameters[1] = new SqlParameter()
            {
                ParameterName = "BookName", Value = parameters.BookName
            };
            spParameters[2] = new SqlParameter()
            {
                ParameterName = "Copies", Value = parameters.Copies
            };

            spParameters[3] = new SqlParameter()
            {
                ParameterName = "AuthorName", Value = parameters.AuthorName
            };

            await DbContextManager.StoreProc <StoreProcResult>("[dbo].spBookEntery ", spParameters);

            try
            {
                await DbContextManager.CommitAsync();
            }
            catch (Exception e)
            {
                DbContextManager.RollbackTransaction();
            }
        }
Beispiel #6
0
        public async Task AddAsync(BookIssue entity)
        {
            var spParameters = new SqlParameter[3];

            spParameters[0] = new SqlParameter()
            {
                ParameterName = "ReturnDate", Value = entity.ReturnDate
            };
            spParameters[1] = new SqlParameter()
            {
                ParameterName = "IssueDate", Value = entity.IssueDate
            };
            spParameters[2] = new SqlParameter()
            {
                ParameterName = "BookIssueId", Value = entity.BookIssueId
            };


            await DbContextManager.StoreProc <StoreProcResult>("[dbo].spReturnBook ", spParameters);

            try
            {
                await DbContextManager.CommitAsync();
            }
            catch (Exception e)
            {
                DbContextManager.RollbackTransaction();
            }
        }
        public async Task AddAsync(BookTrainResult entity)
        {
            var spParameters = new SqlParameter[10];

            spParameters[0] = new SqlParameter()
            {
                ParameterName = "UserId", Value = entity.UserId
            };
            spParameters[1] = new SqlParameter()
            {
                ParameterName = "TrainName", Value = entity.TrainName
            };
            spParameters[2] = new SqlParameter()
            {
                ParameterName = "StationStartingPoint", Value = entity.StationStartingPoint
            };
            spParameters[3] = new SqlParameter()
            {
                ParameterName = "StationEndingPoint", Value = entity.StationEndingPoint
            };
            spParameters[4] = new SqlParameter()
            {
                ParameterName = "StationArriveTime", Value = entity.StationArriveTime
            };
            spParameters[5] = new SqlParameter()
            {
                ParameterName = "StationDepartTime", Value = entity.StationDepartTime
            };
            spParameters[6] = new SqlParameter()
            {
                ParameterName = "TrainObjectTypeName", Value = entity.TrainObjectTypeName
            };
            spParameters[7] = new SqlParameter()
            {
                ParameterName = "TrainAvailableDay", Value = entity.TrainAvailableDay
            };
            spParameters[8] = new SqlParameter()
            {
                ParameterName = "TrainApplicationObjectClassName", Value = entity.TrainApplicationObjectClassName
            };
            spParameters[9] = new SqlParameter()
            {
                ParameterName = "FarePerPerson", Value = entity.FarePerPerson
            };


            await DbContextManager.StoreProc <StoreProcResult>("[dbo].spBookTrainResult ", spParameters);

            try
            {
                await DbContextManager.CommitAsync();
            }
            catch (Exception)
            {
                DbContextManager.RollbackTransaction();
            }
        }
        public async Task AddAsync(Transaction parameters)
        {
            await DbContextManager.BeginTransactionAsync();

            var spParameters = new SqlParameter[7];

            spParameters[0] = new SqlParameter()
            {
                ParameterName = "amount", Value = parameters.Amount
            };
            spParameters[1] = new SqlParameter()
            {
                ParameterName = "senderId", Value = parameters.SenderId
            };
            spParameters[2] = new SqlParameter()
            {
                ParameterName = "recieverId", Value = parameters.ReciverId
            };
            spParameters[3] = new SqlParameter()
            {
                ParameterName = "sendDate", Value = parameters.SendDate
            };
            spParameters[4] = new SqlParameter()
            {
                ParameterName = "transactionStatus", Value = parameters.TransactionStatus
            };
            spParameters[5] = new SqlParameter()
            {
                ParameterName = "remark", Value = parameters.Remarks
            };
            spParameters[6] = new SqlParameter()
            {
                ParameterName = "upiId", Value = parameters.UPIId
            };
            //  spParameters[7] = new SqlParameter() { ParameterName = "Flag", Value = "@flag" };
            //  spParameters[7].Direction = System.Data.ParameterDirection.Output;

            await DbContextManager.StoreProc <StoreProcResult>("[dbo].spTransactions ", spParameters);

            try
            {
                await DbContextManager.CommitAsync();
            }
            catch (Exception e)
            {
                DbContextManager.RollbackTransaction();
            }
        }
Beispiel #9
0
        public async Task AddAsync(PassengerInvoice entity)
        {
            var spParameters = new SqlParameter[1];
            //  spParameters[0] = new SqlParameter() { ParameterName = "userid", Value = entity.UserId };


            await DbContextManager.StoreProc <StoreProcResult>("[dbo].spPassengerInvoice ", spParameters);

            try
            {
                await DbContextManager.CommitAsync();
            }
            catch (Exception e)
            {
                DbContextManager.RollbackTransaction();
            }
        }
Beispiel #10
0
        public async Task UpdateAsync(EmployeeCreate entity)
        {
            await DbContextManager.BeginTransactionAsync();

            try
            {
                var spParameters = new SqlParameter[7];
                spParameters[0] = new SqlParameter()
                {
                    ParameterName = "EmpId", Value = entity.EmployeeId
                };
                spParameters[1] = new SqlParameter()
                {
                    ParameterName = "FirstName", Value = entity.FirstName
                };
                spParameters[2] = new SqlParameter()
                {
                    ParameterName = "LastName", Value = entity.LastName
                };
                spParameters[3] = new SqlParameter()
                {
                    ParameterName = "Email", Value = entity.Email
                };
                spParameters[4] = new SqlParameter()
                {
                    ParameterName = "MobileNumber", Value = entity.MobileNumber
                };
                spParameters[5] = new SqlParameter()
                {
                    ParameterName = "Salary", Value = entity.Salary
                };
                spParameters[6] = new SqlParameter()
                {
                    ParameterName = "JoinDate", Value = entity.JoinDate
                };

                await DbContextManager.StoreProc <StoreProcResult>("[dbo].spEmployeeUpdate", spParameters);

                await DbContextManager.CommitAsync();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                DbContextManager.RollbackTransaction();
            }
        }
        public async Task AddAsync(Passenger entity)
        {
            var spParameters = new SqlParameter[5];

            spParameters[0] = new SqlParameter()
            {
                ParameterName = "PassengerId", Value = entity.PassengerId
            };
            spParameters[1] = new SqlParameter()
            {
                ParameterName = "userId", Value = entity.UserId
            };
            spParameters[2] = new SqlParameter()
            {
                ParameterName = "PassengerName", Value = entity.PassengerName
            };
            spParameters[3] = new SqlParameter()
            {
                ParameterName = "PassengerAge", Value = entity.PassengerAge
            };
            spParameters[4] = new SqlParameter()
            {
                ParameterName = "PassengerGender", Value = entity.PassengerGender
            };


            await DbContextManager.StoreProc <StoreProcResult>("[dbo].spPassengerDetails ", spParameters);

            try
            {
                await DbContextManager.CommitAsync();
            }
            catch (Exception)
            {
                DbContextManager.RollbackTransaction();
            }
        }
Beispiel #12
0
        public async Task AddAsync(EmployeeCreate entity)
        {
            PasswordResult passwordResult = PasswordHash.Encrypt(entity.employeePassword);

            await DbContextManager.BeginTransactionAsync();

            try
            {
                var spParameters = new SqlParameter[10];
                spParameters[0] = new SqlParameter()
                {
                    ParameterName = "FirstName", Value = entity.FirstName
                };
                spParameters[1] = new SqlParameter()
                {
                    ParameterName = "LastName", Value = entity.LastName
                };
                spParameters[2] = new SqlParameter()
                {
                    ParameterName = "Email", Value = entity.Email
                };
                spParameters[3] = new SqlParameter()
                {
                    ParameterName = "MobileNumber", Value = entity.MobileNumber
                };
                spParameters[4] = new SqlParameter()
                {
                    ParameterName = "Password", Value = passwordResult.Signature
                };
                spParameters[5] = new SqlParameter()
                {
                    ParameterName = "Salt", Value = passwordResult.Salt
                };
                spParameters[6] = new SqlParameter()
                {
                    ParameterName = "LoginBlocked", Value = entity.LoginBlocked
                };
                spParameters[7] = new SqlParameter()
                {
                    ParameterName = "StatusId", Value = entity.StatusId
                };
                spParameters[8] = new SqlParameter()
                {
                    ParameterName = "Salary", Value = entity.Salary
                };
                spParameters[9] = new SqlParameter()
                {
                    ParameterName = "JoinDate", Value = entity.JoinDate
                };

                await DbContextManager.StoreProc <StoreProcResult>("[dbo].spEmployeeCreate", spParameters);

                await DbContextManager.CommitAsync();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                DbContextManager.RollbackTransaction();
            }
            //User user = new User();
            //user.StatusId = Status.Active;
            //user.FirstName = entity.FirstName;
            //user.LastName = entity.LastName;
            //user.Email = entity.Email;
            //user.MobileNumber = entity.MobileNumber;

            //await Uow.RegisterNewAsync<User>(user);
            //int UserId = await Uow.CommitAsync();
            //Employee employee = new Employee();
            //employee.UserId = UserId;
            //employee.Salary = entity.Salary;
            //employee.JoinDate = entity.JoinDate;
            //await Uow.RegisterNewAsync<Employee>(employee);
            //await Uow.CommitAsync();
        }