コード例 #1
0
    protected void btn_Save_Click(object sender, EventArgs e)
    {
        // SqlCommand cmd = new SqlCommand();
        //  LabelError.Text = "";
        string path = "~/Photos/" + FileUpload1.FileName;

        FileUpload1.SaveAs(MapPath(path));


        try
        {
            dh.Ins_Up_Del("insert into Student values('" + txt_name.Text + "','" + txt_address.Text + "','" + txt_mobile.Text + "','" + txt_email.Text + "','" + dropdown_quali.SelectedItem.Text + "','" + txt_uname.Text + "','" + txt_pass.Text + "','" + rdb_gender.SelectedItem.Text + "','" + path + "','False','False',0," + DropDownList1.SelectedValue.ToString() + ",'','','','','','')");
            // string stud_id=dh.GetValue ("select max(stud_id) from student");

            // dh.Ins_Up_Del("insert into chapterdetails values(" + stud_id + ",1)");
            LabelError.Text = "Waiting For Admin Approval";
            //int user_id = dh.getmax_id("student", "stud_id");
            //Session["user_id"] = user_id;
            //Session["username"] = txt_name.Text;
            //Response.Redirect("StudentHome.aspx");
        }
        catch (Exception ex)
        {
            LabelError.Text = "Error in Saving";
        }
    }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (Validation())
            {
                try
                {
                    db.Ins_Up_Del("INSERT INTO [AVVMS].[dbo].[license renew] ([Entry Date] ,[Employee ID] ,[New Expiry Date] ,[remarks] ) VALUES ('" + dateTimePicker1.Value.ToShortDateString() + "' ,'" + comboBox1.SelectedItem.ToString() + "' ,'" + dateTimePicker3.Value.ToShortDateString() + "' ,'" + textBox7.Text + "' )");
                    db.Ins_Up_Del("UPDATE [AVVMS].[dbo].[Employee] SET [License Expiry date] = '" + dateTimePicker3.Value.ToShortDateString() + "' where [Employee ID]='" + comboBox1.SelectedItem.ToString() + "'");
                    MessageBox.Show("Insertion Success");

                    if ((DateTime.Parse(DateTime.Now.ToShortDateString()).AddDays(15).CompareTo(DateTime.Parse(dateTimePicker3.Value.ToShortDateString()))) >= 0)
                    {
                        db.Ins_Up_Del("INSERT INTO [AVVMS].[dbo].[Employee_Notifications]([Employee_ID],[Reason],[Remarks])VALUES('" + comboBox1.SelectedItem.ToString() + "','Lisence of Employee ID : " + comboBox1.SelectedItem.ToString() + " will expire On : " + dateTimePicker3.Value.ToShortDateString() + "','Expiration Date : " + dateTimePicker3.Value.ToShortDateString() + "')");

                        Program.pi.Display("Lisence of Employee ID : " + comboBox1.SelectedItem.ToString() + " will expire On : " + dateTimePicker3.Value.ToShortDateString() + "");

                        db.Ins_Up_Del("UPDATE [AVVMS].[dbo].[Employee]SET [status] = 'On Lisence Expiration' WHERE [Employee ID]='" + comboBox1.SelectedItem.ToString() + "'");
                    }

                    this.Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Try Again...\nReason : " + ex.Message);
                }
            }
        }
コード例 #3
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (Validation())
     {
         db.Ins_Up_Del("INSERT INTO [AVVMS].[dbo].[oil]([date],[workshop],[address],[bill no.],[remarks],[vehicle no.],[amount],litres)VALUES('" + dateTimePicker1.Value.ToShortDateString() + "','" + twork.Text + "','" + taddress.Text + "','" + tbill.Text + "','" + tre.Text + "','" + comboBox1.SelectedItem.ToString() + "'," + tam.Text + "," + toil.Text + ")");
         db.Ins_Up_Del("UPDATE [AVVMS].[dbo].[Vehicles]SET [Status] = 'Available' WHERE [Vehicle No.] = '" + comboBox1.SelectedItem.ToString() + "'");
         MessageBox.Show("Added");
         this.Close();
     }
 }
コード例 #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (Validation())
            {
                db.Ins_Up_Del("INSERT INTO [AVVMS].[dbo].[bunk pay]([date],[payed],[bunk],[amount],[balance],[payement mode],[document code],[remark])VALUES('" + dateTimePicker1.Value.ToShortDateString() + "'," + tpay.Text + "," + lbbunk.Text + "," + lbam.Text + "," + lbbal.Text + ",'" + comboBox2.SelectedItem.ToString() + "','" + tbill.Text + "','" + trm.Text + "')");

                db.Ins_Up_Del("UPDATE [AVVMS].[dbo].[pbunk] SET [initial amount] = " + lbbal.Text + ",[amount] = " + lbbal.Text + " WHERE no=" + lbbunk.Text + "");

                MessageBox.Show("added");
                this.Close();
            }
        }
