示例#1
0
        private void button1_Click(object sender, EventArgs e)
        {
            var material = (Data.Material)cmdMaterial.SelectedItem;
            var company  = (Data.Company)cmdCompany.SelectedItem;

            if (material == null)
            {
                errorProvider1.SetError(cmdMaterial, "لطفا کالا را وارد نمایید");
                return;
            }
            if (company == null)
            {
                errorProvider1.SetError(cmdCompany, "لطفا شرکت را انتخاب نمایید");
                return;
            }
            if (string.IsNullOrWhiteSpace(UnitPrice.Value))
            {
                errorProvider2.SetError(UnitPrice, "لطفا قیمت را وارد نمایید");
                return;
            }

            using (UnitOfWork db = new UnitOfWork())
            {
                var model = new Data.MaterialPrice()
                {
                    Id               = int.Parse(Id.Text),
                    MaterialId       = material.Id,
                    CompanyId        = company.CompanyId,
                    UnitPrice        = double.Parse(UnitPrice.Value),
                    Active           = true,
                    InsertTime       = DateTime.Now,
                    ParentId         = null,
                    MaterialTypeData = Data.MaterialPrice.TypeMAterial.Edit
                };
                var result = db.MaterialRepositories.UpdateMaterial(model, checkBox1.Checked);
                if (result.IsChange)
                {
                    db.Save();
                    RtlMessageBox.Show(result.Message);
                    DialogResult = DialogResult.OK;
                }
                else
                {
                    RtlMessageBox.Show(result.Message);
                }
            }
        }
示例#2
0
 private void Btm_PropertiesRegister_Click(object sender, EventArgs e)
 {
     if (cbProperties.SelectedIndex == -1)
     {
         RtlMessageBox.Show("لطفا ویژگی مورد نظر را انتخاب کنید", "توجه", MessageBoxButtons.OK,
                            MessageBoxIcon.Error);
     }
     else
     {
         lbSelectedProperties.Items.Add(cbProperties.SelectedItem);
         cbProperties.SelectedIndex = -1;
         if (lbSelectedProperties.Items.Count == 5)
         {
             this.Btm_PropertiesRegister.Enabled = false;
         }
     }
 }
