Exemplo n.º 1
0
        public static DataTable ConvertXSLXtoDataTable(string strFilePath, string connString)
        {
            OleDbConnection oledbConn = new OleDbConnection(connString);
            DataTable       dt        = new DataTable();
            DataSet         ds        = new DataSet();

            try
            {
                oledbConn.Open();
                using (DataTable Sheets = oledbConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null))
                {
                    for (int i = 0; i < Sheets.Rows.Count; i++)
                    {
                        string           worksheets = Sheets.Rows[i]["TABLE_NAME"].ToString();
                        OleDbCommand     cmd        = new OleDbCommand(String.Format("SELECT * FROM [{0}]", worksheets), oledbConn);
                        OleDbDataAdapter oleda      = new OleDbDataAdapter();
                        oleda.SelectCommand = cmd;

                        oleda.Fill(ds);
                    }

                    dt = ds.Tables[0];
                }
            }
            catch (Exception ex)
            {
                WebLog.Log(ex.Message);
            }
            finally
            {
                oledbConn.Close();
            }

            return(dt);
        }
Exemplo n.º 2
0
        public int UpdateEmployeeInfo(EmployerLoanDetail LoanApp)
        {
            try
            {
                var EmpDetails = uvDb.EmployerLoanDetails.Find(LoanApp.LoanApplication_FK);
                if (EmpDetails != null)
                {
                    EmpDetails.Department           = LoanApp.Department;
                    EmpDetails.Designation          = LoanApp.Designation;
                    EmpDetails.EmployerID           = LoanApp.EmployerID;
                    EmpDetails.EmploymentStatus_FK  = LoanApp.EmploymentStatus_FK;
                    EmpDetails.NetMonthlyIncome     = LoanApp.NetMonthlyIncome;
                    EmpDetails.OfficialEmailAddress = LoanApp.OfficialEmailAddress;
                    EmpDetails.LengthOfServiceInMth = LoanApp.LengthOfServiceInMth;
                    EmpDetails.Occupation           = LoanApp.Occupation;

                    uvDb.SaveChanges();
                }
                return(EmpDetails.ID);
            }
            catch (Exception ex)
            {
                WebLog.Log(ex.Message.ToString());
                return(0);
            }
        }
Exemplo n.º 3
0
 public int LoanRepayment(int tenure, double RepayAmount, string ReferenceNum)
 {
     try
     {
         var i        = 0;
         var original = (from a in uvDb.LoanLedgers
                         where a.RefNumber == ReferenceNum && a.Credit == 0
                         select a).ToList();
         if (original.Count > 0)
         {
             for (i = 0; i <= tenure; i++)
             {
                 for (i = 0; i <= original.Count; i++)
                 {
                     original[i].Credit         = RepayAmount;
                     original[i].PaymentFlag_FK = 1;
                     uvDb.SaveChanges();
                 }
             }
         }
         return(original.Count);
     }
     catch (Exception ex)
     {
         WebLog.Log(ex.Message.ToString());
         return(0);
     }
 }
Exemplo n.º 4
0
        public static int SaveBVNDetails(Helper.BVNC bvnc)
        {
            int i = 0;

            try
            {
                BanksManager bObj = new BanksManager
                {
                    BankName         = bvnc.EnrollmentBank,
                    ContactAddress   = bvnc.address,
                    DateOfBirth      = bvnc.Dateofbirth,
                    EnrollmentBranch = bvnc.EnrollmentBranch,
                    Firstname        = bvnc.FirstNAme,
                    Gender           = bvnc.gender,
                    IsVisible        = 1,
                    Lastname         = bvnc.LastName,
                    Marital_Status   = bvnc.marital_status,
                    Nationlaity      = bvnc.Nationality,
                    Othernames       = bvnc.MiddleName,
                    ValueDate        = MyUtility.getCurrentLocalDateTime().ToString("yyyy/MM/dd"),
                    VerifiedStatus   = bvnc.respCode == "00" ? 1 : 0,
                    ServiceResponse  = bvnc.respDescription
                };
                uvDb.BanksManagers.Add(bObj);
                uvDb.SaveChanges();
            }
            catch (Exception ex)
            {
                WebLog.Log(ex.Message);
            }
            return(i);
        }
Exemplo n.º 5
0
        public int UpdateEmpInfo(EmployerLoanDetail EmpAp)
        {
            try
            {
                var original = (from a in uvDb.EmployerLoanDetails where a.LoanApplication_FK == EmpAp.ID select a).First();
                if (original.ID != 0)
                {
                    original.NetMonthlyIncome     = EmpAp.NetMonthlyIncome;
                    original.Occupation           = EmpAp.Occupation;
                    original.EmploymentStatus_FK  = EmpAp.EmploymentStatus_FK;
                    original.EmployerID           = EmpAp.EmployerID;
                    original.Department           = EmpAp.Department;
                    original.Designation          = EmpAp.Designation;
                    original.LengthOfServiceInYrs = EmpAp.LengthOfServiceInYrs;
                    original.OfficialEmailAddress = EmpAp.OfficialEmailAddress;
                    uvDb.SaveChanges();
                }
                return(original.ID);
            }


            catch (Exception ex)
            {
                WebLog.Log(ex.Message.ToString());
                return(0);
            }
        }
Exemplo n.º 6
0
        public ActionResult Login(LoanViewModel lvm)
        {
            try
            {
                users.Email   = lvm.AccountsModel.Email;
                users.pasword = lvm.AccountsModel.pasword;
                var EncrypPassword = new CryptographyManager().ComputeHash(users.pasword, HashName.SHA256);
                users.pasword = EncrypPassword;

                var valid = DataReaders.loggedIn(users.Email, EncrypPassword);

                if (valid == true)
                {
                    if (users.Email != null)
                    {
                        Session["id"]   = users.Email;
                        Session["User"] = "******" + Session["id"];
                        var    LoggedInuser = new LogginHelper();
                        string user         = LoggedInuser.LoggedInUser();
                        return(View("index"));
                    }
                    else
                    {
                        ViewBag.Message = "Invalid Details ! Try Again";
                        return(View("Signin"));
                    }
                }
                return(View("Signin"));
            }
            catch (Exception ex)
            {
                WebLog.Log(ex.Message.ToString());
                return(null);
            }
        }
Exemplo n.º 7
0
        public string UpdateProfile(User users)
        {
            try
            {
                var original = (from a in uvDb.Users
                                where a.ID == users.ID select a).FirstOrDefault();

                if (original != null)
                {
                    original.Firstname = users.Firstname;
                    original.Lastname  = users.Lastname;
                    //original.EmailAddress = users.EmailAddress;
                    original.PhoneNumber = users.PhoneNumber;
                    // original.PaswordVal = users.PaswordVal;


                    uvDb.SaveChanges();
                }
                return(original.ID.ToString());
            }
            catch (Exception ex)
            {
                WebLog.Log(ex.Message.ToString());
                return(ex.StackTrace.ToString());
            }
        }
Exemplo n.º 8
0
        public string GetCustomerDetails(CustomerObj cusObj)
        {
            try
            {
                dynamic obj = new JObject();

                string agentID    = ConfigurationManager.AppSettings["agentID"];
                string agentKey   = ConfigurationManager.AppSettings["agentKey"];
                var    MerchantFk = cusObj.MerchantFk;
                var    MeterType  = cusObj.MeterType;
                obj.agentkey    = agentKey;
                obj.agentID     = agentID;
                obj.customerId  = cusObj.CustomerID;
                obj.MerchantFK  = MerchantFk;
                obj.accountType = MeterType;


                var plainText = (agentID + agentKey + obj.customerId);
                var builder   = new StringBuilder();
                builder.Append(agentID).Append(agentKey).Append(obj.customerId);

                var hash = new CryptographyManager().ComputeHash(builder.ToString(), HashName.SHA256);
                obj.hashValue = hash;
                var json    = obj.ToString();
                var PostUrl = ConfigurationManager.AppSettings["ValidateCustomerID"];
                var data    = Utility.DoPosts(json, $"{PostUrl}");
                return(data);
            }
            catch (Exception ex)
            {
                WebLog.Log(ex.Message.ToString());
                return(null);
            }
        }
