Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            using (ZakahEntities db = new ZakahEntities())
            {
                try
                {
                    User _user = db.Users.FirstOrDefault(x => (x.username == txtusername.Text) && (x.password == txtPassword.Text));
                    if (null != _user)
                    {
                        if (_user.id > 0)
                        {
                            // log in
                            this.DialogResult = DialogResult.OK;
                            this.Close();
                        }
                    }
                    else
                    {
                        MessageBox.Show("حاول مرة اخرى");
                    }

                }
                catch
                {
                    this.DialogResult = DialogResult.Cancel;
                    this.Close();
                }

            }
        }
Example #2
0
        public FamilyPhoneBook(long FamiyID)
        {
            using (ZakahEntities db = new ZakahEntities())
            {
                FamilyPerson currentFamilyPerson = db.FamilyPersons.FirstOrDefault(x => x.id == FamiyID);
                this.Husbandid = currentFamilyPerson.Husbandid;
                this.wifeid = currentFamilyPerson.wifeid;
                this.ChildBelow18 = currentFamilyPerson.childnumunder18;
                this.ChildNumup18 = currentFamilyPerson.childNumabove18;
                this.FamilyIncom = currentFamilyPerson.Income;
                this.street = currentFamilyPerson.street;
                this.HomeNumber = currentFamilyPerson.HomeNumber;
                this.Telephone = currentFamilyPerson.Telephone;
                this.cellnumber = currentFamilyPerson.cellnumber;

                Person husbbund = db.Persons.FirstOrDefault(x => x.IDnum == this.Husbandid);
                if (null != husbbund)
                {
                    this.HusbundFullName = husbbund.FirstName + " " + husbbund.FatherName + " " + husbbund.LastName + " #" + husbbund.IDnum;
                    this.FamilyName = husbbund.LastName;

                }
                husbbund = db.Persons.FirstOrDefault(x => x.IDnum == this.wifeid);
                if (null != husbbund)
                {
                    this.WifeFullName = husbbund.FirstName + " " + husbbund.FatherName + " " + husbbund.LastName + " #" + husbbund.IDnum;
                    if (string.IsNullOrEmpty(this.FamilyName))
                    {
                        this.FamilyName = husbbund.LastName;
                    }

                }
            }
        }
Example #3
0
        public ReportPhoneByFamily()
        {
            InitializeComponent();
            using (ZakahEntities db = new ZakahEntities())
            {

                foreach (var item in db.Persons.Take(1000))
                {
                    FamilyCollection.Add(item.LastName);

                }
                foreach (var item in db.FamilyPersons.Take(1000))
                {
                    StreetCollection.Add(item.street);
                }

            }
            textBox1.AutoCompleteMode = AutoCompleteMode.Suggest;
            textBox1.AutoCompleteSource = AutoCompleteSource.CustomSource;
            textBox1.AutoCompleteCustomSource = FamilyCollection;

            textStreet.AutoCompleteMode = AutoCompleteMode.Suggest;
            textStreet.AutoCompleteSource = AutoCompleteSource.CustomSource;
            textStreet.AutoCompleteCustomSource = StreetCollection;

            //    dtGridFamilyProjectHistory.AutoGenerateColumns = false;

             //   dtGridFamilyProjectHistory.Columns.Add("sum", "مجموع  ");
        }
Example #4
0
 public FamilyPersonAdd()
 {
     InitializeComponent();
     ZakahEntities db = new ZakahEntities();
     IQueryable<City> query = db.Cities.Where(x => x.ID != 0);
     drpCity.DataSource = query;
     drpCity.DisplayMember = "City1";
     drpCity.ValueMember = "ID";
 }
