示例#1
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     if (Convert.ToDouble(txtCarry.Text) > 0)
     {
         EDM.Outcome oc = new EDM.Outcome()
         {
             CategoryID = 1,
             Desc       = "إلغاء إشتراك",
             Date       = DateTime.Now,
             RecieptID  = ("R" + Properties.Settings.Default.RecieptIDOut),
             Price      = txtCarry.Text,
             TraineeID  = traineeID,
             userName   = Program.Username
         };
         db.Outcomes.Add(oc);
         db.SaveChanges();
         f.fillRptCashOut(name, txtCarry, offerName, dtBegin, dtEnd, 0.ToString(), 0);
         u.updateTraffic(0, Convert.ToDouble(txtCarry.Text));
         Properties.Settings.Default.RecieptID = ++Properties.Settings.Default.RecieptIDOut;
         Properties.Settings.Default.Save();
         DialogResult = DialogResult.OK;
     }
     else
     {
         DialogResult = DialogResult.OK;
     }
 }
示例#2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            var tp = db.TraineeProfiles.Find(logID);

            tp.Paid = tp.Paid + Convert.ToDouble(txtPaid.Text);
            db.SaveChanges();
            tp.Carry = tp.Price - Convert.ToDouble(tp.Paid);
            db.SaveChanges();

            if (Convert.ToDouble(txtPaid.Text) > 0)
            {
                a.addCash(1, "دفع متبقي", Properties.Settings.Default.RecieptID.ToString(), txtPaid.Text, radioGroup1.Text, name, offerName);

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

                f.fillRpt(name, txtPaid, offerName, Convert.ToDateTime(dtBegin.EditValue), Convert.ToDateTime(dtEnd.EditValue), txtCarry.Text, radioGroup1.SelectedIndex);
                Properties.Settings.Default.RecieptID = ++Properties.Settings.Default.RecieptID;
                Properties.Settings.Default.Save();
            }

            XtraMessageBox.Show("تم الحفظ", "تعديل", MessageBoxButtons.OK, MessageBoxIcon.Information);
            this.DialogResult = DialogResult.OK;
        }
示例#3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (!valCategory.Validate())
            {
                return;
            }
            if (!valPrice.Validate())
            {
                return;
            }

            int categoryID = Convert.ToInt32(cmbCategories.EditValue);

            a.addOutcome(categoryID, txtDesc.Text, txtReceiptID.Text, txtPrice.Text, Convert.ToDateTime(dtDate.EditValue));
            u.updateTraffic(0, Convert.ToDouble(txtPrice.Text));

            XtraMessageBox.Show("تم إضافة المصروف بنجاح", "إضافة", MessageBoxButtons.OK, MessageBoxIcon.Information);
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
示例#4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            a.addOrder(dtDate, txtDescription.Text, txtTotal.Text, ref orderID);
            foreach (DataRow dr in dt.Rows)
            {
                int    productID   = Convert.ToInt32(dr["م"]);
                string sell        = dr["سعر الوحدة"].ToString();
                string number      = dr["العدد"].ToString();
                string price       = dr["الثمن"].ToString();
                string productName = dr["الصنف"].ToString();
                a.addOrderDetails(orderID, productID, sell, number, price);
                var p          = db.Products.Find(productID);
                int categoryID = Convert.ToInt32(p.CategoryID);

                CashIn cash = new CashIn()
                {
                    Date        = Convert.ToDateTime(dtDate.EditValue),
                    CategoryID  = categoryID,
                    Desc        = productName,
                    RecieptID   = "",
                    Price       = price,
                    Type        = RGpaymentMethod.Text,
                    TraineeName = "",
                    userName    = Program.Username,
                    OfferName   = "",
                };
                db.CashIns.Add(cash);
                db.SaveChanges();
            }
            db.SaveChanges();
            if (RGpaymentMethod.SelectedIndex == 0)
            {
                u.updateTraffic(Convert.ToDouble(txtTotal.Text), 0);
            }
            XtraMessageBox.Show("تم إضافة الفاتورة بنجاح", "إضافة", MessageBoxButtons.OK, MessageBoxIcon.Information);
            DialogResult = DialogResult.OK;
            this.Close();
        }