コード例 #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Session["usertype"].ToString() == "teacher")
            {
                //double hour = 0;


                //log_out
                //DateTime out_time = System.DateTime.Now;
                //string work_id = dh.GetValue("select top 1 work_id,log_in from tea_attend where tea_id=" + Session["user_id"] + " order by work_id desc");
                //dtb = dh.GetTable("select top 1 work_id,log_in,tea_rate from tea_attend ta  inner join Teacher  t on ta.tea_id=t.tea_id where t.tea_id=" + Session["user_id"] + " order by work_id desc");
                //dh.Ins_Up_Del("update tea_attend set log_out='" + out_time + "' where work_id=" + Convert.ToInt32(work_id.ToString()) + "");
                //dh.Ins_Up_Del("update tea_attend set log_out='" + out_time + "' where work_id=" + dtb.Rows[0][0] + "");
                dh.Ins_Up_Del("update teacher set tea_online='false' where tea_id=" + Convert.ToInt32(Session["user_id"]));

                //  dt = DH.GetTable("select * from Teacher as t inner join tea_attend as ta on ta.tea_id=t.tea_id where tea_id=" + Session["user_id"]);
                //  Label1.Text = dt.Rows[0]["tea_name"].ToString();
                //   DataTable dta = dh.GetTable("select top 1 * from tea_attend as ta inner join teacher as t on t.tea_id=ta.tea_id where t.tea_id=" + Session["user_id"] + "order by work_id desc");

                //   if (dta.Rows.Count > 0)
                //    {
                //DateTime a = Convert.ToDateTime(dtb.Rows[0][1].ToString());
                //DateTime b = out_time;
                //TimeSpan duration = b - a;
                //  double sec = duration.TotalSeconds;
                // double min = duration.TotalMinutes;
                //hour = duration.TotalHours;
                //hour = Math.Round(hour, 2);



                //  Label2.Text = time.ToString();

                //     }
                //Label3.Text = dt.Rows[0]["tea_rate"].ToString();
                //double salary = Convert.ToDouble(dtb.Rows[0]["tea_rate"].ToString()) * hour;
                //  Label4.Text = salary.ToString();
                //string date = System.DateTime.Now.ToString("MMM dd yyyy");

                //dh.Ins_Up_Del("insert into Salary values(" + Session["user_id"] + ",'" + hour.ToString() + "','" + date + "'," + salary + ")");
            }
            if (Session["usertype"].ToString() == "student")
            {
                dh.Ins_Up_Del("update student set stud_online='false' where stud_id=" + Convert.ToInt32(Session["user_id"]));
            }

            Session.Abandon();
            Response.Redirect("Default.aspx");
        }
    }
コード例 #6
0
 protected void Button2_Click(object sender, EventArgs e)
 {
     try
     {
         dh.Ins_Up_Del("INSERT INTO Subjects(sub_name, sub_syllabus)VALUES    ('" + txt_sub.Text + "','" + txt_syll.Text + "')");
         Labelerror.Text = "Saved Successfully !";
         FillTable();
     }
     catch (Exception ex)
     {
         Labelerror.Text = ex.Message.ToString();
     }
 }
コード例 #7
0
 protected void Button2_Click(object sender, EventArgs e)
 {
     try
     {
         dh.Ins_Up_Del("INSERT INTO Exam (exam_name, sub_id, exam_passmark, exam_maxmark) values('" + txt_exam.Text + "'," + DropDownList1.SelectedValue.ToString() + "," + txtpass.Text + "," + txtmax.Text + ")");
         Labelerror.Text = "Saved Successfully !";
         FillTable();
     }
     catch (Exception ex)
     {
         Labelerror.Text = "Error in Saving!";
     }
 }
コード例 #8
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (Validation())
            {
                db.Ins_Up_Del("INSERT INTO [AVVMS].[dbo].[refill bill]([date],[vehicle],[bunk],[amount],[remark],litres)VALUES('" + dateTimePicker1.Value.ToShortDateString() + "','" + comboBoxv.SelectedItem.ToString() + "'," + comboBoxbunk.SelectedItem.ToString() + "," + tam.Text + ",'" + tbill.Text + "'," + tpretr.Text + ")");

                db.Ins_Up_Del("UPDATE [AVVMS].[dbo].[Vehicles]SET [last refill date] = '" + dateTimePicker1.Value.ToShortDateString() + "' WHERE     ([Vehicle No.] = '" + comboBoxv.SelectedItem.ToString() + "')");

                db.Ins_Up_Del("UPDATE [AVVMS].[dbo].[pbunk]SET [amount] = " + ((Convert.ToDouble(tam.Text)) + (Convert.ToDouble(db.GetValue("SELECT [amount] FROM [AVVMS].[dbo].[pbunk] WHERE     ([no] = " + comboBoxbunk.SelectedItem.ToString() + ")")))) + " WHERE     ([no] = " + comboBoxbunk.SelectedItem.ToString() + ")");

                MessageBox.Show("Added");
                this.Close();
            }
        }
コード例 #9
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (Validation())
     {
         try
         {
             db.Ins_Up_Del("UPDATE [AVVMS].[dbo].[batha] SET [Light half Batha] = " + light_half.Text + " ,[light full batha] = " + light_full.Text + ",[light extra amount] = " + light_extra.Text + " ,[light hault batha] = " + light_hault.Text + " ,[heavy half batha] = " + heavy_half.Text + " ,[heavy hault batha] = " + heavy_hault.Text + " ,[heavy full batha] = " + heavy_full.Text + " ,[heavy km alavence driver] = " + heavykm_d.Text + " ,[heavy km alavence permanent cleaner] = " + heavykm_p.Text + " ,[heavy km alavance temporary cleaner] = " + heavykm_t.Text + ",[heavy extra amount driver] = " + heavyed.Text + " ,[heavy extra amount cleaner] = " + heavyec.Text + "");
             MessageBox.Show("Updation Success");
         }
         catch (Exception ex)
         {
             MessageBox.Show("Try Again...\nReason : " + ex.Message);
         }
     }
 }
コード例 #10
0
    protected void btn_Save_Click(object sender, EventArgs e)
    {
        string path = "";

        if (FileUpload1.FileName.Length > 0)
        {
            path = "~/Photos/" + FileUpload1.FileName;
            FileUpload1.SaveAs(MapPath(path));
        }
        else
        {
            path = path1;
        }



        try
        {
            DH.Ins_Up_Del("update Student set stud_name='" + txt_name.Text + "',stud_address='" + txt_address.Text + "',stud_mob='" + txt_mob.Text + "',stud_email='" + txt_email.Text + "',stud_qualification='" + txt_qualificatn.Text + "',stud_uname='" + txt_username.Text + "',stud_password='******',stud_gender='" + rdb_gender.SelectedItem.Text + "',stud_photo='" + path + "' where stud_id=" + Session["user_id"].ToString());

            Session["username"] = txt_name.Text;
            Response.Redirect("StudentHome.aspx");
        }
        catch (Exception ex)
        {
            LabelError.Text = "Error in Saving";
        }
    }
