Beispiel #1
0
 void EditItem()
 {
     if (Application.OpenForms.OfType <FRM_ItemCard>().Any())
     {
         itemCardCmd.EditItemCard(itemID, cmbCategoryName.Text, txtCode.Text, txtName.Text, cmbUnit.Text, double.Parse(txtPrice.Text), chkAddItem.Checked, int.Parse(txtCategoryID.Text));
         HelperClass.ClearValue(tableLayoutPanel2);
         FRM_ItemCard frm = (FRM_ItemCard)Application.OpenForms["FRM_ItemCard"];
         frm.DisplayItemCard();
     }
 }
 private void simpleButtonAddStudyBook_Click(object sender, EventArgs e)
 {
     if (state == "Add")
     {
         InsertBook();
         HelperClass.ClearValue(tableLayoutPanel1);
     }
     else if (state == "Edit")
     {
         EditScore();
         this.Close();
     }
 }
        //New Data
        void newData()
        {
            HelperClass.ClearValue(tableLayoutPanel1);
            List <CLS_SaleMaster> saleMasters = cmdSaleMaster.GetAllSaleMaster();
            int maxID = saleMasters.DefaultIfEmpty().Max(c => c == null ? 1 : c.SaleMasterID + 1);

            lblSaleMasterID.Text = maxID.ToString();
            lblCurrency.Text     = "دينار عراقي";
            lblFinalTotal.Text   = string.Format("{0:N}", double.Parse("0"));
            lblItemQty.Text      = "0";
            dtEntryDate.DateTime = DateTime.Today;
            //lblUsrname.Text = UserInfo.currentUser.UserName;
            lblUsrname.Text = "المدير";

            while (gvSaleDetail.RowCount > 0)
            {
                gvSaleDetail.SelectAll();
                gvSaleDetail.DeleteSelectedRows();
            }
        }
        void AddStudent()
        {
            if (string.IsNullOrWhiteSpace(textEditIdStudent.Text) || string.IsNullOrWhiteSpace(textEditStudentName.Text) ||
                comboBoxGender.Text == "اختيار الجنس" || string.IsNullOrWhiteSpace(textEditDepartment.Text) ||
                comboBoxStep.Text == "اختيار مرحلة" || comboBoxTypeOfStudy.Text == "اختيار نوع الدراسة" ||
                string.IsNullOrWhiteSpace(textEditTotalAmount.Text) || string.IsNullOrWhiteSpace(textEditDiscount.Text))
            {
                XtraMessageBox.Show("يرجى ملئ جميع الحقول", "اضافة", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            cmd_Student.InsertStudent(int.Parse(textEditIdStudent.Text), textEditStudentName.Text, comboBoxGender.Text, txtAge.DateTime,
                                      textEditDepartment.Text, int.Parse(comboBoxStep.Text), comboBoxTypeOfStudy.Text, double.Parse(textEditTotalAmount.Text),
                                      double.Parse(textEditDiscount.Text));

            XtraMessageBox.Show("تمت الاضافه بنجاح", "اضافة", MessageBoxButtons.OK, MessageBoxIcon.Information);
            HelperClass.ClearValue(tableLayoutPanel1);
            comboBoxGender.SelectedIndex      = 0;
            comboBoxStep.SelectedIndex        = 0;
            comboBoxTypeOfStudy.SelectedIndex = 0;
        }
Beispiel #5
0
        void AddItem()
        {
            if (string.IsNullOrWhiteSpace(cmbCategoryName.Text) || string.IsNullOrWhiteSpace(txtCode.Text) ||
                string.IsNullOrWhiteSpace(txtName.Text) || string.IsNullOrWhiteSpace(txtPrice.Text))
            {
                XtraMessageBox.Show("يرجى ملئ جميع الحقول", "اضافة", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            List <CLS_ItemCard> item = itemCardCmd.GetAllItemCard();

            if (item.Exists(c => c.Name == txtName.Text || c.Code == txtCode.Text))
            {
                XtraMessageBox.Show("الصنف معرف مسبقا في بطاقة الاصناف", "اضافة", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                txtName.Focus();
                return;
            }

            if (Application.OpenForms.OfType <FRM_ItemCard>().Any())
            {
                itemCardCmd.InsertItemCard(cmbCategoryName.Text, txtCode.Text, txtName.Text, cmbUnit.Text, double.Parse(txtPrice.Text), chkAddItem.Checked, int.Parse(txtCategoryID.Text));
                HelperClass.ClearValue(tableLayoutPanel2);
                FRM_ItemCard frm = (FRM_ItemCard)Application.OpenForms["FRM_ItemCard"];
                frm.DisplayItemCard();
                //frm.gvItemCard.AddNewRow();
                //int rowHandler = frm.gvItemCard.GetRowHandle(frm.gvItemCard.DataRowCount); ;
                //if (frm.gvItemCard.IsNewItemRow(rowHandler))
                //{
                //    frm.gvItemCard.SetRowCellValue(rowHandler, "CategoryID", txtCategoryID.Text);
                //    frm.gvItemCard.SetRowCellValue(rowHandler, "CategoryName", txtCategoryID.Text);
                //    frm.gvItemCard.SetRowCellValue(rowHandler, "Code", txtCategoryID.Text);
                //    frm.gvItemCard.SetRowCellValue(rowHandler, "Name", txtCategoryID.Text);
                //    frm.gvItemCard.SetRowCellValue(rowHandler, "Unit", txtCategoryID.Text);
                //    frm.gvItemCard.SetRowCellValue(rowHandler, "Price", txtCategoryID.Text);
                //    frm.gvItemCard.SetRowCellValue(rowHandler, "AddItem", txtCategoryID.Text);
                //}
            }
        }
        //User login

        void UserLogin()
        {
            CLS_Users users = cmd_Users.GetUserByUsernameAndPassword(txtUsername.Text, HelperClass.EncryptPassword(txtPassword.Text));

            if (users != null)
            {
                UserInfo.currentUser = users;
                this.Hide();
                Frm_Main frm = new Frm_Main();
                frm.Show();
            }
            else
            {
                count++;
                XtraMessageBox.Show("تاكد من صحة اسم المستخدم وكلمة المرور", "دخول", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                HelperClass.ClearValue(tableLayoutPanel2);
            }

            if (count == 3)
            {
                Application.Exit();
            }
        }