/// <summary>
    /// 
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        DateTime dt = DateTime.Parse(txtDate.Text);

        if(dt.CompareTo(System.DateTime.Today) > 0)
        {
            ErrorMessage.Text = "Received date should not be greater than today.";
            return;
        }

        AccountAdmin accountAdmin = new AccountAdmin();
        AccountPayment entity = new AccountPayment();

        if(ItemId > 0)
            entity = accountAdmin.GetByAccountPaymentId(ItemId);

        entity.AccountID = AccountId;
        entity.Amount = decimal.Parse(txtAmount.Text.Trim());
        entity.Description = txtDescription.Text.Trim();
        entity.ReceivedDate = dt;

        bool status = accountAdmin.AddAffiliatePayment(entity);

        if (status)
        {
            Response.Redirect(_ViewPageLink + AccountId);
        }
        else
        {
            ErrorMessage.Text = "";
        }
    }
Example #2
0
 public static AccountAdmin AdminWithoutPassword(this AccountAdmin user)
 {
     if (user == null)
     {
         return(null);
     }
     user.Password = null;
     return(user);
 }
Example #3
0
        public bool EditAccount(AccountAdmin accountAdmin)
        {
            var EditAccount = _accountAdminRepository.EditAccount(accountAdmin);

            if (!EditAccount)
            {
                return(false);
            }
            return(true);
        }
Example #4
0
 public AccountView(AccountAdmin e)
 {
     Id        = e.Id;
     UserName  = e.UserName;
     FirstName = e.FirstName;
     LastName  = e.LastName;
     Phone     = e.Phone;
     Email     = e.Email;
     Password  = e.Password;
     Role      = e.Role;
 }
Example #5
0
 public void BindAccount()
 {
     ZNode.Libraries.Admin.AccountAdmin Account = new AccountAdmin();
     //Load AccountID
     ListAccounts.DataSource = Account.GetByPortalID(ZNodeConfigManager.SiteConfig.PortalID);
     ListAccounts.DataTextField = "AccountID";
     ListAccounts.DataValueField = "AccountID";
     ListAccounts.DataBind();
     ListItem li = new ListItem("", "0");
     ListAccounts.Items.Insert(0, li);
 }
Example #6
0
        public bool CreateAccount(AccountAdmin accountAdmin)
        {
            var accountExits = _accountAdminRepository.CheckUserName(accountAdmin.userName);

            if (accountExits)
            {
                return(false);
            }

            var idAccount = _accountAdminRepository.AddAccount(accountAdmin);

            if (idAccount == 0)
            {
                return(false);
            }
            return(true);
        }
Example #7
0
 public ActionResult Index(LoginModel model)
 {
     if (ModelState.IsValid)
     {
         bool res = new AccountAdmin().login(model.Username, model.Password);
         if (res)
         {
             Session.Add(CommonConstants.ADMIN_SESSION, model.Username);
             return(RedirectToAction("Index", "Home"));
         }
     }
     else
     {
         ModelState.AddModelError("", "Tên Đăng Nhập Hoặc Mật Khẩu Không Chính Sác");
     }
     return(View(model));
 }
Example #8
0
 public ActionResult Edit(AccountAdmin account, string confirmPassword)
 {
     if (ModelState.IsValid)
     {
         if (account.passWord != confirmPassword)
         {
             ModelState.AddModelError("", "Confirm password không chính xác !");
         }
         else
         {
             var editAccountSuccess = _accountAdminServices.EditAccount(account);
             if (editAccountSuccess)
             {
                 return(RedirectToAction("Index"));
             }
         }
     }
     return(View(account));
 }
Example #9
0
        public ActionResult Login(LoginAdmin model)
        {
            var result = new AccountAdmin().Login(model.Username, model.Password);

            //if (Membership.ValidateUser(model.Username, model.Password) && ModelState.IsValid)
            if (result && ModelState.IsValid)
            {
                SessionHelper.SetSession(new UserSession()
                {
                    Username = model.Username
                });
                //FormsAuthentication.SetAuthCookie(model.Username, model.RememberMe);
                return(RedirectToAction("Index", "Admin"));
            }
            else
            {
                ModelState.AddModelError("", "Error Login");
            }
            return(View(model));
        }
Example #10
0
 public ActionResult Create(AccountAdmin accountAdmin, string confirmPassword)
 {
     if (ModelState.IsValid)
     {
         if (accountAdmin.passWord != confirmPassword)
         {
             ModelState.AddModelError("", "Confirm password không chính xác !");
         }
         else
         {
             var addAccountSuccess = _accountAdminServices.CreateAccount(accountAdmin);
             if (addAccountSuccess)
             {
                 return(RedirectToAction("Index"));
             }
             else
             {
                 ModelState.AddModelError("", "Tài khoản đã tồn tại trong hệ thống !");
             }
         }
     }
     return(View(accountAdmin));
 }