Exemplo n.º 9
0
        public static string PostBuySubcriptionJson(CustomerObj cusObj)
        {
            try
            {
                string agentID  = ConfigurationManager.AppSettings["agentID"];
                string agentKey = ConfigurationManager.AppSettings["agentKey"];

                dynamic obj       = new JObject();
                string  valueTime = DateTime.Now.ToString("Hmmss");
                obj.refNumber    = "Agent" + DateTime.Now.ToString("yyyyMMdd") + valueTime;
                obj.customername = cusObj.CustomerName;
                obj.amount       = cusObj.Amount;
                obj.agentkey     = agentKey;
                obj.agentID      = agentID;
                obj.customerId   = cusObj.CustomerID;
                obj.MerchantFK   = cusObj.MerchantFk;
                obj.accountType  = cusObj.MeterType;

                var plainText = (agentID + agentKey + obj.customerId);
                var builder   = new StringBuilder();
                builder.Append(agentID).Append(agentKey).Append(obj.customerId);
                var hash = new CryptographyManager().ComputeHash(builder.ToString(), HashName.SHA256);
                obj.hashValue = hash;
                var json    = obj.ToString();
                var PostUrl = ConfigurationManager.AppSettings["Buypower"];
                var data    = Utility.DoPosts(json, $"{PostUrl}");
                return(data);
            }
            catch (Exception ex)
            {
                WebLog.Log(ex.Message.ToString());
                //Label1.Text = ex.Message.ToString();
                return(null);
            }
        }
Exemplo n.º 10
0
        public static bool SendMail(string msgSubject, string msgBody, string addressTo, string addressCc, string addressBcc)
        {
            try
            {
                ServicePointManager.ServerCertificateValidationCallback +=
                    (sender, certificate, chain, sslPolicyErrors) => true;

                var smtpServer = ConfigurationManager.AppSettings["MailServerAddress"];
                WebLog.Log("smtpServer:" + smtpServer);
                var smtpServerPort = ConfigurationManager.AppSettings["SMTPServerPort"];
                WebLog.Log("SMTPServerPort:" + smtpServerPort);
                var mailFrom = ConfigurationManager.AppSettings["MailFrom"];
                WebLog.Log("mailFrom:" + mailFrom);
                var mailFromPassword = ConfigurationManager.AppSettings["MailFromPassword"];
                WebLog.Log("mailFromPassword:"******"email:" + email.From + email.Subject + email.IsBodyHtml + email.Body);
                // email.Attachments.Add(new Attachment(addressBcc));
                //mm.Attachments.Add(New Attachment(New MemoryStream(bytes), "iTextSharpPDF.pdf"));
                email.To.Add(addressTo);
                WebLog.Log("email:" + email);
                if (addressCc != null && addressCc != "")
                {
                    email.CC.Add(addressCc);
                }
                if (addressBcc != null && addressBcc != "")
                {
                    email.Bcc.Add(addressBcc);
                }

                var mailClient = new SmtpClient();

                var basicAuthenticationInfo = new NetworkCredential(mailFrom, mailFromPassword);
                WebLog.Log("basicAuthenticationInfo:" + basicAuthenticationInfo);
                mailClient.Host = smtpServer;
                WebLog.Log("mailClient.Host:" + mailClient.Host);
                mailClient.Credentials = basicAuthenticationInfo;
                WebLog.Log("mailClient.Credentials:" + mailClient.Credentials);
                mailClient.Port = int.Parse(smtpServerPort);
                WebLog.Log("mailClient.Port:" + mailClient.Port);
                mailClient.EnableSsl = bool.Parse(ConfigurationManager.AppSettings["EnableSsl"]);
                WebLog.Log("mailClient.EnableSsl:" + mailClient.EnableSsl);
                mailClient.Send(email);


                return(true);
            }
            catch (Exception ex)
            {
                WebLog.Log(ex);
            }
            return(false);
        }
