コード例 #1
0
        public IList <Transactions> GetTransactionsByAccountCode(int?id)
        {
            List <Transactions> transactionList = new List <Transactions>();

            using (SqlConnection con = new SqlConnection(CS))
            {
                SqlCommand cmd = new SqlCommand("pr_GetTransactionsByAccountCode", con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@account_code", id);
                con.Open();
                SqlDataReader rdr = cmd.ExecuteReader();
                while (rdr.Read())
                {
                    var transactionModel = new Transactions()
                    {
                        code             = DataTypesConvertor.ConvertToInt(rdr["code"]),
                        account_code     = DataTypesConvertor.ConvertToInt(rdr["account_code"]),
                        transaction_date = DataTypesConvertor.ConvertToDateTime(rdr["transaction_date"]),
                        capture_date     = DataTypesConvertor.ConvertToDateTime(rdr["capture_date"]),
                        amount           = DataTypesConvertor.ConvertToDecimal(rdr["amount"]),
                        description      = rdr["description"].ToString()
                    };
                    transactionList.Add(transactionModel);
                }
                return(transactionList);
            }
        }
コード例 #2
0
        public Guid AddClientInformation(ClientInformation ClientInformation)
        {
            Guid          ClientInformationID = new Guid("00000000-0000-0000-0000-000000000000");
            SqlConnection con = new SqlConnection(GlobalSettings.connection);

            con.Open();
            SqlCommand Cmd = new SqlCommand("sp_AddClientInformation", con);

            Cmd.CommandType = System.Data.CommandType.StoredProcedure;
            Cmd.Parameters.AddWithValue("@Title", ClientInformation.Title);
            Cmd.Parameters.AddWithValue("@Name", ClientInformation.Name);
            Cmd.Parameters.AddWithValue("@MiddleName", ClientInformation.MiddleName);
            Cmd.Parameters.AddWithValue("@Surname", ClientInformation.Surname);
            Cmd.Parameters.AddWithValue("@Gender", ClientInformation.Gender);
            Cmd.Parameters.AddWithValue("@DateOfBirth", DataTypesConvertor.ConvertToDateTime(ClientInformation.DateOfBirth));
            Cmd.Parameters.AddWithValue("@IDNumber", ClientInformation.IDNumber);
            Cmd.Parameters.AddWithValue("@Cell", ClientInformation.Cell);
            Cmd.Parameters.AddWithValue("@TelHome", ClientInformation.TelHome);
            Cmd.Parameters.AddWithValue("@TelWork", ClientInformation.TelWork);
            Cmd.Parameters.AddWithValue("@Email", ClientInformation.Email);
            Cmd.Parameters.AddWithValue("@StreetNameAndNumber", ClientInformation.StreetNameAndNumber);
            Cmd.Parameters.AddWithValue("@Suburb", ClientInformation.Suburb);
            Cmd.Parameters.AddWithValue("@City", ClientInformation.City);
            Cmd.Parameters.AddWithValue("@PostalCode", ClientInformation.PostalCode);
            SqlDataReader dr = Cmd.ExecuteReader();

            while (dr.Read())
            {
                ClientInformationID = DataTypesConvertor.ConvertToGuid(dr["ClientInformationID"].ToString());
            }
            dr.Close();
            con.Close();
            return(ClientInformationID);
        }
コード例 #3
0
        public List <ClientInformation> GetAllClientInformation()
        {
            List <ClientInformation> ClientInformationDataList = new List <ClientInformation>();

            SqlConnection con = new SqlConnection(GlobalSettings.connection);

            con.Open();
            SqlCommand Cmd = new SqlCommand("sp_GetAllClientInformation", con);

            Cmd.CommandType = System.Data.CommandType.StoredProcedure;

            SqlDataReader dr = Cmd.ExecuteReader();

            while (dr.Read())
            {
                ClientInformation ClientInformation = new ClientInformation();
                ClientInformation.ClientInformationID = DataTypesConvertor.ConvertToGuid(dr["ClientInformationID"].ToString());
                ClientInformation.Title               = dr["Title"].ToString();
                ClientInformation.Name                = dr["Name"].ToString();
                ClientInformation.MiddleName          = dr["MiddleName"].ToString();
                ClientInformation.Surname             = dr["Surname"].ToString();
                ClientInformation.Gender              = dr["Gender"].ToString();
                ClientInformation.DateOfBirth         = DataTypesConvertor.ConvertToDateTime(dr["DateOfBirth"].ToString());
                ClientInformation.IDNumber            = dr["IDNumber"].ToString();
                ClientInformation.Cell                = dr["Cell"].ToString();
                ClientInformation.TelHome             = dr["TelHome"].ToString();
                ClientInformation.TelWork             = dr["TelWork"].ToString();
                ClientInformation.Email               = dr["Email"].ToString();
                ClientInformation.StreetNameAndNumber = dr["StreetNameAndNumber"].ToString();
                ClientInformation.Suburb              = dr["Suburb"].ToString();
                ClientInformation.City                = dr["City"].ToString();
                ClientInformation.PostalCode          = dr["PostalCode"].ToString();

                ClientInformationDataList.Add(ClientInformation);
            }
            dr.Close();
            con.Close();


            return(ClientInformationDataList);
        }
コード例 #4
0
        public Transactions GetTransactionByCode(int?id)
        {
            Transactions accountModel = new Transactions();

            using (SqlConnection con = new SqlConnection(CS))
            {
                SqlCommand cmd = new SqlCommand("pr_GetTransactionByCode", con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@code", id);
                con.Open();
                SqlDataReader rdr = cmd.ExecuteReader();
                while (rdr.Read())
                {
                    accountModel.code             = DataTypesConvertor.ConvertToInt(rdr["code"]);
                    accountModel.account_code     = DataTypesConvertor.ConvertToInt(rdr["person_code"]);
                    accountModel.transaction_date = DataTypesConvertor.ConvertToDateTime(rdr["transaction_date"]);
                    accountModel.capture_date     = DataTypesConvertor.ConvertToDateTime(rdr["capture_date"]);
                    accountModel.amount           = DataTypesConvertor.ConvertToDecimal(rdr["amount"]);
                    accountModel.description      = rdr["description"].ToString();
                }
                return(accountModel);
            }
        }