コード例 #11
0
    protected void Change_Click(object sender, EventArgs e)
    {
        DataTable dt = dh.GetTable("select password,uid from [login] where uid='" + Session["user"] + "'");

        Label2.Visible = false;
        if (dt.Rows.Count < 1)
        {
            Label2.Text     = "Unknown User";
            Label2.CssClass = "failurenotification";
            Label2.Visible  = true;
        }
        else
        {
            if (!dt.Rows[0]["password"].ToString().Equals(TextBox1.Text))
            {
                Label2.Text     = "Unknown password";
                Label2.CssClass = "failurenotification";
                Label2.Visible  = true;
            }
            else
            {
                if (!TextBox2.Text.Equals(TextBox3.Text))
                {
                    Label2.CssClass = "failurenotification";
                    Label2.Text     = "The Password and Confirmation Password must match.";
                    Label2.Visible  = true;
                }
                else
                {
                    dh.Ins_Up_Del("update [login] set password='******' where uid=" + dt.Rows[0]["uid"]);
                    Response.Redirect("ChangePasswordSuccess.aspx");
                }
            }
        }
    }
コード例 #12
0
    protected void LoadQuestion()
    {
        if (Questions.Tables[0].Rows.Count > 0)
        {
            //Load Question;
            DataRow DR = Questions.Tables[0].Rows[0];
            examd_id      = Convert.ToInt32(DR["examd_id"].ToString());
            Question.Text = DR["qstn_no"].ToString() + " of " + totalQs;
            sno           = DR["qstn_no"].ToString();
            //TestName.Text = "";// DR[2].ToString();
            //TestNo.Text = "";//DR[3].ToString();

            Questionlbl.Text = DR["qustn"].ToString();

            rbtnAns.Items.Clear();
            rbtnAns.Items.Add(DR["ans1"].ToString());
            rbtnAns.Items.Add(DR["ans2"].ToString());
            rbtnAns.Items.Add(DR["ans3"].ToString());
            rbtnAns.Items.Add(DR["ans4"].ToString());

            Questions.Tables[0].Rows.Remove(DR);

            if (Questionlbl.Text.Equals(totalQs.ToString()))
            {
                IsLastQs = true;
            }
        }
        else
        {
            //End Of File;
            //Response.Write("<script>alert('Thanks For Your Presence! You Can Leave Now.')</script>");

            try
            {
                dh.Ins_Up_Del("insert into ResultTable values(" + tno + "," + Session["user_id"].ToString() + "," + marks + ",'" + System.DateTime.Now.ToShortDateString() + "')");

                string pass     = dh.GetValue("select exam_passmark from Exam where exam_id=" + tno);
                int    passmark = Convert.ToInt32(pass);

                /*  if (marks >= passmark)
                 * {
                 *
                 *   // string chap = dh.GetValue("select Chapter from ChapterDetails where stud_id=" + Session["user_id"].ToString());
                 *   // int chapter = Convert.ToInt32(chap) + 1;
                 *   // dh.Ins_Up_Del("update ChapterDetails set chapter=" + chapter + " where stud_id=" + Session["user_id"].ToString());
                 *    Session.Abandon();
                 *    Response.Redirect("StudentHome.aspx");
                 * }*/
            }
            catch (Exception ex)
            {
                Response.Write("<script>alert(''" + ex.Message + "'')</script>");
            }



            RedirectToResults();
        }
    }
コード例 #13
0
        private void button1_Click(object sender, EventArgs e)
        {
            i = rd.Next(9999, 11111);

            db.Ins_Up_Del("insert into sub(branch,semester,period,id,otp,reason)values('" + comboBox1.SelectedItem.ToString().Substring(0, 6) + "','" + comboBox2.SelectedItem.ToString().Substring(8, 1) + "','" + textBox2.Text + "','" + textBox1.Text + "','" + i.ToString() + "','" + rsn.Text + "')");
            MessageBox.Show("Substituted Succesfully");
            MessageBox.Show("OTP   :" + i.ToString());
        }
コード例 #14
0
 protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     try
     {
         id = Convert.ToInt32(GridView1.SelectedRow.Cells[2].Text);
         DH.Ins_Up_Del("delete from ExamDetails where examd_id=" + id);
         FillTable();
         Labelerror.Text            = "Deleted!";
         MultiView1.ActiveViewIndex = 1;
     }
     catch (Exception ex)
     {
         Labelerror.Text            = "Please select a question";
         MultiView1.ActiveViewIndex = 1;
         //Labelerror.Text = "Error on Deletion!";
     }
 }
コード例 #15
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (Validation())
     {
         if (update_flag == 0)
         {
             db.Ins_Up_Del("INSERT INTO [AVVMS].[dbo].[pbunk]([name],[address],[initial amount],[amount],status)VALUES('" + tname.Text + "','" + tadd.Text + "'," + tam.Text + "," + tam.Text + ",'Available')");
             MessageBox.Show("Added");
             this.Close();
         }
         else
         {
             db.Ins_Up_Del("UPDATE [AVVMS].[dbo].[pbunk]SET [name] = '" + tname.Text + "',[address] = '" + tadd.Text + "' WHERE no=" + label4.Text + "");
             MessageBox.Show("Updated");
             this.Close();
         }
     }
 }
