Ejemplo n.º 1
0
        public int calculate(long id)

        {
            int sum1 = 0;

            db = new PersonelDBContext();
            List <Rest> rests2 = db.Rests.Where(x => x.RestType == "إجازة بلا أجر" && x.PersonId == id).ToList();

            foreach (Rest r in rests2)
            {
                if (r.Period == "يوم")
                {
                    sum1 += r.RestPeriod;
                }
                else if (r.Period == "شهر")
                {
                    sum1 += (r.RestPeriod * 30);
                }
                else if (r.Period == "سنة")
                {
                    sum1 += (r.RestPeriod * 360);
                }
            }
            return(sum1);
        }
Ejemplo n.º 2
0
        public UpdateTeacher(SelfCard s)
        {
            InitializeComponent();
            DataContext = s;


            db = new PersonelDBContext();
            List <string> workplaces = db.Works.Select(w => w.WorkPlace).ToList();

            workplace.ItemsSource = workplaces;
            emp = s;
            //List<string> ca = db.Jobs.Where(c => c.JobId > 89).Select(x=>x.Category).ToList();

            //firstname.Text = s.FirstName;
            //last.Text = s.LastName;
            //father.Text = s.FatherName;
            //mother.Text = s.MotherName;
            //sex.SelectedItem = s.Sex;
            //grade.ItemsSource = ca;

            List <string> cert = db.Certificates.Select(x => x.CertName).ToList();

            certificate.ItemsSource  = cert;
            certificate.SelectedItem = s.Certificate;
        }
Ejemplo n.º 3
0
        //جلب تاريخ المباشرة بالاعتماد على رقم الموظف
        public DateTime getbegining(long id)
        {
            db = new PersonelDBContext();
            DateTime direct = (DateTime)db.SelfCards.Where(x => x.PersonId == id).Select(m => m.BeginningDate).ToList().ElementAt(0);

            return(direct);
        }
Ejemplo n.º 4
0
        public Certificate_Add()
        {
            InitializeComponent();
            db = new PersonelDBContext();
            IEnumerable w = db.Certificates.Where(mw => mw.CertName != null).ToList();

            cert_grid.ItemsSource = w;
            cert.Text             = null;
        }
Ejemplo n.º 5
0
        public Work_Add()
        {
            InitializeComponent();
            db = new PersonelDBContext();
            IEnumerable w = db.Works.Where(mw => mw.WorkPlace != null).ToList();

            work_grid.ItemsSource = w;
            work.Text             = null;
        }
Ejemplo n.º 6
0
        public string getdata(long desId)
        {
            db = new PersonelDBContext();
            Decision des;

            des = (Decision)db.Decisions.Where(x => x.DecisionId == desId);
            string result = des.DecisionNumber + " " + des.DecisionType + " " + des.DecisionYear;

            return(result);
        }
Ejemplo n.º 7
0
        //private void grade_Selected(object sender, RoutedEventArgs e)
        //{
        //    db = new PersonelDBContext();
        //    db.Jobs.Load();

        //    string cat = grade.Text;
        //    List<Job> job_titles = db.Jobs.Where(x => x.Category.Contains(cat)).ToList();
        //    job.ItemsSource = job_titles.Select(x => x.JobTitle);
        //}

        private void grade_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            db = new PersonelDBContext();
            db.Jobs.Load();

            string     cat        = grade.Text;
            List <Job> job_titles = db.Jobs.Where(x => x.Category.Contains(cat)).ToList();

            job.ItemsSource = job_titles.Select(x => x.JobTitle);
        }
Ejemplo n.º 8
0
        public Statistics_Work()
        {
            InitializeComponent();
            PersonelDBContext db = new PersonelDBContext();


            List <string> certs = db.Certificates.Select(c => c.CertName).ToList();

            certificate.ItemsSource   = certs;
            certificate.SelectedIndex = 0;
        }
Ejemplo n.º 9
0
        public Statistics_emp()
        {
            InitializeComponent();
            PersonelDBContext db = new PersonelDBContext();


            List <string> workplaces = db.Works.Select(w => w.WorkPlace).ToList();

            workplace.ItemsSource   = workplaces;
            workplace.SelectedIndex = 0;
        }
Ejemplo n.º 10
0
        //حساب عدد سنوات الخدمة بالاعتماد على تاريخ المباشرة
        public int service_count(DateTime direct)
        {
            db = new PersonelDBContext();

            int reyear        = direct.Year;
            int nowyear       = DateTime.Now.Year;
            int service_years = nowyear - reyear;


            return(service_years);
        }
Ejemplo n.º 11
0
        public IEnumerable GetDele(long id)
        {
            db = new PersonelDBContext();


            IEnumerable query = (from p in db.Delegatings
                                 join d in db.Decisions on p.DecisionId equals d.DecisionId
                                 where p.PersonId == id && p.DelegatingReason == "الحصول على مؤهل علمي" && d.DecisionStatus != "قرار مطوي"
                                 select new { p.DecisionId, fu = (d.DecisionNumber + " " + d.DecisionType + " " + d.DecisionYear), p.DelegatingType, p.DelegatingReason, p.DelegatingStart, p.DelegatingEnd, p.PeriodNum, p.Notes, p.PeriodType, p.DelegatingCountry }).ToList();

            return(query);
        }
Ejemplo n.º 12
0
        private void grade_DropDownClosed(object sender, EventArgs e)
        {
            PersonelDBContext db = new PersonelDBContext();

            db.Jobs.Load();

            string     cat        = grade.Text;
            List <Job> job_titles = db.Jobs.Where(x => x.Category.Contains(cat)).ToList();

            job.ItemsSource   = job_titles.Select(x => x.JobTitle);
            job.SelectedIndex = 0;
        }
Ejemplo n.º 13
0
        public Add_Special_Bonus()
        {
            InitializeComponent();
            db = new PersonelDBContext();


            List <string> employ = db.SelfCards.Where(x => x.Salary == x.maxsalary && x.Status == "قائم على رأس عمله" && (x.Category == "الأولى" || x.Category == "الثانية")).Select(x => x.FirstName + " " + x.FatherName + " " + x.LastName).ToList();

            emp_list.ItemsSource = employ;


            Decision d = (Decision)DataContext;
        }
Ejemplo n.º 14
0
        public IEnumerable GetChange(long id)
        {
            db = new PersonelDBContext();


            IEnumerable query = (from c in db.FunctionalChanges
                                 join d in db.Decisions on c.DecisionId equals d.DecisionId
                                 where c.PersonId == id && d.DecisionStatus != "قرار مطوي"
                                 select new { c.DecisionId, fu = (d.DecisionNumber + " " + d.DecisionType + " " + d.DecisionYear), c.ChangeReasone, c.ChangeDate, c.Category, c.Status }).ToList();



            return(query);
        }
Ejemplo n.º 15
0
        //جلب جميع الاجازات
        public IEnumerable GetRests(long id)
        {
            db = new PersonelDBContext();

            IEnumerable query = (from r in db.Rests join d in db.Decisions on r.DecisionId equals d.DecisionId
                                 where r.PersonId == id && d.DecisionStatus != "قرار مطوي"
                                 select new { r.DecisionId, fu = (d.DecisionNumber + " " + d.DecisionType + " " + d.DecisionYear), r.RestType, r.RestPeriod, r.Period, r.RestStart, r.RestEnd, r.Attachment, r.Notes }).ToList();



            //List<Rest> query = db.Rests.Where(x => x.PersonId == id).ToList();).ToList

            return(query);
        }
Ejemplo n.º 16
0
        public IEnumerable GetSec(long id)
        {
            db = new PersonelDBContext();


            IEnumerable query = (from c in db.Secondments
                                 join d in db.Decisions on c.DecisionId equals d.DecisionId
                                 where c.PersonId == id && d.DecisionStatus != "قرار مطوي"
                                 select new { c.DecisionId, fu = (d.DecisionNumber + " " + d.DecisionType + " " + d.DecisionYear), c.SecondmentType, c.PeriodNum, c.PeriodType, c.SecondmentStart, c.SecondmentEnd, c.SecondmentPlace, c.Notes }).ToList();



            return(query);
        }
Ejemplo n.º 17
0
        public IEnumerable Getpun(long id)
        {
            db = new PersonelDBContext();


            IEnumerable query = (from p in db.Punishments
                                 join d in db.Decisions on p.DecisionId equals d.DecisionId
                                 where p.PersonId == id && d.DecisionStatus != "قرار مطوي"
                                 select new { p.DecisionId, fu = (d.DecisionNumber + " " + d.DecisionType + " " + d.DecisionYear), p.PunishmentType, p.Reason, p.StartDate, p.EndDate, p.Period, p.Notes, p.Discount }).ToList();



            return(query);
        }
