public void Initialize_Page()
        {
            EditFlag = false;

            AccountNameTxt.Text = "";
            BalanceTxt.Text     = "";
            string date = DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day;

            DateTxt.Text = date;

            Sub_Account = new SubAccount();
            //  user = new User();

            AccountNoForSearchDrop.DataSource     = db.SubAccount.ToList().Where(o => o.MainAccount_id == 1101).ToList();//  Sub_Account.GetAllSubAccountStartBy(1101);
            AccountNoForSearchDrop.DataTextField  = "name";
            AccountNoForSearchDrop.DataValueField = "ID";
            AccountNoForSearchDrop.DataBind();

            //اسم المبيعات بيتاخد من ليس اليوزر
            SalesUesrId.DataSource     = db.AspUser.ToList(); // user.Get_AllUser();
            SalesUesrId.DataTextField  = "Username";
            SalesUesrId.DataValueField = "Id";
            SalesUesrId.DataBind();

            ClearIndxControls();
            setAccoutID();
            //CheckForPrivilage();
        }
        public void Initialize_Page()
        {
            AccountNameTxt.Text = "";
            BalanceTxt.Text     = "";
            EditFlag            = false;
            string date = DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day;

            DateTxt.Text = date;
            Sub_Account  = new SubAccount();

            AccountNoForSearchDrop.DataSource     = db.SubAccount.ToList().Where(s => s.MainAccount_id == 2103);// Sub_Account.GetAllSubAccountStartBy(2103);
            AccountNoForSearchDrop.DataTextField  = "name";
            AccountNoForSearchDrop.DataValueField = "ID";
            AccountNoForSearchDrop.DataBind();
            ClearIndxControls();
            setAccoutID();
            CheckForPrivilage();
        }
        public void Initialize_Page()
        {
            IndxPart.Visible = false;
            EditFlag         = false;
            string date = DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day;

            DateTxt.Text                 = date;
            AccountNameTxt.Text          = "";
            DateRow.Visible              = false;
            Main_Account                 = new MainAccount();
            Main_Account_List            = new List <MainAccount>();
            Sub_Account                  = new SubAccount();
            UpAccountDrop.DataSource     = GetAllMainStartBy(1, int.Parse(AccountLevelDrop.SelectedValue));
            UpAccountDrop.DataTextField  = "name";
            UpAccountDrop.DataValueField = "ID";
            UpAccountDrop.DataBind();

            Dictionary <int, string> AccountsDictionary = new Dictionary <int, string>();

            foreach (var M in db.MainAccount.ToList())
            {
                AccountsDictionary.Add(int.Parse(M.ID.ToString()), M.name);
            }
            foreach (var S in db.SubAccount.ToList())
            {
                AccountsDictionary.Add(int.Parse(S.ID.ToString()), S.name);
            }
            AccountNoForSearchDrop.DataSource     = AccountsDictionary;
            AccountNoForSearchDrop.DataTextField  = "Value";
            AccountNoForSearchDrop.DataValueField = "Key";
            AccountNoForSearchDrop.DataBind();
            RootDrop.SelectedIndex         = 0;
            AccountLevelDrop.SelectedIndex = 0;
            AccountTypeDrop.SelectedIndex  = 0;
            long AccountID = 1;

            try
            {
                if (int.Parse(AccountLevelDrop.SelectedValue) == 2)
                {
                    var up = int.Parse(RootDrop.SelectedValue);
                    AccountID = db.MainAccount.Where(ma => ma.UpAccount == up).Select(i => i.ID).Max() + 1;

                    UpAccountRow.Visible = false;
                }
                else
                {
                    var up = int.Parse(UpAccountDrop.SelectedValue);
                    AccountID = db.MainAccount.Where(ma => ma.UpAccount == up).Select(i => i.ID).Max() + 1;
                }

                AccountIDTxt.Text = AccountID.ToString();
                subAccountID      = int.Parse(AccountIDTxt.Text);
            }
            catch (Exception ex)
            {
            }
            if (int.Parse(AccountLevelDrop.SelectedValue) < 4)
            {
                AccountStateRow.Visible   = false;
                AccountBalanceRow.Visible = false;
            }
            else
            {
                AccountStateRow.Visible   = true;
                AccountBalanceRow.Visible = true;
            }

            //Fill Search Drop Down List
            FillSearchDropDown();
            ClearIndxControls();

            //CheckForPrivilage();
        }