Example #1
0
        public GenericResponse <List <LoginContract> > GetAllUsers(LoginRequest request)
        {
            DbOperation   dbOperation = new DbOperation();
            SqlDataReader reader      = dbOperation.GetData("COR.sel_GetAllUsers");

            try
            {
                List <LoginContract> users = new List <LoginContract>();
                while (reader.Read())
                {
                    users.Add(new LoginContract()
                    {
                        Id        = Convert.ToInt32(reader["Id"]),
                        LoginName = reader["UserName"].ToString()
                    });
                }
                return(new GenericResponse <List <LoginContract> >()
                {
                    Value = users, IsSuccess = true
                });
            }
            catch (Exception)
            {
                return(new GenericResponse <List <LoginContract> >()
                {
                    IsSuccess = false, ErrorMessage = "GetAllUsers operasyonu başarısız."
                });
            }
        }
Example #2
0
        public GenericResponse <List <EducationLevelContract> > getAllEducationLevels(CustomerRequest request)
        {
            DbOperation dbOperation = new DbOperation();
            List <EducationLevelContract> dataContracts = new List <EducationLevelContract>();
            SqlDataReader reader = dbOperation.GetData("CUS.sel_AllEducationLevels");

            while (reader.Read())
            {
                dataContracts.Add(new EducationLevelContract
                {
                    Id                        = Convert.ToInt32(reader["Id"]),
                    EducationLevel            = reader["EducationLevel"].ToString(),
                    EducationLevelDescription = reader["EducationLevelDescription"].ToString()
                });
            }

            if (dataContracts.Count > 0)
            {
                return(new GenericResponse <List <EducationLevelContract> >()
                {
                    Value = dataContracts, IsSuccess = true
                });
            }

            return(new GenericResponse <List <EducationLevelContract> >()
            {
                ErrorMessage = "GetAllEducationLevels işlemi başarısız oldu.", IsSuccess = false
            });
        }
Example #3
0
        public GenericResponse <LoginContract> UserLogin(LoginRequest request)
        {
            DbOperation   dbOperation   = new DbOperation();
            LoginContract loginContract = new LoginContract();

            SqlParameter[] parameters = new SqlParameter[] {
                new SqlParameter("@UserName", request.DataContract.LoginName),
                new SqlParameter("@Password", request.DataContract.Password)
            };

            SqlDataReader reader = dbOperation.GetData("COR.sel_UserLogin", parameters);

            while (reader.Read())
            {
                loginContract.Id        = Convert.ToInt32(reader["Id"]);
                loginContract.LoginName = Convert.ToString(reader["UserName"]);
            }

            try
            {
                return(new GenericResponse <LoginContract>()
                {
                    Value = loginContract, IsSuccess = true
                });
            }
            catch
            {
                return(new GenericResponse <LoginContract>()
                {
                    ErrorMessage = "Başarısız login denemesi", IsSuccess = false
                });
            }
        }
Example #4
0
        public List <CustomerPhoneContract> GetCustomerPhonesByCustomerId(int customerId) //TODO: Buraları düzenle, email ile birlikte
        {
            DbOperation dbOperation = new DbOperation();
            List <CustomerPhoneContract> customerPhones = new List <CustomerPhoneContract>();

            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("CustomerId", customerId)
            };

            SqlDataReader reader = dbOperation.GetData("CUS.sel_CustomerPhonesByCustomerId", parameters);

            while (reader.Read())
            {
                customerPhones.Add(new CustomerPhoneContract
                {
                    PhoneType       = (int)reader["PhoneType"],
                    CustomerId      = (int?)reader["CustomerId"],
                    PhoneNumber     = reader["PhoneNumber"].ToString(),
                    CustomerPhoneId = (int?)reader["CustomerPhoneId"]
                });
            }

            return(customerPhones);
        }
