/// <summary>
        /// Creates a new actor.
        /// </summary>
        /// <param name="name">Actors name</param>
        /// <param name="mbox">Actors e-mail (inverse functional property)</param>
        /// <param name="mbox_sha1sum">Actors e-mail sha1sum (inverse functional property)</param>
        /// <param name="openid">Actors openid (inverse functional property)</param>
        /// <param name="account">Actors agent account (inverse functional property)</param>
        public Actor(string name, string mbox, string mbox_sha1sum, string openid, AgentAccount account)
        {
            this.name = new string[] { name };
            // Properties are used to force validation and normalization
            if (mbox != null)
            {
                this.Mbox = new string[] { mbox };
            }
            if (mbox_sha1sum != null)
            {
                this.Mbox_sha1sum = new string[] { mbox_sha1sum };
            }
            if (openid != null)
            {
                this.Openid = new string[] { openid };
            }
            if (account != null)
            {
                this.Account = new AgentAccount[] { account };
            }
            // TODO - Strongly reconsider deep validation on construction
            var failures = new List <ValidationFailure>(this.Validate(earlyReturnOnFailure: true));

            if (failures.Count > 0)
            {
                throw new ArgumentException(failures[0].Error);
            }
        }
Esempio n. 2
0
        public ActionResult NewItem1(AgentAccount model, string button)
        {
            try
            {
                long id;
                var  message = "";
                TempData["message"] = null;
                if (button != null && button.Equals("update"))
                {
                    return(this.EditItem1(model));
                }
                if (button != null && button.Equals("delete"))
                {
                    return(this.DeleteItem1(model));
                }

                Connection.AgentAccounts.Add(model);
                Connection.SaveChanges();

                TempData["message"] = "Rquest was successful!";
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                TempData["error"] = ex.Message;
            }
            return(RedirectToAction("Index1", "AgentManager"));
        }
Esempio n. 3
0
        public string Insert(string name, string agentName, string pwd, string casino, string cookie, string addr, string addr2, string isEnable, string ip)
        {
            if (Session[Util.ProjectConfig.ADMINUSER] == null)
            {
                return("no");
            }
            admin.PageBase page = new admin.PageBase();
            string         i    = AccountManager.getInfo(name);

            if (i != "0")
            {
                return("-1");  //已存在该帐号名称
            }
            AgentAccount agentAcc = new AgentAccount();

            agentAcc.Name          = name;
            agentAcc.AgentName     = agentName;
            agentAcc.Password      = pwd;
            agentAcc.Casino        = casino;
            agentAcc.Cookie        = cookie;
            agentAcc.Address       = addr;
            agentAcc.Address2      = addr2;
            agentAcc.IsEnable      = isEnable;
            agentAcc.Operator      = page.CurrentManager.ManagerId;
            agentAcc.OperationTime = DateTime.Now;
            agentAcc.IP            = ip;
            return(BLL.AgentAccountManager.Insert(agentAcc) ? "yes" : "no");
        }
Esempio n. 4
0
        public Task <AgentAccountDto> Update(AgentAccountDto agentAccountDto)
        {
            AgentAccount agentAccount = ObjectMapper.Map <AgentAccount>(agentAccountDto);

            agentAccount = _agentAccountRepository.Update(agentAccount);
            return(Task.FromResult <AgentAccountDto>(agentAccountDto));
        }