コード例 #16
0
 protected void Button_token_Click(object sender, EventArgs e)
 {
     db.Ins_Up_Del("INSERT INTO token (token_number, doctor, phone_number, token_date) VALUES(" + Label_token.Text + ",'" + DropDownList_doctor.SelectedItem.ToString() + "','" + TextBox_phone.Text + "','" + DateTime.Today.ToString("dd-MM-yyyy") + "')");
     ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Token Inserted Successfully')", true);
     TextBox_phone.Text = "";
     Label_token.Text   = "N/A";
     DropDownList_doctor.SelectedIndex = 0;
     Button_token.Enabled = false;
 }
コード例 #17
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (Validation())
            {
                String fc = "", sc = "";
                if (panelcleaner.Visible)
                {
                    if (!combofirst.SelectedItem.ToString().Equals("Select First Cleaner"))
                    {
                        fc = combofirst.SelectedItem.ToString();
                    }
                    if (!comboBox7.SelectedItem.ToString().Equals("Select Second Cleaner"))
                    {
                        sc = comboBox7.SelectedItem.ToString();
                    }
                }
                try
                {
                    db.Ins_Up_Del("INSERT INTO [AVVMS].[dbo].[Trips]([Vehicle No.],[Journey],[Purpose],[Provider],[Remarks],[date],[driver],[first cleaner],[second cleaner],[address],[mobile],[mail],[start meter],[start time],[moment slip no.],[status],km)VALUES('" + combovehi.SelectedItem.ToString() + "','" + tfrom.Text + "-" + tto.Text + "','" + tpur.Text + "','" + tname.Text + "','" + textBox1.Text + "','" + dateTimePicker1.Value.ToShortDateString() + "','" + combodriver.SelectedItem.ToString() + "','" + fc + "','" + sc + "','" + richTextadd.Text + "','" + tmobile.Text + "','" + tmail.Text + "','" + label5.Text + "','" + timePicker.Value.ToShortTimeString() + "','" + tmom.Text + "','On Trip',0)");

                    db.Ins_Up_Del("UPDATE [AVVMS].[dbo].[Vehicles]SET [Status] = 'On Trip'WHERE [Vehicle No.] = '" + combovehi.SelectedItem.ToString() + "'");

                    db.Ins_Up_Del("UPDATE [AVVMS].[dbo].[Employee]SET [Status] = 'On Trip'WHERE [Employee ID] = '" + combodriver.SelectedItem.ToString() + "'");
                    if (panelcleaner.Visible)
                    {
                        if (!combofirst.SelectedItem.ToString().Equals("Select First Cleaner"))
                        {
                            db.Ins_Up_Del("UPDATE [AVVMS].[dbo].[Employee]SET [Status] = 'On Trip'WHERE [Employee ID] = '" + combofirst.SelectedItem.ToString() + "'");
                        }
                        if (!comboBox7.SelectedItem.ToString().Equals("Select Second Cleaner"))
                        {
                            db.Ins_Up_Del("UPDATE [AVVMS].[dbo].[Employee]SET [Status] = 'On Trip'WHERE [Employee ID] = '" + comboBox7.SelectedItem.ToString() + "'");
                        }
                    }
                    MessageBox.Show("Assigned Successfully");

                    this.Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Try Again\nReason :" + ex.Message);
                }
            }
        }
コード例 #18
0
 private void button6_Click(object sender, EventArgs e)
 {
     if ((MessageBox.Show("Do you want to delete Vehicle No. : " + dataGridView6.SelectedRows[0].Cells[0].Value.ToString() + "", "AVVMS", MessageBoxButtons.YesNo).ToString().Equals("Yes")))
     {
         try
         {
             //db.Ins_Up_Del("DELETE FROM Employee WHERE     ([Employee ID] = '" + dataGridView6.SelectedRows[0].Cells[0].Value.ToString() + "')");
             db.Ins_Up_Del("UPDATE [AVVMS].[dbo].[Vehicles]SET [Status] = 'Removed' WHERE     ([Vehicle No.] = '" + dataGridView6.SelectedRows[0].Cells[0].Value.ToString() + "')");
             new Vehicle_Sell(dataGridView6.SelectedRows[0].Cells[0].Value.ToString()).ShowDialog();
             MessageBox.Show("Vehicle No. : " + dataGridView6.SelectedRows[0].Cells[0].Value.ToString() + " Deleted SuccessFully", "AVVMS");
             dataGridView6.DataSource = db.GetTable("SELECT [Vehicle No.] ,[Type] ,[Model]  ,[Fuel Capacity] as Milage,[Fuel Type],[fuel]as [Current Feul],[Fuel Refill Limit]    ,[Status]    FROM [AVVMS].[dbo].[Vehicles] where Status != 'Removed'");
             groupBox1.Hide();
         }
         catch (Exception ex)
         {
             MessageBox.Show("Try Again\nReason : " + ex.Message + "", "AVVMS");
         }
     }
 }
コード例 #19
0
    protected void Button1_Click1(object sender, EventArgs e)
    {
        if (FileUpload1.PostedFile != null)
        {
            //string fileExt =
            //   System.IO.Path.GetExtension(FileUpload1.FileName);

            //if (fileExt == ".jpeg" || fileExt == ".jpg")
            //{

            // Get the HttpFileCollection


            try
            {
                Labelerror.Text = "";
                HttpFileCollection hfc = Request.Files;
                for (int i = 0; i < hfc.Count; i++)
                {
                    HttpPostedFile hpf = hfc[i];
                    // if (hpf.ContentLength > 0 && (hpf.FileName.Contains(".jpeg") || hpf.FileName.Contains(".jpg")))
                    if (hpf.ContentLength > 0)
                    {
                        //if (hpf.FileName.ToString().Contains(".wmv"))
                        //{
                        //int c;
                        String count = dh.GetValue("SELECT        MAX(sd_id) FROM            tution ");
                        if (count.Equals(null))
                        {
                            c = 1;
                        }
                        else
                        {
                            c++;
                        }
                        hpf.SaveAs(Server.MapPath("Study") + "\\" + System.IO.Path.GetFileName(hpf.FileName));
                        dh.Ins_Up_Del("INSERT INTO tution                         (sd_id, sub_id, sd_chapter, sd_path, ImageName, Description)VALUES    (" + c + "," + DropDownList1.SelectedValue.ToString() + ",1,'" + "Study\\" + System.IO.Path.GetFileName(hpf.FileName) + "','" + hpf.FileName.ToString() + "','')");
                        Labelerror.Text = Labelerror.Text.ToString() + "<b>File: </b>" + hpf.FileName + " <b>Size:</b> " +
                                          hpf.ContentLength + " <b>Type:</b> " + hpf.ContentType + " Uploaded Successfully <br/>";
                        //  }
                        //{
                        //  Labelerror.Text = "choose wmv file";
                        //}
                    }
                }
            }

            catch (Exception ex)
            {
                Labelerror.Text = "Error on Uploading!";
            }
            //  }
        }
    }