Example #5
0
        public List <CustomerEmailContract> GetCustomerEmailsByCustomerId(int customerId)
        {
            DbOperation dbOperation = new DbOperation();
            List <CustomerEmailContract> customerEmails = new List <CustomerEmailContract>();

            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("CustomerId", customerId)
            };

            SqlDataReader reader = dbOperation.GetData("CUS.sel_CustomerEmailsByCustomerId", parameters);

            while (reader.Read())
            {
                customerEmails.Add(new CustomerEmailContract
                {
                    EmailType      = (int)reader["EmailType"],
                    CustomerId     = (int?)reader["CustomerId"],
                    MailAdress     = reader["MailAdress"].ToString(),
                    CustomerMailId = (int?)reader["CustomerMailId"]
                });
            }

            return(customerEmails);
        }
Example #6
0
        public GenericResponse <List <CityContract> > getAllCities()
        {
            DbOperation         dbOperation   = new DbOperation();
            List <CityContract> cityContracts = new List <CityContract>();
            SqlDataReader       reader        = dbOperation.GetData("COR.sel_AllCities");

            while (reader.Read())
            {
                cityContracts.Add(new CityContract()
                {
                    Id   = Convert.ToInt32(reader["id"]),
                    Code = reader["code"].ToString(),
                    Name = reader["name"].ToString()
                });
            }
            if (cityContracts.Count > 0)
            {
                return(new GenericResponse <List <CityContract> >()
                {
                    Value = cityContracts, IsSuccess = true
                });
            }
            else
            {
                return(new GenericResponse <List <CityContract> >()
                {
                    ErrorMessage = "getAllCities işlemi başarısız", IsSuccess = false
                });
            }
        }
Example #7
0
        public GenericResponse <List <CurrencyContract> > GetAllCurrencies(AccountRequest request)
        {
            DbOperation             dbOperation       = new DbOperation();
            SqlDataReader           reader            = dbOperation.GetData("COR.sel_GetAllCurrencies");
            List <CurrencyContract> currencyContracts = new List <CurrencyContract>();

            while (reader.Read())
            {
                currencyContracts.Add(new CurrencyContract()
                {
                    Symbol = reader["symbol"].ToString(),
                    Code   = reader["code"].ToString(),
                    Id     = Convert.ToInt32(reader["id"]),
                    Name   = reader["name"].ToString()
                });
            }

            try
            {
                return(new GenericResponse <List <CurrencyContract> >()
                {
                    Value = currencyContracts, IsSuccess = true
                });
            }
            catch
            {
                return(new GenericResponse <List <CurrencyContract> >()
                {
                    ErrorMessage = "GetAllCurrencies operasyonu başarısız oldu.", IsSuccess = false
                });
            }
        }
Example #8
0
        public GenericResponse <List <CustomerContract> > FilterCustomersByProperties(CustomerRequest request)
        {
            DbOperation dbOperation = new DbOperation();

            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@CustomerId", request.DataContract.CustomerId),
                new SqlParameter("@CustomerName", request.DataContract.CustomerName),
                new SqlParameter("@CustomerLastName", request.DataContract.CustomerLastName),
                new SqlParameter("@CitizenshipId", request.DataContract.CitizenshipId),
                new SqlParameter("@MotherName", request.DataContract.MotherName),
                new SqlParameter("@FatherName", request.DataContract.FatherName),
                new SqlParameter("@PlaceOfBirth", request.DataContract.PlaceOfBirth),
                new SqlParameter("@DateOfBirth", request.DataContract.DateOfBirth),
                new SqlParameter("@JobId", request.DataContract.JobId),
                new SqlParameter("@EducationLvId", request.DataContract.EducationLvId),
                new SqlParameter("@BranchId", request.DataContract.BranchId)
            };

            try
            {
                List <CustomerContract> customerContracts = new List <CustomerContract>();
                SqlDataReader           reader            = dbOperation.GetData("CUS.sel_FilterCustomerByProperties", parameters);
                while (reader.Read())
                {
                    customerContracts.Add(new CustomerContract()
                    {
                        CustomerId         = Convert.ToInt32(reader["CustomerId"]),
                        CustomerName       = reader["CustomerName"].ToString(),
                        CustomerLastName   = reader["CustomerLastName"].ToString(),
                        CitizenshipId      = reader["CitizenshipId"].ToString(),
                        MotherName         = reader["MotherName"].ToString(),
                        FatherName         = reader["FatherName"].ToString(),
                        PlaceOfBirth       = reader["PlaceOfBirth"].ToString(),
                        JobId              = (int)reader["JobId"],
                        EducationLvId      = (int)reader["EducationLvId"],
                        BranchId           = (int)reader["BranchId"],
                        DateOfBirth        = (DateTime)reader["DateOfBirth"],
                        EducationLevelName = reader["EducationLevel"].ToString(),
                        JobName            = reader["JobName"].ToString(),
                        BranchName         = reader["BranchName"].ToString(),
                        PhoneNumbers       = GetCustomerPhonesByCustomerId(Convert.ToInt32(reader["CustomerId"])),
                        Emails             = GetCustomerEmailsByCustomerId(Convert.ToInt32(reader["CustomerId"]))
                    });
                }

                return(new GenericResponse <List <CustomerContract> >()
                {
                    IsSuccess = true, Value = customerContracts
                });
            }
            catch
            {
                return(new GenericResponse <List <CustomerContract> >()
                {
                    IsSuccess = false, ErrorMessage = "FilterCustomersByProperties operasyonu başarısız."
                });
            }
        }
