Ejemplo n.º 1
0
        public static RolesModel GetRole(string parameter)
        {
            RoleUtilities roleUtilities = new RoleUtilities();
            string        id            = Classes.encryption.Decrypt(parameter);
            RolesModel    roleModel     = roleUtilities.GetRole(id);

            return(roleModel);
        }
Ejemplo n.º 2
0
        public static string UpdateRoles(string parameter, string roleName, string groupOption, string roleType, string roleLink)
        {
            RoleUtilities roleUtilities    = new RoleUtilities();
            string        roleInformations = string.Empty;

            if (!string.IsNullOrEmpty(roleName) || !string.IsNullOrEmpty(groupOption) || !string.IsNullOrEmpty(roleType))
            {
                string id     = Classes.encryption.Decrypt(parameter);
                string result = roleUtilities.UpdateRole(id, roleName, groupOption, roleType, roleLink);
                if (result == "Success")
                {
                    roleInformations = ShowRolesTable(roleUtilities.GetRoles());
                }
            }
            return(roleInformations);
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string            username      = Classes.Cookie.GetCookie("ggZurkVKwLIM+SQ2NMcfsra8/nnrhm9u5sl4TMYTE2Y", false);
            var               roles         = Utilities.AccountUtilities.getUserRoles(username);
            RoleUtilities     roleUtilities = new RoleUtilities();
            List <RolesModel> rolesModels   = new List <RolesModel>();
            List <string>     roleLists     = roles.Split(',').ToList();

            if (roleLists.Find(f => f.ToLower() == "15") == null)
            {
                Response.Redirect("/dashboard.aspx");
            }


            if (Request.HttpMethod == "POST")
            {
                #region Get Post Variable
                string amount   = Request.Form["amount"];
                string currency = Request.Form["currency"];
                #endregion

                if (!string.IsNullOrEmpty(amount) && !string.IsNullOrEmpty(currency))
                {
                    try
                    {
                        #region Proceed with Transfer with Desired Currency and Amount
                        var res = Classes.btcWallet.Utilitties.createSelfTransaction(double.Parse(amount), currency, "http://54.200.165.82:4000/");
                        #endregion

                        #region Show the Hash on the End User
                        SendTransactionResponse = res.txResponse.hash;
                        #endregion

                        toastrUtilities.SessionPush("toast", new KeyValuePair <string, string>("success", $"Process Successfully."));
                    }
                    catch (Exception ex)
                    {
                        toastrUtilities.SessionPush("toast", new KeyValuePair <string, string>("error", $"{ex.Message.ToString()}"));
                    }
                }
            }
        }
Ejemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            RoleUtilities   roleUtilities   = new RoleUtilities();
            OptionUtilities optionUtilities = new OptionUtilities();

            if (Request.HttpMethod == "POST")
            {
                string roleName    = rolename.Value;
                string groupOption = groupoptions.Value;
                string roleType    = Request.Form["type"];
                string roleLink    = rolelink.Value;
                if (!string.IsNullOrEmpty(roleName) || !string.IsNullOrEmpty(groupOption) || !string.IsNullOrEmpty(roleType))
                {
                    string result = roleUtilities.InsertRole(roleName, groupOption, roleType, roleLink);
                    if (result == "Success")
                    {
                        ClearFields();
                        toastrUtilities.SessionPush("toast", new KeyValuePair <string, string>("success", $"{roleName} Successfully Added."));
                    }
                    else
                    {
                        toastrUtilities.SessionPush("toast", new KeyValuePair <string, string>("error", $"An Error Occured Please Contact System Administrator."));
                    }
                }
                else
                {
                    toastrUtilities.SessionPush("toast", new KeyValuePair <string, string>("error", $"Please fill up all Fields."));
                }
            }
            ListItem[] gOptions = optionUtilities.GetGroupOptions();
            groupoptions.Items.Clear();
            groupoptions.Items.AddRange(gOptions);
            sgroupoptions.Items.Clear();
            sgroupoptions.Items.AddRange(gOptions);
            editgroupoptions.Items.Clear();
            editgroupoptions.Items.AddRange(gOptions);
            ShowRoles(roleUtilities.GetRoles());
        }
Ejemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string            username      = Classes.Cookie.GetCookie("ggZurkVKwLIM+SQ2NMcfsra8/nnrhm9u5sl4TMYTE2Y", false);
            var               roles         = Utilities.AccountUtilities.getUserRoles(username);
            RoleUtilities     roleUtilities = new RoleUtilities();
            List <RolesModel> rolesModels   = new List <RolesModel>();
            List <string>     roleLists     = roles.Split(',').ToList();

            if (roleLists.Find(f => f.ToLower() == "12") == null)
            {
                Response.Redirect("/dashboard.aspx");
            }



            if (Request.HttpMethod == "POST")
            {
                #region Assign Post Variables
                string ClientId          = Request.Form["clientId"];
                string PaymentReferrence = Request.Form["pspRef"];
                string PaymentStatus     = Request.Form["pspStatus"];
                string CreditedStatus    = Request.Form["creditedStatus"];
                string PspId             = Request.Form["ctl00$ctl00$MainContent$LMainContent$pspId"];
                string Amount            = Request.Form["amount"];
                string Currency          = Request.Form["currency"];
                string Note             = Request.Form["note"];
                string CardLast4        = Request.Form["cardLast4"];
                string CardExpiry       = Request.Form["cardExpiry"];
                string CardHolderName   = Request.Form["cardHolder"];
                string TradingAccountId = Request.Form["PIN"];
                #endregion

                string PIN = !string.IsNullOrEmpty(TradingAccountId) ? TradingAccountId : string.Empty;

                #region Get Client Info
                ClientModel Info = new ClientModel();
                using (NpgsqlConnection conn = Classes.DB.InstBTCDB("instbtc"))
                {
                    Info = Clients.FindById(conn, int.Parse(ClientId));
                }
                #endregion

                if (Info != null)
                {
                    #region Creating the Transaction Object
                    Classes.Instbtc.Models.TransactionModel Transaction = new Classes.Instbtc.Models.TransactionModel
                    {
                        Psp_ID            = decimal.Parse(PspId),
                        Deposit_Currency  = Currency,
                        Deposit_Amount    = Convert.ToDecimal(Amount),
                        Exchange_Currency = "BTC",
                        Exchange_Amount   = Convert.ToDecimal(Classes.Instbtc.Utilities.Conversion.GetBTCAmountRestSharp(Amount, Currency)),
                        Created_Date      = DateTime.UtcNow,
                        Client_ID         = Convert.ToDecimal(ClientId),
                        Psp_Status        = PaymentStatus,
                        Credited_Status   = CreditedStatus,
                        PaymentReference  = PaymentReferrence,
                        Notes             = Note,
                        type                 = Classes.Instbtc.Models.TransactionType.DEPOSIT,
                        CardLast4            = !string.IsNullOrEmpty(CardLast4) ? CardLast4 : "",
                        CardHolderName       = !string.IsNullOrEmpty(CardHolderName) ? CardHolderName : "",
                        Transaction_Currency = "BTC"
                    };
                    #endregion

                    #region Create The Transaction
                    var    TransactionCheck = Utilities.Transactions.CheckTransactionIfExist(Transaction.PaymentReference);
                    object result           = new object();
                    if (string.IsNullOrEmpty(TransactionCheck))
                    {
                        result = Classes.Instbtc.Create.Transactions.CreateTransaction(Transaction);
                    }
                    else
                    {
                        toastrUtilities.SessionPush("toast", new KeyValuePair <string, string>("error", $"Cant Create Transaction, Existing Detected!"));
                        Response.Redirect("/transaction-lists.aspx");
                    }

                    #endregion

                    if (result.ToString() != "Internal Error" || result != null)
                    {
                        decimal OriginalDepositTransactionAmount = decimal.Parse(Transaction.Deposit_Amount.ToString());
                        decimal OriginalBtcExchangeAmount        = decimal.Parse(Transaction.Exchange_Amount.ToString());

                        EmailTemplateUtilities.SendNotificationDeposit(Info.Id.ToString(), OriginalDepositTransactionAmount.ToString(), OriginalBtcExchangeAmount.ToString(), Transaction);

                        //if (Info.Referral.ToLower() == "lblv" || Info.Referral.ToLower() == "tradershome" || Info.Referral.ToLower() == "profitix" || Info.Referral.ToLower() == "vlom" || Info.Referral.ToLower() == "uptos" || Info.Referral.ToLower() == "fundiza" || Info.Referral.ToLower() == "kiplar" || Info.Referral.ToLower() == "investigram" || Info.Referral.ToLower() == "commercewealth")
                        //{
                        //    try
                        //    {
                        //        var pspList = PspUtilities.GetPspById(Transaction.Psp_ID.ToString());
                        //        var pspName = pspList.Where(w => w.Id == int.Parse(Transaction.Psp_ID.ToString()))?.FirstOrDefault()?.Name;
                        //        pspName = pspName.Replace("USD ", "").Replace("EUR ", "").Replace("AUD ", "");
                        //        var res = BrandsIntegration.PushToBrand(Info, Transaction, PaymentStatus, result, $"[{pspName}] " + Note, PIN, pspName);
                        //        toastrUtilities.SessionPush("toast", new KeyValuePair<string, string>("success", $"{res}"));
                        //    }
                        //    catch (Exception ex)
                        //    {
                        //        toastrUtilities.SessionPush("toast", new KeyValuePair<string, string>("error", $"{ex.Message.ToString()}"));
                        //    }
                        //}
                        //else
                        //{
                        //    decimal OriginalDepositTransactionAmount = decimal.Parse(Transaction.Deposit_Amount.ToString());
                        //    decimal OriginalBtcExchangeAmount = decimal.Parse(Transaction.Exchange_Amount.ToString());

                        //    EmailTemplateUtilities.SendNotificationDeposit(Info.Id.ToString(), OriginalDepositTransactionAmount.ToString(), OriginalBtcExchangeAmount.ToString(), Transaction);
                        //}
                    }
                    else
                    {
                        toastrUtilities.SessionPush("toast", new KeyValuePair <string, string>("error", $"An Error Occured Cant Create Transaction"));
                    }
                }
                else
                {
                    //Redirect Invalid Client Id;
                    toastrUtilities.SessionPush("toast", new KeyValuePair <string, string>("error", $"No Client With this Id: {ClientId}"));
                    Response.Redirect("/transaction-lists.aspx");
                }
            }

            OptionUtilities optionUtilities = new OptionUtilities();
            pspId.Items.AddRange(optionUtilities.GetPSPOptions());
        }