示例#3
0
 private void Btnbackaup_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(textBoxXpath.Text))
     {
         RtlMessageBox.Show("مسیر ذخیره سازی را انتخاب کنید");
     }
     else
     {
         panel1.Enabled     = false;
         btnbackaup.Enabled = false;
         IsBackup           = true;
         if (!backgroundWorkerback.IsBusy)
         {
             backgroundWorkerback.RunWorkerAsync();
         }
     }
 }
 private void BtmSelect_Click(object sender, EventArgs e)
 {
     if (dgvEmployees.CurrentRow != null)
     {
         using (UnitOfWork db = new UnitOfWork())
         {
             coId     = dgvEmployees.CurrentRow.Cells["nvcCoID"].Value.ToString();
             fullName = dgvEmployees.CurrentRow.Cells["nvcFirstName"].Value.ToString() + " " +
                        dgvEmployees.CurrentRow.Cells["nvcLastName"].Value.ToString();
         }
         this.Close();
     }
     else
     {
         RtlMessageBox.Show("لطفا یک کارمند را انتخاب کنید", "توجه", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
示例#5
0
 private void UserControlBackUp_Leave(object sender, EventArgs e)
 {
     if (radioButton1.Checked)
     {
         if (IsBackup == true)
         {
             RtlMessageBox.Show("در حال پشتیبان گیری");
         }
     }
     else
     {
         if (IsBackup == true)
         {
             RtlMessageBox.Show("در حال بازیابی");
         }
     }
 }
 private void BtnDelete_Click(object sender, EventArgs e)
 {
     if (MYdataGridView.CurrentRow != null)
     {
         int id = int.Parse(MYdataGridView.CurrentRow.Cells[0].Value.ToString());
         if (RtlMessageBox.Show("ایا از حذف شخص مطمئن هستید", "توجه"
                                , MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             using (UnitofWork db = new UnitofWork())
             {
                 db.accountingrepository.Delete(id);
                 db.Save();
                 Filter();
             }
         }
     }
 }
示例#7
0
 private void btnEditStaff_Click(object sender, EventArgs e)
 {
     if (dgvStaff.CurrentRow != null)
     {
         int id = int.Parse(dgvStaff.CurrentRow.Cells[0].Value.ToString());
         frmAddOrEditStaff frm = new frmAddOrEditStaff();
         frm.id = id;
         if (frm.ShowDialog() == DialogResult.OK)
         {
             BindGrid();
         }
     }
     else
     {
         RtlMessageBox.Show($"یک شخص را انخاب کنید!", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
示例#8
0
        private void btmDelete_Click(object sender, EventArgs e)
        {
            if (dgvSubProjects.CurrentRow != null)
            {
                using (UnitOfWork db = new UnitOfWork())
                {
                    if (RtlMessageBox.Show($"آیا از حذف مطمئن هستید؟", "توجه", MessageBoxButtons.YesNo,
                                           MessageBoxIcon.Warning) == DialogResult.Yes)
                    {
                        var selectItems = dgvSubProjects.Rows.Cast <DataGridViewRow>().Where(t => Convert.ToBoolean(t.Cells["bitSelect"].Value) == true).ToList();

                        foreach (var item in selectItems)
                        {
                            var id          = int.Parse(item.Cells["intID"].Value.ToString());
                            var subProjects = db.SubProjects.GetEntity(t => t.intID == id);
                            db.SubProjects.Delete(subProjects);
                        }
                        db.Save();
                        SearchSubProjects();
                    }
                }
            }
            //Int16 intSelectedSubprojects = 0;
            //foreach (DataRow drVendor in this.dsSubprojects.Tables["tabSubprojects"].Rows)
            //{
            //    if ((Boolean)drVendor["bitSelect"])
            //    {
            //        ++intSelectedSubprojects;
            //    }
            //}

            //if (intSelectedSubprojects > 0)
            //{
            //    DialogResult dialogResult = MessageBox.Show("آیا می خواهید " + intSelectedSubprojects.ToString() + " زیرپروژه‌ها را حذف کنید؟", "حذف", MessageBoxButtons.YesNo);
            //    if (dialogResult == DialogResult.Yes)
            //    {
            //        Subproject.DeleteSubprojects(this.cnConnection, this.dsSubprojects);
            //        SearchSubProjects();
            //    }
            //}
            //else
            //{
            //    MessageBox.Show(".هیچ زیرپروژه‌ای انتخاب نشده است", "هشدار", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign);
            //}
        }
示例#9
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (textBox1.Text.ToLower() == textBox2.Text.ToLower())
     {
         using (var db = new UnitOfWork())
         {
             var user = new Data.User()
             {
                 UserId   = userId,
                 Password = textBox1.Text
             };
             var result = db.UserServices.UpdateUser(user);
             RtlMessageBox.Show(result.Message);
             db.Save();
             DialogResult = DialogResult.OK;
         }
     }
 }
示例#10
0
 private void DataGridViewX1_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         NetCollegeEntities db = new NetCollegeEntities();
         var        coname     = dataGridViewX1.CurrentRow.Cells[0].Value.ToString();
         classTable classTable = db.classTables.Where(c => c.class_ID == coname).Single();
         string     classneme  = dataGridViewX1.CurrentRow.Cells[0].Value.ToString();
         txtClassID.Text   = classTable.class_ID;
         txtCapacty.Text   = Convert.ToString(classTable.capacity);
         txtDest.Text      = classTable.description;
         txtVideo.Checked  = Convert.ToBoolean(classTable.video_projector);
         txtCooler.Checked = Convert.ToBoolean(classTable.cooler);
     }
     catch (Exception)
     {
         RtlMessageBox.Show("رکوردی انتخاب نشده است");
     }
 }
示例#11
0
      } // end GetFilePathFromFileDialog

      #endregion

      #region ValidateDataDropFilePath

      private bool ValidateDataDropFilePath(ICS.GUI_Library.Controls.WizardControlPanels.WizardControlPanel sender, EventArgs e)
      {
         if (_txtFromFilePath.Text.Length == 0)
         {
            RtlMessageBox.Show(String.Empty, String.Empty);

            return (false);
         } // end if
         else if (System.IO.File.Exists(_txtFromFilePath.Text))
         {
            return (true);
         } // end else if
         else
         {
            RtlMessageBox.Show(String.Empty, String.Empty);

            return (false);
         } // end else
      } // end GetFilePathFromFileDialog
示例#12
0
        private void ButtonX1_Click(object sender, EventArgs e)
        {
            NetCollegeEntities db   = new NetCollegeEntities();
            string             ramz = encrypt(txtpass.Text);
            var q = db.usersTables.Where(x => x.username == txtuser.Text && x.password == ramz).ToList();

            if (q.Count > 0)
            {
                RtlMessageBox.Show("خوش امدید  " + q[0].uname + " " + q[0].ufamily);
                User.AccessType = (int)q[0].accessType;
                User.Uname      = q[0].uname;
                User.Ufamily    = q[0].ufamily;
                DialogResult    = DialogResult.OK;
            }
            else
            {
                RtlMessageBox.Show("نام یا رمز کاربری اشتباه است");
            }
        }
示例#13
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         if (BaseValidator.IsFormValid(this.components))
         {
             using (UnitOfWork db = new UnitOfWork())
             {
                 var M = db.MGenericRepository.GetById(1);
                 if (M.ManagerImage != null)
                 {
                     File.Delete(Application.StartupPath + "/Images/" + M.ManagerImage);
                 }
             }
             string imageName = Guid.NewGuid().ToString() + Path.GetExtension(pcManager.ImageLocation);
             string path      = Application.StartupPath + "/Images/";
             if (!Directory.Exists(path))
             {
                 Directory.CreateDirectory(path);
             }
             pcManager.Image.Save(path + imageName);
             var m = new Manager();
             m.ManagerID          = 1;
             m.ManagerName        = txtName.Text;
             m.ManagerAddress     = txtAddress.Text;
             m.ManagerAge         = int.Parse(txtAge.Text.ToString());
             m.ManagerPhoneNumber = txtPhoneNumber.Text;
             m.ManagerExpert      = txtExpert.Text;
             m.ManagerEmail       = txtEmail.Text;
             m.ManagerImage       = imageName;
             using (UnitOfWork db = new UnitOfWork())
             {
                 db.MGenericRepository.Update(m);
                 db.Save();
                 DialogResult = DialogResult.OK;
             }
         }
     }
     catch
     {
         RtlMessageBox.Show("به صورت صحیح وارد کنید!", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
示例#14
0
 private void button1_Click(object sender, EventArgs e)
 {
     using (var db = new UnitOfWork())
     {
         var foodssurplusPrice = db.FoodService.GetAllByCompanyId((int)comboBox1.SelectedValue);
         foreach (var foodDetailsModel in foodssurplusPrice)
         {
             _foodId = foodDetailsModel.Id;
             var model  = foodDetailsModel.FoodSurplusPrices;
             var result = Calculator(model);
             if (!result.IsChange)
             {
                 RtlMessageBox.Show("فیلد های مورد نظر برای غذای " + foodDetailsModel.FoodName +
                                    "بروزرسانی نشد" + "لطفا تا زمان مشاهده پیغام اتمام عملیات صبر نمایید");
             }
         }
         RtlMessageBox.Show("عملیات به اتمام رسید");
     }
 }
示例#15
0
 private void BtnMaintenanceItem_Click(object sender, EventArgs e)
 {
     if (dgvMaintenance.CurrentRow != null)
     {
         var maintenanceId = Convert.ToInt32(dgvMaintenance.CurrentRow.Cells["intID"].Value.ToString());
         FrmMaintenanceItems frmMaintenanceItems = new FrmMaintenanceItems();
         frmMaintenanceItems.maintenanceId = maintenanceId;
         using (UnitOfWork db = new UnitOfWork())
         {
             var maintenance = db.Maintenance.GetEntity(t => t.intID == maintenanceId);
             frmMaintenanceItems.coIdsWorker = maintenance.nvcCoIdsWorkGroup;
         }
         frmMaintenanceItems.Show();
     }
     else
     {
         RtlMessageBox.Show("لطفا یک سطر را مشخص کنید", "توجه", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
示例#16
0
 private void DataGridViewX1_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         NetCollegeEntities db = new NetCollegeEntities();
         var     stID          = dataGridViewX1.CurrentRow.Cells[0].Value.ToString();
         stTable stTable       = db.stTables.Where(c => c.studentID == stID).Single();
         txtStAdress.Text          = stTable.stAddress;
         txtSTFamily.Text          = stTable.stFamily;
         txtStID.Text              = stTable.studentID;
         txtStName.Text            = stTable.stName;
         txtStTel.Text             = stTable.stTel;
         pictureBox1.ImageLocation = Application.StartupPath + "/Images/st/" + stTable.stImage;
     }
     catch (Exception)
     {
         RtlMessageBox.Show("رکوردی انتخاب نشده است");
     }
 }
示例#17
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            NetCollegeEntities db = new NetCollegeEntities();

            if (IsEdit == false)
            {
                DeptTable deptTable = new DeptTable();

                deptTable.deptName = txtdeptName.Text;
                deptTable.boss     = txtboss.Text;

                try
                {
                    db.DeptTables.Add(deptTable);
                    RtlMessageBox.Show(" ساختمان جدیداضافه شد  ");
                    db.SaveChanges();
                }


                catch
                {
                    RtlMessageBox.Show("خطا در انجام عملیات");
                }
            }
            else
            {
                DeptTable deptTable = new DeptTable();
                deptTable.deptName = txtdeptName.Text;
                deptTable.boss     = txtboss.Text;
                deptTable.deptId   = int.Parse(txtdeptId.Text);

                db.Entry(deptTable).State = System.Data.Entity.EntityState.Modified;
                IsEdit = false;
                RtlMessageBox.Show("ویرایش ساختمان  انجام شد");
                db.SaveChanges();
            }
            btnAdd.Enabled   = true;
            btnEdit.Enabled  = true;
            btnDelet.Enabled = true;
            btnEnebel();
            BindGrid();
        }
示例#18
0
        private void BtmDelete_Click(object sender, EventArgs e)
        {
            using (UnitOfWork db = new UnitOfWork())
            {
                if (RtlMessageBox.Show($"آیا از حذف مطمئن هستید؟", "توجه", MessageBoxButtons.YesNo,
                                       MessageBoxIcon.Warning) == DialogResult.Yes)
                {
                    var selectItems = dgvMaintenance.Rows.Cast <DataGridViewRow>().Where(t => Convert.ToBoolean(t.Cells["bitSelect"].Value) == true).ToList();

                    foreach (var item in selectItems)
                    {
                        var id           = int.Parse(item.Cells["intID"].Value.ToString());
                        var maintenances = db.Maintenance.GetEntity(t => t.intID == id);
                        db.Maintenance.Delete(maintenances);
                    }
                    db.Save();
                    Filter();
                }
            }
        }
示例#19
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            NetCollegeEntities db       = new NetCollegeEntities();
            string             password = encrypt(txtpass.Text);

            if (IsEdit == false)
            {
                usersTable usersTable = new usersTable()
                {
                    username   = txtuser.Text,
                    password   = password,
                    uname      = txtname.Text,
                    ufamily    = txtfamily.Text,
                    accessType = comAcsses.SelectedIndex + 1
                };



                try
                {
                    db.usersTables.Add(usersTable);
                    RtlMessageBox.Show(" کاربر جدیداضافه شد  ");
                    db.SaveChanges();
                }

                catch (DbUpdateException)
                {
                    RtlMessageBox.Show("یوزر نیم  تکراری است");
                }
                catch
                {
                    RtlMessageBox.Show("خطا در انجام عملیات");
                }
            }

            btnAdd.Enabled = true;

            btnDelet.Enabled = true;
            btnEnebel();
            BindGrid();
        }
示例#20
0
        private void Btnrestore_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(textBoxXpathr.Text))
            {
                RtlMessageBox.Show("فایل پشتیبان را انتخاب کنید");
            }

            else
            {
                if (RtlMessageBox.Show("فایل پشتیبان جایگزین شود؟", "نرم افزار مدیریت آموزشگاه", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    panel3.Enabled      = false;
                    btnpatheres.Enabled = false;
                    IsBackup            = true;
                    if (!backgroundWorkerresto.IsBusy)
                    {
                        backgroundWorkerresto.RunWorkerAsync();
                    }
                }
            }
        }
 private void BtnDelete_Click(object sender, EventArgs e)
 {
     if (MydataGridView.CurrentRow != null)
     {
         using (UnitofWork db = new UnitofWork())
         {
             string name = MydataGridView.CurrentRow.Cells[1].Value.ToString();
             if (RtlMessageBox.Show($"ایا از حذف {name} مطمئن هستید؟", "توجه", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
             {
                 int customerId = int.Parse(MydataGridView.CurrentRow.Cells[0].Value.ToString());
                 db.CustomerRepository.DeleteCustomer(customerId);
                 db.Save();
                 Bindgrid();
             }
         }
     }
     else
     {
         RtlMessageBox.Show("لطفا شخص مورد نظر را انتخاب کنید");
     }
 }
示例#22
0
      } // end SetTrustConnSectionView

      #endregion

      #endregion

      #region Loading Control Data

      #region LoadCmbDBServer

      /// <summary>
      /// Loads the available SQL Server servers into the DB Server combobox.
      /// </summary>
      private void LoadCmbDBServer()
      {
         try
         {
            // Clear the DB Server combobox and fill it with SQL Server servers
            _cmbDBServer.Items.Clear();
            DataTable dt = SMO.SmoApplication.EnumAvailableSqlServers(false);
            if (dt.Rows.Count > 0)
            {
               foreach (DataRow dr in dt.Rows)
               {
                  this._cmbDBServer.Items.Add(dr["Name"]);
               }
            }
         } // end try
         catch (Exception ex)
         {
            RtlMessageBox.Show(GUILibStrings.msgSqlFetchError+"\n\n" +
                            ex.Message, GUILibStrings.errorSqlFetch);
         } // end catch
      } // end LoadCmbDBServer
示例#23
0
 private void DataGridViewX1_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         NetCollegeEntities db     = new NetCollegeEntities();
         var          teId         = dataGridViewX1.CurrentRow.Cells[0].Value.ToString();
         teacherTable teacherTable = db.teacherTables.Where(c => c.teacherId == teId).Single();
         txtAdress.Text            = teacherTable.teacherAddress;
         txtCetifacrte.Text        = teacherTable.TeacherCetifacrte;
         txtExpert.Text            = teacherTable.TeacherExpert;
         txtFamily.Text            = teacherTable.teacherFamily;
         txtName.Text              = teacherTable.teacherName;
         txtTeID.Text              = teacherTable.teacherId;
         txtTel.Text               = teacherTable.teacherTel;
         pictureBox1.ImageLocation = Application.StartupPath + "/Images/te/" + teacherTable.teImage;
     }
     catch (Exception)
     {
         RtlMessageBox.Show("رکوردی انتخاب نشده است");
     }
 }
示例#24
0
 private void btnRemove_Click(object sender, EventArgs e)
 {
     if (dgvStaff.CurrentRow != null)
     {
         string name = dgvStaff.CurrentRow.Cells[1].Value.ToString();
         if (RtlMessageBox.Show($"آیا از حذف {name} مطمئن هستید؟", "توجه", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
         {
             int id = int.Parse(dgvStaff.CurrentRow.Cells[0].Value.ToString());
             using (UnitOfWork db = new UnitOfWork())
             {
                 db.SGenericRepository.Delete(id);
                 db.Save();
                 BindGrid();
             }
         }
     }
     else
     {
         RtlMessageBox.Show($"یک شخص را انخاب کنید!", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
示例#25
0
 private void BtmRegister_Click(object sender, EventArgs e)
 {
     if (txtRegisterName.Text == "")
     {
         RtlMessageBox.Show("لطفا نام کالا را وارد کنید", "توجه", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         string name = txtRegisterName.Text;
         using (UnitOfWork db = new UnitOfWork())
         {
             var categories = db.Categories.GetEntity(t => t.nvcName == categoryName);
             var nameEntity = db.PartName.GetEntity(t => t.nvcName == name);
             if (nameEntity != null)
             {
                 RtlMessageBox.Show("این نام کالا قبلا ثبت شده است", "خطا", MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
             }
             else
             {
                 var         maxNumber = db.PartName.GetAll().Max(t => t.intNumber);
                 tabPartName tabName   = new tabPartName()
                 {
                     bitSelect   = false,
                     intNumber   = maxNumber + 1,
                     nvcName     = name,
                     intCategory = categories.intNumber
                 };
                 db.PartName.Insert(tabName);
                 db.Save();
                 RtlMessageBox.Show("ثبت با موفقیت انجام شد", "ثبت", MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);
                 ListRefresh();
                 txtRegisterName.Text = "";
                 txtEditName.Text     = "";
             }
         }
     }
 }
示例#26
0
 private void Buttonpath_Click(object sender, EventArgs e)
 {
     try
     {
         FolderBrowserDialog folderBrowser = new FolderBrowserDialog();
         if (folderBrowser.ShowDialog() == DialogResult.OK)
         {
             if (folderBrowser.SelectedPath.Length == 3)
             {
                 textBoxXpath.Text = folderBrowser.SelectedPath + "BackupFile" + "_" + DateTime.Now.Date.Year + DateTime.Now.Date.Month + DateTime.Now.Date.Day + "_" + DateTime.Now.TimeOfDay.Hours + DateTime.Now.TimeOfDay.Minutes + ".Bak";
             }
         }
         else
         {
             textBoxXpath.Text = folderBrowser.SelectedPath + "//BackupFile" + "_" + DateTime.Now.Date.Year + DateTime.Now.Date.Month + DateTime.Now.Date.Day + "_" + DateTime.Now.TimeOfDay.Hours + DateTime.Now.TimeOfDay.Minutes + ".Bak";
         }
     }
     catch (PathTooLongException)
     {
         RtlMessageBox.Show("مسیر طولانی است");
     }
 }
示例#27
0
 private void btnDeleteCustomer_Click(object sender, EventArgs e)
 {
     if (grdCustomer.CurrentRow.Selected)
     {
         var customerId = int.Parse(grdCustomer.CurrentRow.Cells[3].Value.ToString());
         using (UnitOfWork db = new UnitOfWork())
         {
             string name = grdCustomer.CurrentRow.Cells[0].Value.ToString();
             if (RtlMessageBox.Show($"ایا از حذف {name}مطمئن هستید؟", "توجه", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
             {
                 var res = db.ICustomerrepository.DeleteCustomer(customerId);
                 db.SaveChange();
                 MessageBox.Show("عملیات حدف با موفقیت انجام شد");
                 BindGrid();
             }
         }
     }
     else
     {
         MessageBox.Show("مقداری انتخاب نشده است!");
     }
 }
示例#28
0
        private void button1_Click(object sender, EventArgs e)
        {
            using (var db = new UnitOfWork())
            {
                if (string.IsNullOrWhiteSpace(Quantity.Value) && Quantity.Text == "0")
                {
                    errorProvider1.RightToLeft = true;
                    errorProvider1.SetError(Quantity, "لطفا مقدار لازم را وارد را وارد نمایید");
                }

                var material = (MaterialPriceModel)comboBox1.SelectedItem;
                //مبلغ هرکیلو تقسیم بر 1000=مبلغ هر گرم
                var unitPrice  = material.UnitPrice / 1000;
                var quantity   = double.Parse(Quantity.Value);
                var totalPrice = unitPrice * quantity;

                var foodMaterial = new Data.FoodMaterial()
                {
                    Id = _foodMaterilId,
                    MaterialPriceId    = material.MateriaPriceId,
                    UnitPrice          = material.UnitPrice,
                    Quantity           = double.Parse(Quantity.Value),
                    FoodId             = _foodIds,
                    MaterialTotalPrice = totalPrice,
                    Active             = true
                };

                if (db.FoodMaterialService.UpdateFoodMaterial(foodMaterial))
                {
                    db.Save();
                    RtlMessageBox.Show("عملیات با موفقیت انجام شد");
                    DialogResult = DialogResult.OK;
                }
                else
                {
                    MessageBox.Show("کالا ثبت نگردید");
                }
            }
        }
 private void BtmRegister_Click(object sender, EventArgs e)
 {
     if (txtNameSubZone.Text == "")
     {
         RtlMessageBox.Show("لطفا نام زیرشاخه را وارد کنید", "توجه", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         string subZoneName = txtNameSubZone.Text;
         using (UnitOfWork db = new UnitOfWork())
         {
             var zones    = db.Zone.GetEntity(t => t.nvcName == zoneName);
             var subZones = db.SubZone.GetEntity(t => t.nvcName == subZoneName);
             if (subZones != null)
             {
                 RtlMessageBox.Show("این زیرشاخه قبلا ثبت شده است", "خطا", MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
             }
             else
             {
                 var         maxNumber   = db.SubZone.GetAll().Max(t => t.intNumber);
                 tabSubZones tabSubZones = new tabSubZones()
                 {
                     bitSelect = false,
                     intNumber = maxNumber + 1,
                     nvcName   = subZoneName,
                     intZone   = zones.intNumber
                 };
                 db.SubZone.Insert(tabSubZones);
                 db.Save();
                 RtlMessageBox.Show("ثبت با موفقیت انجام شد", "ثبت", MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);
                 ListRefresh();
                 txtNameSubZone.Text = "";
                 txtEditSubZone.Text = "";
             }
         }
     }
 }
示例#30
0
 private void btnRelease_Click(object sender, EventArgs e)
 {
     if (txtName.Text != "")
     {
         using (UnitOfWork db = new UnitOfWork())
         {
             int    id   = db.PatientsRepository.GetPatientIdByName(txtName.Text);
             var    p    = db.PGenericRepository.GetById(id);
             string name = p.PatientName;
             if (RtlMessageBox.Show($"آیا از ترخیص {name} مطمئن هستید؟", "توجه", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
             {
                 db.PGenericRepository.Delete(p);
                 db.Save();
                 DialogResult = DialogResult.OK;
             }
         }
     }
     else
     {
         RtlMessageBox.Show("بیمار را انتخب کنید!", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }