private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtBimehName.Text.Trim() == string.Empty)
            {
                MessageBox.Show(Messages.Error_NewBimeh);
            }
            else if (!Information.IsNumeric(txtBimehPrice.Text))
            {
                MessageBox.Show(Messages.Error_Mablagh);
            }
            else
            {
                var b = new Bimeh();
                b.CarId         = int.Parse(cmbPelak.SelectedValue.ToString());
                b.Name          = txtBimehName.Text;
                b.Price         = long.Parse(txtBimehPrice.Text);
                b.Shomareh      = txtBimehNumber.Text;
                b.TarikhSodour  = fdpSodourDate.Controls[1].Text;
                b.TarikhEngheza = fdpEnghezaDate.Controls[1].Text;
                b.Type          = BimehType.ثالث;
                if (Id == 0)
                {
                    bc.Create(b);
                }
                else
                {
                    b.Id = Id;
                    bc.Update(b);
                    Id = 0;
                }

                FillDGV();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// حذف بیمه
        /// </summary>
        /// <param name="code">کد بیمه</param>
        /// <returns>اگه عملیات موفق امیز باشد مقدار صحیح برمیگرداند</returns>
        public bool Delete(int code)
        {
            try
            {
                Bimeh myBimeh = db.Bimeh.First(
                    item => item.code_bimeh == code
                    );

                db.Bimeh.DeleteObject(myBimeh);
                db.SaveChanges();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// ویرایش اطلاعات بیمه
        /// </summary>
        /// <param name="code">کد بیمه</param>
        /// <param name="name">نام سازمان بیمه</param>
        /// <param name="darsad">درصد بیمه</param>
        /// <param name="etebar">اعتبار</param>
        /// <returns>اگر عملیات موفقیت امیز باشد مقدار صحیح برمیگرداند</returns>
        public bool Edit(int code, string name, string darsad, string etebar)
        {
            Bimeh myBimeh = db.Bimeh.First(item => item.code_bimeh == code);

            try
            {
                myBimeh.nameSazman_bimeh    = name;
                myBimeh.tarikheEtebar_bimeh = etebar;
                myBimeh.darsad_bimeh        = darsad;

                db.SaveChanges();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// جستجو بر اساس کد بیمه
        /// </summary>
        /// <param name="code">کد بیمه</param>
        /// <returns>اگر کد بیمه در جدول بود اطلاعات دارو داخل فیلدهای کلاس ذخیره میشود</returns>
        public bool Search(int code)
        {
            try
            {
                Bimeh myBimeh = db.Bimeh.First(item => item.code_bimeh == code);

                BimehCode    = myBimeh.code_bimeh;
                NameSazman   = myBimeh.nameSazman_bimeh;
                TarikhEtebar = myBimeh.tarikheEtebar_bimeh;
                DarsadBimeh  = myBimeh.darsad_bimeh;

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Esempio n. 5
0
 public void Create(Bimeh t)
 {
 }