Beispiel #1
0
 public List <BLL.DTO.TransactionDto> GetCustomerTransactions(int CustomerId, DateTime ToDate, DateTime Fromdate, int isCust)
 {
     try
     {
         string  sql = "select CustomerId,FromAccount, ToAccount, MerchantId, Amount from Transaction where CustomerId=@CustomerId and Status=@Status and CONVERT(DATE, CreatedOn) BETWEEN @FromDate AND @ToDate  order by CreatedOn desc";
         MSQconn c   = new MSQconn(ConString);
         c.SetSQL(sql);
         c.AddParam("@CustomerId", CustomerId);
         c.AddParam("@FromDate", Fromdate);
         c.AddParam("@ToDate", ToDate);
         c.AddParam("@Status", 1);
         //for customer Status is  1
         //for merchant Status is  0
         var ds = c.Select();
         if (ds != null && ds.Tables[0].Rows.Count > 0)
         {
             var list = Helper.ConvertDataTable <BLL.DTO.TransactionDto>(ds.Tables[0]);
             return(list);
         }
         else
         {
             // new ErrorLog("Get Customer error: " + ex.ToString());
             List <BLL.DTO.TransactionDto> lt = new List <BLL.DTO.TransactionDto>();
             return(lt);
         }
     }
     catch (Exception ex)
     {
         new ErrorLog("Get trxn Customer error: " + ex.ToString());
         List <BLL.DTO.TransactionDto> lt = new List <BLL.DTO.TransactionDto>();
         return(lt);
         //throw;
     }
 }
Beispiel #2
0
 public bool ValidateDuplicateEnrollment(MerchantCreation r)
 {
     try
     {
         MSQconn con = new MSQconn(ConString);
         string  sql = "Select * from Merchant where PhoneNumber=@PhoneNumber or SettlementAccount=@SettlementAccount or EmailAddress=@EmailAddress";
         con.SetSQL(sql);
         // Dbcon.AddParam("@bvn", r.bvn);
         con.AddParam("@PhoneNumber", r.PhoneNumber);
         con.AddParam("@SettlementAccount", r.SettlementAccount);
         con.AddParam("@EmailAddress", r.EmailAddress);
         // Dbcon.AddParam("@HandleUsername", r.HandleUsername);
         DataSet ds = con.Select();
         if (ds != null && ds.Tables[0].Rows.Count > 0)
         {
             //duplicate
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception ex)
     {
         new ErrorLog("ValidateDuplicateEnrollment error:" + ex.ToString());
         return(false);
     }
 }
Beispiel #3
0
        public Tuple <bool, List <MerchantCreation> > GetmerchantAcct(string PhoneNumber)
        {
            string sql = "select * from Merchant where Username=@Username and Status=@Status";

            try
            {
                MSQconn con = new MSQconn(ConString);
                con.SetSQL(sql);
                con.AddParam("@PhoneNumber", PhoneNumber);
                con.AddParam("@Status", 1);
                DataSet ds = con.Select();
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    //var list = ds.Tables[0].Select().ToArray();
                    var list = Helper.ConvertDataTable <MerchantCreation>(ds.Tables[0]);
                    return(Tuple.Create(true, list));
                }
                else
                {
                    List <MerchantCreation> lt = new List <MerchantCreation>();
                    return(Tuple.Create(false, lt));
                    //DataRow[] lt =null;
                    //return Tuple.Create(true, lt);
                }
            }
            catch (Exception ex)
            {
                new ErrorLog("Login merchant error: " + ex.ToString());
                List <MerchantCreation> lt = new List <MerchantCreation>();
                return(Tuple.Create(false, lt));
            }
        }
Beispiel #4
0
        public OtpResponse GetOtp(string Otp)
        {
            OtpResponse response = new OtpResponse();
            DataSet     ds       = null;

            try
            {
                string  sql = "select * FROM Otp WHERE GeneratedOtp=@Otp";
                MSQconn c   = new MSQconn(ConString);
                c.SetSQL(sql);
                c.AddParam("@Otp", Otp);
                ds = c.Select();
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    response.Bvn    = ds.Tables[0].Rows[0]["Bvn"].ToString();
                    response.Otp    = ds.Tables[0].Rows[0]["GeneratedOtp"].ToString();
                    response.IsUsed = Convert.ToInt16(ds.Tables[0].Rows[0]["IsUsed"]);
                }
            }
            catch (Exception ex)
            {
                return(response);
            }
            return(response);
        }
Beispiel #5
0
 public bool ValidateDuplicateEnrollment(string bvn)
 {
     try
     {
         MSQconn con = new MSQconn(ConString);
         string  sql = "Select * from Customer where BVN=@BVN";
         con.SetSQL(sql);
         con.AddParam("@BVN", bvn);
         DataSet ds = con.Select();
         if (ds != null && ds.Tables[0].Rows.Count > 0)
         {
             //duplicate
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception ex)
     {
         new ErrorLog("ValidateDuplicateEnrollment error:" + ex.ToString());
         return(false);
     }
 }
Beispiel #6
0
        public Tuple <bool, List <CustomerCreation> > GetCustomer(string BVN)
        {
            string sql = "select * from Customer where BVN=@BVN and Status=@Status";

            try
            {
                MSQconn con = new MSQconn(ConString);
                con.SetSQL(sql);
                con.AddParam("@BVN", BVN);
                con.AddParam("@Status", 1);
                DataSet ds = con.Select();
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    //var list = ds.Tables[0].Select().ToArray();
                    var list = Helper.ConvertDataTable <CustomerCreation>(ds.Tables[0]);
                    return(Tuple.Create(true, list));
                }
                else
                {
                    List <CustomerCreation> lt = new List <CustomerCreation>();
                    return(Tuple.Create(false, lt));
                }
            }
            catch (Exception ex)
            {
                new ErrorLog("Get customer details error: " + ex.ToString());
                List <CustomerCreation> lt = new List <CustomerCreation>();
                return(Tuple.Create(false, lt));
            }
        }
Beispiel #7
0
        //public DataSet GetIncident(int EmployerId, string Type, DateTime FromDate, DateTime ToDate)
        public DataSet GetIncident()
        {
            DataSet result = null;

            try
            {
                MSQconn con = new MSQconn(ConString);
                string  sql = @"select * from [Incident]";
                con.SetSQL(sql);
                //con.AddParam("@EmployerId", EmployerId);
                //con.AddParam("@Type", Type);
                //con.AddParam("@FromDate", FromDate);
                //con.AddParam("@ToDate", ToDate);
                result = con.Select();
            }
            catch (Exception ex)
            {
                return(null);
            }

            return(result);
        }
Beispiel #8
0
        public Tuple <bool, List <BvnSearchResp> > GetVoters(string bvn = "")
        {
            try
            {
                MSQconn con = new MSQconn(ConString);
                string  sql = "";
                if (bvn == "")
                {
                    sql = @"SELECT *,[BVN],[RegistrationDate],[FirstName],[MiddleName],[DateOfBirth],[Email],[Gender],[LgaOfOrigin],[LgaOfResidence],[ResidentialAddress],[StateOfOrigin],[StateOfResidence],[Base64Image] FROM InecReg";
                }
                else
                {
                    sql = "select * from InecReg where BVN=@BVN order by desc ";
                }

                con.SetSQL(sql);
                con.AddParam("@BVN", bvn);
                //  con.AddParam("@Status", 1);
                DataSet ds = con.Select();
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    var list = Helper.ConvertDataTable <BvnSearchResp>(ds.Tables[0]);
                    return(Tuple.Create(true, list));
                }
                else
                {
                    List <BvnSearchResp> lt = new List <BvnSearchResp>();
                    return(Tuple.Create(false, lt));
                }
            }
            catch (Exception ex)
            {
                new ErrorLog(ex);
                List <BvnSearchResp> lt = new List <BvnSearchResp>();
                return(Tuple.Create(false, lt));
            }
        }