示例#5
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (!valOffer.Validate())
            {
                return;
            }

            if (!changeOffer)
            {
                a.addTraineeProfile(traineeID, cmbOffers, dtBegin, dtEnd, txtPrice, txtPaid, txtCarry, sessionNum, freezing, invitations, spa, massage, others, inbody,
                                    radioGroup1, type, ref logID, cmbTrainers, cmbEmployees);

                if (Convert.ToDouble(txtPaid.Text) == 0)
                {
                    a.addCash(1, "تجديد إشتراك", "", txtPaid.Text, "", traineeName, cmbOffers.Text);
                }
                else if (Convert.ToDouble(txtPaid.Text) > 0)
                {
                    a.addCash(1, "تجديد إشتراك", Properties.Settings.Default.RecieptID.ToString(), txtPaid.Text, radioGroup1.Text, traineeName, cmbOffers.Text);
                    if (radioGroup1.SelectedIndex == 0)
                    {
                        u.updateTraffic(Convert.ToDouble(txtPaid.Text), 0);
                    }
                    f.fillRpt(traineeName, txtPaid, offerName, Convert.ToDateTime(dtBegin.EditValue), Convert.ToDateTime(dtEnd.EditValue), txtCarry.Text, radioGroup1.SelectedIndex);
                    Properties.Settings.Default.RecieptID = ++Properties.Settings.Default.RecieptID;
                    Properties.Settings.Default.Save();
                }
                XtraMessageBox.Show("تمت الإضافة بنجاح", "إضافة", MessageBoxButtons.OK, MessageBoxIcon.Information);
                DialogResult = DialogResult.OK;
            }
            if (changeOffer)
            {
                var tp = db.TraineeProfiles.Find(logID);
                tp.OfferID     = Convert.ToInt32(cmbOffers.EditValue);
                tp.From        = Convert.ToDateTime(dtBegin.EditValue);
                tp.To          = Convert.ToDateTime(dtEnd.EditValue);
                tp.Price       = Convert.ToDouble(txtPrice.Text);
                tp.Paid        = Convert.ToDouble(txtPaid.Text);
                tp.Carry       = Convert.ToDouble(txtCarry.Text);
                tp.SessionsNum = sessionNum - tp.SessionsNum;
                tp.Invitations = invitations - tp.Invitations;
                tp.Massage     = massage - tp.Massage;
                tp.SPA         = spa - tp.SPA;
                tp.Others      = others - tp.Others;
                tp.Freezing    = freezing - tp.Freezing;
                db.SaveChanges();

                if (Convert.ToInt32(txtPaid.Text) == 0)
                {
                    a.addCash(1, "تغيير إشتراك", "", txtPaid.Text, "", traineeName, cmbOffers.Text);
                }
                if (Convert.ToInt32(txtPaid.Text) > 0)
                {
                    if (Convert.ToDouble(txtCarry.Text) > 0)
                    {
                        a.addCash(1, "تغيير إشتراك", Properties.Settings.Default.RecieptID.ToString(), txtPaid.Text, radioGroup1.Text, traineeName, cmbOffers.Text);
                        Properties.Settings.Default.RecieptID = ++Properties.Settings.Default.RecieptID;
                        Properties.Settings.Default.Save();
                    }
                    else if (Convert.ToDouble(txtCarry.Text) < 0)
                    {
                        a.addOutcome(1, "تغيير إشتراك", "R" + Properties.Settings.Default.RecieptIDOut, txtPaid.Text, DateTime.Now);
                        Properties.Settings.Default.RecieptIDOut = ++Properties.Settings.Default.RecieptIDOut;
                        Properties.Settings.Default.Save();
                    }

                    f.fillRpt(traineeName, txtPaid, offerName, Convert.ToDateTime(dtBegin.EditValue), Convert.ToDateTime(dtEnd.EditValue), txtCarry.Text, radioGroup1.SelectedIndex);
                }
                XtraMessageBox.Show("تم التعديل بنجاح", "إضافة", MessageBoxButtons.OK, MessageBoxIcon.Information);
                DialogResult = DialogResult.OK;
            }

            frmMain frm = new frmMain();

            frm.checkTraineesProfile();
        }