Example #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            // validate inputs
            // add inputs to database

               // FamilyPerson _family = new FamilyPerson();
            ZakahEntities db = new ZakahEntities();
            Person _currentPerson = new Person();
            FamilyPerson newFamilyRelation = new FamilyPerson();

            newFamilyRelation.Husbandid = txtHusbandid.Text;
            newFamilyRelation.wifeid = txtwifeid.Text;
            newFamilyRelation.street = txtStreet.Text;
            newFamilyRelation.CityID = Convert.ToInt32(drpCity.SelectedValue);
            newFamilyRelation.HomeNumber = txtHomeNum.Text;
            newFamilyRelation.POBOX = txtPOBOX.Text;
            newFamilyRelation.mikod = Convert.ToInt32(txtMikod.Text);
            newFamilyRelation.Telephone = txtTelephone.Text;
            newFamilyRelation.cellnumber = txtCell.Text;
            newFamilyRelation.childnumunder18 = Convert.ToInt32(txtChildesUnder18.Text);
            newFamilyRelation.childNumabove18 = Convert.ToInt32(txtChiledabove18.Text);
            newFamilyRelation.workType = txtWork.Text;
            newFamilyRelation.Income = Convert.ToInt32(txtIncome.Text);
            if (string.Empty != txtOjra.Text)
            {
                newFamilyRelation.Mashkanta_Ojra = Convert.ToInt32(txtOjra.Text);
            }
            newFamilyRelation.ownHouse = chkOwnHouse.Checked;

            db.AddToFamilyPersons(newFamilyRelation);
            db.SaveChanges();

            /*db.SaveChanges();*/
            _currentPerson.FamilyID = newFamilyRelation.id;
            _currentPerson.IDnum = txtHusbandid.Text;
            _currentPerson.FirstName = txtHusFirstname.Text;
            _currentPerson.FatherName = txtHusFatherName.Text;
            _currentPerson.LastName = txtHusFamily.Text;
            db.AddToPersons(_currentPerson);

            _currentPerson = new Person();
            _currentPerson.FamilyID = newFamilyRelation.id;
            _currentPerson.IDnum = txtwifeid.Text;
            _currentPerson.FirstName = txtWifeFirstname.Text;
            _currentPerson.FatherName = txtWifeFatherName.Text;
            _currentPerson.LastName = txtWifeFamily.Text;
            db.AddToPersons(_currentPerson);
            db.AddToPersons(_currentPerson);
            db.SaveChanges();

            btnAddFamily.Enabled =false;
            MessageBox.Show("تم اضافة العائلة بنجاح");
            // we should add id number for husband and wife
            //  this.FillGridMySites(this.oMySites.GetDataList(tblMySitesDB.lists.All, tblMySitesDB.Where.None, tblMySitesDB.Order.ByID));
        }
Example #6
0
        private void RenderReport(moslemFamilyProject moslemFamilyProject)
        {
            List<PersonsInProjects> allFamiliesinProj=new List<PersonsInProjects>();
            ZakahEntities db = new ZakahEntities();
            var query  = from p in db.moslemFamilyProjects.Where(x => (x.date >= dateFrom.Value) && (x.date <= dateTo.Value))
                         select p;
               List<moslemFamilyProject> allprj = query.ToList<moslemFamilyProject>();
               foreach (moslemFamilyProject item in allprj)
               {
                   PersonsInProjects _personinproject = new PersonsInProjects(item.familyID);
                   _personinproject.date = Convert.ToDateTime(item.date).ToString("M/d/yyyy");

                   _personinproject.Amount = item.amount;
                   _personinproject.Titleamount = "المبلغ";
                  // _personinproject.ProjectName = comboBox1.Text;
                   allFamiliesinProj.Add(_personinproject);
               }

               this.reportViewer1.LocalReport.DataSources.Clear();
               this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet_PersoninFamily", allFamiliesinProj));
               ReportParameter p1 = new ReportParameter("DateFrom", dateFrom.Value.ToString("mm/dd/yyyy"));
               ReportParameter p2 = new ReportParameter("DateTo", dateTo.Value.ToString("mm/dd/yyyy"));
               ReportParameter p3 = new ReportParameter("project", comboBox1.Text);

               reportViewer1.LocalReport.SetParameters(new ReportParameter[] { p1, p2, p3 });
               reportViewer1.Visible = true;
               this.reportViewer1.RefreshReport();
        }
