Пример #1
0
        public void Add()
        {
            string s = "insert into ghabz (id, stdno, name, artcourse, date, lastdate, lastcheck, mablagh, paid, sharh) Values (N'{0}',N'{1}',N'{2}',N'{3}',N'{4}',N'{5}',N'{6}',{7},{8},N'{9}')";

            s = string.Format(s, this.id, this.stdno, this.name, this.artcourse, this.date, this.lastdate, this.lastcheck, this.mablagh, this.paid, this.sharh);
            da.Connect();
            da.docommand(s);
            da.disconnect();
        }
Пример #2
0
        public void CreateBackup()
        {
            string s = "BACKUP DATABASE M_A_DB TO  DISK = N'{0}' WITH RETAINDAYS = 60, NOFORMAT, NOINIT,  NAME = N'{1}', SKIP, NOREWIND, NOUNLOAD,  STATS = 10";

            s = string.Format(s, this.path, this.Backup_name);
            da.Connect();
            da.docommand(s);
            da.disconnect();
        }
Пример #3
0
        public void Add()
        {
            string s = "insert into contact (nam,mob1,mob2,toz) Values (N'{0}',N'{1}',N'{2}',N'{3}')";

            s = string.Format(s, this.nam, this.mob1, this.mob2, this.toz);
            da.Connect();
            da.docommand(s);
            da.disconnect();
        }
Пример #4
0
        public void Add()
        {
            string s = "insert into hozoor (stdno, stdname, classno, artcourse, date, day, status) Values (N'{0}', N'{1}',{2}, N'{3}',N'{4}',N'{5}',N'{6}') ";

            s = string.Format(s, this.stdno, this.stdname, this.classno, this.artcourse, this.date, this.day, this.status);
            da.Connect();
            da.docommand(s);
            da.disconnect();
        }
Пример #5
0
        public void Add()
        {
            string s = "insert into Courses (id,coursename) Values ({0},N'{1}')";

            s = string.Format(s, this.id, this.coursename);
            da.Connect();
            da.docommand(s);
            da.disconnect();
        }
Пример #6
0
        public void Add()
        {
            string s = "insert into hazineh_types (id, htype) Values ({0},N'{1}')";

            s = string.Format(s, this.id, this.htype);
            da.Connect();
            da.docommand(s);
            da.disconnect();
        }
Пример #7
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Amoozeshgah SH = new Amoozeshgah();
            DataTable   dt = new DataTable();

            try
            {
                mydataaccess da = new mydataaccess();
                da.Connect();
                da.disconnect();
            }
            catch
            {
                mydataaccess da = new mydataaccess();

                byte ChDbExist = da.CheckDatabseExists();

                if (ChDbExist == 1)
                {
                    da.Attach();
                }
                else if (ChDbExist == 2)
                {
                    try
                    {
                        da.detach_action();
                        da.Attach();
                    }
                    catch
                    {
                        MessageBox.Show("لطفا با پشتیبان تماس بگیرید");
                        Application.Exit();
                    }
                }
            }
            finally
            {
                dt = SH.Select();

                Date.currentDate_Setter();
            }

            if (dt.Rows.Count == 0)
            {
                frmaddAmoozeshgah fad = new frmaddAmoozeshgah();

                if (fad.ShowDialog() != DialogResult.Abort)
                {
                    Application.Run(new frmMain());
                }
            }
            else
            {
                Application.Run(new frmMain());
            }
        }
Пример #8
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         my.ConnectforRestore();
         my.docommand(textBox1.Text);
         my.disconnect();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         try
         {
             my.disconnect();
         }
         catch (Exception) { }
     }
 }
Пример #9
0
        public void Add()
        {
            radif = Selectmaxid();

            string s = "INSERT INTO hazineh (radif, type, date, mablagh, comments) VALUES ({0}, N'{1}', N'{2}', {3}, N'{4}') ";

            s = string.Format(s, this.radif, this.type, this.date, this.mablagh, this.comments);
            da.Connect();
            da.docommand(s);
            da.disconnect();
        }
Пример #10
0
        public void Add()
        {
            string s = "insert into payments (id, name, date, paidformonth, mablagh, sharh) Values (N'{0}',N'{1}',N'{2}', N'{3}', {4}, N'{5}')";

            s = string.Format(s, this.id, this.name, this.date, this.paidformonth, this.mablagh, this.sharh);
            da.Connect();
            da.docommand(s);
            da.disconnect();
        }
Пример #11
0
        public void Add()
        {
            string s = "insert into acc (user_code,pass,fname,lname,tel,address,semat) Values (N'{0}',N'{1}',N'{2}',N'{3}',N'{4}',N'{5}',N'{6}')";

            s = string.Format(s, this.user_code, this.pass, this.fname, this.lname, this.tel, this.address, this.semat);
            da.Connect();
            da.docommand(s);
            da.disconnect();
        }