Example #9
0
        public GenericResponse <List <RemittanceContract> > GetAllRemittances(RemittanceRequest request)
        {
            DbOperation dbOperation = new DbOperation();

            try
            {
                List <RemittanceContract> remittancesList = new List <RemittanceContract>();
                SqlDataReader             reader          = dbOperation.GetData("TRN.sel_GelAllRemittances");
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        remittancesList.Add(new RemittanceContract()
                        {
                            Id = (int)reader["Id"],
                            ReceiverAccountNumber  = reader["ReceiverAccountNumber"].ToString(),
                            ReceiverAccountSuffix  = reader["ReceiverAccountSuffix"].ToString(),
                            SenderAccountNumber    = reader["SenderAccountNumber"].ToString(),
                            SenderAccountSuffix    = reader["SenderAccountSuffix"].ToString(),
                            TransactionStatus      = (int?)reader["TransactionStatus"],
                            TransactionDate        = (DateTime?)reader["TransactionDate"],
                            TransactionDescription = reader["TransactionDescription"].ToString(),
                            TransferAmount         = (decimal?)reader["TransferAmount"],
                            ReceiverBranchName     = reader["ReceiverBranchName"].ToString(),
                            SenderBranchName       = reader["SenderBranchName"].ToString(),
                            SenderLastName         = reader["SenderLastName"].ToString(),
                            SenderName             = reader["SenderName"].ToString(),
                            ReceiverLastName       = reader["ReceiverLastName"].ToString(),
                            ReceiverName           = reader["ReceiverName"].ToString(),
                            CurrencyId             = (int?)reader["CurrencyId"],
                            CurrencyCode           = reader["CurrencyCode"].ToString()
                        });
                    }

                    return(new GenericResponse <List <RemittanceContract> >()
                    {
                        IsSuccess = true, Value = remittancesList
                    });
                }

                return(new GenericResponse <List <RemittanceContract> >()
                {
                    IsSuccess = false, ErrorMessage = "Herhangi bir havale kaydı bulunamadı."
                });
            }
            catch (Exception ex)
            {
                return(new GenericResponse <List <RemittanceContract> >()
                {
                    Value = null, IsSuccess = false, ErrorMessage = "GetAllRemittances işlemi başarısız!"
                });

                throw ex;
            }
        }
