Example #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            var ans = (from prog in dc.programs where prog.name == progNameTxt.Text select prog).FirstOrDefault();



            if (ans != null)
            {
                MessageBox.Show("התוכנית כבר קיימת במערכת");
            }
            else
            {
                program pr = new program(); //create new program record
                pr.name            = progNameTxt.Text;
                pr.start_date      = startDatedt.Value;
                pr.end_date        = endDatedt.Value;
                pr.frequency       = frequencyStr.Text;
                pr.comments        = commentsStr.Text;
                pr.program_details = detailsStr.Text;
                pr.program_type    = programTypeStr.Text;

                dc.programs.InsertOnSubmit(pr);
                dc.SubmitChanges();
            }
        }
Example #2
0
        private void saveButton_Click(object sender, EventArgs e)
        {
            Customer customerId = (from c in dc.Customers // get the record from the db
                                   where c.Id == Program.custId
                                   select c).FirstOrDefault();

            if (customerId != null)
            {
                customerId.independency  = indepependency.Text;//get values no need to check if null
                customerId.mobility      = mobility.Text;
                customerId.active_inclub = activeClub.Text;
                customerId.day_care      = dayCenter.Text;
                if (entitledDisctrue.Checked)
                {
                    customerId.entitled_todiscount = true;
                }
                else if (entitledDiscfalse.Checked)
                {
                    customerId.entitled_todiscount = false;
                }
                if (holocSurvtrue.Checked)
                {
                    customerId.holocaust_survaviour = true;
                }
                else if (holocSurvfalse.Checked)
                {
                    customerId.holocaust_survaviour = false;
                }
                if (nursLawtrue.Checked)
                {
                    customerId.nursing_law = true;
                }
                else if (nursLawfalse.Checked)
                {
                    customerId.nursing_law = false;
                }
                dc.SubmitChanges();


                if (foreignWorkerYes.Checked)
                {
                    customerId.foreign_worker = true;
                }
                else if (foreignWorkerYes.Checked)
                {
                    customerId.foreign_worker = false;
                }
            }
        }
Example #3
0
        //dataGridView1_CellContentClick


        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var senderGrid = (DataGridView)sender;

            if (e.ColumnIndex == senderGrid.Columns["AddProgram"].Index && e.RowIndex >= 0)
            {
                int index      = Convert.ToInt32(e.RowIndex);
                int programNum = int.Parse(dataGridView1.Rows[index].Cells[0].Value.ToString());
                var ans        = (from custprog in dc.customer_programs
                                  where
                                  custprog.customer_id == Program.custId && custprog.program_id == programNum
                                  select custprog).FirstOrDefault();



                if (ans != null)
                {
                    MessageBox.Show("מקבל השירות כבר שויך לתוכנית");
                }
                else
                {
                    MessageBox.Show(programNum.ToString());


                    customer_program cp = new customer_program(); //create new customer program record

                    cp.customer_id = Program.custId;
                    cp.program_id  = programNum;
                    cp.start_date  = DateTime.Now;
                    cp.end_date    = DateTime.Parse(dataGridView1.Rows[index].Cells[5].Value.ToString());
                    dc.customer_programs.InsertOnSubmit(cp);
                    dc.SubmitChanges();
                }
            }

            if (e.ColumnIndex == senderGrid.Columns["MoreInfo"].Index && e.RowIndex >= 0)
            {
                int index              = Convert.ToInt32(e.RowIndex);
                int programNum         = int.Parse(dataGridView1.Rows[index].Cells[0].Value.ToString());
                SearchResultsProgram f = new SearchResultsProgram();
                f.Show();
                this.Hide();
            }
        }
Example #4
0
        private void button2_Click(object sender, EventArgs e)
        {
            var ans = (from volunlist in dc.volunteers where volunlist.first_name == strFName.Text && volunlist.last_name == strLName.Text select volunlist).FirstOrDefault();


            if (ans != null)
            {
                MessageBox.Show("המתנדב כבר רשום במערכת");
            }
            else
            {
                volunteer vol = new volunteer(); //create new volunteer record
                vol.first_name    = strFName.Text;
                vol.last_name     = strLName.Text;
                vol.email_address = emailAdd.Text;
                vol.comments      = strComments.Text;
                vol.start_date    = startDate.Value;
                vol.end_date      = endDate.Value;
                dc.volunteers.InsertOnSubmit(vol);
                dc.SubmitChanges();
            }
        }
Example #5
0
        private void button2_Click(object sender, EventArgs e)
        {
            var customerId = (from c in dc.Customers // get the record from the db
                              where c.Id == Program.custId
                              select c).FirstOrDefault();

            if (customerId != null)
            {
                if (specialPName_str.Text == "" || specialPDetails_str.Text == "" || specialPType_str.Text == "")
                {
                    MessageBox.Show("לא מולאו כל שדות חובה");
                }
                else

                {
                    customer_sp_act spactivity = new customer_sp_act(); //create new customer special activity record

                    spactivity.activity_name    = specialPName_str.Text;
                    spactivity.activity_details = specialPDetails_str.Text;
                    spactivity.activity_type    = specialPType_str.Text;
                    spactivity.activity_status  = "פעיל";
                    spactivity.customer_id      = Program.custId;
                    if (qualificationTrue.Checked)
                    {
                        spactivity.qualification = true;
                    }

                    else if (qualificationfalse.Checked)
                    {
                        spactivity.qualification = false;
                    }

                    dc.customer_sp_acts.InsertOnSubmit(spactivity);
                    dc.SubmitChanges();
                }
            }
        }
Example #6
0
        private void button2_Click(object sender, EventArgs e)
        {
            var customerId = (from c in dc.Customers // get the record from the db
                              where c.Id == Program.custId
                              select c).FirstOrDefault();

            if (customerId != null)
            {
                contact cont = new contact(); //create new customer contact record of family type
                cont.first_name = strFName.Text;
                cont.last_name  = strLName.Text;
                dc.contacts.InsertOnSubmit(cont);
                dc.SubmitChanges();

                phone ph = new phone(); //create new phone record
                if (phoneNumM.Text != "" && areaCodeM.Text != "")
                {
                    ph.phone_type = "נייד";
                    ph.area_code  = areaCodeM.Text;
                    ph.phone_num  = phoneNumM.Text;
                    dc.phones.InsertOnSubmit(ph);
                    //   dc.SubmitChanges();
                }

                dc.SubmitChanges();

                if (ph != null)
                {
                    contact_phone cph = new contact_phone();
                    cph.contact_id = cont.ID;
                    cph.phone_id   = ph.ID;
                    cph.status     = "פעיל";
                    cph.type       = ph.phone_type;
                    dc.contact_phones.InsertOnSubmit(cph);
                }


                dc.SubmitChanges();

                wh_address adr = new wh_address(); // new address record

                adr.city_name = cityName.Text;
                if (streetName.Text != "")
                {
                    adr.street_name = streetName.Text;
                }
                if (houseNum.Text != "")
                {
                    adr.house_num = int.Parse(houseNum.Text);
                }
                if (apartNum.Text != "")
                {
                    adr.appartment_num = int.Parse(apartNum.Text);
                }
                if (postCode.Text != "")
                {
                    adr.zip_code = postCode.Text;
                }
                dc.wh_addresses.InsertOnSubmit(adr);
                dc.SubmitChanges();

                contact_address contaddr = new contact_address();//new contact address record

                contaddr.contact_id = cont.ID;
                contaddr.address_id = adr.ID;
                contaddr.status     = "פעיל";
                dc.contact_addresses.InsertOnSubmit(contaddr);

                dc.SubmitChanges();

                customer_contact custcont = new customer_contact(); //add new contact to customer
                custcont.customer_id = Program.custId;
                custcont.contact_id  = cont.ID;
                custcont.type        = "מטפל ראשי";
                custcont.status      = "פעיל";
                dc.customer_contacts.InsertOnSubmit(custcont);
                dc.SubmitChanges();
            }
        }
Example #7
0
        private void InsertMedicalHistory_Click(object sender, EventArgs e)
        {
            var customerId = (from c in dc.Customers // get the record from the db
                              where c.Id == Program.custId
                              select c).FirstOrDefault();

            if (customerId != null)
            {
                if (Hearing_chkbox.Checked)
                {
                    customer_medical_history custmed = new customer_medical_history(); //create new customer medical history record
                    custmed.desease     = "שמיעה";
                    custmed.severity    = Severity_cbBox1.Text;
                    custmed.comments    = comments1.Text;
                    custmed.customer_id = Program.custId;
                    dc.customer_medical_histories.InsertOnSubmit(custmed);
                    dc.SubmitChanges();
                }

                if (Chronic__chkbox.Checked)
                {
                    customer_medical_history custmed = new customer_medical_history(); //create new customer medical history record
                    custmed.desease     = "מחלה כרונית";
                    custmed.severity    = Severity_cbBox2.Text;
                    custmed.comments    = comments2.Text;
                    custmed.customer_id = Program.custId;
                    dc.customer_medical_histories.InsertOnSubmit(custmed);
                    dc.SubmitChanges();
                }

                if (Vision__chkbox.Checked)
                {
                    customer_medical_history custmed = new customer_medical_history();
                    custmed.desease     = "ראיה";
                    custmed.severity    = Severity_cbBox3.Text;
                    custmed.comments    = comments3.Text;
                    custmed.customer_id = Program.custId;
                    dc.customer_medical_histories.InsertOnSubmit(custmed);
                    dc.SubmitChanges();
                }
                if (Demensia__chkbox.Checked)
                {
                    customer_medical_history custmed = new customer_medical_history();
                    custmed.desease     = "דמנציה";
                    custmed.severity    = Severity_cbBox4.Text;
                    custmed.comments    = comments4.Text;
                    custmed.customer_id = Program.custId;
                    dc.customer_medical_histories.InsertOnSubmit(custmed);
                    dc.SubmitChanges();
                }
                if (Parkinson__chkbox.Checked)
                {
                    customer_medical_history custmed = new customer_medical_history();
                    custmed.desease     = "פרקינסון";
                    custmed.severity    = Severity_cbBox5.Text;
                    custmed.comments    = comments5.Text;
                    custmed.customer_id = Program.custId;
                    dc.customer_medical_histories.InsertOnSubmit(custmed);
                    dc.SubmitChanges();
                }
                if (Other__chkbox.Checked)
                {
                    if (diffDeseaseNamestr.Text == "")
                    {
                        diffDeseaseNamestr.BackColor = Color.Red;
                        MessageBox.Show("נא למלא את שם המחלה");
                    }

                    else
                    {
                        customer_medical_history custmed = new customer_medical_history();
                        custmed.desease     = diffDeseaseNamestr.Text;
                        custmed.severity    = Severity_cbBox6.Text;
                        custmed.comments    = comments6.Text;
                        custmed.customer_id = Program.custId;
                        dc.customer_medical_histories.InsertOnSubmit(custmed);
                        dc.SubmitChanges();
                    }
                }

                AddCustomerPage2 f = new AddCustomerPage2();
                f.Show();
                this.Hide();
            }
        }
Example #8
0
        private void saveButton_Click(object sender, EventArgs e)
        {
            if (strId.Text == "" || strFName.Text == "" || strLName.Text == "" || dateofBirth.Value == DateTime.Now ||
                (!checkMale.Checked && !checkFemale.Checked) ||
                ((phoneNumH.Text == "" || areaCodeH.Text == "") && (phoneNumM.Text == "" || areaCodeM.Text == "")))
            {
                MessageBox.Show("לא מולאו כל שדות החובה");
                if (strId.Text == "")
                {
                    strId.BackColor = Color.Red; // color red if id is null
                }
                else
                {
                    strId.BackColor = Color.White;
                }

                if (strFName.Text == "")
                {
                    strFName.BackColor = Color.Red;// color red if first name is null
                }
                else
                {
                    strFName.BackColor = Color.White;
                }

                if (strLName.Text == "")
                {
                    strLName.BackColor = Color.Red;// color red if last name is null
                }
                else
                {
                    strLName.BackColor = Color.White;
                }

                if (dateofBirth.Value == DateTime.Now)
                {
                    dateofBirth.BackColor = Color.Red;
                }
                else
                {
                    dateofBirth.BackColor = Color.White;
                }

                if (!checkMale.Checked && !checkFemale.Checked)
                {
                    checkMale.BackColor   = Color.Red;
                    checkFemale.BackColor = Color.Red;
                }
                else
                {
                    checkMale.BackColor   = Color.White;
                    checkFemale.BackColor = Color.White;
                }
            }
            else
            {
                var ans = (from cust in dc.Customers where cust.Id == strId.Text select cust).FirstOrDefault();



                if (ans != null)
                {
                    MessageBox.Show("מקבל שירות כבר קיים במערכת");
                }
                else
                {
                    Customer cust = new Customer(); //create new customer record
                    cust.Id         = strId.Text;
                    cust.first_name = strFName.Text;
                    cust.last_name  = strLName.Text;
                    cust.birthdate  = dateofBirth.Value;
                    if (checkMale.Checked)
                    {
                        cust.gender = "זכר";
                    }
                    else
                    {
                        cust.gender = "נקבה";
                    }
                    cust.marital_status = maritalStatus.Text;
                    cust.comments       = strComments.Text;
                    cust.email_address  = emailAdd.Text;
                    cust.status_cd      = "פעיל";
                    dc.Customers.InsertOnSubmit(cust);
                    // dc.SubmitChanges();


                    phone ph = new phone(); //create new phone record
                    if (phoneNumH.Text != "" && areaCodeH.Text != "")
                    {
                        ph.phone_type = "בית";
                        ph.area_code  = areaCodeH.Text;
                        ph.phone_num  = phoneNumH.Text;
                        dc.phones.InsertOnSubmit(ph);
                        //  dc.SubmitChanges();
                    }
                    phone ph1 = new phone(); //create new phone record
                    if (phoneNumM.Text != "" && areaCodeM.Text != "")
                    {
                        ph1.phone_type = "נייד";
                        ph1.area_code  = areaCodeM.Text;
                        ph1.phone_num  = phoneNumM.Text;
                        dc.phones.InsertOnSubmit(ph1);
                        //   dc.SubmitChanges();
                    }

                    dc.SubmitChanges();

                    if (ph != null)
                    {
                        customer_phone cph = new customer_phone();
                        cph.customer_id = strId.Text;
                        cph.phone_id    = ph.ID;
                        cph.status      = "פעיל";
                        cph.type        = ph.phone_type;
                        dc.customer_phones.InsertOnSubmit(cph);
                    }

                    if (ph1 != null)
                    {
                        customer_phone cph1 = new customer_phone();
                        cph1.customer_id = strId.Text;
                        cph1.phone_id    = ph1.ID;
                        cph1.status      = "פעיל";
                        cph1.type        = ph1.phone_type;
                        dc.customer_phones.InsertOnSubmit(cph1);
                    }

                    dc.SubmitChanges();

                    wh_address adr = new wh_address(); // new address record

                    adr.city_name = cityName.Text;
                    if (streetName.Text != "")
                    {
                        adr.street_name = streetName.Text;
                    }
                    if (houseNum.Text != "")
                    {
                        adr.house_num = int.Parse(houseNum.Text);
                    }
                    if (apartNum.Text != "")
                    {
                        adr.appartment_num = int.Parse(apartNum.Text);
                    }
                    if (neighbName.Text != "")
                    {
                        adr.neighborhood = neighbName.Text;
                    }
                    if (postCode.Text != "")
                    {
                        adr.zip_code = postCode.Text;
                    }
                    dc.wh_addresses.InsertOnSubmit(adr);
                    dc.SubmitChanges();

                    customer_address custaddr = new customer_address();//new customer address record

                    custaddr.customer_id = strId.Text;
                    custaddr.address_id  = adr.ID;
                    custaddr.status      = "פעיל";
                    dc.customer_addresses.InsertOnSubmit(custaddr);

                    dc.SubmitChanges();


                    nextButton.Enabled = true;
                }
            }
        }