Esempio n. 5
0
        protected void ProcessResponse()
        {
            var trxRef    = Request.QueryString["trxRef"];
            var trxToken  = Request.QueryString["trxToken"];
            var SecretKey = ConfigurationManager.AppSettings["SecretKey"];
            TransactionalInformation trans;

            try
            {
                dynamic obj = new JObject();
                obj.trxRef   = trxRef.Trim();
                obj.trxToken = trxToken.Trim();
                var json = obj.ToString();
                // string url = "http://www.paytrx.org/api/web/GetTransactionRecord";
                string url = "http://paytrx.net/api/web/GetTransactionRecord";

                //re-query payment gateway for the transaction.
                var reqData = "{\"TrxRef\":\"" + trxRef + "\"" + ",\"TrxToken\":\"" + trxToken + "\"}";
                //  var url = ConfigurationManager.AppSettings["FlutterWave_Requery"];
                //var url = FlutteWaveEngine.FlutterWaveRequery;
                string serverResponse = string.Empty;

                var plainText = (trxRef + trxToken + SecretKey);

                var hash   = new CryptographyManager().ComputeHash(plainText, HashName.SHA256);
                var isPaid = PaymentRequery(reqData, url, hash, out serverResponse, out trans);
                var jvalue = JObject.Parse(serverResponse);

                dynamic jvalues = JObject.Parse(serverResponse);
                if (jvalue != null && $"{jvalues?.data?.resp_code}".ToLower() == "00")
                {
                    AgentAccount AgtAccount = new AgentAccount();
                    string       user       = LoggedInuser.LoggedInUser();
                    if (user != null)
                    {
                        int userid = DataReaders.GetUserIdByEmail(user);
                        AgtAccount.AgentUser_FK    = userid;
                        AgtAccount.Credit          = jvalues?.data?.amount;
                        AgtAccount.Debit           = 0;
                        AgtAccount.ReferenceNumber = jvalues?.data?.trxref;
                        AgtAccount.TranxDate       = jvalues?.data?.created_at;
                        AgtAccount.ValueDate       = DateTime.Now.ToString("yyyy:mm:dd");
                        AgtAccount.ValueTime       = DateTime.Now.ToString("HH:mm:ss");
                        db.AgentAccounts.Add(AgtAccount);
                        db.SaveChanges();
                        TempData["paymentmsg"] = "Payment Not Succesfull";
                    }
                }
                else
                if (jvalue != null && $"{jvalues?.data?.resp_code}".ToLower() != "00")
                {
                    //var hash = ComputeHash(plainText);
                    TempData["Message"] = "Payment Not Succesfull";
                }
            }
            catch (Exception ex)
            {
                //lblStatusMsg.Text = ex.Message.ToString();
            }
        }
Esempio n. 6
0
        public async Task <AgentAccountDto> GetById(int id)
        {
            AgentAccount result = await _agentAccountRepository.GetAsync(id);

            AgentAccountDto dto = ObjectMapper.Map <AgentAccountDto>(result);

            return(dto);
        }
Esempio n. 7
0
        public Task <AgentAccountDto> Create(AgentAccountDto agentAccountDto)
        {
            agentAccountDto.CreatorUserId = AbpSession.UserId.Value;
            agentAccountDto.CreationTime  = DateTime.Now;
            AgentAccount agentAccount = ObjectMapper.Map <AgentAccount>(agentAccountDto);

            agentAccountDto.Id = _agentAccountRepository.InsertAndGetId(agentAccount);
            return(Task.FromResult <AgentAccountDto>(agentAccountDto));
        }
Esempio n. 8
0
        public ActionResult NewItem1(int id = 0)
        {
            AgentAccount model = new AgentAccount();

            if (id > 0)
            {
                model = Connection.AgentAccounts.Find(id);
            }
            return(View(model));
        }
Esempio n. 9
0
        // GET: AgentAccounts/Edit
        public ActionResult Edit()
        {
            string id = User.Identity.GetUserId();

            AgentAccount agent = db.AgentAccounts.Find(id);

            if (agent == null)
            {
                return(HttpNotFound());
            }
            return(View(agent));
        }
 /// <summary>
 /// Constructor specifies whether using first and last name or family name
 /// </summary>
 /// <param name="isFirstLastName">If this should assign first and last name</param>
 /// <param name="firstName">The persons first or given name</param>
 /// <param name="lastName">The persons last or family name</param>
 /// <param name="mbox">The persons mailbox</param>
 /// <param name="mbox_sha1sum">The persons mbox sha1sum</param>
 /// <param name="openid">The persons openid</param>
 /// <param name="account">The persons account</param>
 public Person(bool isFirstLastName, string firstName, string lastName, string mbox, string mbox_sha1sum, string openid, AgentAccount account)
     : base(mbox, mbox_sha1sum, openid, account)
 {
     if (!isFirstLastName)
     {
         this.lastName = new string[] { lastName };
         this.firstName = new string[] { firstName };
     }
     else
     {
         this.familyName = new string[] { lastName };
         this.givenName = new string[] { firstName };
     }
 }
 public Person(bool isFirstLastName, string[] firstName, string[] lastName, string[] mbox, string[] mbox_sha1sum, string[] openid, AgentAccount[] account)
     : base(mbox, mbox_sha1sum, openid, account)
 {
     if (!isFirstLastName)
     {
         this.lastName = lastName;
         this.firstName = firstName;
     }
     else
     {
         this.familyName = lastName;
         this.givenName = firstName;
     }
 }
Esempio n. 12
0
 public bool Insert(AgentAccount agentAcc)
 {
     MySqlParameter[] parm = new MySqlParameter[] {
         new MySqlParameter("?Name", agentAcc.Name),
         new MySqlParameter("?AgentName", agentAcc.AgentName),
         new MySqlParameter("?Password", agentAcc.Password),
         new MySqlParameter("?Casino", agentAcc.Casino),
         new MySqlParameter("?Cookie", agentAcc.Cookie),
         new MySqlParameter("?Address", agentAcc.Address),
         new MySqlParameter("?Address2", agentAcc.Address2),
         new MySqlParameter("?IsEnable", agentAcc.IsEnable),
         new MySqlParameter("?IsLogin", agentAcc.IsLogin),
         new MySqlParameter("?Operator", agentAcc.Operator),
         new MySqlParameter("?OperationTime", agentAcc.OperationTime),
         new MySqlParameter("?IP", agentAcc.IP)
     };
     return(MySqlHelper.ExecuteNonQuery(SQL_INSERT, parm) > 0);
 }
Esempio n. 13
0
 /// <summary>
 /// Constructor invoked by the Person Subclass
 /// </summary>
 /// <param name="mbox"></param>
 /// <param name="mbox_sha1sum"></param>
 /// <param name="openid"></param>
 /// <param name="account"></param>
 protected Actor(string mbox, string mbox_sha1sum, string openid, AgentAccount account)
 {
     if (mbox != null)
     {
         this.Mbox = new string[] { mbox };
     }
     if (mbox_sha1sum != null)
     {
         this.Mbox_sha1sum = new string[] { mbox_sha1sum };
     }
     if (openid != null)
     {
         this.Openid = new string[] { openid };
     }
     if (account != null)
     {
         this.Account = new AgentAccount[] { account };
     }
 }
Esempio n. 14
0
        public ActionResult Edit([Bind(Include = "Id,FirstName,LastName,Email,PhoneCell,PhoneOffice,Company,StreetNumber,StreetName,SuiteNumber,City,StateProv,ZipCode,AboutMeText,YearsOfExp,WebsiteLink,FacebookLink,TwitterLink,InstagramLink,LinkedInLink,RealEstateLicense,LicensedState,ProfileImage")] AgentAccount agent, HttpPostedFileBase uploadImage)
        {
            var isValid = ModelState.IsValid;
            var hasFile = uploadImage != null && uploadImage.ContentLength > 0;

            if (ModelState.IsValid && hasFile)
            {
                if (!uploadImage.ContentType.StartsWith("image/"))
                {
                    isValid = false;
                    ModelState.AddModelError("ProfileImage", "Invalid file");
                }
            }
            if (isValid)
            {
                if (hasFile)
                {
                    string imageFileName  = null;
                    var    folderPath     = Server.MapPath("~/UserContent");
                    var    extentionIndex = uploadImage.FileName.LastIndexOf(".");
                    var    imageExtention = uploadImage.FileName.Substring(extentionIndex);
                    imageFileName = agent.Id + imageExtention;
                    var imageFilePath = Path.Combine(folderPath, imageFileName);
                    uploadImage.SaveAs(imageFilePath);

                    agent.ProfileImage = imageFileName;
                }
                else
                {
                    var agentDb = db.AgentAccounts.Find(agent.Id);
                    agent.ProfileImage = agentDb.ProfileImage;
                }

                db.Entry(agent).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Profile"));
            }
            return(View(agent));
        }