Ejemplo n.º 6
0
        public static string SearchRole(string roleName, string groupOption, string roleType, string roleLink)
        {
            RoleUtilities roleUtilities = new RoleUtilities();

            return(ShowRolesTable(roleUtilities.SearchRoles("", roleName, groupOption, roleType, roleLink)));
        }
Ejemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string            username      = Classes.Cookie.GetCookie("ggZurkVKwLIM+SQ2NMcfsra8/nnrhm9u5sl4TMYTE2Y", false);
            var               roles         = Utilities.AccountUtilities.getUserRoles(username);
            RoleUtilities     roleUtilities = new RoleUtilities();
            List <RolesModel> rolesModels   = new List <RolesModel>();
            List <string>     roleLists     = roles.Split(',').ToList();

            if (roleLists.Find(f => f.ToLower() == "16") == null)
            {
                Response.Redirect("/dashboard.aspx");
            }

            if (Request.HttpMethod == "POST")
            {
                if (Request.Files["documentUpload"].ContentLength > 0)
                {
                    if (Request.Files["documentUpload"].ContentLength > 10485760)
                    {
                        toastrUtilities.SessionPush("toast", new KeyValuePair <string, string>("error", $"Please Upload a File Below 5MB"));
                    }
                    else
                    {
                        var file = Request.Files[0];

                        using (NpgsqlConnection conn = Classes.DB.InstBTCDB("instbtc"))
                        {
                            #region Validate if Client Id is Valid
                            var           query = @"SELECT id FROM clients WHERE id=@id";
                            NpgsqlCommand cmd   = new NpgsqlCommand(query, conn);
                            cmd.Parameters.AddWithValue("@id", int.Parse(Request.Form["clientId"]));
                            var dt = Classes.DB.Select(conn, query, cmd);
                            if (dt.Rows.Count < 0 || dt == null)
                            {
                                toastrUtilities.SessionPush("toast", new KeyValuePair <string, string>("error", $"Client is not existing, please check the correctness of client id."));
                                return;
                            }
                            #endregion

                            #region Check if file can convert to base64 docs
                            var base64doc = string.Empty;
                            try
                            {
                                base64doc = GeneralUtilities.ConvertToBase64(Request.Files["documentUpload"]);
                            }
                            catch
                            {
                                base64doc = string.Empty;
                            }
                            #endregion

                            #region Upload the file to Aws Bucket
                            string awsBaseUrl  = $"https://instbtcdocs.s3.eu-central-1.amazonaws.com/";
                            var    DocFileName = Classes.BrandsMaster.Utilities.AmazonS3Utility.S3UploadFile("instbtcdocs", file, "AKIAXCLOKQTQ4SHCAS64", "Sdx7hnFx2U1D7WUv+mDSoZjvaj3+/MDD8K98fJOe");
                            #endregion

                            #region Build the Document Model
                            DocumentModel document = new DocumentModel
                            {
                                ClientId    = int.Parse(Request.Form["clientId"]),
                                Type        = Request.Form["documentType"],
                                Base64Doc   = base64doc,
                                Status      = "Initial",
                                CreatedDate = DateTime.UtcNow,
                                SubType     = GeneralUtilities.FixInvalidChars(Request.Form["documentSubtype"]),
                                aws_file    = $"{awsBaseUrl}{DocFileName}"
                            };
                            #endregion

                            var res = InsertDocument(conn, document);

                            if (res == "Success")
                            {
                                toastrUtilities.SessionPush("toast", new KeyValuePair <string, string>("success", $"Document Upload Successfully."));
                            }
                            else
                            {
                                toastrUtilities.SessionPush("toast", new KeyValuePair <string, string>("error", $"Problem with uploading document"));
                                return;
                            }
                        }
                    }
                }
            }
        }