Esempio n. 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            txtUsername.Focus();
            persianDate pd = new persianDate();
            string visit_Date = cbxYear.Text + "/" + cbxMonth.Text + "/" + cbxDay.Text;
            string visit_Time = cbxHour.Text + ":" + cbxMin.Text + ":" + "0";

            string realNowTime = string.Empty;
            SqlConnection con1 = new SqlConnection("server=(local); DataBase=itproject ; integrated security=true");
            con1.Open();
            SqlCommand c1 = new SqlCommand();
            c1.CommandText = "insert into dailyAct values(N'قرار ملاقات','" + txtdescription.Text + "','" + pd.date() + "','" + pd.time() + "','" + visit_Date + "','" + visit_Time + "','" + txtplace.Text + "','" + txtUsername.Text + "')";

            c1.Connection = con1;
            try
            {
                c1.ExecuteNonQuery();
                MessageBox.Show("ثبت شد");
            }
            catch
            {
                MessageBox.Show("زمان مورد نظر قبلا ثبت شده است");
            }
            con1.Close();
            txtdescription.Clear();
            txtplace.Clear();
            txtUsername.Clear();
            cbxYear.Text = null;
            cbxMonth.Text = null;
            cbxDay.Text = null;
            cbxHour.Text = null;
            cbxMin.Text = null;
            txtUsername.Focus();
        }
Esempio n. 2
0
        private void button2_Click_1(object sender, EventArgs e)
        {
            persianDate pd = new persianDate();
            string visit_Date = cbxYear.Text + "/" + cbxMonth.Text + "/" + cbxDay.Text;
            string visit_Time = cbxHour.Text + ":" + cbxMin.Text + ":" + "0";

            string realNowTime = string.Empty;

            SqlConnection con1 = new SqlConnection("server=(local); DataBase=itproject ; integrated security=true");
            con1.Open();
            SqlCommand c1 = new SqlCommand();

            //MessageBox.Show(radioButton1.Text + "," + txtdescription.Text + "," + pd.date() + "," + pd.time() + "," + visit_Date + "," + visit_Time + "," + txtplace.Text);
            //if (radioButton1.Checked)
            //{
                c1.CommandText = "insert into dailyAct values(N'" + cmbEventType.Text + "' ,'" + txtdescription.Text + "','" + pd.date() + "','" + pd.time() + "','" + visit_Date + "','" + visit_Time + "',N'" + txtplace.Text + "', '" + persianDate.usernameTemp + "')";
                //c1.CommandText = "insert into dailyAct values('"+radioButton1.Text+"','" + txtdescription.Text + "','" + pd.date() + "','" + pd.time() + "','" + visit_Date + "','" + visit_Time + "','" + txtplace.Text + "', '" + persianDate.usernameTemp + "')";
               // }
            //else if (radioButton2.Checked)
            //{
               // c1.CommandText = "insert into dailyAct values(N'برنامه روزانه',N'" + txtdescription.Text + "','" + pd.date() + "','" + pd.time() + "','" + visit_Date + "','" + visit_Time + "','" + txtplace.Text + "','" + persianDate.usernameTemp + "')";
               // }
            c1.Connection = con1;
            try
            {
                c1.ExecuteNonQuery();
                MessageBox.Show("ثبت شد");
            }
            catch(Exception x)
            {
                MessageBox.Show(x.Message);
                //MessageBox.Show("زمان مورد نظر قبلا ثبت شده است");
            }
            con1.Close();
            txtdescription.Clear();
            txtplace.Clear();
            cbxYear.Text = null;
            cbxMonth.Text = null;
            cbxDay.Text = null;
            cbxHour.Text = null;
            cbxMin.Text = null;
        }
Esempio n. 3
0
 private void button4_Click(object sender, EventArgs e)
 {
     txtnote.Focus();
     persianDate pd = new persianDate();
     SqlConnection con1 = new SqlConnection("server=(local); DataBase=itproject ; integrated security=true");
     con1.Open();
     SqlCommand c1 = new SqlCommand();
     c1.CommandText = "insert into note values('" + pd.date() + "','" + pd.time() + "','" + txtnote.Text + "','"+ persianDate.usernameTemp +"')";
     c1.Connection = con1;
     try
     {
         c1.ExecuteNonQuery();
         MessageBox.Show("ثبت شد");
     }
     catch
     {
         MessageBox.Show("دوباره امتحان کنید");
     }
     con1.Close();
     txtnote.Clear();
 }
Esempio n. 4
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            ///////////
            persianDate p = new persianDate();
            visitDateTextBox.Text = p.date();
            int visitd = dailyActBindingSource.Find("visitDate", visitDateTextBox.Text);
            if (visitd != -1)
            {
                persianDate.dateTemp = visitDateTextBox.Text;
                alarm am = new alarm();
                add.ActiveForm.Hide();
                am.ShowDialog();
            }
            else
            {
                MessageBox.Show("برنامه ی امروز شما آزاد است");
            }

            //////////////////
        }