Ejemplo n.º 18
0
        private void updat(object sender, RoutedEventArgs e)
        {
            Decision d = (Decision)DataContext;

            try
            {
                db = new PersonelDBContext();
                db.Decisions.Update(d);
                db.SaveChanges();
                MessageBox.Show("تم التعديل بنجاح");
                // this.Visibility = Visibility.Collapsed;
            }
            catch (Exception m)
            { MessageBox.Show("يوجد خطأ"); }
        }
Ejemplo n.º 19
0
        public AddPersonnel()
        {
            InitializeComponent();
            db = new PersonelDBContext();
            // Work w = new Work();

            List <string> workplaces = db.Works.Select(w => w.WorkPlace).ToList();

            workplace.ItemsSource   = workplaces;
            workplace.SelectedIndex = 0;
            List <string> cert = db.Certificates.Select(x => x.CertName).ToList();

            certificate.ItemsSource   = cert;
            certificate.SelectedIndex = 0;
        }
Ejemplo n.º 20
0
        public ShowTeacher(SelfCard s)
        {
            InitializeComponent();

            db          = new PersonelDBContext();
            DataContext = s;


            db = new PersonelDBContext();
            List <string> workplaces = db.Works.Select(w => w.WorkPlace).ToList();

            workplace.ItemsSource   = workplaces;
            workplace.SelectedValue = s.Workplace;
            emp = s;
        }
Ejemplo n.º 21
0
        private void show(object sender, RoutedEventArgs e)
        {
            try

            {
                PersonelDBContext dbc    = new PersonelDBContext();
                List <SelfCard>   selves = dbc.SelfCards.Where(x => x.Category == catecory.Text && x.Status == status.Text && x.JobTitle == job.Text).ToList();

                search_emp.ItemsSource = selves;
            }
            catch
            {
                MessageBox.Show(" خطأ اتصال بقاعدة البيانات");
            }
        }
Ejemplo n.º 22
0
        private void add_work(object sender, RoutedEventArgs e)
        {
            if (work.Text != null && work.Text != "")
            {
                Work new_work = new Work();
                new_work.WorkPlace = work.Text;

                db = new PersonelDBContext();
                db.Works.Add(new_work);
                db.SaveChanges();
                work.Text = null;
                MessageBox.Show("تمت الاضافة بنجاح");
                IEnumerable w = db.Works.Where(mw => mw.WorkPlace != null).ToList();
                work_grid.ItemsSource = w;
            }
        }
Ejemplo n.º 23
0
        public int getDelegate(long empID)
        {
            PersonelDBContext db = new PersonelDBContext();
            int period_sum       = 0;
            List <Delegating> dl = db.Delegatings.Where(x => x.PersonId == empID && x.DelegatingReason == "الحصول على مؤهل علمي").ToList();

            foreach (Delegating d in dl)
            {
                if (d.PeriodType == "سنة")
                {
                    period_sum = period_sum + (int)d.PeriodNum;
                }
            }

            return(period_sum);
        }
Ejemplo n.º 24
0
        private void add_certificate(object sender, RoutedEventArgs e)
        {
            if (cert.Text != null && cert.Text != "")
            {
                Certificate new_cert = new Certificate();
                new_cert.CertName = cert.Text;

                db = new PersonelDBContext();
                db.Certificates.Add(new_cert);
                db.SaveChanges();
                cert.Text = null;
                MessageBox.Show("تمت الاضافة بنجاح");
                IEnumerable w = db.Certificates.Where(mw => mw.CertName != null).ToList();
                cert_grid.ItemsSource = w;
            }
        }
Ejemplo n.º 25
0
        // عدد الاجازات الادارية المتبقية لموظف ما بالاعتماد على رقمه وعدد الاجازات الكلي المسموح به
        public int MinRest(int count, long id)
        {
            db = new PersonelDBContext();
            int         minrest = 0;
            int         days    = 0;
            int         now     = DateTime.Now.Year;
            List <Rest> rests   = db.Rests.Where(x => x.RestType == "إجازة ادارية" && x.RestStart.Value.Year == now && x.PersonId == id).ToList();


            foreach (Rest r in rests)
            {
                days += r.RestPeriod;
            }
            minrest = count - days;
            return(minrest);
        }
