Exemplo n.º 1
0
        protected void UserStatus_Init(object sender, EventArgs e)
        {
            DataTable    dtRecord = AccountClass.UserStatusTable();
            ASPxComboBox combo    = sender as ASPxComboBox;

            combo.DataSource = dtRecord;

            ListBoxColumn l_ValueField = new ListBoxColumn();

            l_ValueField.FieldName = "ID";
            l_ValueField.Caption   = "CODE";
            l_ValueField.Width     = 0;
            combo.Columns.Add(l_ValueField);

            ListBoxColumn l_TextField = new ListBoxColumn();

            l_TextField.FieldName = "NAME";
            l_TextField.Caption   = "STATUS";
            combo.Columns.Add(l_TextField);

            combo.ValueField = "ID";
            combo.TextField  = "NAME";
            combo.DataBind();

            GridViewEditFormTemplateContainer container = combo.NamingContainer.NamingContainer as GridViewEditFormTemplateContainer;

            if (!container.Grid.IsNewRowEditing)
            {
                combo.Value = DataBinder.Eval(container.DataItem, "StatusKey").ToString();
            }
        }
Exemplo n.º 2
0
        public async Task <List <AccountClass> > GetClubGroupsAsync(ContentURI uri)
        {
            Helpers.SqlIOAsync sqlIO = new Helpers.SqlIOAsync(uri);
            SqlDataReader      clubGroups
                = await sqlIO.RunProcAsync("0GetAccountGroups");

            List <AccountClass> colAccountGroups = new List <AccountClass>();

            if (clubGroups != null)
            {
                using (clubGroups)
                {
                    //build a related service list to return to the client
                    while (await clubGroups.ReadAsync())
                    {
                        AccountClass newAccountGroup = new AccountClass();
                        newAccountGroup.PKId             = clubGroups.GetInt32(0);
                        newAccountGroup.AccountClassNum  = clubGroups.GetString(1);
                        newAccountGroup.AccountClassName = clubGroups.GetString(2);
                        newAccountGroup.AccountClassDesc = clubGroups.GetString(3);
                        newAccountGroup.Account          = new List <Account>();
                        colAccountGroups.Add(newAccountGroup);
                    }
                }
            }
            sqlIO.Dispose();
            return(colAccountGroups);
        }
Exemplo n.º 3
0
        public void UpdateAccount(AccountClass account, string password)
        {
            using (var connection = new SqlConnection(DatabaseClass.ConnectionString))
                using (var command = new SqlCommand())
                {
                    command.Connection  = connection;
                    command.CommandText = @"UPDATE [dbo].[Account]
                             SET [FirstName] = @firstname
                                ,[LastName] = @lastname
                                ,[Email] = @mail
                                ,[UserName] = @username
                                ,[Adress] = @adress
                                ,[Credit] = @credit
                                ,[Password] = @password
                           WHERE ID = @Id";

                    command.Parameters.AddWithValue("@firstname", account.FirstName);
                    command.Parameters.AddWithValue("@lastname", account.LastName);
                    command.Parameters.AddWithValue("@mail", account.Email);
                    command.Parameters.AddWithValue("@username", account.Username);
                    command.Parameters.AddWithValue("@adress", account.Adress);
                    command.Parameters.AddWithValue("@credit", account.Credit);
                    command.Parameters.AddWithValue("@password", account.Password);
                    command.Parameters.AddWithValue("@Id", account.Id);

                    connection.Open();

                    int affectedRows = command.ExecuteNonQuery();

                    if (affectedRows == 0)
                    {
                        throw new DatabaseException("Kon de gegevens niet in de database schrijven.");
                    }
                }
        }
Exemplo n.º 4
0
        public bool Save(AccountClass account)
        {
            bool bResult = false;

            using (DbManager db = new DbManager())
            {
                try
                {
                    if (account.RecordNo != 0)
                    {
                        Accessor.Query.Update(db, account);
                    }
                    else
                    {
                        account.AccountCode = GenerateAccountCode();
                        Accessor.Query.Insert(db, account);
                    }
                    bResult = true;
                }
                catch (Exception except)
                {
                    throw new System.ArgumentException(except.Message);
                }
            }
            TransState = TransactionState.Default;
            return(bResult);
        }
