示例#1
0
        private void FinishBtn_Click(object sender, RoutedEventArgs e)
        {
            DateTime now = DateTime.Now.Date;

            role.Name                = "Super Admin";
            role.Description         = "this admin has all privilages and also must add new admins.";
            role.SuperAdminPrivilage = true;
            role.RoleCreationDate    = now;
            _context.Roles.Add(role);
            _context.SaveChanges();

            role.Name                = "Admin";
            role.Description         = "this admin has all privilages except store privilages. There can be multiple admins but all will have equal privilages.";
            role.SuperAdminPrivilage = role.StorePrivilage = false;
            role.RulePrivilage       = role.PaymentPrivilage = role.MemberPrivilage = role.EventPrivilage = true;
            role.RoleCreationDate    = now;
            _context.Roles.Add(role);
            _context.SaveChanges();

            role.Name                = "Store Keeper";
            role.Description         = "this admin has privilages involving the store management. There can be multiple store admins but all will have equal privilages.";
            role.RoleCreationDate    = now;
            role.StorePrivilage      = true;
            role.SuperAdminPrivilage = role.RulePrivilage = role.PaymentPrivilage = role.MemberPrivilage = role.EventPrivilage = false;
            _context.Roles.Add(role);
            _context.SaveChanges();

            _context.Abouts.Add(Edir);
            _context.SaveChanges();
        }
示例#2
0
 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     foreach (Member member in members)
     {
         member.AttendStatus          = false;
         _context.Entry(member).State = System.Data.Entity.EntityState.Modified;
         _context.SaveChanges();
     }
 }
示例#3
0
        private void AddBtn_Click(object sender, RoutedEventArgs e)
        {
            Sib.Name     = ChildName.Text.Trim();
            Sib.Phone    = Convert.ToInt64(Phone.Text.Trim());
            Sib.ParentId = SelParent;

            _context.Siblings.Add(Sib);
            _context.SaveChanges();
            Clear();
            refreshBtn_Click();
        }
示例#4
0
        private void AddBtn_Click(object sender, RoutedEventArgs e)
        {
            rule.Name                 = RuleName.Text.Trim();
            rule.Description          = Description.Text.ToString();
            rule.FirstFin             = Convert.ToDouble(FirstFin.Text);
            rule.SecondFin            = Convert.ToDouble(SecondFin.Text);
            rule.LastFin              = Convert.ToDouble(FinalFin.Text);
            rule.RuleRegistrationDate = DateTime.Now.Date;

            _context.Rules.Add(rule);
            _context.SaveChanges();
            SucessMessage sm = new SucessMessage();

            sm.MessageText.Text = "Registered Successfully";
            sm.Show();
        }
示例#5
0
        private void AddBtn_Click(object sender, RoutedEventArgs e)
        {
            Eve.Name  = EventName.Text.Trim();
            Eve.Place = EventPlace.Text.Trim();
            Eve.Fin   = Convert.ToDouble(EventFin.Text);
            Eve.date  = Convert.ToDateTime(EventDate.Text);
            //Eve.time = Convert.ToDateTime(EventTime.Text);
            Eve.Description = Description.Text.Trim();

            _context.EdirEvents.Add(Eve);
            _context.SaveChanges();
            SucessMessage sm = new SucessMessage();

            sm.MessageText.Text = "Registered Successfully";
            sm.Show();
        }
示例#6
0
 private void CreateRoleBtn_Click(object sender, RoutedEventArgs e)
 {
     role.Name                = RoleName.Text.Trim();
     role.Description         = Description.Text.ToString();
     role.EventPrivilage      = role.PaymentPrivilage = role.SuperAdminPrivilage = role.StorePrivilage =
         role.MemberPrivilage = false;
     if (MemberPrivilage.IsChecked.GetValueOrDefault())
     {
         role.MemberPrivilage = true;
     }
     if (EventPrivilage.IsChecked.GetValueOrDefault())
     {
         role.EventPrivilage = true;
     }
     if (PaymentPrivilage.IsChecked.GetValueOrDefault())
     {
         role.PaymentPrivilage = true;
     }
     if (StorePrivilage.IsChecked.GetValueOrDefault())
     {
         role.StorePrivilage = true;
     }
     role.RoleCreationDate = DateTime.Now.Date;
     _context.Roles.Add(role);
     _context.SaveChanges();
 }
示例#7
0
        private void RegBtn_Click(object sender, RoutedEventArgs e)
        {
            role.Name        = RoleName.Text.Trim();
            role.Description = Description.Text.Trim();

            _context.Roles.Add(role);
            _context.SaveChanges();
        }
示例#8
0
 public MainWindow()
 {
     InitializeComponent();
     Dash_view();
     //Create Db Context Instance
     _context = new EdirDbContext();
     _context.SaveChanges();
     Edir = _context.Abouts.FirstOrDefault();
 }
示例#9
0
        private void OkButton_Click(object sender, RoutedEventArgs e)
        {
            _context.Entry(Selected).State = System.Data.Entity.EntityState.Deleted;
            _context.SaveChanges();
            SucessMessage sm = new SucessMessage();

            sm.MessageText.Text = "Deleted Successfully";
            this.Hide();
            sm.Show();
        }
示例#10
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     if (Account.Password == PasswordBox.Password)
     {
         if (NewPass.Password == Confirm.Password)
         {
             Account.Password = NewPass.Password;
             _context.Entry(Account).State = System.Data.Entity.EntityState.Modified;
             _context.SaveChanges();
             SucessMessage sm = new SucessMessage();
             sm.MessageText.Text = "Password Changed";
             sm.Show();
         }
     }
 }
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     if (AccountRole == 2)
     {
         admins.RoleId           = Convert.ToInt64(RoleId.SelectedIndex);
         admins.Username         = Username.Text.Trim();
         admins.Password         = PasswordBox.ToString();
         admins.AdminUpgradeDate = DateTime.Now.Date;
         _context.UserAccounts.Add(admins);
         _context.SaveChanges();
         SucessMessage Sm = new SucessMessage();
         Sm.MessageText.Text = "Admin Added Successfully";
         Sm.Show();
     }
     else
     {
         ErrorMessage Sm = new ErrorMessage();
         Sm.MessageText.Text = "Access Denied";
         Sm.Show();
     }
 }
示例#12
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            List <Member> selectedMembers = new List <Member>();
            List <Pay>    pays            = new List <Pay>();
            Pay           pay             = new Pay();

            pays = _context.Payments.ToList();
            int checkBoxColum = 4;

            for (int i = 0; i < MemberDataGrid.Items.Count - 1; i++)
            {
                var  item = MemberDataGrid.Items[i];
                var  payStatusCheckbox = MemberDataGrid.Columns[checkBoxColum].GetCellContent(item) as CheckBox;
                var  stg = MemberDataGrid.Columns[0].GetCellContent(item) as TextBlock;
                long Id  = Convert.ToInt64(stg.Text);
                if ((bool)payStatusCheckbox.IsChecked)
                {
                    Member member = _context.Members.FirstOrDefault(m => m.Id == Id);
                    member.PayStatus = true;
                    pay.MemberId     = member.Id;
                    pay.PaidDate     = DateTime.Now.Date;
                    _context.Payments.Add(pay);
                    _context.Entry(member).State = System.Data.Entity.EntityState.Modified;
                    _context.SaveChanges();
                }
            }
            foreach (Member m in selectedMembers)
            {
                if (member.PayStatus == false)
                {
                    member.Debit += Amount;
                    _context.Entry(member).State = System.Data.Entity.EntityState.Modified;
                    _context.SaveChanges();
                }
            }

            Edir.Capital += (pays.Count() * Amount);
            _context.Entry(Edir).State = System.Data.Entity.EntityState.Modified;
            _context.SaveChanges();
        }