Example #11
0
 /// <summary>
 /// Bind Grid
 /// </summary>
 protected void BindGrid()
 {
     AccountAdmin _AccountAdmin = new AccountAdmin();
     TList<Account> accountList = _AccountAdmin.GetAllCustomer();
     accountList.Sort("AccountID Desc");
     uxGrid.DataSource = accountList;
     uxGrid.DataBind();
 }
Example #12
0
    /// <summary>
    /// 
    /// </summary>
    protected void BindData()
    {
        AccountAdmin accountAdmin = new AccountAdmin();
        AccountTypeAdmin accountTypeAdmin = new AccountTypeAdmin();
        ProfileAdmin profileAdmin = new ProfileAdmin();
        CustomerAdmin customerAdmin = new CustomerAdmin();
        ReferralCommissionAdmin referralCommissionAdmin = new ReferralCommissionAdmin();

        ZNode.Libraries.DataAccess.Entities.Account account = accountAdmin.GetByAccountID(AccountID);

        if (account != null)
        {
            // General Information
            lblAccountID.Text = account.AccountID.ToString();
            lblCompanyName.Text = account.BillingCompanyName;
            lblExternalAccNumber.Text = account.ExternalAccountNo;
            lblDescription.Text = account.Description;
            lblLoginName.Text = customerAdmin.GetByUserID(int.Parse(AccountID.ToString()));
            lblCustomerDetails.Text = account.AccountID.ToString() + " - " + account.BillingFirstName + " " + account.BillingLastName;
            lblWebSite.Text = account.Website;
            lblSource.Text = account.Source;
            lblCreatedDate.Text = account.CreateDte.ToShortDateString();
            lblCreatedUser.Text = account.CreateUser;

            // Referral Detail

            // Get Referral Type Name for a Account
            if (account.ReferralCommissionTypeID != null)
            {
                ReferralCommissionType referralType = referralCommissionAdmin.GetByReferralID(int.Parse(account.ReferralCommissionTypeID.ToString()));
                lblReferralType.Text = referralType.Name;
            }
            else
            {
                lblReferralType.Text = "";
            }

            if (account.ReferralStatus == "A")
            {
                string affiliateLink = "http://" + ZNodeConfigManager.SiteConfig.DomainName + "/default.aspx?affiliate_id=" + account.AccountID;
                hlAffiliateLink.Text = affiliateLink;
                hlAffiliateLink.NavigateUrl = affiliateLink;
            }
            else
            {
                hlAffiliateLink.Text = "NA";
            }

            if (account.ReferralCommission != null)
            {
                if (account.ReferralCommissionTypeID == 1)
                {
                    lblReferralCommission.Text = account.ReferralCommission.Value.ToString("N");
                }
                else
                {
                    lblReferralCommission.Text = account.ReferralCommission.Value.ToString("c");
                }
            }
            else
            {
                lblReferralCommission.Text = "";
            }

            lblTaxId.Text = account.TaxID;

            if (account.ReferralStatus != null)
            {
                //Getting the Status Description
                Array values = Enum.GetValues(typeof(ZNodeApprovalStatus.ApprovalStatus));
                Array names=Enum.GetNames(typeof(ZNodeApprovalStatus.ApprovalStatus));
                for (int i = 0; i < names.Length; i++)
                {
                    if (names.GetValue(i).ToString() == account.ReferralStatus)
                    {
                        lblReferralStatus.Text = ZNodeApprovalStatus.GetEnumValue(values.GetValue(i));
                        break;
                    }
                }

                BindPayments(accountAdmin);
            }
            else
            {
                pnlAffiliatePayment.Visible = false;
                lblReferralStatus.Text = "";
            }

            if (account.UpdateDte != null)
            {
                lblUpdatedDate.Text = account.UpdateDte.Value.ToShortDateString();
            }

            // Email Opt-In
            if (account.EmailOptIn)
            {
                EmailOptin.Src = ZNode.Libraries.Framework.Business.ZNodeHelper.GetCheckMark(true);
            }
            else
            {
                EmailOptin.Src = ZNode.Libraries.Framework.Business.ZNodeHelper.GetCheckMark(false);
            }

            lblUpdatedUser.Text = account.UpdateUser;
            lblCustom1.Text = account.Custom1;
            lblCustom2.Text = account.Custom2;
            lblCustom3.Text = account.Custom3;

            // Get Profile Type Name for a Account
            Profile _profileList = profileAdmin.GetByProfileID(int.Parse(account.ProfileID.ToString()));
            lblProfileTypeName.Text = _profileList.Name;

            // Address Information

            ZNodeAddress AddressFormat = new ZNodeAddress();

            // Format Billing Address
            AddressFormat.FirstName = string.IsNullOrEmpty(account.BillingFirstName) ? string.Empty : account.BillingFirstName;
            AddressFormat.LastName = string.IsNullOrEmpty(account.BillingLastName) ? string.Empty : account.BillingLastName;
            AddressFormat.CompanyName = string.IsNullOrEmpty(account.BillingCompanyName) ? string.Empty : account.BillingCompanyName;
            AddressFormat.Street1 = string.IsNullOrEmpty(account.BillingStreet) ? string.Empty : account.BillingStreet;
            AddressFormat.Street2 = string.IsNullOrEmpty(account.BillingStreet1) ? string.Empty : account.BillingStreet1;
            AddressFormat.City = string.IsNullOrEmpty(account.BillingCity) ? string.Empty : account.BillingCity;
            AddressFormat.StateCode = string.IsNullOrEmpty(account.BillingStateCode) ? string.Empty : account.BillingStateCode;
            AddressFormat.PostalCode = string.IsNullOrEmpty(account.BillingPostalCode) ? string.Empty : account.BillingPostalCode;
            AddressFormat.CountryCode = string.IsNullOrEmpty(account.BillingCountryCode) ? string.Empty : account.BillingCountryCode;
            lblBillingAddress.Text = AddressFormat.ToString() + "Tel: " + account.BillingPhoneNumber + "<br>Email: " + account.BillingEmailID;

            // Format Shipping Address
            AddressFormat.FirstName = string.IsNullOrEmpty(account.ShipFirstName) ? string.Empty : account.BillingFirstName;
            AddressFormat.LastName = string.IsNullOrEmpty(account.ShipLastName) ? string.Empty : account.ShipLastName;
            AddressFormat.CompanyName = string.IsNullOrEmpty(account.ShipCompanyName) ? string.Empty : account.ShipCompanyName;
            AddressFormat.Street1 = string.IsNullOrEmpty(account.ShipStreet) ? string.Empty : account.ShipStreet;
            AddressFormat.Street2 = string.IsNullOrEmpty(account.ShipStreet1) ? string.Empty : account.ShipStreet1;
            AddressFormat.City = string.IsNullOrEmpty(account.ShipCity) ? string.Empty : account.ShipCity;
            AddressFormat.StateCode = string.IsNullOrEmpty(account.ShipStateCode) ? string.Empty : account.ShipStateCode;
            AddressFormat.PostalCode = string.IsNullOrEmpty(account.ShipPostalCode) ? string.Empty : account.ShipPostalCode;
            AddressFormat.CountryCode = string.IsNullOrEmpty(account.ShipCountryCode) ? string.Empty : account.ShipCountryCode;
            lblShippingAddress.Text = AddressFormat.ToString() + "Tel: " + account.ShipPhoneNumber + "<br>Email: " + account.ShipEmailID;

            //To get Amount owed
            AccountHelper helperAccess = new AccountHelper();
            DataSet myDataSet = helperAccess.GetCommisionAmount(ZNodeConfigManager.SiteConfig.PortalID, account.AccountID.ToString());

            lblAmountOwed.Text = "$" + myDataSet.Tables[0].Rows[0]["CommissionOwed"].ToString();

            // Orders Grid
            this.BindGrid();

            // Retrieves the Role for User using Userid
            if (account.UserID != null)
            {
                 Guid UserKey = new Guid();
                 UserKey = account.UserID.Value;
                 MembershipUser _user = Membership.GetUser(UserKey);
                 string roleList = "";

                //Get roles for this User account
                string[] roles = Roles.GetRolesForUser(_user.UserName);

                foreach (string Role in roles)
                {
                    roleList += Role + "<br>";
                }
                lblRoles.Text = roleList;

                string rolename = roleList;

                //Hide the Edit button if a NonAdmin user has entered this page
                if(!Roles.IsUserInRole("ADMIN"))
                {
                    if (Roles.IsUserInRole(_user.UserName, "ADMIN"))
                    {
                        EditCustomer.Visible = false;
                    }
                    else if (Roles.IsUserInRole(HttpContext.Current.User.Identity.Name, "CUSTOMER SERVICE REP"))
                    {
                        if (rolename == Convert.ToString("USER<br>") || rolename == Convert.ToString(""))
                        {
                            EditCustomer.Visible = true;
                        }
                        else
                        {
                            EditCustomer.Visible = false;
                        }
                    }
                }
            }
        }
    }
Example #13
0
    /// <summary>
    /// Bind payments Grid
    /// <param name="AccountAdmin"></param>
    /// </summary>    
    protected void BindPayments(AccountAdmin AccountAdmin)
    {
        uxPaymentList.DataSource = AccountAdmin.GetPaymentsByAccountId(AccountID);
        uxPaymentList.DataBind();

        pnlAffiliatePayment.Visible = true;
    }
Example #14
0
 /// <summary>
 /// Bind payments Grid
 /// </summary>
 protected void BindPayments()
 {
     AccountAdmin accountAdmin = new AccountAdmin();
     BindPayments(accountAdmin);
 }