//,,
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         dbs_CMMSEntities1 obj = new dbs_CMMSEntities1();
         var EditeData         = obj.tbl_ShenasnamehMoshinAlat.Where(x => x.ID == propID).First();
         EditeData.NameDastgha         = txtNameDastghah.Text;
         EditeData.CodeDastghah        = txtCodeDastghah.Text;
         EditeData.ModelDastGhah       = txtModelDastghah.Text;
         EditeData.Size                = txtSize.Text;
         EditeData.Vazn                = txtVazn.Text;
         EditeData.Zarfiyat            = txtZarfiyat.Text;
         EditeData.AmerMofid           = txtOmrehMofid.Text;
         EditeData.SharkatSazandeh     = txtSherkateSazandeh.Text;
         EditeData.KeshvarSazandeh     = txtKeshvarSazandeh.Text;
         EditeData.TaiedKonnadeh       = txtTaiedKonnandeh.Text;
         EditeData.AdressNamayandegi   = txtAddressNamayandegi.Text;
         EditeData.TelphoneNamayandegi = txtTelphoneNamayandegi.Text;
         EditeData.Bargh               = chkBargh.Checked;
         EditeData.Ab                   = chkAb.Checked;
         EditeData.Hava                 = chkHava.Checked;
         EditeData.Ghaz                 = chkGaz.Checked;
         EditeData.TarikhSakht          = DateTime.Parse(txtTarikhSakht.Text);
         EditeData.TarikhBahrehBardari  = DateTime.Parse(txtTarikhBahrehBardari.Text);
         EditeData.TarikhTahiyeEttelaat = DateTime.Parse(txtTarikhTahiyehAtelaat.Text);
         obj.SaveChanges();
         MessageBox.Show("اطلاعات با موفقیت ویرایش گردید", "ویرایش", MessageBoxButtons.OK, MessageBoxIcon.Information);
         this.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "خطایی رخ داده است", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }
Esempio n. 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                dbs_CMMSEntities1 obj = new dbs_CMMSEntities1();
                tbl_Ghaleb        tbl = new tbl_Ghaleb();
                tbl.Code                  = txtCode.Text;
                tbl.NameGhaleb            = txtName.Text;
                tbl.TypeGhaleb            = cmbType.Text;
                tbl.Tool                  = txtTool.Text;
                tbl.Arz                   = txtArz.Text;
                tbl.Ertefa                = txtErtefa.Text;
                tbl.Vazn                  = txtVazn.Text;
                tbl.VaziyatKharid         = txtVaziyatKharid.Text;
                tbl.SystemKhoonakKonnadeh = txtSystemKhoonakKonnadeh.Text;
                tbl.TypeGiris             = txtTypeGiris.Text;
                tbl.OmreMofid             = txtOmerMofid.Text;
                tbl.Sazandeh              = txtSazandeh.Text;
                tbl.TarikhSakht           = PersianDateTimeHelper.ConvertToDate(txtTarikhSakht.Text);
                tbl.tarikhShorooBeKar     = PersianDateTimeHelper.ConvertToDate(txtTarikhShorooBeKar.Text);
                if (rdbFelezi.Checked)
                {
                    tbl.VaziyatGhaleb = true;
                    tbl.GensGhaleb    = txtFelezi.Text;
                }
                else
                {
                    tbl.VaziyatGhaleb = false;
                    tbl.GensGhaleb    = txtPelastic.Text;
                }

                tbl.UsableMaterials    = txtUsableMaterials.Text;
                tbl.Address            = txtAddress.Text;
                tbl.sharayetneghahdari = txtSharayetNegahdari.Text;
                obj.tbl_Ghaleb.Add(tbl);
                obj.SaveChanges();
                MessageBox.Show("اطلاعات با موفقیت ذخیره گردید", "ثبت اطلاعات", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "خطای رخ داده است", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Esempio n. 3
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         DateTime dt;
         if (DateTime.TryParse(txtTarikhSakht.Text, out dt) && DateTime.TryParse(txtTarikhBahrehBardari.Text, out dt) && DateTime.TryParse(txtTarikhTahiyehAtelaat.Text, out dt))
         {
             dbs_CMMSEntities1         obj = new dbs_CMMSEntities1();
             tbl_ShenasnamehMoshinAlat tbl = new tbl_ShenasnamehMoshinAlat();
             tbl.NameDastgha         = txtNameDastghah.Text;
             tbl.CodeDastghah        = txtCodeDastghah.Text;
             tbl.ModelDastGhah       = txtModelDastghah.Text;
             tbl.Size                = txtSize.Text;
             tbl.Vazn                = txtVazn.Text;
             tbl.Zarfiyat            = txtZarfiyat.Text;
             tbl.AmerMofid           = txtOmrehMofid.Text;
             tbl.SharkatSazandeh     = txtSherkateSazandeh.Text;
             tbl.KeshvarSazandeh     = txtKeshvarSazandeh.Text;
             tbl.TaiedKonnadeh       = txtTaiedKonnandeh.Text;
             tbl.AdressNamayandegi   = txtAddressNamayandegi.Text;
             tbl.TelphoneNamayandegi = txtTelphoneNamayandegi.Text;
             tbl.Bargh               = chkBargh.Checked;
             tbl.Ab                   = chkAb.Checked;
             tbl.Hava                 = chkHava.Checked;
             tbl.Ghaz                 = chkGaz.Checked;
             tbl.TarikhSakht          = PersianDateTimeHelper.ConvertToDate(txtTarikhSakht.Text);
             tbl.TarikhBahrehBardari  = PersianDateTimeHelper.ConvertToDate(txtTarikhBahrehBardari.Text);
             tbl.TarikhTahiyeEttelaat = PersianDateTimeHelper.ConvertToDate(txtTarikhTahiyehAtelaat.Text);
             obj.tbl_ShenasnamehMoshinAlat.Add(tbl);
             obj.SaveChanges();
             MessageBox.Show("اطلاعات با موفقیت ذخیره گردید", "ثبت اطلاعات", MessageBoxButtons.OK, MessageBoxIcon.Information);
             this.Close();
         }
         else
         {
             MessageBox.Show("لطفا تاریخ را درست وارد نمایید", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "خطای رخ داده است", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }
Esempio n. 4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                dbs_CMMSEntities1 obj = new dbs_CMMSEntities1();
                var EditeData         = obj.tbl_Ghaleb.Where(x => x.ID == PropID).First();
                EditeData.NameGhaleb         = txtName.Text;
                EditeData.Code               = txtCode.Text;
                EditeData.Vazn               = txtVazn.Text;
                EditeData.Address            = txtAddress.Text;
                EditeData.UsableMaterials    = txtUsableMaterials.Text;
                EditeData.TypeGhaleb         = cmbType.Text;
                EditeData.Tool               = txtTool.Text;
                EditeData.Arz                = txtArz.Text;
                EditeData.Ertefa             = txtErtefa.Text;
                EditeData.OmreMofid          = txtOmerMofid.Text;
                EditeData.Sazandeh           = txtSazandeh.Text;
                EditeData.sharayetneghahdari = txtSharayetNegahdari.Text;
                EditeData.TarikhSakht        = PersianDateTimeHelper.ConvertToDate(txtTarikhSakht.Text);
                EditeData.tarikhShorooBeKar  = PersianDateTimeHelper.ConvertToDate(txtTarikhShorooBeKar.Text);
                EditeData.TypeGiris          = txtTypeGiris.Text;
                EditeData.VaziyatKharid      = txtVaziyatKharid.Text;
                if (rdbFelezi.Checked)
                {
                    EditeData.VaziyatGhaleb = true;
                    EditeData.GensGhaleb    = txtFelezi.Text;
                }
                else
                {
                    EditeData.VaziyatGhaleb = false;
                    EditeData.GensGhaleb    = txtPelastic.Text;
                }

                obj.SaveChanges();
                MessageBox.Show("اطلاعات با موفقیت ویرایش گردید", "ویرایش", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "خطایی رخ داده است", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         if (MessageBox.Show("آیا مطمن از حذف این محصول هستید ؟ ", "عملیات حذف", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
         {
             dbs_CMMSEntities1 obj = new dbs_CMMSEntities1();
             obj.tbl_ShenasnamehMoshinAlat.Where(x => x.ID == propID).Load();
             obj.tbl_ShenasnamehMoshinAlat.Local.Clear();
             obj.SaveChanges();
             MessageBox.Show("اطلاعات با موفقیت حذف گردید", "عملیات حذف", MessageBoxButtons.OK, MessageBoxIcon.Information);
             PopulateDataGridView();
         }
     }
     catch (Exception ex)
     {
         conn.Close();
         MessageBox.Show(ex.Message, "خطایی رخ داده است", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Esempio n. 6
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         if (MessageBox.Show("آیا مطمن از حذف این محصول هستید ؟ ", "عملیات حذف", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
         {
             using (dbs_CMMSEntities1 obj = new dbs_CMMSEntities1())
             {
                 obj.tbl_UsableMaterialsGhaleb.Where(x => x.ID == model.ID).Load();
                 obj.tbl_UsableMaterialsGhaleb.Local.Clear();
                 obj.SaveChanges();
             }
             MessageBox.Show("اطلاعات با موفقیت حذف گردید", "عملیات حذف", MessageBoxButtons.OK, MessageBoxIcon.Information);
             PopulateDataGridView();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "خطایی رخ داده است", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         dbs_CMMSEntities1 obj = new dbs_CMMSEntities1();
         var EditeData         = obj.tbl_AnbarGhataatYadaki.Where(x => x.ID == propID).First();
         EditeData.Code            = txtCode.Text;
         EditeData.NameGheteh      = txtName.Text;
         EditeData.ShomarehFani    = txtShomarehFani.Text;
         EditeData.Mojoodi         = long.Parse(txtMojoodi.Text);
         EditeData.NoghtehSefaresh = long.Parse(txtNoghtehSefaresh.Text);
         EditeData.Discription     = txtDiscription.Text;
         obj.SaveChanges();
         MessageBox.Show("اطلاعات با موفقیت ویرایش گردید", "ویرایش", MessageBoxButtons.OK, MessageBoxIcon.Information);
         this.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "خطایی رخ داده است", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         dbs_CMMSEntities1      obj = new dbs_CMMSEntities1();
         tbl_AnbarGhataatYadaki tbl = new tbl_AnbarGhataatYadaki();
         tbl.Code            = txtCode.Text;
         tbl.NameGheteh      = txtName.Text;
         tbl.ShomarehFani    = txtShomarehFani.Text;
         tbl.Mojoodi         = long.Parse(txtMojoodi.Text);
         tbl.NoghtehSefaresh = long.Parse(txtNoghtehSefaresh.Text);
         tbl.Discription     = txtDiscription.Text;
         obj.tbl_AnbarGhataatYadaki.Add(tbl);
         obj.SaveChanges();
         MessageBox.Show("اطلاعات با موفقیت ذخیره گردید", "ثبت اطلاعات", MessageBoxButtons.OK, MessageBoxIcon.Information);
         this.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "خطای رخ داده است", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }
Esempio n. 9
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                dbs_CMMSEntities1 obj = new dbs_CMMSEntities1();
                var EditeData         = obj.tbl_UsableMaterialsGhaleb.Where(x => x.ID == PropID).First();
                EditeData.Caption             = txtCaption.Text;
                EditeData.Type                = cmbType.Text;
                EditeData.TimeServices        = txtTimeServices.Text;
                EditeData.UsableGhataatYadaki = txtUsableGhataatYadaki.Text;
                EditeData.Peryod              = txtperyod.Text;
                EditeData.UsableMaterials     = txtUsableMaterials.Text;


                obj.SaveChanges();
                MessageBox.Show("اطلاعات با موفقیت ویرایش گردید", "ویرایش", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "خطایی رخ داده است", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Esempio n. 10
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         dbs_CMMSEntities1         obj = new dbs_CMMSEntities1();
         tbl_UsableMaterialsGhaleb tbl = new tbl_UsableMaterialsGhaleb();
         tbl.IDGhaleb            = PropIDGhaleb;
         tbl.Caption             = txtCaption.Text;
         tbl.Type                = cmbType.Text;
         tbl.TimeServices        = txtTimeServices.Text;
         tbl.UsableGhataatYadaki = txtUsableGhataatYadaki.Text;
         tbl.UsableMaterials     = txtUsableMaterials.Text;
         tbl.Peryod              = txtperyod.Text;
         obj.tbl_UsableMaterialsGhaleb.Add(tbl);
         obj.SaveChanges();
         MessageBox.Show("اطلاعات با موفقیت ذخیره گردید", "ثبت اطلاعات", MessageBoxButtons.OK, MessageBoxIcon.Information);
         this.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "خطای رخ داده است", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }