示例#1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            EDM.Invitation inv = new EDM.Invitation()
            {
                Name        = txtName.Text,
                Address     = txtAddress.Text,
                Phone       = txtPhone.Text,
                Nationality = txtNationality.Text,
                EmployeeID  = Convert.ToInt32(cmbEmployee.EditValue),
                TraineeID   = Convert.ToInt32(cmbTrainees.EditValue),
                Date        = DateTime.Now,
                Gender      = cmbGender.EditValue.ToString(),
                Type        = "invitation"
            };
            TraineeID = Convert.ToInt32(cmbTrainees.EditValue);
            var trainee = from t in db.TraineeProfiles
                          where t.TraineeID == TraineeID && t.Active == true
                          select t;

            foreach (var item in trainee)
            {
                //if (item.Active == true)
                //{
                //    int num = Convert.ToInt32(item.SessionsNum);
                //    num -= 1;
                //    item.Sessions = num.ToString();
                //    break;
                //}
            }

            var sm = db.SocialMedias.Find(5);

            sm.number = ++sm.number;
            db.SaveChanges();

            db.Invitations.Add(inv);
            db.SaveChanges();

            EDM.Interest inter = new EDM.Interest()
            {
                InvitationID     = inv.InvitationID,
                Aerobics         = Convert.ToBoolean(chkAerobics.EditValue),
                Running          = Convert.ToBoolean(chkRunning.EditValue),
                Swimming         = Convert.ToBoolean(chkSwimming.EditValue),
                PersonalTraining = Convert.ToBoolean(chkPersonal.EditValue),
                Rohabilitation   = Convert.ToBoolean(chkRohab.EditValue),
                Fitness          = Convert.ToBoolean(chkFitness.EditValue),
                WeightGaining    = Convert.ToBoolean(ChkGain.EditValue),
                WeightLoss       = Convert.ToBoolean(chkLoss.EditValue),
                Mas          = Convert.ToBoolean(chkMas.EditValue),
                BodyBuilding = Convert.ToBoolean(chkBody.EditValue),
                Spa          = Convert.ToBoolean(chkSpa.EditValue),
                Other        = Convert.ToBoolean(chkOther.EditValue),
            };
            db.Interests.Add(inter);
            db.SaveChanges();
            XtraMessageBox.Show("تمت الإضافة بنجاح", "إضافة", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
示例#2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            EDM.Invitation inv = new EDM.Invitation()
            {
                Name        = txtName.Text,
                Address     = txtAddress.Text,
                Phone       = txtPhone.Text,
                Nationality = txtNationality.Text,
                EmployeeID  = Convert.ToInt32(cmbEmployee.EditValue),
                Date        = DateTime.Now,
                Gender      = cmbGender.EditValue.ToString(),
                Type        = "visit"
            };
            db.Invitations.Add(inv);

            EDM.Interest inter = new EDM.Interest()
            {
                InvitationID     = inv.InvitationID,
                Aerobics         = Convert.ToBoolean(chkAerobics.EditValue),
                Running          = Convert.ToBoolean(chkRunning.EditValue),
                Swimming         = Convert.ToBoolean(chkSwimming.EditValue),
                PersonalTraining = Convert.ToBoolean(chkPersonal.EditValue),
                Rohabilitation   = Convert.ToBoolean(chkRohab.EditValue),
                Fitness          = Convert.ToBoolean(chkFitness.EditValue),
                WeightGaining    = Convert.ToBoolean(ChkGain.EditValue),
                WeightLoss       = Convert.ToBoolean(chkLoss.EditValue),
                Mas          = Convert.ToBoolean(chkMas.EditValue),
                BodyBuilding = Convert.ToBoolean(chkBody.EditValue),
                Spa          = Convert.ToBoolean(chkSpa.EditValue),
                Other        = Convert.ToBoolean(chkOther.EditValue),
            };
            db.Interests.Add(inter);

            int SocialID = Convert.ToInt32(radioGroup1.EditValue);
            var sm       = db.SocialMedias.Find(SocialID);

            sm.number = ++sm.number;
            db.SaveChanges();

            XtraMessageBox.Show("تمت الإضافة بنجاح", "إضافة", MessageBoxButtons.OK, MessageBoxIcon.Information);
            DialogResult = DialogResult.OK;
        }
