using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Telerik.WinControls;
using ajans.class_ajans;
using ajans.forms;

namespace ajans.forms
{
    public partial class frm_darj_eshterak : Telerik.WinControls.UI.RadForm
    {
        public frm_darj_eshterak()
        {
            InitializeComponent();
        }
         public int id_esh;
        public Boolean Editmode;
        private void btn_insert_Click(object sender, EventArgs e)
        {
            eshterak es = new eshterak();
            es.id_esh = id_esh;
            es.code_eshterak = txt_codeeshterak.Text;
            es.n_eshterak = txt_n_eshterak.Text;
            es.l_eshterak = txt_l_eshterak.Text;
            es.codem_eshterak = txt_codemeli_eshterak.Text;
            es.ts_eshterak = txt_teshterak.Text;
            es.mob_eshterak = txt_mobeshterak.Text;
            es.tel_eshterak = txt_teleshterak.Text;
            es.shp_eshterak = txt_shpeshterak.Text;
            es.posti_eshterak = txt_codeposti_eshterak.Text;
            es.address_eshterak = txt_addeshterak.Text;
            if (Editmode)
            {
                es.update();
                this.Close();
                return;
            }
            es.insert();
            DialogResult dr;
            dr = MessageBox.Show("عملیات با موفقیت انجام شد آیا می خواهید اشتراک جدیدی ثبت کنید", "پیام", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (dr == DialogResult.Yes)
            {
                txt_codeeshterak.Text = "";
               txt_n_eshterak.Text="";
                 txt_l_eshterak.Text="";
                txt_codemeli_eshterak.Text="";
                txt_teshterak.Text="";
                 txt_mobeshterak.Text="";
                txt_teleshterak.Text="";
               txt_shpeshterak.Text="";
             txt_codeposti_eshterak.Text="";
                 txt_addeshterak.Text="";
            }
            else this.Close();
            
        }

        private void btn_enseraf_Click(object sender, EventArgs e)
        {
           this.Close();
        }
        

     
    }
}