Example #7
0
        private void RenderReport(HomeFixesProject homeFixesProject)
        {
            List<PersonsInProjects> allFamiliesinProj = new List<PersonsInProjects>();
            ZakahEntities db = new ZakahEntities();
            var query = from p in db.HomeFixesProjects.Where(x => (x.date >= dateFrom.Value) && (x.date <= dateTo.Value))
                        select p;
            List<HomeFixesProject> allprj = query.ToList<HomeFixesProject>();
            foreach (HomeFixesProject item in allprj)
            {
                PersonsInProjects _personinproject = new PersonsInProjects(item.familyID);
                _personinproject.date = Convert.ToDateTime(item.date).ToString("M/d/yyyy");
                _personinproject.Amount = item.amount ;
                          _personinproject.Titleamount = "مبلغ الترميم";
                 _personinproject.AdditionalData+= "عدد الغرف :"+ item.RoomNumbers +"\n";
                 _personinproject.AdditionalData += " احتياجات الترميم :" + item.Tarmimdemands + "\n";
                 _personinproject.AdditionalData += "  تكاليف الترميم :" + item.TarmimTakalef + "\n";
                 _personinproject.AdditionalData += "   ملاحظات :" + item.Note + "\n";
                // _personinproject.ProjectName = comboBox1.Text;
                allFamiliesinProj.Add(_personinproject);
            }

            this.reportViewer1.LocalReport.DataSources.Clear();
            this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet_PersoninFamily", allFamiliesinProj));
            ReportParameter p1 = new ReportParameter("DateFrom", dateFrom.Value.ToString("mm/dd/yyyy"));
            ReportParameter p2 = new ReportParameter("DateTo", dateTo.Value.ToString("mm/dd/yyyy"));
            ReportParameter p3 = new ReportParameter("project", comboBox1.Text);

            reportViewer1.LocalReport.SetParameters(new ReportParameter[] { p1, p2, p3 });
            reportViewer1.Visible = true;
            this.reportViewer1.RefreshReport();
        }
        private void RenderReport(SchoolBagsProject schoolBagsProject)
        {
            List<PersonsInProjects> allFamiliesinProj = new List<PersonsInProjects>();
            ZakahEntities db = new ZakahEntities();
            var query = from p in db.SchoolBagsProjects.Where(x => (x.date >= dateFrom.Value) && (x.date <= dateTo.Value))
                        select p;
            string MasrofSummary = string.Empty;
            long? sum = query.Sum(x => x.amount);
            MasrofSummary = "عدد الحقائب التي وزعت بين هذه التواريخ : " + sum.ToString();

            List<SchoolBagsProject> allprj = query.ToList<SchoolBagsProject>();
            foreach (SchoolBagsProject item in allprj)
            {
                PersonsInProjects _personinproject = new PersonsInProjects(item.familyID);
                _personinproject.date = Convert.ToDateTime(item.date).ToString("M/d/yyyy");
                _personinproject.Amount = item.amount;
                _personinproject.Titleamount = "عدد الحقائب";
                // _personinproject.ProjectName = comboBox1.Text;
                allFamiliesinProj.Add(_personinproject);
            }

            this.reportViewer1.LocalReport.DataSources.Clear();
            this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet_PersoninFamily", allFamiliesinProj));
            ReportParameter p1 = new ReportParameter("DateFrom", dateFrom.Value.ToString("mm/dd/yyyy"));
            ReportParameter p2 = new ReportParameter("DateTo", dateTo.Value.ToString("mm/dd/yyyy"));
            ReportParameter p3 = new ReportParameter("project", comboBox1.Text);
            ReportParameter p4 = new ReportParameter("MasrofSummary", MasrofSummary);

            reportViewer1.LocalReport.SetParameters(new ReportParameter[] { p1, p2, p3,p4 });
            reportViewer1.Visible = true;
            this.reportViewer1.RefreshReport();
        }
Example #9
0
        void txtHusbandid_Leave(object sender, System.EventArgs e)
        {
            // check if there is id like that at table FamilyPerson
            //if have a relation in family person then
            bool isthereahusbandinsystem = false;
            if (txtHusbandid.Text.Length > 8)
            {
               //isthereahusbandinsystem= this.oPerson.ExisPersonByIDnumber(txtid.Text);

               ZakahEntities db = new ZakahEntities();
               var familyrelation = db.FamilyPersons.FirstOrDefault(x => (x.Husbandid == txtHusbandid.Text) || (x.wifeid == txtHusbandid.Text));
               if (null!= familyrelation)
               {
                   isthereahusbandinsystem = true;
               }
               else
               {
                   isthereahusbandinsystem = false;

               }
            }

            if (isthereahusbandinsystem)
            {
                //  isthereahusbandinsystem
                MessageBox.Show("تفاصيل الزوج موجودة .لا يمكن اضافة شخص اكثر من مرة");
                // clear id
                txtHusbandid.Text = string.Empty;
                txtwifeid.Focus();

            }
        }
Example #10
0
        void txtWifeId_Leave(object sender, System.EventArgs e)
        {
            // check if there is id like that at table FamilyPerson
            //if have a relation in family person then
            bool isthereahusbandinsystem = false;
            if (txtwifeid.Text.Length > 8)
            {

                ZakahEntities db = new ZakahEntities();
                var familyrelation = db.FamilyPersons.FirstOrDefault(x => (x.Husbandid == txtwifeid.Text) || (x.wifeid == txtHusbandid.Text));
                if (null != familyrelation)
                {
                    isthereahusbandinsystem = true;
                }
                else
                {
                    isthereahusbandinsystem = false;

                }
            }

            if (isthereahusbandinsystem)
            {
                //  isthereahusbandinsystem
                MessageBox.Show(" الزوج موجود وتابع لعاءلة اخرى");
                // clear id
                txtwifeid.Text = string.Empty;
                txtwifeid.Focus();

            }
        }