示例#3
0
        void add()
        {
            if (radioChk.SelectedIndex == 0)
            {
                if (have)
                {
                    var t = from tp in db.TraineeProfiles
                            where tp.TraineeID == TraineeID && tp.Active == true
                            select tp;
                    foreach (var item in t)
                    {
                        item.Invitations = --item.Invitations;
                    }
                    EDM.Invitation i = new EDM.Invitation()
                    {
                        Name        = txtName.Text,
                        Address     = txtAddress.Text,
                        Phone       = txtPhone.Text,
                        Gender      = cmbGender.Text,
                        Nationality = txtNationality.Text,
                        EmployeeID  = Convert.ToInt32(cmbEmployee.EditValue),
                        Date        = Convert.ToDateTime(dtDate.EditValue),
                        TraineeID   = TraineeID,
                        Type        = radioChk.Text,
                    };
                    db.Invitations.Add(i);
                    db.SaveChanges();
                    a.addCash(2, radioChk.Text, "", 0.ToString(), "", txtName.Text, radioGroup2.Text);
                    XtraMessageBox.Show("تم إضافة الدعوة بنجاح", "إضافة", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                }
                else
                {
                    XtraMessageBox.Show("هذا المشترك لا يمتلك دعوات", "تنبيه", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            else if (radioChk.SelectedIndex == 1)
            {
                EDM.Invitation inv = new EDM.Invitation()
                {
                    Name        = txtName.Text,
                    Address     = txtAddress.Text,
                    Phone       = txtPhone.Text,
                    Gender      = cmbGender.Text,
                    Nationality = txtNationality.Text,
                    EmployeeID  = Convert.ToInt32(cmbEmployee.EditValue),
                    Date        = Convert.ToDateTime(dtDate.EditValue),
                    SessionID   = Convert.ToInt32(cmbSessions.EditValue),
                    Price       = txtPrice.Text,
                    Type        = radioChk.Text,
                };
                db.Invitations.Add(inv);
                db.SaveChanges();
                a.addCash(2, radioChk.Text, Properties.Settings.Default.RecieptID.ToString(), txtPrice.Text, radioGroup3.Text, txtName.Text, radioGroup2.Text, Convert.ToDateTime(dtDate.EditValue));

                if (radioGroup3.SelectedIndex == 0)
                {
                    u.updateTraffic(Convert.ToDouble(txtPrice.Text), 0);
                }

                int SocialID = Convert.ToInt32(radioGroup1.EditValue);
                a.incrementSocialMedia(SocialID);
                Properties.Settings.Default.RecieptID = ++Properties.Settings.Default.RecieptID;
                Properties.Settings.Default.Save();
                XtraMessageBox.Show("تم إضافة الجلسة بنجاح", "إضافة", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
            else if (radioChk.SelectedIndex == 2)
            {
                var t = from tp in db.TraineeProfiles
                        where tp.TraineeID == TraineeID && tp.Active == true
                        select tp;
                foreach (var item in t)
                {
                    if (radioGroup2.SelectedIndex == 0)
                    {
                        item.SPA = --item.SPA;
                    }
                    else if (radioGroup2.SelectedIndex == 1)
                    {
                        item.Massage = --item.Massage;
                    }
                    else if (radioGroup2.SelectedIndex == 2)
                    {
                        item.Others = --item.Others;
                    }
                    break;
                }
                var            z = db.Trainees.Find(TraineeID);
                EDM.Invitation i = new EDM.Invitation()
                {
                    Name        = cmbTrainees.Text,
                    Address     = z.Address,
                    Phone       = z.Phone,
                    Gender      = z.Gender,
                    Nationality = z.Nationality,
                    EmployeeID  = Convert.ToInt32(cmbEmployee.EditValue),
                    Date        = Convert.ToDateTime(dtDate.EditValue),
                    TraineeID   = TraineeID,
                    Type        = radioChk.Text,
                };
                db.Invitations.Add(i);
                db.SaveChanges();
                a.addCash(2, radioChk.Text, "", 0.ToString(), "", cmbTrainees.Text, radioGroup2.Text);
                XtraMessageBox.Show("تمت الإضافة بنجاح", "إضافة", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
            else if (radioChk.SelectedIndex == 3)
            {
                EDM.Invitation i = new EDM.Invitation()
                {
                    Name        = txtName.Text,
                    Address     = txtAddress.Text,
                    Phone       = txtPhone.Text,
                    Gender      = cmbGender.Text,
                    Nationality = txtNationality.Text,
                    EmployeeID  = Convert.ToInt32(cmbEmployee.EditValue),
                    Date        = Convert.ToDateTime(dtDate.EditValue),
                    Type        = radioChk.Text,
                };
                db.Invitations.Add(i);

                int SocialID = Convert.ToInt32(radioGroup1.EditValue);
                var sm       = db.SocialMedias.Find(SocialID);
                sm.number = ++sm.number;

                db.SaveChanges();
                a.addCash(2, radioChk.Text, "", 0.ToString(), "", txtName.Text, radioGroup2.Text);
                XtraMessageBox.Show("تم إضافة الزيارة بنجاح", "إضافة", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
        }