Esempio n. 15
0
        public bool Update(string id, string name, string agentName, string pwd, string casino, string cookie, string addr, string addr2, string isEnable, string ip)
        {
            if (Session[Util.ProjectConfig.ADMINUSER] == null)
            {
                return(false);
            }
            admin.PageBase page     = new admin.PageBase();
            AgentAccount   agentAcc = new AgentAccount();

            agentAcc.ID            = int.Parse(id);
            agentAcc.Name          = name;
            agentAcc.AgentName     = agentName;
            agentAcc.Password      = pwd;
            agentAcc.Casino        = casino;
            agentAcc.Cookie        = cookie;
            agentAcc.Address       = addr;
            agentAcc.Address2      = addr2;
            agentAcc.IsEnable      = isEnable;
            agentAcc.Operator      = page.CurrentManager.ManagerId;
            agentAcc.OperationTime = DateTime.Now;
            agentAcc.IP            = ip;
            return(BLL.AgentAccountManager.Update(agentAcc));
        }
Esempio n. 16
0
        private ActionResult DeleteItem1(AgentAccount model)
        {
            try
            {
                long id;
                var  message = "";
                TempData["message"] = null;

                //get detail and set changes
                var realModel = Connection.AgentAccounts.Find(model.Id);

                realModel.IsDeleted = true;
                Connection.SaveChanges();
                TempData["message"] = "Rquest Deleted successful!";
                return(RedirectToAction("Index1", "AgentManager"));
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                TempData["error"] = "Error deleting user. Contact Admin";
                return(View(model));
            }
        }