Example #10
0
        public GenericResponse <CustomerContract> GetCustomerDetailsById(CustomerRequest request)
        {
            DbOperation dbOperation = new DbOperation();

            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@CustomerId", request.DataContract.CustomerId)
            };

            try
            {
                SqlDataReader reader = dbOperation.GetData("CUS.sel_GetCustomerDetailsById", parameters);

                if (reader.HasRows)
                {
                    CustomerContract customer = new CustomerContract();
                    while (reader.Read())
                    {
                        customer.CustomerId         = Convert.ToInt32(reader["CustomerId"]);
                        customer.CustomerName       = reader["CustomerName"].ToString();
                        customer.CustomerLastName   = reader["CustomerLastName"].ToString();
                        customer.CitizenshipId      = reader["CitizenshipId"].ToString();
                        customer.MotherName         = reader["MotherName"].ToString();
                        customer.FatherName         = reader["FatherName"].ToString();
                        customer.PlaceOfBirth       = reader["PlaceOfBirth"].ToString();
                        customer.DateOfBirth        = (DateTime)reader["DateOfBirth"];
                        customer.EducationLevelName = reader["EducationLevel"].ToString();
                        customer.JobName            = reader["JobName"].ToString();
                        customer.BranchName         = reader["BranchName"].ToString();
                        customer.PhoneNumbers       = GetCustomerPhonesByCustomerId(Convert.ToInt32(reader["CustomerId"]));
                        customer.Emails             = GetCustomerEmailsByCustomerId(Convert.ToInt32(reader["CustomerId"]));
                    }

                    return(new GenericResponse <CustomerContract>()
                    {
                        Value = customer, IsSuccess = true
                    });
                }

                else
                {
                    return(new GenericResponse <CustomerContract>()
                    {
                        IsSuccess = false, ErrorMessage = "Verilen ID ile kayıtlı herhangi bir müşteri bulunamadı!"
                    });
                }
            }
            catch (Exception)
            {
                return(new GenericResponse <CustomerContract>()
                {
                    IsSuccess = false, ErrorMessage = "GetCustomerDetailsById operasyonu başarısız oldu."
                });
            }
        }
Example #11
0
        public GenericResponse <List <DepositWithdrawalContract> > GetAllDepositWithdrawals(DepositWithdrawalRequest request)
        {
            DbOperation dbOperation = new DbOperation();

            try
            {
                List <DepositWithdrawalContract> depositWithdrawalsList = new List <DepositWithdrawalContract>();
                SqlDataReader reader = dbOperation.GetData("TRN.sel_GelAllDepositWithDrawals");
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        depositWithdrawalsList.Add(new DepositWithdrawalContract()
                        {
                            Id                  = (int)reader["Id"],
                            AccountNumber       = reader["AccountNumber"].ToString(),
                            AccountSuffix       = reader["AccountSuffix"].ToString(),
                            FormedUserId        = (int?)reader["FormedUserId"],
                            TransferBranchId    = (int?)reader["TransferBranchId"],
                            TransferDate        = (DateTime?)reader["TransferDate"],
                            TransferDescription = reader["TransferDescription"].ToString(),
                            TransferType        = (int?)reader["TransferType"],
                            CurrencyId          = (int?)reader["CurrencyId"],
                            TransferAmount      = (decimal)reader["TransferAmount"],
                            CurrencyCode        = reader["CurrencyCode"].ToString(),
                            UserName            = reader["UserName"].ToString(),
                            BranchName          = reader["BranchName"].ToString()
                        });
                    }

                    return(new GenericResponse <List <DepositWithdrawalContract> >()
                    {
                        IsSuccess = true, Value = depositWithdrawalsList
                    });
                }

                return(new GenericResponse <List <DepositWithdrawalContract> >()
                {
                    IsSuccess = false, ErrorMessage = "Herhangi bir havale kaydı bulunamadı.", Value = null
                });
            }
            catch (Exception ex)
            {
                return(new GenericResponse <List <DepositWithdrawalContract> >()
                {
                    Value = null, IsSuccess = false, ErrorMessage = "GetAllDepositWithdrawals işlemi başarısız!"
                });

                throw ex;
            }
        }
Example #12
0
        public GenericResponse <List <BranchContract> > FilterBranchsByProperties(BranchRequest request)
        {
            DbOperation dbOperation = new DbOperation();

            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@Id", request.DataContract.Id),
                new SqlParameter("@BranchName", request.DataContract.BranchName),
                new SqlParameter("@Adress", request.DataContract.Adress),
                new SqlParameter("@CityId", request.DataContract.CityId),
                new SqlParameter("@DateOfLaunch", request.DataContract.DateOfLaunch),
                new SqlParameter("@MailAdress", request.DataContract.MailAdress),
                new SqlParameter("@PhoneNumber", request.DataContract.PhoneNumber),
            };

            try
            {
                List <BranchContract> branchsList = new List <BranchContract>();
                SqlDataReader         reader      = dbOperation.GetData("COR.sel_FilterBranchsByProperties", parameters);
                while (reader.Read())
                {
                    branchsList.Add(new BranchContract()
                    {
                        Id           = (int)reader["Id"],
                        CityId       = (int)reader["CityId"],
                        Adress       = (string)reader["Adress"],
                        MailAdress   = (string)reader["MailAdress"],
                        BranchName   = (string)reader["BranchName"],
                        DateOfLaunch = (DateTime)reader["DateOfLaunch"],
                        PhoneNumber  = (string)reader["PhoneNumber"],
                        City         = reader["CityName"].ToString()
                    });
                }

                return(new GenericResponse <List <BranchContract> >()
                {
                    Value = branchsList, IsSuccess = true
                });
            }
            catch
            {
                return(new GenericResponse <List <BranchContract> >()
                {
                    IsSuccess = false, ErrorMessage = "FilterBranchsByProperties isteği başarısız."
                });
            }
        }
Example #13
0
        public GenericResponse <List <BranchContract> > GetAllBranches(BranchRequest request)
        {
            DbOperation           dbOperation     = new DbOperation();
            List <BranchContract> branchContracts = new List <BranchContract>();

            try
            {
                SqlDataReader reader = dbOperation.GetData("COR.sel_GetAllBranches");
                while (reader.Read())
                {
                    branchContracts.Add(new BranchContract()
                    {
                        Id           = (int)reader["Id"],
                        CityId       = (int)reader["CityId"],
                        Adress       = (string)reader["Adress"],
                        MailAdress   = (string)reader["MailAdress"],
                        BranchName   = (string)reader["BranchName"],
                        DateOfLaunch = (DateTime)reader["DateOfLaunch"],
                        PhoneNumber  = (string)reader["PhoneNumber"],
                        City         = reader["CityName"].ToString()
                    });
                }
            }
            catch (Exception)
            {
                return(new GenericResponse <List <BranchContract> >()
                {
                    ErrorMessage = "GetAllBranches metodu başarısız.", IsSuccess = false
                });
            }

            if (branchContracts.Count > 0)
            {
                return(new GenericResponse <List <BranchContract> >()
                {
                    Value = branchContracts, IsSuccess = true
                });
            }
            else
            {
                return(new GenericResponse <List <BranchContract> >()
                {
                    IsSuccess = false, ErrorMessage = "Hiç şube getirilemedi."
                });
            }
        }
Example #14
0
        public GenericResponse <List <AccountContract> > GetAllAccounts(AccountRequest request)
        {
            DbOperation            dbOperation      = new DbOperation();
            List <AccountContract> accountContracts = new List <AccountContract>();
            SqlDataReader          reader           = dbOperation.GetData("CUS.sel_GetAllAccounts");

            try
            {
                while (reader.Read())
                {
                    accountContracts.Add(new AccountContract()
                    {
                        Id              = Convert.ToInt32(reader["Id"]),
                        BranchId        = (int)reader["BranchId"],
                        CustomerId      = (int)reader["CustomerId"],
                        AdditionNo      = (int)reader["AdditionNo"],
                        CurrencyId      = (int)reader["CurrencyId"],
                        Balance         = (decimal)reader["Balance"],
                        DateOfFormation = (DateTime)reader["DateOfFormation"],
                        IBAN            = reader["IBAN"].ToString(),
                        IsActive        = (bool)reader["IsActive"],
                        /*DateOfDeactivation = (DateTime)reader["DateOfDeactivation"]*/
                        FormedUserId   = (int)reader["FormedUserId"],
                        BranchName     = reader["BranchName"].ToString(),
                        CurrencyCode   = reader["code"].ToString(),
                        FormedUserName = reader["UserName"].ToString()
                                         /*DateOfLastTrasaction = (DateTime)reader["DateOfLastTransaction"]*/
                    });
                }

                return(new GenericResponse <List <AccountContract> >()
                {
                    IsSuccess = true, Value = accountContracts
                });
            }
            catch (Exception)
            {
                return(new GenericResponse <List <AccountContract> >()
                {
                    IsSuccess = false, ErrorMessage = "GetAllAccounts operasyonu başarısız"
                });
            }
        }