Example #11
0
        private void RenderReport(moslemFamilyProject moslemFamilyProject)
        {
            List<FamilyPerson> allFamiliesinProj=new List<FamilyPerson>();
            List<Person> allprj=new List<Person>();
            ZakahEntities db = new ZakahEntities();

            var query = from f in db.FamilyPersons.Where(x => x.street.StartsWith(textStreet.Text))
                        join p in db.Persons.Where(x => (x.LastName.StartsWith(textBox1.Text))) on f.id equals p.FamilyID
                        select new { f.street, p.FamilyID, p.IDnum, f.Husbandid, f.wifeid, f.cellnumber, f.Telephone, p.LastName, f.HomeNumber };
            if (!string.IsNullOrEmpty(textBox1.Text) && string.IsNullOrEmpty(textStreet.Text))
            {
            // search by both;
                query = from f in db.FamilyPersons
                        join p in db.Persons.Where(x => (x.LastName.StartsWith(textBox1.Text))) on f.id equals p.FamilyID
                        select new { f.street, p.FamilyID, p.IDnum, f.Husbandid, f.wifeid, f.cellnumber, f.Telephone, p.LastName, f.HomeNumber };

            }
            if (string.IsNullOrEmpty(textBox1.Text) && !string.IsNullOrEmpty(textStreet.Text))
            {
                // search by both;
                query = from f in db.FamilyPersons.Where(x => x.street.StartsWith(textStreet.Text))
                        join p in db.Persons on f.id equals p.FamilyID
                        select new { f.street, p.FamilyID, p.IDnum, f.Husbandid, f.wifeid, f.cellnumber, f.Telephone, p.LastName, f.HomeNumber };

            }

            if (!string.IsNullOrEmpty(textBox1.Text) && !string.IsNullOrEmpty(textStreet.Text))
            {
                // search by both;
                query = from f in db.FamilyPersons.Where(x => x.street.StartsWith(textStreet.Text))
                        join p in db.Persons.Where(x => (x.LastName.StartsWith(textBox1.Text))) on f.id equals p.FamilyID
                        select new { f.street, p.FamilyID, p.IDnum, f.Husbandid, f.wifeid, f.cellnumber, f.Telephone, p.LastName, f.HomeNumber };
               ;

            }

            var query2 = from a in query
                         group a by a.FamilyID into newfamily
                         select new
                         {
                             PostalCode = newfamily.Key,
                             newfamily = newfamily
                         };

             foreach (var item1 in query2)
                {
                    foreach (var item in item1.newfamily)
                    {
                        FamilyPerson currentFamilyPerson = db.FamilyPersons.FirstOrDefault(x => (x.Husbandid == item.IDnum) || (x.wifeid == item.IDnum));
                        FamilyPhoneBook _familyDetails = new FamilyPhoneBook(currentFamilyPerson.id);
                        // _familyDetails.date = Convert.ToDateTime(item.date).ToString("M/d/yyyy");
                        //   _familyDetails.Amount = item.amount;
                        _familyDetails.Titleamount = "مبلغ الترميم";
                        //_familyDetails.AdditionalData += "عدد الغرف :" + item.RoomNumbers + "\n";
                        //_familyDetails.AdditionalData += " احتياجات الترميم :" + item.Tarmimdemands + "\n";
                        //_familyDetails.AdditionalData += "  تكاليف الترميم :" + item.TarmimTakalef + "\n";
                        //_familyDetails.AdditionalData += "   ملاحظات :" + item.Note + "\n";
                        // _personinproject.ProjectName = comboBox1.Text;
                        allFamiliesinProj.Add(_familyDetails);
                        break;
                    }

                }

            this.reportViewer1.LocalReport.DataSources.Clear();
            this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet_PersoninFamily", allFamiliesinProj));
            //ReportParameter p1 = new ReportParameter("DateFrom", dateFrom.Value.ToString("mm/dd/yyyy"));
            //ReportParameter p2 = new ReportParameter("DateTo", dateTo.Value.ToString("mm/dd/yyyy"));
            //ReportParameter p3 = new ReportParameter("project", comboBox1.Text);
            //ReportParameter p4 = new ReportParameter("MasrofSummary", MasrofSummary);

            //reportViewer1.LocalReport.SetParameters(new ReportParameter[] { p1, p2, p3, p4 });
            reportViewer1.Visible = true;
            this.reportViewer1.RefreshReport();
        }