示例#13
0
        private void UpdateBtn_Click(object sender, RoutedEventArgs e)
        {
            Member SelectedMember = ((Member)MemGrid.SelectedItem);

            if (SelectedMember != null)
            {
                SelectedMember.FirstName  = MemName.Text.Trim();
                SelectedMember.LastName   = MemLastName.Text.Trim();
                SelectedMember.MotherName = MemMotherName.Text.Trim();
                SelectedMember.SubCity    = Subcity.Text;
                if (GenderBtn.IsChecked.GetValueOrDefault())
                {
                    SelectedMember.Gender = "Female";
                }
                else
                {
                    SelectedMember.Gender = "Male";
                }
                if (MarriageStat.IsChecked.GetValueOrDefault())
                {
                    SelectedMember.MariageStatus = true;
                }
                else
                {
                    SelectedMember.MariageStatus = false;
                }
                SelectedSubcity = Subcity.SelectedIndex;

                if (SelectedSubcity == 0)
                {
                    Mem.SubCity = "Arada";
                }
                else if (SelectedSubcity == 1)
                {
                    Mem.SubCity = "Akaki/Kality";
                }
                else if (SelectedSubcity == 2)
                {
                    Mem.SubCity = "Bole";
                }
                else if (SelectedSubcity == 3)
                {
                    Mem.SubCity = "Kolfe Keraniyo";
                }
                else if (SelectedSubcity == 4)
                {
                    Mem.SubCity = "Yeka";
                }
                else if (SelectedSubcity == 5)
                {
                    Mem.SubCity = "Gulele";
                }
                else if (SelectedSubcity == 6)
                {
                    Mem.SubCity = "Ledeta";
                }
                else if (SelectedSubcity == 7)
                {
                    Mem.SubCity = "Nefas Silk";
                }
                else if (SelectedSubcity == 8)
                {
                    Mem.SubCity = "Kirkos";
                }
                else if (SelectedSubcity == 9)
                {
                    Mem.SubCity = "Addis Ketema";
                }

                SelectedMember.Woreda       = Convert.ToInt64(Woreda.Text);
                SelectedMember.Kebele       = Convert.ToInt64(Kebele.Text);
                SelectedMember.HouseNummber = HouseNum.Text.Trim();
                SelectedMember.PhoneNumber  = Convert.ToInt64(Phone.Text);


                _context.Entry(SelectedMember).State = System.Data.Entity.EntityState.Modified;
                _context.SaveChanges();
            }
            ErrorMessage message = new ErrorMessage();

            message.SetContent("You have made an update");
            message.Show();
            Clear();
        }
示例#14
0
 private void AddItem_Click(object sender, RoutedEventArgs e)
 {
     totPrice = Convert.ToInt64(SinglePrice.Text.ToString());
     quan     = Convert.ToInt32(Quantity.Text);
     totPrice = quan * totPrice;
     if (edir.Capital >= totPrice)
     {
         item.Name          = ItName.Text.Trim();
         item.PurchasedDate = Convert.ToDateTime(PurchasedDate.Text.ToString());
         item.DamageFee     = Convert.ToDouble(DamageFee.Text);
         item.Quantity      = Convert.ToInt32(quan);
         item.DailyPayment  = Convert.ToDouble(DayPayment.Text);
         edir.Capital      -= totPrice;
         _context.Items.Add(item);
         _context.SaveChanges();
         _context.Entry(edir).State = System.Data.Entity.EntityState.Modified;
         _context.SaveChanges();
         SucessMessage sm = new SucessMessage();
         sm.MessageText.Text = "Registered Successfully";
         sm.Show();
     }
     else
     {
         ErrorMessage er = new ErrorMessage();
         er.MessageText.Text = "No Balance For This Amount";
         er.Show();
     }
 }