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(); }
private void button4_Click(object sender, EventArgs e) { persianDate p = new persianDate(); string date = cbxYear.Text + "/" + cbxMonth.Text + "/" + cbxDay.Text; SqlConnection con1 = new SqlConnection("server=(local); DataBase=itproject ; integrated security=true"); try { con1.Open(); SqlDataAdapter da = new SqlDataAdapter("Select noteId,textN,dateN,timeN from note where username='******' and dateN='"+date+"'", con1); DataTable dt = new DataTable(); da.Fill(dt); dataGridView1.DataSource = dt.DefaultView; dataGridView1.Columns["noteId"].HeaderText = "شماره یادداشت"; dataGridView1.Columns["textN"].HeaderText = "یادداشت"; dataGridView1.Columns["dateN"].HeaderText = "تاریخ انجام"; dataGridView1.Columns["timeN"].HeaderText = "ساعت انجام"; } catch { MessageBox.Show("خطای اتصال\nدوباره امتحان کنید"); } finally { con1.Close(); } cbxDay.Text = null; cbxMonth.Text = null; cbxYear.Text = null; }
private void alarm_Load(object sender, EventArgs e) { System.Media.SystemSounds.Exclamation.Play(); //Beep(700, 500); persianDate p = new persianDate(); SqlConnection con1 = new SqlConnection("server=(local); DataBase=itproject ; integrated security=true"); con1.Open(); SqlDataAdapter da = new SqlDataAdapter("Select typeDA,titr,visitTime from dailyAct where visitDate='" + persianDate.dateTemp + "'and username='******'", con1); DataTable dt = new DataTable(); da.Fill(dt); dataGridView1.DataSource = dt.DefaultView; con1.Close(); }
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; }
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(); }
private void button1_Click(object sender, EventArgs e) { persianDate p = new persianDate(); SqlConnection con1 = new SqlConnection("server=(local); DataBase=itproject ; integrated security=true"); con1.Open(); try { SqlDataAdapter da = new SqlDataAdapter("Select visitTime from dailyAct where username='******'", con1); DataTable dt = new DataTable(); da.Fill(dt); dataGridView1.DataSource = dt.DefaultView; dataGridView1.Columns["visitTime"].HeaderText = "ساعت "; } catch { MessageBox.Show("خطای اتصال\nدوباره امتحان کنید"); } finally { con1.Close(); } }
private void cbxevent_SelectedIndexChanged(object sender, EventArgs e) { persianDate p = new persianDate(); SqlConnection con1 = new SqlConnection("server=(local); DataBase=itproject ; integrated security=true"); con1.Open(); try { if (cbxevent.Text == "قرار ملاقات") { SqlDataAdapter da = new SqlDataAdapter("Select daId,typeDA,titr,visitDate,visitTime,place,recordDate,recordTime from dailyAct where username='******' and typeDA=N'قرار ملاقات'", con1); DataTable dt = new DataTable(); da.Fill(dt); dataGridView1.DataSource = dt.DefaultView; } else if (cbxevent.Text == "برنامه روزانه") { SqlDataAdapter da = new SqlDataAdapter("Select daId,typeDA,titr,visitDate,visitTime,place,recordDate,recordTime from dailyAct where username='******' and typeDA=N'برنامه روزانه'", con1); DataTable dt = new DataTable(); da.Fill(dt); dataGridView1.DataSource = dt.DefaultView; } dataGridView1.Columns["daId"].HeaderText = "شماره رویداد"; dataGridView1.Columns["typeDa"].HeaderText = "نوع رویداد"; dataGridView1.Columns["titr"].HeaderText = "توضیحات"; dataGridView1.Columns["visitDate"].HeaderText = "تاریخ انجام"; dataGridView1.Columns["visitTime"].HeaderText = "ساعت انجام"; dataGridView1.Columns["recordDate"].HeaderText = "تاریخ ثبت"; dataGridView1.Columns["recordTime"].HeaderText = "ساعت ثبت"; dataGridView1.Columns["place"].HeaderText = "مکان موردنظر"; } catch { MessageBox.Show("خطای اتصال\nدوباره امتحان کنید"); } finally { con1.Close(); } }
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("برنامه ی امروز شما آزاد است"); } ////////////////// }