コード例 #20
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (Validation())
            {
                db.Ins_Up_Del("INSERT INTO [AVVMS].[dbo].[insurance]([no.],[date],[to],[payement mode],[document code],[document date],[remarks],[from],[vehicle no.],[amount])VALUES('" + label11.Text + "','" + dateTimePickerdate.Value.ToShortDateString() + "','" + dateTimePickerto.Value.ToShortDateString() + "','" + comboBoxpmode.SelectedItem.ToString() + "','" + tdcode.Text + "','" + dateTimePickerddte.Value.ToShortDateString() + "','" + tremark.Text + "','" + dateTimePickerfrom.Value.ToShortDateString() + "','" + comboBoxvehicle.SelectedItem.ToString() + "','" + tam.Text + "')");

                db.Ins_Up_Del("UPDATE [AVVMS].[dbo].[Vehicles]SET [Insurance Expiry date] = '" + dateTimePickerto.Value.ToShortDateString() + "' WHERE     ([Vehicle No.] = '" + comboBoxvehicle.SelectedItem.ToString() + "')");

                if ((DateTime.Parse(DateTime.Now.ToShortDateString()).AddDays(15).CompareTo(DateTime.Parse(dateTimePickerto.Value.ToShortDateString()))) >= 0)
                {
                    db.Ins_Up_Del("INSERT INTO [AVVMS].[dbo].[Vehicle_Notifications]([Vehicle],[Reason],[Remarks])VALUES('" + comboBoxvehicle.SelectedItem.ToString() + "','Insurance of Vehicle No. : " + comboBoxvehicle.SelectedItem.ToString() + " will expire On : " + dateTimePickerto.Value.ToShortDateString() + "','Expiration Date : " + dateTimePickerto.Value.ToShortDateString() + "')");

                    db.Ins_Up_Del("UPDATE [AVVMS].[dbo].[Vehicles]SET [status] = 'On Certificate Expiration' WHERE [Vehicle No.]='" + comboBoxvehicle.SelectedItem.ToString() + "'");

                    Program.pi.Display("Insurance of Vehicle No. : " + comboBoxvehicle.SelectedItem.ToString() + " will expire On : " + dateTimePickerto.Value.ToShortDateString() + "");
                }
                MessageBox.Show("In Success");
                this.Close();
            }
        }
コード例 #21
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (Validation())
            {
                String type = "", lisence = "", lisence_expiry = "";
                if (panel1.Visible)
                {
                    type = comboBoxtyp.SelectedItem.ToString();
                }
                else if (panel2.Visible)
                {
                    lisence        = tlise.Text;
                    lisence_expiry = dateTimePickerexp.Value.ToShortDateString();
                }
                if (update_flag == 0)
                {
                    db.Ins_Up_Del("INSERT INTO [AVVMS].[dbo].[Employee]([Employee ID],[Join date],[Name],[Address],[Mobile No.],[Email],[DOB],[Category],[Type],[License No.],[License Expiry date],[Status],[Blood Group])VALUES('" + tid.Text + "','" + dateTimePickerjdate.Value.ToShortDateString() + "','" + tname.Text + "','" + richTextBoxadd.Text + "','" + tmob.Text + "','" + tmail.Text + "','" + dateTimePickerdob.Value.ToShortDateString() + "','" + comboBoxcate.SelectedItem.ToString() + "','" + type + "','" + lisence + "','" + lisence_expiry + "','Available','" + comboBoxbloo.SelectedItem.ToString() + "')");
                    MessageBox.Show("Added Successfully");
                }
                else
                {
                    db.Ins_Up_Del("UPDATE [AVVMS].[dbo].[Employee] SET [Join date] = '" + dateTimePickerjdate.Value.ToShortDateString() + "',[Name] = '" + tname.Text + "' ,[Address] ='" + richTextBoxadd.Text + "' ,[Mobile No.]='" + tmob.Text + "' ,[Email] = '" + tmail.Text + "' ,[DOB] = '" + dateTimePickerdob.Value.ToShortDateString() + "' ,[Category] = '" + comboBoxcate.SelectedItem.ToString() + "',[Type] = '" + type + "' ,[License No.] = '" + lisence + "' ,[License Expiry date] = '" + lisence_expiry + "',[Blood Group] = '" + comboBoxbloo.SelectedItem.ToString() + "' WHERE     ([Employee ID] = '" + label8.Text + "')");
                    MessageBox.Show("Updated Successfully");
                }

                if (comboBoxcate.SelectedItem.ToString().Equals("Driver"))
                {
                    if ((DateTime.Parse(DateTime.Now.ToShortDateString()).AddDays(15).CompareTo(DateTime.Parse(dateTimePickerexp.Value.ToShortDateString()))) >= 0)
                    {
                        db.Ins_Up_Del("INSERT INTO [AVVMS].[dbo].[Employee_Notifications]([Employee_ID],[Reason],[Remarks])VALUES('" + tid.Text + "','Lisence of Employee ID : " + tid.Text + " will expire On : " + dateTimePickerexp.Value.ToShortDateString() + "','Expiration Date : " + dateTimePickerexp.Value.ToShortDateString() + "')");

                        Program.pi.Display("Lisence of Employee ID : " + tid.Text + " will expire On : " + dateTimePickerexp.Value.ToShortDateString() + "");

                        db.Ins_Up_Del("UPDATE [AVVMS].[dbo].[Employee]SET [status] = 'On Lisence Expiration' WHERE [Employee ID]='" + tid.Text + "'");
                    }
                }


                this.Close();
            }
        }