Esempio n. 17
0
        private ActionResult EditItem1(AgentAccount model)
        {
            try
            {
                var item = Connection.AgentAccounts.Find(model.Id);
                if (item != null && item.Id > 0)
                {
                    item.AccountName   = model.AccountName;
                    item.AccountNumber = model.AccountNumber;
                    item.BankCode      = model.BankCode;
                    item.Id            = model.Id;
                    item.IsDeleted     = false;
                    Connection.SaveChanges();
                    TempData["message"] = "Request updated successful!";
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                TempData["error"] = ex.Message;
            }

            return(RedirectToAction("Index1", "AgentManager"));
        }
        public async Task <ActionResult> RegisterAgent(RegisterAgentViewModel model, HttpPostedFileBase uploadImage)
        {
            var isValid = ModelState.IsValid;
            var hasFile = uploadImage != null && uploadImage.ContentLength > 0;

            if (ModelState.IsValid && hasFile)
            {
                if (!uploadImage.ContentType.StartsWith("image/"))
                {
                    isValid = false;
                    ModelState.AddModelError("ProfileImage", "Invalid file");
                }
            }
            if (isValid)
            {
                var user = new ApplicationUser {
                    UserName = model.Email, Email = model.Email
                };
                var result = await UserManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    UserManager.AddToRole(user.Id, "Agent");
                    await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false);

                    string imageFileName = null;
                    if (hasFile)
                    {
                        var folderPath     = Server.MapPath("~/UserContent");
                        var extentionIndex = uploadImage.FileName.LastIndexOf(".");
                        var imageExtention = uploadImage.FileName.Substring(extentionIndex);
                        imageFileName = user.Id + imageExtention;
                        var imageFilePath = Path.Combine(folderPath, imageFileName);
                        uploadImage.SaveAs(imageFilePath);
                    }


                    var agent = new AgentAccount {
                        AboutMeText       = model.AboutMeText,
                        City              = model.City,
                        Company           = model.Company,
                        Email             = model.Email,
                        FacebookLink      = model.FacebookLink,
                        FirstName         = model.FirstName,
                        InstagramLink     = model.InstagramLink,
                        LastName          = model.LastName,
                        LicensedState     = model.LicensedState,
                        LinkedInLink      = model.LinkedInLink,
                        PhoneCell         = model.PhoneCell,
                        PhoneOffice       = model.PhoneOffice,
                        ProfileImage      = imageFileName,
                        RealEstateLicense = model.RealEstateLicense,
                        StateProv         = model.StateProv,
                        StreetName        = model.StreetName,
                        StreetNumber      = model.StreetNumber,
                        SuiteNumber       = model.SuiteNumber,
                        TwitterLink       = model.TwitterLink,
                        WebsiteLink       = model.WebsiteLink,
                        YearsOfExp        = model.YearsOfExp,
                        ZipCode           = model.ZipCode,
                        Id          = user.Id,
                        DateCreated = DateTime.Now
                    };

                    db.AgentAccounts.Add(agent);
                    db.SaveChanges();

                    return(RedirectToAction("Index", "Home"));
                }
                AddErrors(result);
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
Esempio n. 19
0
        public IOptional WithAccount(AgentAccount account)
        {
            _agent.account = account;

            return(this);
        }
 public static bool Update(AgentAccount agentAcc)
 {
     return(agentAccService.Update(agentAcc));
 }
 public static bool Insert(AgentAccount agentAcc)
 {
     return(agentAccService.Insert(agentAcc));
 }
 /// <summary>
 /// Creates a person, specifying a givenName and familyName
 /// </summary>
 /// <param name="givenName">The persons given name</param>
 /// <param name="familyName">The persons family name</param>
 /// <param name="mbox">The persons mailbox</param>
 /// <param name="mbox_sha1sum">The persons mbox sha1sum</param>
 /// <param name="openid">The persons openid</param>
 /// <param name="account">The persons verification account</param>
 public Person(string givenName, string familyName, string mbox, string mbox_sha1sum, string openid, AgentAccount account)
     : this(false, givenName, familyName, mbox, mbox_sha1sum, openid, account)
 {
 }
 /// <summary>
 /// Constructor specifies whether using first and last name or family name
 /// </summary>
 /// <param name="isFirstLastName">If this should assign first and last name</param>
 /// <param name="firstName">The persons first or given name</param>
 /// <param name="lastName">The persons last or family name</param>
 /// <param name="mbox">The persons mailbox</param>
 /// <param name="mbox_sha1sum">The persons mbox sha1sum</param>
 /// <param name="openid">The persons openid</param>
 /// <param name="account">The persons account</param>
 public Person(bool isFirstLastName, string firstName, string lastName, string mbox, string mbox_sha1sum, string openid, AgentAccount account)
     : base(mbox, mbox_sha1sum, openid, account)
 {
     if (!isFirstLastName)
     {
         this.lastName  = new string[] { lastName };
         this.firstName = new string[] { firstName };
     }
     else
     {
         this.familyName = new string[] { lastName };
         this.givenName  = new string[] { firstName };
     }
 }
 /// <summary>
 /// Creates a person, specifying a givenName and familyName
 /// </summary>
 /// <param name="givenName">The persons given name</param>
 /// <param name="familyName">The persons family name</param>
 /// <param name="mbox">The persons mailbox</param>
 /// <param name="mbox_sha1sum">The persons mbox sha1sum</param>
 /// <param name="openid">The persons openid</param>
 /// <param name="account">The persons verification account</param>
 public Person(string givenName, string familyName, string mbox, string mbox_sha1sum, string openid, AgentAccount account)
     : this(false, givenName, familyName, mbox, mbox_sha1sum, openid, account)
 {
 }