示例#6
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (!valName.Validate())
            {
                return;
            }
            if (!valBirth.Validate())
            {
                return;
            }
            if (!valPhone.Validate())
            {
                return;
            }

            MemoryStream ms = new MemoryStream();

            pBox.Image.Save(ms, pBox.Image.RawFormat);
            byte[]   img = ms.ToArray();
            DateTime dt  = Convert.ToDateTime(dtBirthdate.EditValue);

            dt = dt.Date;
            EDM.Trainee t = new EDM.Trainee()
            {
                CardNumber  = txtCardNumber.Text,
                TraineeName = txtName.Text,
                Birtdate    = dt,
                Gender      = cmbGender.EditValue.ToString(),
                Status      = cmbStatus.EditValue.ToString(),
                Nationality = txtNationality.Text,
                Degree      = txtDegree.Text,
                NationalID  = txtNationalID.Text,
                Notes       = txtNotes.Text,
                JoiningDate = Convert.ToDateTime(dtHiring.EditValue),
                Telephone   = txtTel.Text,
                Phone       = txtPhone.Text,
                Address     = txtAddress.Text,
                Mail        = txtMail.Text,
                Photo       = img,
                SocialID    = Convert.ToInt32(radioGroup1.EditValue),
            };
            db.Trainees.Add(t);
            db.SaveChanges();
            var tp = db.TraineeProfiles.Find(logID);

            tp.TraineeID  = t.TraineeID;
            tp.Transfered = true;

            if (Convert.ToInt32(txtPaid.Text) == 0)
            {
                a.addCash(1, "نقل إشتراك", 0.ToString(), 0.ToString(), "", txtName.Text, tp.Offer.OfferName);
            }
            if (Convert.ToInt32(txtPaid.Text) > 0)
            {
                a.addCash(1, "نقل إشتراك", Properties.Settings.Default.RecieptID.ToString(), txtPaid.Text, RGpaymentMethod.Text, txtName.Text, tp.Offer.OfferName);
                if (RGpaymentMethod.SelectedIndex == 0)
                {
                    u.updateTraffic(Convert.ToDouble(txtPaid.Text), 0);
                }
                db.SaveChanges();
                f.fillRpt(txtName.Text, txtPaid, tp.Offer.OfferName, Convert.ToDateTime(tp.From), Convert.ToDateTime(tp.To), tp.Carry.ToString(), RGpaymentMethod.SelectedIndex);
                Properties.Settings.Default.RecieptID = ++Properties.Settings.Default.RecieptID;
                Properties.Settings.Default.Save();
            }

            db.SaveChanges();
            XtraMessageBox.Show("تم نقل العضوية بنجاح", "إضافة", MessageBoxButtons.OK, MessageBoxIcon.Information);
            DialogResult = DialogResult.OK;
        }
示例#7
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();
            }
        }