コード例 #22
0
        private void button1_Click(object sender, EventArgs e)
        {
            String br = comboBox1.SelectedItem.ToString();
            String cv = br.Substring(0, 6);

            if (comboBox2.SelectedItem.ToString().Equals("semester1"))
            {
                db.Ins_Up_Del("UPDATE       " + cv + "t1" + " SET                p1 = '" + comboBox8.SelectedItem.ToString() + "', f1 = '" + f1.SelectedItem.ToString() + "', p2 = '" + comboBox7.SelectedItem.ToString() + "', f2 = '" + f2.SelectedItem.ToString() + "', p3 = '" + comboBox6.SelectedItem.ToString() + "', f3 = '" + f3.SelectedItem.ToString() + "', p4 = '" + comboBox5.SelectedItem.ToString() + "', f4 = '" + f4.SelectedItem.ToString() + "', p5 = '" + comboBox4.SelectedItem.ToString() + "', f5 = '" + f5.SelectedItem.ToString() + "' WHERE    (day = '" + comboBox3.SelectedItem.ToString() + "')");
            }
            if (comboBox2.SelectedItem.ToString().Equals("semester2"))
            {
                db.Ins_Up_Del("UPDATE       " + cv + "t2" + " SET                p1 = '" + comboBox8.SelectedItem.ToString() + "', f1 = '" + f1.SelectedItem.ToString() + "', p2 = '" + comboBox7.SelectedItem.ToString() + "', f2 = '" + f2.SelectedItem.ToString() + "', p3 = '" + comboBox6.SelectedItem.ToString() + "', f3 = '" + f3.SelectedItem.ToString() + "', p4 = '" + comboBox5.SelectedItem.ToString() + "', f4 = '" + f4.SelectedItem.ToString() + "', p5 = '" + comboBox4.SelectedItem.ToString() + "', f5 = '" + f5.SelectedItem.ToString() + "' WHERE    (day = '" + comboBox3.SelectedItem.ToString() + "')");
            }
            if (comboBox2.SelectedItem.ToString().Equals("semester3"))
            {
                db.Ins_Up_Del("UPDATE       " + cv + "t3" + " SET                p1 = '" + comboBox8.SelectedItem.ToString() + "', f1 = '" + f1.SelectedItem.ToString() + "', p2 = '" + comboBox7.SelectedItem.ToString() + "', f2 = '" + f2.SelectedItem.ToString() + "', p3 = '" + comboBox6.SelectedItem.ToString() + "', f3 = '" + f3.SelectedItem.ToString() + "', p4 = '" + comboBox5.SelectedItem.ToString() + "', f4 = '" + f4.SelectedItem.ToString() + "', p5 = '" + comboBox4.SelectedItem.ToString() + "', f5 = '" + f5.SelectedItem.ToString() + "' WHERE    (day = '" + comboBox3.SelectedItem.ToString() + "')");
            }
            if (comboBox2.SelectedItem.ToString().Equals("semester4"))
            {
                db.Ins_Up_Del("UPDATE       " + cv + "t4" + " SET                p1 = '" + comboBox8.SelectedItem.ToString() + "', f1 = '" + f1.SelectedItem.ToString() + "', p2 = '" + comboBox7.SelectedItem.ToString() + "', f2 = '" + f2.SelectedItem.ToString() + "', p3 = '" + comboBox6.SelectedItem.ToString() + "', f3 = '" + f3.SelectedItem.ToString() + "', p4 = '" + comboBox5.SelectedItem.ToString() + "', f4 = '" + f4.SelectedItem.ToString() + "', p5 = '" + comboBox4.SelectedItem.ToString() + "', f5 = '" + f5.SelectedItem.ToString() + "' WHERE    (day = '" + comboBox3.SelectedItem.ToString() + "')");
            }
            if (comboBox2.SelectedItem.ToString().Equals("semester5"))
            {
                db.Ins_Up_Del("UPDATE       " + cv + "t5" + " SET                p1 = '" + comboBox8.SelectedItem.ToString() + "', f1 = '" + f1.SelectedItem.ToString() + "', p2 = '" + comboBox7.SelectedItem.ToString() + "', f2 = '" + f2.SelectedItem.ToString() + "', p3 = '" + comboBox6.SelectedItem.ToString() + "', f3 = '" + f3.SelectedItem.ToString() + "', p4 = '" + comboBox5.SelectedItem.ToString() + "', f4 = '" + f4.SelectedItem.ToString() + "', p5 = '" + comboBox4.SelectedItem.ToString() + "', f5 = '" + f5.SelectedItem.ToString() + "' WHERE    (day = '" + comboBox3.SelectedItem.ToString() + "')");
            }
            if (comboBox2.SelectedItem.ToString().Equals("semester6"))
            {
                db.Ins_Up_Del("UPDATE       " + cv + "t6" + " SET                p1 = '" + comboBox8.SelectedItem.ToString() + "', f1 = '" + f1.SelectedItem.ToString() + "', p2 = '" + comboBox7.SelectedItem.ToString() + "', f2 = '" + f2.SelectedItem.ToString() + "', p3 = '" + comboBox6.SelectedItem.ToString() + "', f3 = '" + f3.SelectedItem.ToString() + "', p4 = '" + comboBox5.SelectedItem.ToString() + "', f4 = '" + f4.SelectedItem.ToString() + "', p5 = '" + comboBox4.SelectedItem.ToString() + "', f5 = '" + f5.SelectedItem.ToString() + "' WHERE    (day = '" + comboBox3.SelectedItem.ToString() + "')");
            }
        }