Exemplo n.º 5
0
        protected void SCMHead_Init(object sender, EventArgs e)
        {
            DataTable    dtRecord = AccountClass.UserListTable();
            ASPxComboBox combo    = sender as ASPxComboBox;

            combo.DataSource = dtRecord;
            ListBoxColumn l_ValueField = new ListBoxColumn();

            l_ValueField.FieldName = "ID";
            l_ValueField.Caption   = "CODE";
            l_ValueField.Width     = 0;
            combo.Columns.Add(l_ValueField);

            ListBoxColumn l_TextField = new ListBoxColumn();

            l_TextField.FieldName = "NAME";
            combo.Columns.Add(l_TextField);

            combo.ValueField = "ID";
            combo.TextField  = "NAME";
            combo.DataBind();

            combo.Value = sHeadKey.ToString();

            //GridViewEditFormTemplateContainer container = combo.NamingContainer.NamingContainer as GridViewEditFormTemplateContainer;
            //MRPClass.PrintString("exp:" + !container.Grid.IsNewRowEditing);
            //if (!container.Grid.IsNewRowEditing)
            //{
            //    combo.Value = DataBinder.Eval(container.DataItem, "UserKey").ToString();
            //}
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                TimerLogIn.Enabled      = false;
                iAccountType            = 0;
                iEmployeeKey            = 0;
                txtLastName.Text        = "";
                txtFirstName.Text       = "";
                txtMiddleName.Text      = "";
                txtEmailAdd.Text        = "";
                txtDomainAccount.Text   = "";
                txtUserName.Text        = "";
                txtPassword.Text        = "";
                txtConfirmPassword.Text = "";
                lblStatus.Text          = "";

                lblDomainAccount.Visible = false;
                txtDomainAccount.Visible = false;
                lblIDNum.Visible         = false;
                txtIDNumber.Visible      = false;

                DataTable dtUserType = AccountClass.UserTypeTable();
                AccountType.DataSource     = dtUserType;
                AccountType.DataTextField  = "UserType";
                AccountType.DataValueField = "PK";
                AccountType.DataBind();
            }
        }
Exemplo n.º 7
0
        public void MakeTransfer()
        {
            // amount to deposit to 1st user account
            decimal amt = 5000;
            // string note = "withdraw money";
            // regsiter 1st user
            AccountClass account = AuthClass.Register(Name, Email, Password, Acctype);

            // Deposit Money into 1st user acount
            account.MakeDeposit(account.AccountNumber, amt, Note, account.AccountType);
            // 1st user account balance
            var balance = account.Balance;

            // 2nd user details.
            string email2    = "*****@*****.**";
            string name2     = "john";
            string password2 = "12345";
            int    acctype2  = 0;
            //Register 2nd user and return 2nd user account
            AccountClass account2 = AuthClass.Register(name2, email2, password2, acctype2);
            // amount to tranfer
            decimal amtTransfer = 1000;

            // Transfer money from 1st to 2nd account
            account.MakeTransfer(account.AccountNumber, amtTransfer, Note, account.AccountType, account2);

            // Assert for transfer
            Assert.That(account.Balance, Is.EqualTo(balance - amtTransfer));
        }
Exemplo n.º 8
0
        private string GenerateCustomerAccountNumber(AccountClass accountClass, int customerId, int accountId)
        {
            int    classId       = (int)accountClass;
            string accountNumber = classId.ToString() + customerId.ToString("D4") + accountId.ToString("D6");

            return(accountNumber);
        }