示例#8
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (!valName.Validate())
            {
                txtName.Focus();
                return;
            }
            if (!valBirth.Validate())
            {
                dtBirthdate.Focus();
                return;
            }
            if (!valGender.Validate())
            {
                cmbGender.Focus();
                return;
            }
            if (!valPhone.Validate())
            {
                txtPhone.Focus();
                return;
            }
            if (!valOffer.Validate())
            {
                cmbOffers.Focus();
                return;
            }

            MemoryStream ms = new MemoryStream();

            pBox.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
            byte[]   img      = ms.ToArray();
            DateTime dt       = Convert.ToDateTime(dtBirthdate.EditValue);
            int      SocialID = Convert.ToInt32(radioGroup1.EditValue);

            if (txtCardNumber.Text != "")
            {
                a.addTrainee(txtCardNumber, txtName, dt, cmbGender, cmbStatus, txtNationality, txtDegree, txtNationalID, txtNotes, dtHiring, txtTel, txtPhone, txtAddress, txtMail,
                             img, radioGroup1, ref TraineeID);
                a.addTraineeProfile(TraineeID, cmbOffers, dtBegin, dtEnd, txtPrice, txtPaid, txtCarry, sessionNum, freezing, invitations, spa, massage, others, inbody,
                                    RGpaymentMethod, type, ref LogID, cmbTrainers, cmbEmployee);
                a.incrementSocialMedia(SocialID);
                if (Convert.ToDouble(txtPaid.Text) == 0)
                {
                    a.addCash(1, "إضافة إشتراك", 0.ToString(), txtPaid.Text, "", txtName.Text, cmbOffers.Text);
                }
                if (Convert.ToDouble(txtPaid.Text) > 0)
                {
                    a.addCash(1, "إضافة إشتراك", Properties.Settings.Default.RecieptID.ToString(), txtPaid.Text, RGpaymentMethod.Text, txtName.Text, cmbOffers.Text);
                    if (RGpaymentMethod.SelectedIndex == 0)
                    {
                        u.updateTraffic(Convert.ToDouble(txtPaid.Text), 0);
                    }
                    f.fillRpt(txtName.Text, txtPaid, offerName, Convert.ToDateTime(dtBegin.EditValue), Convert.ToDateTime(dtEnd.EditValue), txtCarry.Text, RGpaymentMethod.SelectedIndex);
                    Properties.Settings.Default.RecieptID = ++Properties.Settings.Default.RecieptID;
                    Properties.Settings.Default.Save();
                }
                XtraMessageBox.Show("تمت الإضافة بنجاح", "إضافة", MessageBoxButtons.OK, MessageBoxIcon.Information);
                if (XtraMessageBox.Show("هل تريد إضافة inbody report?", "سؤال", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    if (inbody == 0)
                    {
                        XtraMessageBox.Show("هذا الإشتراك ليس له تقارير", "تنبيه", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return;
                    }
                    frmInbodyReport frm = new frmInbodyReport();
                    frm.LogID = LogID;
                    frm.ShowDialog();
                }
                this.Close();
            }
            else if (txtCardNumber.Text == "")
            {
                if (XtraMessageBox.Show("لم يتم تمرير الكارت، هل تريد الإستمرار؟", "تنبيه", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                {
                    a.addTrainee(txtCardNumber, txtName, dt, cmbGender, cmbStatus, txtNationality, txtDegree, txtNationalID, txtNotes, dtHiring, txtTel, txtPhone, txtAddress, txtMail,
                                 img, radioGroup1, ref TraineeID);
                    a.addTraineeProfile(TraineeID, cmbOffers, dtBegin, dtEnd, txtPrice, txtPaid, txtCarry, sessionNum, freezing, invitations, spa, massage, others, inbody,
                                        RGpaymentMethod, type, ref LogID, cmbTrainers, cmbEmployee);
                    a.incrementSocialMedia(SocialID);
                    if (Convert.ToDouble(txtPaid.Text) == 0)
                    {
                        a.addCash(1, "إضافة إشتراك", 0.ToString(), txtPaid.Text, "", txtName.Text, cmbOffers.Text);
                    }
                    if (Convert.ToDouble(txtPaid.Text) > 0)
                    {
                        a.addCash(1, "إضافة إشتراك", Properties.Settings.Default.RecieptID.ToString(), txtPaid.Text, RGpaymentMethod.Text, txtName.Text, cmbOffers.Text);
                        if (RGpaymentMethod.SelectedIndex == 0)
                        {
                            u.updateTraffic(Convert.ToDouble(txtPaid.Text), 0);
                        }
                        f.fillRpt(txtName.Text, txtPaid, offerName, Convert.ToDateTime(dtBegin.EditValue), Convert.ToDateTime(dtEnd.EditValue), txtCarry.Text, RGpaymentMethod.SelectedIndex);
                        Properties.Settings.Default.RecieptID = ++Properties.Settings.Default.RecieptID;
                        Properties.Settings.Default.Save();
                    }
                    XtraMessageBox.Show("تمت الإضافة بنجاح", "إضافة", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    if (XtraMessageBox.Show("هل تريد إضافة inbody report?", "سؤال", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        if (inbody == 0)
                        {
                            XtraMessageBox.Show("هذا الإشتراك ليس له تقارير", "تنبيه", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            this.Close();
                            return;
                        }
                        else
                        {
                            frmInbodyReport frm = new frmInbodyReport();
                            frm.LogID = LogID;
                            frm.ShowDialog();
                        }
                    }
                    this.Close();
                }
            }
        }