コード例 #23
0
 protected void Button2_Click(object sender, EventArgs e)
 {
     try
     {
         DH.Ins_Up_Del("update student set stud_status='True' where stud_id=" + DropDownList1.SelectedValue.ToString());
         Labelerror.Text = "Approved";
         Bind();
     }
     catch (Exception ex)
     {
         Labelerror.Text = "Error";
     }
 }
コード例 #24
0
    protected void Button2_Click(object sender, EventArgs e)
    {
        try
        {
            dh.Ins_Up_Del("insert into adminmsgs values(" + Session["user_id"].ToString() + ",'" + Session["usertype"].ToString() + "','" + DateTime.Now.ToShortDateString() + "','" + TextBoxsub.Text + "','" + TextBoxmsg.Text + "')");

            Labelerror.Text = "Send Successfully !";
            TextBoxmsg.Text = "";
            TextBoxsub.Text = "";
        }
        catch (Exception ex)
        {
            Labelerror.Text = "Error in Sending!";
        }
    }
コード例 #25
0
 private void button6_Click(object sender, EventArgs e)
 {
     if ((MessageBox.Show("Do you want to delete Bunk No. : " + dataGridView6.SelectedRows[0].Cells[0].Value.ToString() + "", "AVVMS", MessageBoxButtons.YesNo).ToString().Equals("Yes")))
     {
         try
         {
             db.Ins_Up_Del("UPDATE [AVVMS].[dbo].[pbunk]SET [Status] = 'Removed' WHERE     ([no] = '" + dataGridView6.SelectedRows[0].Cells[0].Value.ToString() + "')");
             MessageBox.Show("Bunk No. : " + dataGridView6.SelectedRows[0].Cells[0].Value.ToString() + " Deleted SuccessFully", "AVVMS");
             dataGridView6.DataSource = db.GetTable("SELECT [no],[name],[address],[amount],[status]FROM [AVVMS].[dbo].[pbunk] where Status != 'Removed'");
             groupBox1.Hide();
         }
         catch (Exception ex)
         {
             MessageBox.Show("Try Again\nReason : " + ex.Message + "", "AVVMS");
         }
     }
 }
コード例 #26
0
 private void button4_Click_1(object sender, EventArgs e)
 {
     if ((MessageBox.Show("Do you want to delete Employee ID : " + dataGridView6.SelectedRows[0].Cells[0].Value.ToString() + "", "AVVMS", MessageBoxButtons.YesNo).ToString().Equals("Yes")))
     {
         try
         {
             //db.Ins_Up_Del("DELETE FROM Employee WHERE     ([Employee ID] = '" + dataGridView6.SelectedRows[0].Cells[0].Value.ToString() + "')");
             db.Ins_Up_Del("UPDATE [AVVMS].[dbo].[Employee]SET [Status] = 'Removed' WHERE     ([Employee ID] = '" + dataGridView6.SelectedRows[0].Cells[0].Value.ToString() + "')");
             MessageBox.Show("Employee ID : " + dataGridView6.SelectedRows[0].Cells[0].Value.ToString() + " Deleted SuccessFully", "AVVMS");
             dataGridView6.DataSource = db.GetTable("SELECT     [Employee ID], Name,  [Join date], [Mobile No.], Type ,Category, DOB, [Blood Group],Status FROM         Employee where Status != 'Removed'");
             groupBox1.Hide();
         }
         catch (Exception ex)
         {
             MessageBox.Show("Try Again\nReason : " + ex.Message + "", "AVVMS");
         }
     }
 }
コード例 #27
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (textBox1.Text.Length == 0)
     {
         MessageBox.Show("Enter message tiltle");
     }
     else
     {
         if (msg.Text.Length == 0)
         {
             MessageBox.Show("Enter Message body");
         }
         else
         {
             DBhandler v = new DBhandler();
             v.Ins_Up_Del("insert into messages(title,message) values('" + textBox1.Text.ToString() + "','" + msg.Text.ToString() + "')");
             MessageBox.Show("Message insrted succesfully");
         }
     }
 }
コード例 #28
0
    protected void Button1_Click1(object sender, EventArgs e)
    {
        if (FileUpload1.PostedFile != null)
        {
            //string fileExt =
            //   System.IO.Path.GetExtension(FileUpload1.FileName);

            //if (fileExt == ".jpeg" || fileExt == ".jpg")
            //{

            // Get the HttpFileCollection


            try
            {
                Labelerror.Text = "";
                HttpFileCollection hfc = Request.Files;
                for (int i = 0; i < hfc.Count; i++)
                {
                    HttpPostedFile hpf = hfc[i];
                    // if (hpf.ContentLength > 0 && (hpf.FileName.Contains(".jpeg") || hpf.FileName.Contains(".jpg")))
                    if (hpf.ContentLength > 0)
                    {
                        // if (hpf.FileName.ToString().Contains(".jpg"))
                        //{
                        hpf.SaveAs(Server.MapPath("Study") + "\\" + System.IO.Path.GetFileName(hpf.FileName));
                        DH.Ins_Up_Del("insert into StudyMaterials values(" + DropDownList1.SelectedValue.ToString() + ",1,'" + "Study\\" + System.IO.Path.GetFileName(hpf.FileName) + "','" + hpf.FileName.ToString() + "','')");
                        Labelerror.Text = Labelerror.Text.ToString() + "<b>File: </b>" + hpf.FileName + " <b>Size:</b> " +
                                          hpf.ContentLength + " <b>Type:</b> " + hpf.ContentType + " Uploaded Successfully <br/>";
                        //}
                    }
                }
            }

            catch (Exception ex)
            {
                Labelerror.Text = "Error on Uploading!";
            }
            //}
        }
    }