Пример #12
0
        public void Add()
        {
            radif = Selectmaxid();
            string s = "INSERT INTO std_history (radif, ghabz_id,sharh,date,stdno,bedehkari,bestankari,tashkhis,mandeh) VALUES ({0}, N'{1}', N'{2}', N'{3}', N'{4}', {5}, {6}, N'{7}', {8}) ";

            s = string.Format(s, this.radif, this.ghabz_id, this.sharh, this.date, this.stdno, this.bedehkari, this.bestankari, this.tashkhis, this.mandeh);
            da.Connect();
            da.docommand(s);

            UpdateMandeh();

            da.disconnect();
        }
Пример #13
0
        public void Add()
        {
            string s;

            if (flag)
            {
                s = "insert into Amoozeshgah (name,tel,address,photo) Values (N'{0}',N'{1}',N'{2}',@img_photo_file)";
                s = string.Format(s, this.name, this.tel, this.address);
                da.cmd.Parameters.Add("@img_photo_file", SqlDbType.Image, photo.Length).Value = photo;
            }
            else
            {
                s = "insert into Amoozeshgah (name,tel,address) Values (N'{0}',N'{1}',N'{2}')";
                s = string.Format(s, this.name, this.tel, this.address);
            }

            da.Connect();
            da.docommand(s);
            da.disconnect();
        }
Пример #14
0
        public void Add()
        {
            string s = "insert into sms ([matnsms],[shomaremaghsad],[tarikh],[tahvilshod],[type],[tahvilgirande],[tarikhtahvil]) Values (N'{0}',N'{1}',N'{2}',N'{3}',N'{4}',N'{5}',N'{6}')";

            s = string.Format(s, matnsms
                              , shomaremaghsad
                              , tarikh
                              , tahvilshod
                              , type
                              , tahvilgirande
                              , tarikhtahvil);
            da.Connect();
            da.docommand(s);
            da.disconnect();
        }
Пример #15
0
        public void Add()
        {
            string s;

            if (flag)
            {
                s = "insert into teachers (teacherno,name,artcourse,tel, resume, prof_img) Values ({0},N'{1}',N'{2}',N'{3}', N'{4}',@img_photo_file)";
                s = string.Format(s, this.teacherno, this.name, this.artcourse, this.tel, this.resume);
                da.cmd.Parameters.Add("@img_photo_file", SqlDbType.Image, photo.Length).Value = photo;
            }
            else
            {
                s = "insert into teachers (teacherno,name,artcourse,tel, resume) Values ({0},N'{1}',N'{2}',N'{3}', N'{4}')";
                s = string.Format(s, this.teacherno, this.name, this.artcourse, this.tel, this.resume);
            }
            da.Connect();
            da.docommand(s);
            da.disconnect();
        }
Пример #16
0
        public void Add()
        {
            string s;

            if (flag)
            {
                s = "insert into std (stdno, reg_date,name,father,idno,job,degree,course,tel, mob,address,resume,birthdate, hesab, status,std_img)" +
                    " Values (N'{0}',N'{1}',N'{2}',N'{3}',N'{4}',N'{5}',N'{6}',N'{7}',N'{8}',N'{9}',N'{10}',N'{11}',N'{12}', {13}, N'{14}',@img_photo_file)";
                s = string.Format(s, this.stdno, this.reg_date, this.name, this.father, this.idno, this.job, this.degree, this.course, this.tel, this.mob, this.address, this.resume, birthdate, hesab, status);
                da.cmd.Parameters.Add("@img_photo_file", SqlDbType.Image, photo.Length).Value = photo;
            }
            else
            {
                s = "insert into std (stdno,reg_date,name,father,idno,job,degree,course,tel, mob,address,resume,birthdate, hesab, status)" +
                    " Values (N'{0}',N'{1}',N'{2}',N'{3}',N'{4}',N'{5}',N'{6}',N'{7}',N'{8}',N'{9}',N'{10}',N'{11}',N'{12}', {13}, N'{14}')";
                s = string.Format(s, this.stdno, this.reg_date, this.name, this.father, this.idno, this.job, this.degree, this.course, this.tel, this.mob, this.address, this.resume, this.birthdate, this.hesab, this.status);
            }

            da.Connect();
            da.docommand(s);
            da.disconnect();
        }
Пример #17
0
        public void Add()
        {
            string s;

            s = "insert into classes (classno,teacher, stdname, stdno, artcourse,clday,clFromTime, clToTime, method, open_date) Values ({0},N'{1}',N'{2}',N'{3}',N'{4}',N'{5}', N'{6}', N'{7}', N'{8}',N'{9}')";
            s = string.Format(s, this.classno, this.teacher, this.stdname, this.stdno, this.artcourse, this.clday, this.clFromTime, this.clToTime, this.method, this.open_date);

            da.Connect();
            da.docommand(s);
            da.disconnect();
        }