Exemplo n.º 11
0
        public ActionResult GetAllFlavour()
        {
            try {
                var obj = new Wrapper()
                {
                    flavour = new List <string>()
                    {
                        "Vanilla", "red velvet", "rainbow", "carrot", "rainbow"
                    },
                    topping = new List <string>()
                    {
                        "sprinkles", "sugar carrots", "bacon", "Happy Birthday"
                    },
                    frosting = new List <string>()
                    {
                        "cream cheese", "chocolate", "vanilla", "maple"
                    }
                };

                return(Json(obj, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                WebLog.Log(ex.Message.ToString());
                return(null);
            }
        }
Exemplo n.º 12
0
        public static string GetSessionID()
        {
            try
            {
                string agentid      = ConfigurationManager.AppSettings["agentID"];
                string agentKey     = ConfigurationManager.AppSettings["agentKey"];
                string EmailAddress = ConfigurationManager.AppSettings["agentEmail"];

                var signaturetext = new StringBuilder();
                signaturetext.Append(agentid).Append(agentKey).Append(EmailAddress);

                var signature = new CryptographyManager().ComputeHash(signaturetext.ToString(), HashName.SHA512);

                dynamic obj = new JObject();
                obj.agentkey  = agentKey;
                obj.signature = signature;

                var json    = obj.ToString();
                var PostUrl = ConfigurationManager.AppSettings["GetSessionID"];

                PostUrl = System.Configuration.ConfigurationManager.AppSettings["GetSessionID"];

                PostUrl = PostUrl.Replace("{$agentid}", agentid.ToString()).Trim().Replace("{$agentkey}", agentKey.ToString()).Trim().Replace("{$signature}", signature.ToString()).Trim();

                var     data      = Utility.DoGet1($"{PostUrl}", agentid, agentKey, signature);
                dynamic session   = JObject.Parse(data);
                var     sessionID = session?.sessionid;
                return(sessionID);
            }
            catch (Exception ex)
            {
                WebLog.Log(ex.Message.ToString());
                return(null);
            }
        }
Exemplo n.º 13
0
        public ActionResult EditCustomerService(LoanViewModel lvm)
        {
            try
            {
                GLobalClient gc = new GLobalClient();
                ViewBag.listMerchant = gc.findAllMerchant();
                //lvm.CustomerServices = gc.FindCustomerService(lvm);
                CustomerService _cs = new CustomerService();
                _cs.ID                 = lvm.CustomerServices.ID;
                _cs.CustomerID         = lvm.CustomerServices.CustomerID;
                _cs.CustomerIDLabel    = lvm.CustomerServices.CustomerIDLabel;
                _cs.PackageTypeIDLabel = lvm.CustomerServices.PackageTypeIDLabel;
                _cs.PackageType        = lvm.CustomerServices.PackageType;
                _cs.OtherLabel         = lvm.CustomerServices.OtherLabel;
                _cs.OtherLabelID       = lvm.CustomerServices.OtherLabelID;


                var UpdateCustomerService = DataCreators.UpdateCustomerService(_cs);
                // return View("AllCustomerService");
                return(RedirectToAction("AllCustomerService", "Customer", new { area = "" }));
            }
            catch (Exception ex)
            {
                WebLog.Log(ex.Message.ToString());
                return(null);
            }
        }
Exemplo n.º 14
0
 public ActionResult CreateService(LoanViewModel lvm, FormCollection form)
 {
     try
     {
         var    LoggedInuser = new LogginHelper();
         string user         = LoggedInuser.LoggedInUser();
         if (user != "")
         {
             var          userid = DataReaders.GetUserIdByEmail(user);
             GLobalClient gc     = new GLobalClient();
             ViewBag.listMerchant             = gc.findAllMerchant();
             lvm.CustomerServices.Customer_FK = userid;
             lvm.CustomerServices.DateCreated = DateTime.Now;
             lvm.CustomerServices.ValueDate   = DateTime.Now.ToString();
             lvm.CustomerServices.Merchant_Fk = Convert.ToInt16(form["ID"]);
             lvm.CustomerServices.ValueTime   = "1";
             lvm.CustomerServices.isVissible  = 1;
             lvm.CustomerServices.OtherLabel  = "other";
             gc.CreateCustomerService(lvm.CustomerServices);
             TempData["Message"] = "New Service Added";
             return(View("CreateService"));
         }
         else
         {
             return(View("CreateService"));
         }
     }
     catch (Exception ex)
     {
         WebLog.Log(ex.Message.ToString());
         return(null);
     }
 }
Exemplo n.º 15
0
        public ActionResult UserRole(LoanViewModel lvm, FormCollection form)
        {
            try
            {
                int roleid = Convert.ToInt16(form["roleid"]);
                int userid = Convert.ToInt16(form["id"]);
                userroles.RoleId = roleid;
                userroles.UserId = userid;
                userroles.RoleId = DataReaders.selectRolesByName(userroles);
                if (userroles.RoleId != 0)
                {
                    TempData["message"] = "User Already Have This Role";
                    return(View(""));
                }
                else

                {
                    userroles.RoleId     = roleid;
                    userroles.UserId     = userid;
                    userroles.IsVissible = 1;
                    userroles.dates      = DateTime.Now;

                    DataCreators.InsertUserRoles(userroles);
                    TempData["message"]     = "User n Roles Created Succesfully";
                    lvm.getAllUserAndRoless = getAllUsersAndRoles();
                }
                return(View(""));
            }
            catch (Exception ex)
            {
                WebLog.Log(ex.Message.ToString());
                return(null);
            }
        }
Exemplo n.º 16
0
        public ActionResult BuyAirtime()
        {
            try
            {
                string user = LoggedInuser.LoggedInUser();
                if (user == null || user == "")
                {
                    user = LoggedInuser.getDefaultUser();
                }
                if (user != null)
                {
                    Classes.Internetserviceprovider.InternetServiceObj _ptv = new Classes.Internetserviceprovider.InternetServiceObj();
                    // if (TempData["message"] != null)
                    if (TempData["PaytvObj"] != null)
                    {
                        _ptv = (Internetserviceprovider.InternetServiceObj)TempData["PaytvObj"];
                        var a = TempData["message"];
                        var b = TempData["BillerName"];
                        //TempData["Msg"] = "No Internet Connection";

                        return(View(_ptv));
                    }
                }
                return(View());
            }
            catch (Exception ex)
            {
                WebLog.Log(ex.Message.ToString());
                return(null);
            }
        }
Exemplo n.º 17
0
        public List <getAllUserAndRoles> getAllUsersAndRoles()
        {
            //---- Create object of our entities class.
            try
            {
                LoanViewModel lvm  = new LoanViewModel();
                var           user = "******";
                users.Email = user;
                users.id    = DataReaders.selectUserID(users);

                var results = (from a in db.UserRoles
                               join c in db.Roles on a.RoleId equals c.RoleId
                               join b in db.Users on a.UserId equals b.id
                               //where a.UserId == users.id
                               select new Models.getAllUserAndRoles {
                    userid = b.id, roleid = c.RoleId, rolename = c.RoleName, email = b.Email, id = a.id
                }).ToList();
                var model = new LoanViewModel
                {
                    getAllUserAndRoless = results.ToList(),
                };
                lvm.getAllUserAndRoless = results;
                return(lvm.getAllUserAndRoless.ToList());
            }
            catch (Exception ex)
            {
                WebLog.Log(ex.Message.ToString());
                return(null);
            }
        }
Exemplo n.º 18
0
        public int getmerchantID(string services)
        {
            try
            {
                int MerchantID = 0;
                if (services == "MTNVTU")
                {
                    return(MerchantID = 301);
                }
                if (services == "GLOVTU")
                {
                    MerchantID = 302;
                }
                if (services == "ETISALATVTU")
                {
                    MerchantID = 303;
                }
                if (services == "AIRTELVTU")
                {
                    MerchantID = 304;
                }

                return(MerchantID);
            }
            catch (Exception ex)
            {
                WebLog.Log(ex.Message.ToString());
                return(0);
            }
        }
Exemplo n.º 19
0
        public static string postNewXMLData(string destinationUrl, string requestXml)
        {
            try
            {
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(destinationUrl);
                byte[]         bytes;
                bytes = System.Text.Encoding.ASCII.GetBytes(requestXml);
                request.ContentType   = "text/xml; encoding='utf-8'";
                request.ContentLength = bytes.Length;
                request.Method        = "POST";

                Stream requestStream = request.GetRequestStream();
                requestStream.Write(bytes, 0, bytes.Length);
                requestStream.Close();
                HttpWebResponse response;
                response = (HttpWebResponse)request.GetResponse();
                if (response.StatusCode == HttpStatusCode.OK)
                {
                    Stream responseStream = response.GetResponseStream();
                    string responseStr    = new StreamReader(responseStream).ReadToEnd();
                    return(responseStr);
                }
                return(null);
            }
            catch (Exception ex)
            {
                WebLog.Log(ex.Message);
                return(null);
            }
        }
Exemplo n.º 20
0
 public ActionResult WalletReceipt()
 {
     try
     {
         Classes.Paytv.Receipt Receipt = new Classes.Paytv.Receipt();
         string RefNum = Request.QueryString["RefNum"];
         if (RefNum == null)
         {
             return(RedirectToAction("BuyAirtime", "Airtime"));
         }
         if (RefNum != null)
         {
             TempData["ErrMsg"] = "Transaction successful ! Thank You";
             var CusTransac = _dr.GetRecord(RefNum);
             Receipt.CustomerID     = CusTransac.CustomerID;
             Receipt.Amount         = Convert.ToDouble(CusTransac.Amount);
             TempData["Amount"]     = Receipt.Amount;
             Receipt.customerName   = CusTransac.CustomerName;
             Receipt.Phone          = CusTransac.CustomerPhone;
             Receipt.transactionlNo = CusTransac.ReferenceNumber;
             Receipt.Service        = CusTransac.ServiceDetails;
             Receipt.ErrorMsg       = TempData["ErrMsg"].ToString();
         }
         return(View(Receipt));
     }
     catch (Exception ex)
     {
         WebLog.Log(ex.Message.ToString());
         return(null);
     }
 }
Exemplo n.º 21
0
        public int UpdateNYSCLoanReferalLeder(List <LoansLedger> Ln, double mode, double div)
        {
            try
            {
                var bn = 0;
                int nb = Ln.Count;
                for (var c = 0; c < nb; c++)
                {
                    int cv       = Ln[c].ID;
                    var original = (from a in Ln where a.ID == cv select a).SingleOrDefault();

                    if (c + 1 == div && mode != 0)
                    {
                        original.Credit = mode;
                    }

                    else
                    {
                        original.Credit = original.Debit;
                    }
                    uvDb.SaveChanges();

                    bn = original.ID;
                }



                return(bn);
            }
            catch (Exception ex)
            {
                WebLog.Log(ex.Message.ToString());
                return(0);
            }
        }
Exemplo n.º 22
0
        public string getDiscoName(string DiscoId)
        {
            try
            {
                string Disconame = "";
                switch (DiscoId)
                {
                case "1":
                    Disconame = "StarTimes";
                    break;

                case "2":
                    Disconame = "DSTV";
                    break;

                case "3":
                    Disconame = "GOTV";
                    break;

                case "4":
                    Disconame = "KWESE";
                    break;

                default:
                    break;
                }
                TempData["Disconame"] = Disconame;
                return(TempData["Disconame"].ToString());
            }
            catch (Exception ex)
            {
                WebLog.Log(ex.Message.ToString());
                return(null);
            }
        }
Exemplo n.º 23
0
        public string UpdateEmp(string id)
        {
            try
            {
                var ids    = Convert.ToInt16(id);
                var i      = 0;
                var RefNum = (from a in uvDb.LoanApplications where a.ID == ids select a.LoanRefNumber).FirstOrDefault();
                if (RefNum != null)
                {
                    var original = (from a in uvDb.LoanLedgers where a.RefNumber == RefNum && a.PaymentFlag_FK == 0 select a).ToList();
                    if (original.Count > 0)
                    {
                        for (i = 1; i == original.Count; i++)
                        {
                            original[i].Institution_FK = 7;

                            uvDb.SaveChanges();
                        }
                    }
                }
                return(RefNum);
            }
            catch (Exception ex)
            {
                WebLog.Log(ex.Message.ToString());
                return(null);
            }
        }
Exemplo n.º 24
0
        public int UpdateLedger(string IDS, NYSCLoanLedger LoanLedger)
        {
            try
            {
                int ID = Convert.ToInt32(IDS);
                // LoanLedger.ID = ID;
                // var resp = uvDb.NYSCLoanLedgers.Find(LoanLedger.ID);

                var resp = uvDb.NYSCLoanLedgers.Find(ID);

                if (resp != null)
                {
                    // resp.Credit = resp.Debit;
                    resp.Debit       = LoanLedger.Credit;
                    resp.PaymentFlag = LoanLedger.PaymentFlag;
                    uvDb.SaveChanges();
                }
                return(resp.ID);
            }
            catch (Exception ex)
            {
                WebLog.Log(ex.Message.ToString());
                return(0);
            }
        }
Exemplo n.º 25
0
        public int UpdateLoanApplication(LoanApplication LoanApp)
        {
            try
            {
                var original = uvDb.LoanApplications.Find(LoanApp.LoanRefNumber);


                if (original != null)
                {
                    original.ApplicationStatus_FK = LoanApp.ApplicationStatus_FK;
                    // original.LoanComment = LoanApp.LoanComment;
                    original.DateModified = LoanApp.DateModified;

                    uvDb.SaveChanges();
                }
                return(original.ID);
            }


            catch (Exception ex)
            {
                WebLog.Log(ex.Message.ToString());
                return(0);
            }
        }
Exemplo n.º 26
0
        public int CreateUserRole(User users, int flag)
        {
            try
            {
                UserRole UserRoles = new UserRole();
                UserRoles.User_FK = users.ID;
                if (flag == 1)
                {
                    UserRoles.Role_FK = Convert.ToInt16(ConfigurationManager.AppSettings["NYSCAgentRole"]);
                }
                if (flag == 2)
                {
                    UserRoles.Role_FK = Convert.ToInt16(ConfigurationManager.AppSettings["NYSCApplicantRole"]);
                }

                UserRoles.IsVisible = 1;
                _DM.InsertUserRoles(UserRoles);
                return(users.ID);
            }
            catch (Exception ex)
            {
                WebLog.Log(ex.Message.ToString());
                return(0);
            }
        }
Exemplo n.º 27
0
        public List <LoanLedger> UpdateLoanLedger(string RefNum, double LoanAmt)
        {
            try
            {
                // var resp = (from a in uvDb.LoanLedgers where a.RefNumber == RefNum select a).ToList();
                var resp        = SelectLoanLedger(RefNum, LoanAmt);
                var Firstrecord = resp.First();
                if (Firstrecord != null)
                {
                    Firstrecord.Credit         = LoanAmt;
                    Firstrecord.PaymentFlag_FK = 1;
                    uvDb.SaveChanges();
                }

                var query = "UPDATE LoanLedger SET PaymentFlag_FK = 2 WHERE RefNumber = '" + RefNum + "' AND Credit = 0";
                using (var context = new UvlotEntities())
                {
                    context.Database.ExecuteSqlCommand(query);
                }


                if (resp == null)
                {
                    return(null);
                }
                return(resp.ToList());
            }
            catch (Exception ex)
            {
                WebLog.Log(ex.Message.ToString());
                return(null);
            }
        }
Exemplo n.º 28
0
        public void SendEmail(User userObj, string password)
        {
            try
            {
                string referralLink = ConfigurationManager.AppSettings["ReferralLink"] + userObj.MyReferralCode;
                var    bodyTxt      = System.IO.File.ReadAllText(HostingEnvironment.MapPath("~/EmailNotifications/ReferralWelcomeEmail.html"));

                string myname = userObj.Firstname;
                bodyTxt = bodyTxt.Replace("$firstName", myname);
                bodyTxt = bodyTxt.Replace("$UserName", userObj.EmailAddress);
                bodyTxt = bodyTxt.Replace("$passwordVal", password);
                bodyTxt = bodyTxt.Replace("$refferalCode", userObj.MyReferralCode);
                bodyTxt = bodyTxt.Replace("$referralLink", referralLink);
                //bodyTxt = bodyTxt.Replace("$RepaymentAmt", MyUtility.ConvertToCurrency(apObj.RepaymentAmount));
                //WebLog.Log(bodyTxt);
                // WebLog.Log("apObj.EmailAddress: " + apObj.EmailAddress);
                var msgHeader = $"Welcome to CashNowNow Referral Network";
                WebLog.Log("msgHeader " + msgHeader);
                var sendMail = NotificationService.SendMailOut(msgHeader, bodyTxt, userObj.EmailAddress, null, null);
            }
            catch (Exception ex)
            {
                WebLog.Log(ex.Message.ToString());
            }
        }
Exemplo n.º 29
0
        public int UpdateLoanTenureAndInterestRate(string RefNum, double LoanAmount, int LoanTenure, int INST)
        {
            try
            {
                var InterestRate = (from a in uvDb.LoanInterestRates where a.Institution_FK == INST && a.LoanTenure == LoanTenure select a.InterestRate).FirstOrDefault();
                if (InterestRate == 0)
                {
                    return((int)InterestRate);
                }
                if (InterestRate != 0)
                {
                    var original = (from a in uvDb.LoanApplications
                                    where a.LoanRefNumber == RefNum
                                    select a).FirstOrDefault();

                    if (original != null)
                    {
                        original.ApprovedTenure     = LoanTenure;
                        original.ApprovedLoanAmount = LoanAmount;
                        original.ApprovedInterest   = InterestRate;

                        uvDb.SaveChanges();
                    }
                    return(original.ID);
                }
                return((int)InterestRate);
            }
            catch (Exception ex)
            {
                WebLog.Log(ex.Message.ToString());
                return(0);
            }
        }
Exemplo n.º 30
0
        public string removestring(string[] channelist)
        {
            try
            {
                string        arrc   = "";
                List <string> vc     = new List <string>();
                char[]        mychar = { '?', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' };
                if (channelist.Length > 0)
                {
                    for (var i = 0; i < channelist.Length; i++)
                    {
                        arrc = Convert.ToString(channelist[i]);
                        arrc = arrc.TrimEnd(mychar);

                        vc.Add(arrc);
                    }
                }
                string ListChannel = string.Join(", ", vc.ToArray());
                return(ListChannel);
            }
            catch (Exception ex)
            {
                WebLog.Log(ex.Message.ToString());
                return(null);
            }
        }