示例#1
0
    public int Insert()
    {
        int inserted = 0;

        String query = "insert into tblbooking values('" + Name + "','" + Email + "','" + Mobile + "','" + CarNo + "','" + BDateTime + "','" + PDate + "','" + PTime + "','" + PLocation + "','" + DDate + "','" + DTime + "'," + Amount + ")";

        inserted = dbobj.InsertUpdateDelete(query);
        return(inserted);
    }
    public int Insert()
    {
        int     inserted = 0;
        Boolean flag     = false;
        String  query    = "insert into tblcar values('" + CarNo + "','" + CarName + "','" + CarType + "','" + FuelType + "','" + Description + "','" + CarImage + "'," + HrlyRate + "," + MinHrs + ",'" + CarCatName + "','" + "NO" + "')";
        String  query1   = "select CarNo from tblcar where CarNo='" + CarNo + "'";

        flag = dbobj.CheckDuplicate(query1);
        if (flag == false)
        {
            inserted = dbobj.InsertUpdateDelete(query);
        }
        return(inserted);
    }
示例#3
0
    public int Insert()
    {
        int     inserted = 0;
        Boolean flag     = false;
        String  query    = "insert into tbluserrecord values('" + Email + "','" + Name + "','" + Address + "','" + Mobile + "','" + Password + "','" + UserImage + "','" + Feedback + "')";
        String  query1   = "select Email from tbluserrecord where Email='" + Email + "'";

        flag = dbobj.CheckDuplicate(query1);
        if (flag == false)
        {
            inserted = dbobj.InsertUpdateDelete(query);
        }
        return(inserted);
    }
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        clsDBaccess dbobj = new clsDBaccess();

        try
        {
            int    rowupdate = e.RowIndex;
            String txtCarNo  = (String)GridView1.Rows[rowupdate].Cells[1].Text;
            //TextBox txtCarCat = (TextBox)GridView1.Rows[rowupdate].Cells[2].Controls[0];

            /* TextBox txtCarName = (TextBox)GridView1.Rows[rowupdate].Cells[3].Controls[0];
             *
             * TextBox txtCarType = (TextBox)GridView1.Rows[rowupdate].Cells[4].Controls[0];
             * TextBox txtFuelType = (TextBox)GridView1.Rows[rowupdate].Cells[5].Controls[0];
             * TextBox txtDescription = (TextBox)GridView1.Rows[rowupdate].Cells[6].Controls[0];
             * TextBox txtHrlyRate = (TextBox)GridView1.Rows[rowupdate].Cells[7].Controls[0];
             * TextBox txtMinHrs = (TextBox)GridView1.Rows[rowupdate].Cells[8].Controls[0];*/

            TextBox txtbooked = (TextBox)GridView1.Rows[rowupdate].Cells[9].Controls[0];
            // String password = (String)GridView1.Rows[rowupdate].Cells[5].Text;
            String query = "update tblcar set Booked='" + txtbooked.Text + "' where CarNo='" + txtCarNo + "'";

            dbobj.InsertUpdateDelete(query);

            //remove the edit mode
            GridView1.EditIndex = -1;
            populateGridview();
        }
        catch (Exception err)
        {
            lblmsg.Text = err.Message;
        }
    }
示例#5
0
    protected void btnSubmitCat_Click(object sender, EventArgs e)
    {
        int c = 0;

        ob.CarCatName = txtCarCatName.Text;
        Boolean flag   = false;
        String  query  = "insert into tblcarcat values('" + ob.CarCatName + "','" + txtSeater.Text + "')";
        String  query1 = "select CarCatName from tblcarcat where CarCatName='" + ob.CarCatName + "'";

        try
        {
            flag = dbobj.CheckDuplicate(query1);
            if (flag == false)
            {
                c = dbobj.InsertUpdateDelete(query);
            }
            if (c == 1)
            {
                lblmsg.Text = "Car Inserted Successfully";
            }
            else
            {
                lblmsg.Text = "Car Category Already Exists";
            }
            txtCarCatName.Text = "";
            txtSeater.Text     = "";
        }
        catch (Exception err)
        {
            lblmsg.Text = err.Message;
        }
    }
示例#6
0
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int        updated;
        int        rowupdate = e.RowIndex;
        clsbooking obj       = new clsbooking();

        try
        {
            obj.BookingID = int.Parse((String)GridView1.Rows[rowupdate].Cells[1].Text);
            obj.Delete();
            obj.CarNo = (String)GridView1.Rows[rowupdate].Cells[5].Text;

            String query = "update tblcar set Booked='" + "NO" + "' where CarNo='" + obj.CarNo + "'";
            updated = dbobj.InsertUpdateDelete(query);


            GridView1.EditIndex = -1;

            //refresh the grid view
            populateGridview();
        }
        catch (Exception err)
        {
            lblmsg.Text = err.Message;
        }
    }
示例#7
0
    protected void btnBook_Click(object sender, EventArgs e)
    {
        ob.BDateTime = DateTime.Now.ToString("dd/MM/yyyy");
        int inserted, updated;

        try
        {
            inserted = ob.Insert();
            String query = "update tblcar set Booked='" + "YES" + "' where CarNo='" + ob.CarNo + "'";
            updated = dbobj.InsertUpdateDelete(query);
            Response.Redirect("BookedSuccessfully.aspx");
        }
        catch (Exception err)
        {
            lblmsg.Text = err.Message;
        }
    }
示例#8
0
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int        updated, result;
        int        rowupdate = e.RowIndex;
        clsbooking obj       = new clsbooking();

        try
        {
            obj.BookingID = int.Parse((String)GridView1.Rows[rowupdate].Cells[1].Text);
            DateTime cdt       = DateTime.Now.AddHours(1);
            String[] splitdate = GridView1.Rows[rowupdate].Cells[4].Text.Split('-');
            String[] splittime = GridView1.Rows[rowupdate].Cells[5].Text.Split(':');

            DateTime pdt = new DateTime(int.Parse(splitdate[2]), int.Parse(splitdate[1]), int.Parse(splitdate[0]), int.Parse(splittime[0]), int.Parse(splittime[1]), 00);
            result = DateTime.Compare(pdt, cdt);

            if (result > 0)
            {
                obj.Delete();

                obj.CarNo = (String)GridView1.Rows[rowupdate].Cells[2].Text;

                String query = "update tblcar set Booked='" + "NO" + "' where CarNo='" + obj.CarNo + "'";
                updated = dbobj.InsertUpdateDelete(query);

                //remove the edit mode
                GridView1.EditIndex = -1;

                //refresh the grid view
                populateGridview();
            }
            else
            {
                lblmsg.Text = "Previous Bookings Cannot Be Cancelled";
            }
        }
        catch (Exception err)
        {
            lblmsg.Text = err.Message;
        }
    }
    protected void btnEditProfile_Click(object sender, EventArgs e)
    {
        int c, updated;

        try
        {
            AddDetails();
            String query = "update tbluserrecord set Name='" + ob.Name + "',Address='" + ob.Address + "',Mobile='" + ob.Mobile + "',UserImage='" + ob.UserImage + "' where Email='" + ob.Email + "'";
            updated = dbobj.InsertUpdateDelete(query);


            if (updated == 1)
            {
                Response.Redirect("MyProfile.aspx");
            }
        }
        catch (Exception err)
        {
            lblmsg.Text = err.Message;
        }
    }