Ejemplo n.º 26
0
        public IEnumerable GetDelegations(long id)
        {
            PersonelDBContext db = new PersonelDBContext();

            db = new PersonelDBContext();

            IEnumerable query = (from r in db.Delegatings
                                 join d in db.Decisions on r.DecisionId equals d.DecisionId
                                 where r.PersonId == id
                                 select new { r.DecisionId, fu = (d.DecisionNumber + " " + d.DecisionType + " " + d.DecisionYear), r.DelegatingType, r.PeriodNum, r.PeriodType, r.DelegatingStart, r.DelegatingEnd, r.DelegatingReason, r.DelegatingCountry, r.Notes }).ToList();



            //List<Rest> query = db.Rests.Where(x => x.PersonId == id).ToList();).ToList

            return(query);
        }
Ejemplo n.º 27
0
        private void show(object sender, RoutedEventArgs e)
        {
            try

            {
                PersonelDBContext dbc = new PersonelDBContext();



                List <SelfCard> selves = dbc.SelfCards.Where(x => x.Sex == sex.Text && x.Religion == religion.Text).ToList();

                search_emp.ItemsSource = selves;
            }
            catch
            {
                MessageBox.Show(" خطأ اتصال بقاعدة البيانات");
            }
        }
Ejemplo n.º 28
0
        public Add_Tech_Bonus()
        {
            InitializeComponent();
            db = new PersonelDBContext();

            if (Login.currentUser.Rule == "معيد")
            {
                emp = (from p in db.SelfCards
                       where (p.Status == "قائم على رأس عمله" && p.Salary < p.maxsalary && (p.FileClass == "معيد"))
                       select p.FirstName + " " + p.FatherName + " " + p.LastName).ToList <string>();


                emplist.ItemsSource = emp;
            }
            if (Login.currentUser.Rule == "تدريسي")
            {
                emp = (from p in db.SelfCards
                       where (p.Status == "قائم على رأس عمله" && p.Salary < p.maxsalary && (p.FileClass == "تدريسي"))
                       select p.FirstName + " " + p.FatherName + " " + p.LastName).ToList <string>();


                emplist.ItemsSource = emp;
            }
            if (Login.currentUser.Rule == "فني")
            {
                emp = (from p in db.SelfCards
                       where (p.Status == "قائم على رأس عمله" && p.Salary < p.maxsalary && (p.FileClass == "فني"))
                       select p.FirstName + " " + p.FatherName + " " + p.LastName).ToList <string>();


                emplist.ItemsSource = emp;
            }

            else if (Login.currentUser.Rule == "admin")
            {
                emp = (from p in db.SelfCards
                       where (p.Status == "قائم على رأس عمله" && p.Salary < p.maxsalary && (p.FileClass == "تدريسي" || p.FileClass == "فني" || p.FileClass == "معيد"))
                       select p.FirstName + " " + p.FatherName + " " + p.LastName).ToList <string>();


                emplist.ItemsSource = emp;
            }
            Decision d = (Decision)DataContext;
        }
Ejemplo n.º 29
0
        public AddTeacher()
        {
            InitializeComponent();
            db = new PersonelDBContext();
            // Work w = new Work();

            List <string> workplaces = db.Works.Select(w => w.WorkPlace).ToList();

            workplace.ItemsSource   = workplaces;
            workplace.SelectedIndex = 0;
            List <string> ca = db.Jobs.Where(c => c.JobId > 89).Select(x => x.Category).Distinct().ToList();



            grade.ItemsSource = ca;
            List <string> cert = db.Certificates.Select(x => x.CertName).ToList();

            certificate.ItemsSource   = cert;
            certificate.SelectedIndex = 0;
        }
Ejemplo n.º 30
0
        public UpdateEmp(SelfCard s)
        {
            InitializeComponent();
            DataContext = s;


            db = new PersonelDBContext();
            List <string> workplaces = db.Works.Select(w => w.WorkPlace).ToList();

            workplace.ItemsSource = workplaces;
            emp = s;
            List <string> cert = db.Certificates.Select(x => x.CertName).ToList();

            certificate.ItemsSource  = cert;
            certificate.SelectedItem = s.Certificate;

            //firstname.Text = s.FirstName;
            //last.Text = s.LastName;
            //father.Text = s.FatherName;
            //mother.Text = s.MotherName;
            //sex.SelectedItem = s.Sex;
        }