예제 #1
0
      private void personalCarUseToolStripMenuItem_Click_1(object sender, EventArgs e)
      {
          Personal_Car_Use_Form o = new Personal_Car_Use_Form();

          o.Show();
          this.Hide();
      }
        private void personalCarUseToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Personal_Car_Use_Form obj = new Personal_Car_Use_Form();

            obj.Show();
            Visible = false;
        }
예제 #3
0
        private void SubmitButton_Click(object sender, EventArgs e)
        {
            return_date = ReturnDatePicker.Value;
            return_time = RetrunTimePicker.Value;
            string   req_num = RequisitionNumberComboBox.Text;
            string   tid     = TeacherIdComboBox.Text;
            int      km      = Int32.Parse(TotalKmTextBox.Text);
            TimeSpan d1      = return_date - d;
            TimeSpan t1      = return_time - stime;
            int      day     = d1.Days;
            int      hours   = day * 24 + t1.Hours;

            if (t1.Minutes > 30)
            {
                hours = hours + 1;
            }
            int totalcost = 0;



            SqlConnection cnn = new SqlConnection("Server=.\\SQLEXPRESS;Database=DTMS; Integrated Security=true");
            SqlCommand    cmd = new SqlCommand("select transport_rent_per_hour,transport_holdage_per_hour from transport where transport_number='" + transport_number + "' ;", cnn);

            cnn.Open();
            SqlDataReader reader = cmd.ExecuteReader();

            reader.Read();
            int trph = Int32.Parse(reader[0].ToString());
            int thph = Int32.Parse(reader[1].ToString());

            reader.Close();
            totalcost = trph * km + thph * hours;
            String Query = "insert into per_car_use (teacher_id,teacher_name,teacher_designation,transport_category,start_date,return_date,start_time,return_time,total_hours,total_km,total_taka) values ( '" + this.TeacherIdComboBox.Text + "' ,'" + tn + "', '" + td + "','" + tc + "','" + d + "','" + return_date + "','" + stime + "','" + return_time + "','" + hours + "','" + km + "','" + totalcost + "');";

            cmd = new SqlCommand(Query, cnn);
            //SqlDataReader MyReader;



            cmd.ExecuteReader();
            this.TeacherIdComboBox.Text = string.Empty;
            //MessageBox.Show("Saved", "Result", MessageBoxButtons.OKCancel, MessageBoxIcon.Hand);
            MessageBox.Show("saved");

            Personal_Car_Use_Form obj = new Personal_Car_Use_Form();

            obj.Show();
            Visible = false;
        }