Example #15
0
        public GenericResponse <List <RemittanceContract> > FilterRemittancesByProperties(RemittanceRequest request)
        {
            DbOperation dbOperation = new DbOperation();

            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@StartingDate", request.DataContract.StartingDate),
                new SqlParameter("@EndingDate", request.DataContract.EndingDate),
                new SqlParameter("@CurrencyId", request.DataContract.CurrencyId),
                new SqlParameter("@StartingBalance", request.DataContract.StartingBalance),
                new SqlParameter("@EndingBalance", request.DataContract.EndingBalance),
                new SqlParameter("SenderAccountNumber", request.DataContract.SenderAccountNumber),
                new SqlParameter("ReceiverAccountNumber", request.DataContract.ReceiverAccountNumber)
            };
            try
            {
                List <RemittanceContract> remittancesList = new List <RemittanceContract>();
                SqlDataReader             reader          = dbOperation.GetData("TRN.sel_FilterRemittancesByProperties", parameters);
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        remittancesList.Add(new RemittanceContract()
                        {
                            Id = (int)reader["Id"],
                            ReceiverAccountNumber  = reader["ReceiverAccountNumber"].ToString(),
                            ReceiverAccountSuffix  = reader["ReceiverAccountSuffix"].ToString(),
                            SenderAccountNumber    = reader["SenderAccountNumber"].ToString(),
                            SenderAccountSuffix    = reader["SenderAccountSuffix"].ToString(),
                            TransactionStatus      = (int?)reader["TransactionStatus"],
                            TransactionDate        = (DateTime?)reader["TransactionDate"],
                            TransactionDescription = reader["TransactionDescription"].ToString(),
                            TransferAmount         = (decimal?)reader["TransferAmount"],
                            ReceiverBranchName     = reader["ReceiverBranchName"].ToString(),
                            SenderBranchName       = reader["SenderBranchName"].ToString(),
                            SenderLastName         = reader["SenderLastName"].ToString(),
                            SenderName             = reader["SenderName"].ToString(),
                            ReceiverLastName       = reader["ReceiverLastName"].ToString(),
                            ReceiverName           = reader["ReceiverName"].ToString(),
                            CurrencyId             = (int?)reader["CurrencyId"],
                            CurrencyCode           = reader["CurrencyCode"].ToString()
                        });
                    }

                    return(new GenericResponse <List <RemittanceContract> >()
                    {
                        IsSuccess = true, Value = remittancesList
                    });
                }
                return(new GenericResponse <List <RemittanceContract> >()
                {
                    IsSuccess = false, ErrorMessage = "Herhangi bir havale kaydı bulunamadı."
                });
            }

            catch (Exception ex)
            {
                return(new GenericResponse <List <RemittanceContract> > {
                    ErrorMessage = "FilterRemittancesByProperties işlemi başarısız!", IsSuccess = false, Value = null
                });

                throw ex;
            }
        }
Example #16
0
        public GenericResponse <List <AccountContract> > FilterAccountsByProperties(AccountRequest request)
        {
            DbOperation            dbOperation      = new DbOperation();
            List <AccountContract> accountContracts = new List <AccountContract>();

            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@Id", request.DataContract.Id),
                new SqlParameter("@BranchId", request.DataContract.BranchId),
                new SqlParameter("@CustomerId", request.DataContract.CustomerId),
                new SqlParameter("@AdditionNo", request.DataContract.AdditionNo),
                new SqlParameter("@CurrencyId", request.DataContract.CurrencyId),
                new SqlParameter("@Balance", request.DataContract.Balance),
                new SqlParameter("@IBAN", request.DataContract.IBAN),
                new SqlParameter("@IsActive", request.DataContract.IsActive),
                new SqlParameter("@FormedUserId", request.DataContract.FormedUserId),
                new SqlParameter("@DateOfFormation", request.DataContract.DateOfFormation),
                //new SqlParameter("@DateOfDeactivation",request.DataContract.DateOfDeactivation),
                //new SqlParameter("@DateOfLastTransaction",request.DataContract.DateOfLastTrasaction)
            };

            try
            {
                List <AccountContract> accounts = new List <AccountContract>();
                SqlDataReader          reader   = dbOperation.GetData("CUS.sel_FilterAccountsByProperties", parameters);
                while (reader.Read())
                {
                    accounts.Add(new AccountContract()
                    {
                        Id              = Convert.ToInt32(reader["Id"]),
                        BranchId        = (int)reader["BranchId"],
                        CustomerId      = (int)reader["CustomerId"],
                        AdditionNo      = (int)reader["AdditionNo"],
                        CurrencyId      = (int)reader["CurrencyId"],
                        Balance         = (decimal)reader["Balance"],
                        DateOfFormation = (DateTime)reader["DateOfFormation"],
                        IBAN            = reader["IBAN"].ToString(),
                        IsActive        = (bool)reader["IsActive"],
                        //DateOfDeactivation = (DateTime)reader["DateOfDeactivation"],
                        FormedUserId   = (int)reader["FormedUserId"],
                        BranchName     = reader["BranchName"].ToString(),
                        CurrencyCode   = reader["code"].ToString(),
                        FormedUserName = reader["UserName"].ToString()
                                         //DateOfLastTrasaction = (DateTime)reader["DateOfLastTransaction"]
                    });
                }
                return(new GenericResponse <List <AccountContract> >()
                {
                    Value = accounts, IsSuccess = true
                });
            }
            catch (Exception)
            {
                return(new GenericResponse <List <AccountContract> >()
                {
                    ErrorMessage = "FilterAccountsByProperties operasyonu başarısız.", IsSuccess = false
                });

                throw;
            }
        }
Example #17
0
        public GenericResponse <List <CustomerContract> > GetAllCustomers(CustomerRequest request)
        {
            DbOperation             dbOperation   = new DbOperation();
            List <CustomerContract> dataContracts = new List <CustomerContract>();
            SqlDataReader           reader        = dbOperation.GetData("CUS.sel_AllCustomers");

            while (reader.Read())
            {
                dataContracts.Add(new CustomerContract
                {
                    CustomerId         = Convert.ToInt32(reader["CustomerId"]),
                    CustomerName       = reader["CustomerName"].ToString(),
                    CustomerLastName   = reader["CustomerLastName"].ToString(),
                    CitizenshipId      = reader["CitizenshipId"].ToString(),
                    MotherName         = reader["MotherName"].ToString(),
                    FatherName         = reader["FatherName"].ToString(),
                    PlaceOfBirth       = reader["PlaceOfBirth"].ToString(),
                    JobId              = (int)reader["JobId"],
                    EducationLvId      = (int)reader["EducationLvId"],
                    BranchId           = (int)reader["BranchId"],
                    DateOfBirth        = (DateTime)reader["DateOfBirth"],
                    EducationLevelName = reader["EducationLevel"].ToString(),
                    JobName            = reader["JobName"].ToString(),
                    BranchName         = reader["BranchName"].ToString(),
                    PhoneNumbers       = GetCustomerPhonesByCustomerId(Convert.ToInt32(reader["CustomerId"])), //Bunda sakınca var mı? Sor
                    Emails             = GetCustomerEmailsByCustomerId(Convert.ToInt32(reader["CustomerId"]))
                });
            }


            //     public int? CustomerId { get; set; }

            //public string CustomerName { get; set; }

            //public string CustomerLastName { get; set; }

            //public string CitizenshipId { get; set; }

            //public string MotherName { get; set; }

            //public string FatherName { get; set; }

            //public string PlaceOfBirth { get; set; }

            //public int JobId { get; set; }

            //public int EducationLvId { get; set; }

            //public DateTime DateOfBirth { get; set; }

            //public List<CustomerPhoneContract> PhoneNumbers { get; set; }

            //public List<CustomerEmailContract> Emails { get; set; }


            //SqlConnection sqlConnection = new SqlConnection(dbOperation.GetConnectionString());
            //SqlCommand sqlCommand = new SqlCommand
            //{
            //    Connection = sqlConnection,
            //    CommandType = CommandType.StoredProcedure,
            //    CommandText = "CUS.sel_AllCustomers"
            //};
            //using (sqlConnection)
            //{
            //    sqlConnection.Open();
            //    using (SqlDataReader reader = sqlCommand.ExecuteReader())
            //    {
            //        while (reader.Read())
            //        {
            //dataContracts.Add(new CustomerContract
            //{
            //    CustomerId = Convert.ToInt32(reader["CustomerId"]),
            //    CustomerName = reader["CustomerName"].ToString(),
            //    CitizenshipId = reader["CitizenshipId"].ToString()
            //});

            //        }
            //    }
            //}

            if (dataContracts.Count > 0)
            {
                return(new GenericResponse <List <CustomerContract> >()
                {
                    Value = dataContracts, IsSuccess = true
                });
            }

            return(new GenericResponse <List <CustomerContract> >()
            {
                ErrorMessage = "GetAllCustomers işlemi başarısız oldu.", IsSuccess = false
            });
        }
Example #18
0
        public GenericResponse <List <DepositWithdrawalContract> > FilterDepositWithdrawalsByProperties(DepositWithdrawalRequest request)
        {
            DbOperation dbOperation = new DbOperation();

            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@StartingDate", request.DataContract.StartingDate),
                new SqlParameter("@TransferBranchId", request.DataContract.TransferBranchId),
                new SqlParameter("@EndingDate", request.DataContract.EndingDate),
                new SqlParameter("@CurrencyId", request.DataContract.CurrencyId),
                new SqlParameter("@AccountNumber", request.DataContract.AccountNumber),
                new SqlParameter("@AccountSuffix", request.DataContract.AccountSuffix),
                new SqlParameter("@StartingAmount", request.DataContract.StartingAmount),
                new SqlParameter("@EndingAmount", request.DataContract.EndingAmount),
                new SqlParameter("@FormedUserId", request.DataContract.FormedUserId),
                new SqlParameter("@Id", request.DataContract.Id),
                new SqlParameter("@TransferDate", request.DataContract.TransferDate),
                new SqlParameter("@TransferDescription", request.DataContract.TransferDescription),
                new SqlParameter("@TransferType", request.DataContract.TransferType)
            };
            try
            {
                List <DepositWithdrawalContract> depositWithdrawalsList = new List <DepositWithdrawalContract>();
                SqlDataReader reader = dbOperation.GetData("TRN.sel_FilterDepositWithdrawalsByProperties", parameters);
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        depositWithdrawalsList.Add(new DepositWithdrawalContract()
                        {
                            Id                  = (int)reader["Id"],
                            AccountNumber       = reader["AccountNumber"].ToString(),
                            AccountSuffix       = reader["AccountSuffix"].ToString(),
                            FormedUserId        = (int?)reader["FormedUserId"],
                            TransferBranchId    = (int?)reader["TransferBranchId"],
                            TransferDate        = (DateTime?)reader["TransferDate"],
                            TransferDescription = reader["TransferDescription"].ToString(),
                            TransferType        = (int?)reader["TransferType"],
                            CurrencyId          = (int?)reader["CurrencyId"],
                            TransferAmount      = (decimal)reader["TransferAmount"],
                            CurrencyCode        = reader["CurrencyCode"].ToString(),
                            UserName            = reader["UserName"].ToString(),
                            BranchName          = reader["BranchName"].ToString()
                        });
                    }

                    return(new GenericResponse <List <DepositWithdrawalContract> >()
                    {
                        IsSuccess = true, Value = depositWithdrawalsList
                    });
                }
                return(new GenericResponse <List <DepositWithdrawalContract> >()
                {
                    IsSuccess = false, ErrorMessage = "Herhangi bir havale kaydı bulunamadı.", Value = null
                });
            }

            catch (Exception ex)
            {
                return(new GenericResponse <List <DepositWithdrawalContract> > {
                    ErrorMessage = "FilterDepositWithdrawalsByProperties işlemi başarısız!", IsSuccess = false, Value = null
                });

                throw ex;
            }
        }