コード例 #29
0
        private void add_db_Click(object sender, EventArgs e)
        {
            int co = Subjects.Items.Count;

            if (co == 0)
            {
                MessageBox.Show("Minimum One Subject Is required");
            }

            else
            {
                switch (co)
                {
                case 1: db.Ins_Up_Del("INSERT INTO staffs (ID, NAME, S1, S2, S3, S4, S5,PHONE,pass )VALUES        (" + i + ", '" + name.Text.ToString() + "', '" + Subjects.Items[0].ToString() + "', 'nil', 'nil', 'nil', 'nil', '" + phone.Text.ToString() + "','" + rd.Next(3000, 4000) + "')");
                    MessageBox.Show("Inserted");
                    break;

                case 2:
                    db.Ins_Up_Del("INSERT INTO staffs (ID, NAME, S1, S2, S3, S4, S5,PHONE,pass )VALUES        (" + i + ", '" + name.Text.ToString() + "', '" + Subjects.Items[0].ToString() + "', '" + Subjects.Items[1].ToString() + "', 'nil', 'nil', 'nil', '" + phone.Text.ToString() + "','" + rd.Next(3000, 4000) + "')");
                    MessageBox.Show("Inserted");
                    break;

                case 3:
                    db.Ins_Up_Del("INSERT INTO staffs (ID, NAME, S1, S2, S3, S4, S5,PHONE,pass )VALUES        (" + i + ", '" + name.Text.ToString() + "', '" + Subjects.Items[0].ToString() + "', '" + Subjects.Items[1].ToString() + "',  '" + Subjects.Items[2].ToString() + "', 'nil', 'nil', '" + phone.Text.ToString() + "','" + rd.Next(3000, 4000) + "')");
                    MessageBox.Show("Inserted");
                    break;

                case 4:
                    db.Ins_Up_Del("INSERT INTO staffs (ID, NAME, S1, S2, S3, S4, S5,PHONE,pass )VALUES        (" + i + ", '" + name.Text.ToString() + "', '" + Subjects.Items[0].ToString() + "', '" + Subjects.Items[1].ToString() + "',  '" + Subjects.Items[2].ToString() + "', '" + Subjects.Items[3].ToString() + "', 'nil', '" + phone.Text.ToString() + "','" + rd.Next(3000, 4000) + "')");
                    MessageBox.Show("Inserted");
                    break;

                case 5:
                    db.Ins_Up_Del("INSERT INTO staffs (ID, NAME, S1, S2, S3, S4, S5,PHONE,pass )VALUES        (" + i + ", '" + name.Text.ToString() + "', '" + Subjects.Items[0].ToString() + "', '" + Subjects.Items[1].ToString() + "',  '" + Subjects.Items[2].ToString() + "', '" + Subjects.Items[3].ToString() + "', '" + Subjects.Items[4].ToString() + "', '" + phone.Text.ToString() + "','" + rd.Next(3000, 4000) + "')");
                    MessageBox.Show("Inserted");
                    break;
                }
                i          = rd.Next(2000, 3000);
                id.Text    = i.ToString();
                name.Text  = null;
                phone.Text = null;
            }
        }
コード例 #30
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (Validation())
            {
                String message = "";
                int    c1f     = 0;

                for (int i = 0; i < dataGridView1.Rows.Count; i++)
                {
                    if (dataGridView1.Rows[i].Cells[1].Value.ToString().Equals(""))
                    {
                        c1f = 1;
                        if (message.Equals(""))
                        {
                            message = message + "Enter Address For Customer No. : " + (i + 1);
                        }
                        else
                        {
                            message = message + "\nEnter Address For Customer No. : " + (i + 1);
                        }
                    }
                    if (dataGridView1.Rows[i].Cells[2].Value.ToString().Equals(""))
                    {
                        c1f = 1;
                        if (message.Equals(""))
                        {
                            message = message + "Enter Tender Amount For Customer No. : " + (i + 1);
                        }
                        else
                        {
                            message = message + "\nEnter Tender Amount For Customer No. : " + (i + 1);
                        }
                    }
                    else
                    {
                        try
                        {
                            Decimal k = Convert.ToDecimal(dataGridView1.Rows[i].Cells[2].Value.ToString());
                        }
                        catch (FormatException ex)
                        {
                            c1f = 1;
                            if (message.Equals(""))
                            {
                                message = message + "Enter Correct Qoutation Amount For Supplier No. : " + (i + 1);
                            }
                            else
                            {
                                message = message + "\nEnter Correct Qoutation Amount For Supplier No. : " + (i + 1);
                            }
                        }
                    }
                    if (c1f == 0)
                    {
                        for (int i2 = 0; i2 < dataGridView1.Rows.Count; i2++)
                        {
                            db.Ins_Up_Del("INSERT INTO [AVVMS].[dbo].[tender]([customer],[tender amount],[vehicle no.]) VALUES ('" + dataGridView1.Rows[i].Cells[1].Value.ToString() + "'," + dataGridView1.Rows[i].Cells[2].Value.ToString() + " ,'" + label2.Text + "')");
                        }
                        db.Ins_Up_Del("INSERT INTO [AVVMS].[dbo].[sell] ([Tender date] ,[Selected Tender No.],[Tender Amount],[Cheque No.],[Purchase date],vehicle)VALUES('" + dateTimePicker1.Value.ToString() + "','" + tsq.Text + "','" + tam.Text + "','" + tcheck.Text + "','" + dateTimePicker2.Value.ToShortDateString() + "','" + label2.Text + "')");
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show(message);
                    }
                }
            }
        }