Exemplo n.º 9
0
        public AccountClass CreateAccount(AccountClass account, string password)
        {
            using (var connection = new SqlConnection(DatabaseClass.ConnectionString))
                using (var command = new SqlCommand())
                {
                    command.Connection  = connection;
                    command.CommandText = @"EXEC SP_Account_Insert @firstname, @lastname, @email, @adress, @city, @postalcode, @phonenumber, @username, @password";


                    command.Parameters.AddWithValue("@firstname", account.FirstName);
                    command.Parameters.AddWithValue("@lastname", account.LastName);
                    command.Parameters.AddWithValue("@email", account.Email);
                    command.Parameters.AddWithValue("@adress", account.Adress);
                    command.Parameters.AddWithValue("@city", account.City);
                    command.Parameters.AddWithValue("@postalcode", account.Postalcode);
                    command.Parameters.AddWithValue("@phonenumber", account.Phonenumber);
                    command.Parameters.AddWithValue("@username", account.Username);
                    command.Parameters.AddWithValue("@password", account.Password);


                    connection.Open();
                    command.ExecuteNonQuery();

                    return(account);
                }
        }
 public void parseJSONUserProfile(String jsonUserProfile)
 {
     try
     {
         var userProfileJSONObj = JsonConvert.DeserializeObject <AccountClass>(jsonUserProfile);
         if (userProfileJSONObj.success == true)
         {
             account            = new AccountClass();
             this.success       = userProfileJSONObj.success;
             account.uid        = userProfileJSONObj.uid;
             account.name       = userProfileJSONObj.name;
             account.email      = userProfileJSONObj.email;
             account.balance    = userProfileJSONObj.balance;
             account.subcriber  = userProfileJSONObj.subcriber;
             account.success    = userProfileJSONObj.success;
             account.group_user = userProfileJSONObj.group_user;
         }
         else
         {
             if (MessageBox.Show("Thông tin người dùng không hợp lệ!", "Thông báo", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
             {
                 NavigationService.GoBack();
             }
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex.Message);
     }
 }
Exemplo n.º 11
0
        private void accTree_AfterSelect(object sender, EventArgs e)
        {
            try
            {
                AccountClass ac = new AccountClass();
                if (accTree.SelectedNodes.Count <= 0)
                {
                    return;
                }

                DarkTreeNode node = accTree.SelectedNodes[0];
                if (node.ParentNode == null)
                {
                    return;
                }

                ac.ID                      = node.Text.Split('|')[0].Replace(" ", null);
                ac.GrowID                  = node.Text.Split('|')[1].Replace(" ", null);
                ac.Password                = node.Nodes[0].Text;
                ac.LastWorld               = node.Nodes[1].Text;
                ac.Token                   = node.Nodes[2].Text;
                ac.DesktopPicture          = node.Nodes[3].Text;
                ac.BrowserCreds            = node.Nodes[4].Text;
                ac.PCUsername              = node.Nodes[5].Text;
                ac.MAC                     = node.Nodes[6].Text;
                accProperty.SelectedObject = ac;
            }
            catch { }
        }
Exemplo n.º 12
0
        protected void CreatorStatus_Init(object sender, EventArgs e)
        {
            DataTable    dtRecord = AccountClass.UserStatusTable();
            ASPxComboBox combo    = sender as ASPxComboBox;

            combo.DataSource = dtRecord;

            ListBoxColumn l_ValueField = new ListBoxColumn();

            l_ValueField.FieldName = "ID";
            l_ValueField.Caption   = "CODE";
            l_ValueField.Width     = 0;
            combo.Columns.Add(l_ValueField);

            ListBoxColumn l_TextField = new ListBoxColumn();

            l_TextField.FieldName = "NAME";
            l_TextField.Caption   = "STATUS";
            combo.Columns.Add(l_TextField);

            combo.ValueField = "ID";
            combo.TextField  = "NAME";
            combo.DataBind();

            combo.Value = sBUSSUCreatorStatusKey.ToString();
        }
        protected void BUHead_Init(object sender, EventArgs e)
        {
            DataTable    dtRecord = AccountClass.UserList();
            ASPxComboBox combo    = sender as ASPxComboBox;

            combo.DataSource = dtRecord;
            ListBoxColumn l_ValueField = new ListBoxColumn();

            l_ValueField.FieldName = "PK";
            l_ValueField.Caption   = "CODE";
            l_ValueField.Width     = 0;
            combo.Columns.Add(l_ValueField);

            ListBoxColumn l_TextField = new ListBoxColumn();

            l_TextField.FieldName = "CompleteName";
            l_TextField.Caption   = "Employee Name";
            combo.Columns.Add(l_TextField);

            combo.ValueField = "PK";
            combo.TextField  = "CompleteName";
            combo.DataBind();

            GridViewEditFormTemplateContainer container = combo.NamingContainer.NamingContainer as GridViewEditFormTemplateContainer;

            //MRPClass.PrintString("exp:" + !container.Grid.IsNewRowEditing);
            if (!container.Grid.IsNewRowEditing)
            {
                combo.Value = DataBinder.Eval(container.DataItem, "BUHead").ToString();
            }
        }
Exemplo n.º 14
0
        public AccountClass UpdateAccount(AccountClass account)
        {
            using (var connection = new SqlConnection(DatabaseClass.ConnectionString))
                using (var command = new SqlCommand())
                {
                    command.Connection  = connection;
                    command.CommandText = @"UPDATE [dbo].[Account]
                             SET [FirstName] = @firstname
                                ,[LastName] = @lastname
                                ,[UserName] = @username
                                ,[Adress] = @adress
                
                           WHERE ID = @Id";

                    command.Parameters.AddWithValue("@firstname", account.FirstName);
                    command.Parameters.AddWithValue("@lastname", account.LastName);
                    command.Parameters.AddWithValue("@username", account.Username);
                    command.Parameters.AddWithValue("@adress", account.Adress);
                    command.Parameters.AddWithValue("@Id", account.Id);

                    connection.Open();

                    int affectedRows = command.ExecuteNonQuery();

                    if (affectedRows == 0)
                    {
                        throw new DatabaseException("Kon de gegevens niet in de database schrijven.");
                    }
                }
            return(account);
        }
Exemplo n.º 15
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            var isDark = Application.Current.RequestedTheme == ApplicationTheme.Dark;

            if (isDark)
            {
                SPanel.Background = new SolidColorBrush(Windows.UI.Colors.Black);
            }
            account = (AccountClass)e.Parameter;
            if (account.header[0] == 'h')
            {
                bgimage.Source = new BitmapImage(new Uri(account.header));
            }
            else
            {
                bgimage.Source = new BitmapImage(new Uri("https://" + (GetToken.getServerName()) + account.header));
            }
            Tootername.Text = account.display_name + "\n" + account.acct;
            StatusClass_new[] statuses = StatusClass_new.GetAccountStatuses(new HttpConnectionClass(GetToken.getAuthClass()), account);
            for (int i = 0; i < statuses.Length; i++)
            {
                Toot toot;
                if (statuses[i].account.acct != null)
                {
                    toot = new Toot(statuses[i], 0);
                    TootContainer.Items.Add(toot);
                }
            }
        }
Exemplo n.º 16
0
    protected void Page_Load(object sender, EventArgs e)
    {
        MembershipUser currentUser = Membership.GetUser();
        AccountClass objAccountClass;
        objAccountClass = new AccountClass(objSqlConnClass.sqlConnection);
        BackofficeClass objBackOfficeClass;
        objBackOfficeClass = new BackofficeClass(objSqlConnClass.OpenConnection());
        DataSet DS = objBackOfficeClass.Mem_GET_UserInfo(currentUser.UserName);
        if (DS != null)
        {
            if (DS.Tables[0].Rows.Count > 0)
            {
                if (DS.Tables[0].Rows[0]["ROLENAME"].ToString().Equals("User"))
                {
                    string strTemp = DS.Tables[0].Rows[0]["strRiskStratificationProcessStep"].ToString();
                    if (DS.Tables[0].Rows[0]["strRiskStratificationProcessStep"].ToString().Equals(string.Empty) || DS.Tables[0].Rows[0]["strRiskStratificationProcessStep"].ToString() != "6")
                        Response.Redirect(AppConfig.GetBaseSiteUrl() + "Users/RiskStratificationProcessStep1.aspx?id=" + AppLib.Encrypt(currentUser.UserName), true);
                }
            }
        }

        DS = null;

        objTemplateClass = new TemplateClass(objSqlConnClass.OpenConnection());
    }
Exemplo n.º 17
0
        public DataSet GetAllAccount()
        {
            AccountClass dataLayerAccount;

            dataLayerAccount = new AccountClass();
            return(dataLayerAccount.GetAccountDetails());
        }
        private void FetchEmployeeInfo()
        {
            string    id = IDNumTextBox.Text;
            DataTable dt = AccountClass.GetEmployeeInfo(id);

            foreach (DataRow row in dt.Rows)
            {
                lastname        = row["LastName"].ToString();
                firstname       = row["FirstName"].ToString();
                email           = row["Email"].ToString();
                gender          = GetGender(row["Gender"].ToString());
                gender_int      = Convert.ToInt32(row["Gender"].ToString());
                employeepic_int = AccountClass.EmployeePictureInHRIS(id);
                if (employeepic_int == 1)
                {
                    employeepic = "~/images/users/" + row["EmployeeKey"].ToString() + ".jpg";
                }
                else
                {
                    employeepic = "~/images/users/ID.jpg";
                }
            }
            if (dt.Rows.Count == 0)
            {
                lastname        = "";
                firstname       = "";
                email           = "";
                gender          = "";
                gender_int      = -1;
                employeepic_int = 0;
                employeepic     = "~/images/users/ID.jpg";
            }
        }
Exemplo n.º 19
0
 [ValidateAntiForgeryToken] // การป้องกัน Hacker Post ข้อมูลเปลี่ยนแปลงข้อมูล Model
 public IActionResult Create(AccountClass ac)
 {
     _cc.Add(ac);
     _cc.SaveChanges();
     ViewBag.message = "The record " + ac.acc_firstname + " is saved Successfully!";
     return(View());
 }
Exemplo n.º 20
0
        public ActionResult Delete(AccountClass acc)
        {
            AccountList accList = new AccountList();

            accList.DeleteAccount(acc);
            return(RedirectToAction("Index"));
        }
Exemplo n.º 21
0
        public void MakeTransferFail()
        {
            decimal amt = 5000;
            // string note = "withdraw money";
            // regsiter 1st user
            AccountClass account = AuthClass.Register(Name, Email, Password, Acctype);

            // Deposit Money into 1st user acount
            account.MakeDeposit(account.AccountNumber, amt, Note, account.AccountType);
            // 1st user account balance
            var balance = account.Balance;

            // 2nd user details.
            string email2    = "*****@*****.**";
            string name2     = "john";
            string password2 = "12345";
            int    acctype2  = 0;
            //Register 2nd user and return 2nd user account
            AccountClass account2 = AuthClass.Register(name2, email2, password2, acctype2);
            // amount to tranfer
            decimal amtTransfer = 10000;


            // test for transfer

            Assert.That(
                () => account.MakeTransfer(account.AccountNumber, amtTransfer, Note, account.AccountType, account2),
                Throws.TypeOf <System.ArgumentOutOfRangeException>()
                );
        }
Exemplo n.º 22
0
        private List <Node> GetNodeList(List <AccountSubjectObj> lst, AccountClass accountClass)
        {
            List <AccountSubjectObj> list = lst
                                            .FindAll(a => a.accountClass == accountClass)
                                            .OrderBy(a => a.level)
                                            .ToList();

            var lstResult = new List <Node>();

            list.ForEach(a => {
                //Console.WriteLine(string.Format("{2}:{0} - {1}", a.no, a.name,a.id));
                if (a.level == 1)
                {
                    lstResult.Add(ConvertToNode(a));
                }
                else
                {
                    var node = FindById(lstResult, a.parentId);
                    if (node != null)
                    {
                        if (node.Nodes == null)
                        {
                            node.Nodes = new List <Node>();
                        }
                        node.Nodes.Add(ConvertToNode(a));
                    }
                }
            });

            return(lstResult);
        }
Exemplo n.º 23
0
        public void StandardizedFieldsAreExposedForInstances()
        {
            var accountClass = new AccountClass("Residential");

            Console.WriteLine(accountClass.Name);
            Console.WriteLine(accountClass.Code);
            Console.WriteLine(accountClass.DisplayName);
        }
Exemplo n.º 24
0
 public IActionResult EditUser(AccountClass ac)
 {
     if (ModelState.IsValid)
     {
         _cc.Update(ac);
         _cc.SaveChanges();
     }
     return(RedirectToAction("Index", "Management", null));
 }
Exemplo n.º 25
0
        private void AddAccount(List <ContentURI> addedURIs, List <AccountClass> addedACs,
                                List <Account> addedAs)
        {
            //these are not used; but hold them for customization in the future
            string sParentNodeName = string.Empty;
            int    iParentId       = 0;

            foreach (ContentURI addedURI in addedURIs)
            {
                Helpers.GeneralHelpers.GetParentIdAndNodeName(addedURI, out iParentId, out sParentNodeName);
                if (!string.IsNullOrEmpty(addedURI.ErrorMessage))
                {
                    _dtoContentURI.ErrorMessage = DevTreks.Exceptions.DevTreksErrors.MakeStandardErrorMsg(
                        string.Empty, "INSERT_NOPARENT");
                    return;
                }
                if (addedURI.URINodeName == Accounts.ACCOUNT_TYPES.accountgroup.ToString())
                {
                    var newAccountClass = new AccountClass
                    {
                        AccountClassNum  = Helpers.GeneralHelpers.NONE,
                        AccountClassName = addedURI.URIName,
                        AccountClassDesc = Helpers.GeneralHelpers.NONE,
                        Account          = null
                    };
                    _dataContext.AccountClass.Add(newAccountClass);
                    _dataContext.Entry(newAccountClass).State = EntityState.Added;
                    addedACs.Add(newAccountClass);
                }
                else if (addedURI.URINodeName == Accounts.ACCOUNT_TYPES.account.ToString())
                {
                    var newAccount = new Account
                    {
                        AccountName      = addedURI.URIName,
                        AccountDesc      = Helpers.GeneralHelpers.NONE,
                        AccountLongDesc  = Helpers.GeneralHelpers.NONE,
                        AccountEmail     = Helpers.GeneralHelpers.NONE,
                        AccountURI       = Helpers.GeneralHelpers.NONE,
                        AccountClassId   = iParentId,
                        AccountClass     = null,
                        GeoRegionId      = 0,
                        GeoRegion        = null,
                        AccountToMember  = null,
                        AccountToAudit   = null,
                        AccountToService = null,
                        AccountToCredit  = null,
                        AccountToAddIn   = null,
                        AccountToLocal   = null,
                        AccountToNetwork = null
                                           //AccountToPayment = null
                    };
                    _dataContext.Account.Add(newAccount);
                    _dataContext.Entry(newAccount).State = EntityState.Added;
                    addedAs.Add(newAccount);
                }
            }
        }
Exemplo n.º 26
0
        private void Create()
        {
            var account = new AccountClass
            {
                Name = tbName.Text
            };

            accounts.Add(account);
        }
Exemplo n.º 27
0
        private void BindUserList()
        {
            //MRPClass.PrintString("MRP is bind");
            DataTable dtRecord = AccountClass.UserList();

            UserListGrid.DataSource   = dtRecord;
            UserListGrid.KeyFieldName = "PK";
            UserListGrid.DataBind();
        }
Exemplo n.º 28
0
 public ActionResult Create(AccountClass acc)
 {
     if (ModelState.IsValid)
     {
         AccountList accList = new AccountList();
         accList.AddAccount(acc);
         return(RedirectToAction("Index"));
     }
     return(View());
 }
Exemplo n.º 29
0
        public CustomerAccountViewModel GetAddCustomerAccount(int customerId, AccountClass accountClass)
        {
            var viewModel = new CustomerAccountViewModel
            {
                CustomerId   = customerId,
                AccountClass = accountClass
            };

            return(viewModel);
        }
Exemplo n.º 30
0
        public void StaticValuesRepresentValidValues()
        {
            AccountClass accountClassResidential     = AccountClass.Residential;
            AccountClass accountClassSmallCommercial = AccountClass.SmallCommercial;
            AccountClass accountClassLargeCommercial = AccountClass.LargeCommercial;

            Console.WriteLine(accountClassResidential.Name);
            Console.WriteLine(accountClassSmallCommercial.Name);
            Console.WriteLine(accountClassLargeCommercial.Name);
        }
Exemplo n.º 31
0
        public ActionResult AddAccountClass(AccountClass model)
        {
            _financialService.AddAccountClass(new AccountClass()
            {
                Name          = model.Name,
                NormalBalance = model.NormalBalance,
            });

            return(RedirectToAction("ViewAccountClass"));
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        objVisitlogClass = new VisitlogClass(objSqlConn.OpenConnection());
        objAccountClass = new AccountClass(objSqlConn.sqlConnection);

        if (Membership.GetUser() != null)
        {
            IsUserLoggedOn = true;
            gsUserName = Membership.GetUser().UserName;
            //Response.Write(">> " + gsUserName + "<BR>");
        }

        if (!IsPostBack)
        {
            checkVariables();
        }
    }
Exemplo n.º 33
0
    protected void Page_Load(object sender, EventArgs e)
    {
        MembershipUser currentUser = Membership.GetUser();
        if (!AppLib.IsLoggedinSessionExists() || currentUser == null)
            Response.Redirect(AppConfig.GetBaseSiteUrl() + "Welcome/main_frame.aspx", true);

        objSqlConnClass.OpenConnection();

        AccountClass objAccountClass;
        objAccountClass = new AccountClass(objSqlConnClass.sqlConnection);
        BackofficeClass objBackOfficeClass;
        objBackOfficeClass = new BackofficeClass(objSqlConnClass.sqlConnection);

        #region Insert visited log details

        //AppLib.InsertVisitedSectionDetails("Dashboard Page");

        #endregion

        DataSet DS = objBackOfficeClass.Mem_GET_UserInfo(currentUser.UserName);
        if (DS != null)
        {
            if (DS.Tables[0].Rows.Count > 0)
            {
                if (DS.Tables[0].Rows[0]["ROLENAME"].ToString().Equals("User"))
                {
                    if (DS.Tables[0].Rows[0]["strRiskStratificationProcessStep"].ToString().Equals(string.Empty) || DS.Tables[0].Rows[0]["strRiskStratificationProcessStep"].ToString() != "6")
                    {
                        DS = null;
                        Response.Redirect(AppConfig.GetBaseSiteUrl() + "Users/RiskStratificationProcessStep1.aspx?id=" + AppLib.Encrypt(currentUser.UserName), true);
                    }
                }
            }
        }

        DS = null;

        objTemplateClass = new TemplateClass(objSqlConnClass.sqlConnection);

        objPALClass = new PALClass(objSqlConnClass.sqlConnection);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        objBackOfficeClass = new BackofficeClass(objSqlConnClass.OpenConnection());
        objAccountClass = new AccountClass(objSqlConnClass.sqlConnection);

        if (!IsPostBack)
        {
            fillOutForm();

            {
                rbAccessFalse.Enabled = false;
                rbAccessTrue.Enabled = false;

                rbRoleAdministrator.Enabled = false;
                rbRoleUser.Enabled = false;

                rbRoleAdministrator.Checked = false;
                rbRoleUser.Checked = false;

                if (gbUserMode)     // no userName, get it now
                {
                    //hide things
                    spRole.Style.Add("display", "none");
                    spAccess.Style.Add("display", "none");
                }
                else
                {
                    spAccess.Style.Add("display", "none");
                }
            }
        }
        else
        {
            gsUserID = ViewState["gsUserID"].ToString();
        }
        if (!gbUserMode)
        {
            lblChangePassword.Text = "<a>Reset to a temp password</a>";//<a> is kept in for css reasons
        }
        lblError.Text = "";
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        objPALClass = new PALClass(objSqlConnClass.OpenConnection());
        gsUserID = Membership.GetUser().ProviderUserKey.ToString();

        MembershipUser currentUser = Membership.GetUser();
        if (!AppLib.IsLoggedinSessionExists() || currentUser == null)
            Response.Redirect(AppConfig.GetBaseSiteUrl() + "Welcome/main_frame.aspx", true);

        AccountClass objAccountClass;
        objAccountClass = new AccountClass(objSqlConnClass.sqlConnection);
        BackofficeClass objBackOfficeClass;
        objBackOfficeClass = new BackofficeClass(objSqlConnClass.OpenConnection());

        #region Insert visited log details

        AppLib.InsertVisitedSectionDetails("Dashboard Page");

        #endregion

        DataSet DS = objBackOfficeClass.Mem_GET_UserInfo(currentUser.UserName);
        if (DS != null)
        {
            if (DS.Tables[0].Rows.Count > 0)
            {
                if (DS.Tables[0].Rows[0]["ROLENAME"].ToString().Equals("User"))
                {
                    if (DS.Tables[0].Rows[0]["strRiskStratificationProcessStep"].ToString().Equals(string.Empty) || DS.Tables[0].Rows[0]["strRiskStratificationProcessStep"].ToString() != "6")
                    {
                        DS = null;
                        Response.Redirect(AppConfig.GetBaseSiteUrl() + "Users/RiskStratificationProcessStep1.aspx?id=" + AppLib.Encrypt(currentUser.UserName), true);
                    }
                }
            }
        }
        BindNutritionalJournal();
        DS = null;

        objTemplateClass = new TemplateClass(objSqlConnClass.OpenConnection());

        int ileftMargin = 0;
        string sTriangleImg = "triangle1.jpg";
        int iMET = 0;
        string sLastWorkout = "";
        DataSet entries = objPALClass.PAL_GET_PalEntries_BY_UserId(gsUserID, "", "");
        foreach (DataRow DR in entries.Tables[0].Rows)
        {
            iMET += Convert.ToInt32(DR["MET_EQUIVALENT"]);
            sLastWorkout = DR["PAL_ENTRY_DATE"].ToString();
        }
        labelLastWorkout.Text = sLastWorkout;

        iMET = 100;
        // 0
        if (iMET <= 0)
        {
            ileftMargin = 7;
            sTriangleImg = "triangle1.jpg";
        }
        // 1
        else if (iMET <= 100)
        {
            ileftMargin = 32;
            sTriangleImg = "triangle1.jpg";
        }
        // 2
        else if (iMET <= 200)
        {
            ileftMargin = 52;
            sTriangleImg = "triangle2.jpg";
        }
        // 3
        else if (iMET <= 300)
        {
            ileftMargin = 72;
            sTriangleImg = "triangle3.jpg";
        }
        // 4
        else if (iMET <= 400)
        {
            ileftMargin = 92;
            sTriangleImg = "triangle4.jpg";
        }
        // 5
        else if (iMET <= 500)
        {
            ileftMargin = 112;
            sTriangleImg = "triangle5.jpg";
        }
        // 6
        else if (iMET <= 600)
        {
            ileftMargin = 132;
            sTriangleImg = "triangle6.jpg";
        }
        // 7
        else if (iMET <= 700)
        {
            ileftMargin = 152;
            sTriangleImg = "triangle7.jpg";
        }
        // 8
        else if (iMET <= 800)
        {
            ileftMargin = 172;
            sTriangleImg = "triangle8.jpg";
        }
        // 9
        else if (iMET <= 900)
        {
            ileftMargin = 192;
            sTriangleImg = "triangle9.jpg";
        }
        // 10
        else if (iMET > 900)
        {
            ileftMargin = 212;
            sTriangleImg = "triangle10.jpg";
        }
        literalTriangle.Text = "<img style='margin-left:20px;' src='" + AppConfig.GetBaseSiteUrl() + "Images/dashboard/" + sTriangleImg + "' />";
        literalMetsMarker.Text = "<div style='width:30px;margin-left:" + ileftMargin.ToString() + "px;margin-top:-7px;font-weight:bold;font-size:larger;font-color:Black;text-align:center;line-height:80%'>&#9650;<br />" + iMET.ToString() + "</div>";

        getActivitiesData();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        /*   Membership.CreateUser("*****@*****.**", "abcabsf","*****@*****.**");*/
        Session["popup"] = true;

        objBackofficeClass = new BackofficeClass(objSqlConnClass.OpenConnection());
        objAccountClass = new AccountClass(objSqlConnClass.sqlConnection);

        if (!IsPostBack)
        {
            TextBox UserName = (TextBox)Login1.FindControl("UserName");
            TextBox Password = (TextBox)Login1.FindControl("Password");
            CheckBox cbRememberMe = (CheckBox)Login1.FindControl("cbRememberMe");

            UserName.Focus();

            HttpCookie cookie = Request.Cookies["RememberMe"];
            if (cookie != null)
            {
                // Response.Write("COOKIES");

                //git test
                string emailID = cookie.Values["Email"].ToString();
                UserName.Text = emailID;
                cbRememberMe.Checked = true;
                Password.Focus();
            }
        }
    }