Example #1
0
 protected void Button_Cancel_P10_Click(object sender, EventArgs e)
 {
     Button_Cancel_P10.Visible = false;
     Button_Update_P10.Visible = false;
     Button_Save.Visible       = true;
     for (int lop = 0; lop < GridView5.Rows.Count; lop++)
     {
         LinkButton LinkButtona = (LinkButton)GridView5.Rows[lop].FindControl("LinkButton3");
         LinkButtona.ForeColor = System.Drawing.Color.Blue;
     }
     HiddenField_VehicleId_p10.Value = "0";
     TextBox_ChassisNumber.Text      = "";
     TextBox_Colour.Text             = "";
     TextBox_CubicCapacity.Text      = "";
     TextBox_EnginNo.Text            = "";
     TextBox_Height.Text             = "";
     TextBox_HorsePower.Text         = "";
     TextBox_InsuranceNumber.Text    = "";
     TextBox_Lenght.Text             = "";
     //TextBox_Maker_Name.Text = "";
     DropDownList_ManufactureMonths.DataBind();
     DropDownList_ManufactureMonths.Items.Insert(0, "");
     DropDownList_ManufactureMonths.Items[0].Value = "";
     TextBox_Manufacture_Year.Text = "";
     TextBox_NoOfCylinder.Text     = "";
     // TextBox_OwnerName.Text = "";
     TextBox_Registration_Authority.Text = "";
     TextBox_SeatingCapcity.Text         = "";
     TextBox_UnLandedWeight.Text         = "";
     TextBox_Width.Text          = "";
     TextBox_Number.Text         = "";
     TextBox_Cost.Text           = "";
     TextBox_RegistrationNo.Text = "";
     CheckBoxList_Vehicle_FuelType.DataBind();
 }
Example #2
0
        protected void LinkButton3_Click(object sender, EventArgs e)
        {
            GridViewRow gv           = (GridViewRow)(sender as Control).Parent.Parent;
            int         i            = gv.RowIndex;
            LinkButton  LinkButton3  = (LinkButton)GridView5.Rows[i].FindControl("LinkButton3");
            HiddenField HiddenField2 = (HiddenField)GridView5.Rows[i].FindControl("HiddenField2");

            HiddenField_VehicleId_p10.Value = HiddenField2.Value;
            for (int lop = 0; lop < GridView5.Rows.Count; lop++)
            {
                LinkButton LinkButtona = (LinkButton)GridView5.Rows[lop].FindControl("LinkButton3");
                LinkButtona.ForeColor = System.Drawing.Color.Blue;
            }
            LinkButton3.ForeColor = System.Drawing.Color.Red;


            {
                ////Fetch Data

                SqlConnection con = new SqlConnection(connection);
                SqlCommand    cmd = new SqlCommand("Select_Vehicle_For_Update", con);
                cmd.CommandType = CommandType.StoredProcedure;
                SqlParameter v_id = new SqlParameter("@Vehicle_id", HiddenField_VehicleId_p10.Value);
                //cmd.Parameters.Add(v_id);
                //SqlDataReader r = cmd.ExecuteReader(new SqlParameter("@Vehicle_id", HiddenField_VehicleId_p10.Value));

                cmd.Parameters.Add(new SqlParameter("@Vehicle_id", HiddenField_VehicleId_p10.Value));
                con.Open();
                SqlDataReader r = cmd.ExecuteReader();
                if (r.Read())
                {
                    TextBox_Registration_Authority.Text = Convert.ToString(r["Registration_Authority"]);
                    DropDownList_Vehicle_Class_Id.DataBind();
                    DropDownList_Vehicle_Class_Id.SelectedValue = Convert.ToString(r["Vehicle_Class_Id"]);
                    DropDownList_Vehicle_Condition_Id.DataBind();
                    DropDownList_Vehicle_Condition_Id.SelectedValue = Convert.ToString(r["Vehicle_Condition_Id"]);
                    DropDownList_ManufacturerId.DataBind();
                    DropDownList_ManufacturerId.SelectedValue = Convert.ToString(r["Maker_Name"]);
                    Vehicle_Type_Id.DataBind();
                    Vehicle_Type_Id.SelectedValue = Convert.ToString(r["Vehicle_Type_Id"]);
                    DropDownList_Vehicle_BodyTypeId.DataBind();
                    DropDownList_Vehicle_BodyTypeId.SelectedValue = Convert.ToString(r["Vehicle_BodyTypeId"]);

                    TextBox_Manufacture_Year.Text = Convert.ToString(r["Manufacture_Year"]);
                    DropDownList_ManufactureMonths.SelectedValue = Convert.ToString(r["Manufacture_Month"]);
                    TextBox_NoOfCylinder.Text              = Convert.ToString(r["NoOfCylinder"]);
                    TextBox_HorsePower.Text                = Convert.ToString(r["HorsePower"]);
                    TextBox_CubicCapacity.Text             = Convert.ToString(r["CubicCapacity"]);
                    TextBox_ChassisNumber.Text             = Convert.ToString(r["ChassisNumber"]);
                    TextBox_EnginNo.Text                   = Convert.ToString(r["EnginNo"]);
                    TextBox_SeatingCapcity.Text            = Convert.ToString(r["SeatingCapcity"]);
                    TextBox_UnLandedWeight.Text            = Convert.ToString(r["UnLandedWeight"]);
                    TextBox_Colour.Text                    = Convert.ToString(r["Colour"]);
                    TextBox_Lenght.Text                    = Convert.ToString(r["Lenght"]);
                    TextBox_Width.Text                     = Convert.ToString(r["Width"]);
                    TextBox_Height.Text                    = Convert.ToString(r["Height"]);
                    TextBox_InsuranceNumber.Text           = Convert.ToString(r["InsuranceNumber"]);
                    WebDateChooser_Insurance_FromDate.Text = Convert.ToString(r["Insurance_FromDate"]);
                    HiddenField_Insurance_FromDate.Value   = Convert.ToString(r["Insurance_FromDate"]);
                    WebDateChooser_Insurance_ToDate.Text   = Convert.ToString(r["Insurance_ToDate"]);
                    HiddenField__Insurance_ToDate.Value    = Convert.ToString(r["Insurance_ToDate"]);
                    TextBox_Number.Text                    = Convert.ToString(r["Number"]);
                    TextBox_RegistrationNo.Text            = Convert.ToString(r["Registration_Number"]);
                    WebDateChooser_PurchasedDate.Text      = Convert.ToString(r["Purchased_Date"]);
                    TextBox_Cost.Text = Convert.ToString(r["Cost"]);
                    //= Convert.ToString(r["Date_Time"]);
                    //= Convert.ToString(r["Emp_Id"]);
                }
                else
                {
                }
                con.Close();
                CheckBoxList_Vehicle_FuelType.DataBind();
                for (int ind = 0; ind < CheckBoxList_Vehicle_FuelType.Items.Count; ind++)
                {
                    if (hasval(CheckBoxList_Vehicle_FuelType.Items[ind].Value))
                    {
                        CheckBoxList_Vehicle_FuelType.Items[ind].Selected = true;
                        //HiddenField_Vehicle_FuelType_Id.Value = CheckBoxList_Vehicle_FuelType.Items[i].Value;
                        //string connection = Convert.ToString(ConfigurationManager.ConnectionStrings["TMSConnectionString"]);
                        //string Qry = "INSERT INTO Vehicle_Fuel (Vehicle_FuelType_Id, Vehicle_id, Emp_Id) VALUES (" + CheckBoxList_Vehicle_FuelType.Items[i].Value + "," + HiddenField_Vehicle_id.Value+ ","+Session["Emp_Id"]+")";
                        //SqlConnection con = new SqlConnection(connection);
                        //SqlCommand cmd = new SqlCommand(Qry, con);
                        //con.Open();
                        //cmd.ExecuteNonQuery();
                        //con.Close();
                        //SqlDataSource_Vehicle_FuelType_Id.Insert();
                    }
                }

                //////Fetch Data
            }
            Button_Cancel_P10.Visible = true;
            Button_Update_P10.Visible = true;
            Button_Save.Visible       = false;
        }
Example #3
0
        protected void Button_Update_P10_Click(object sender, EventArgs e)
        {
            if (HiddenField_VehicleId_p10.Value != "0")
            {
                //HiddenField_Insurance_FromDate.Value = Convert.ToString(WebDateChooser_Insurance_FromDate.Value);
                //HiddenField__Insurance_ToDate.Value = Convert.ToString(WebDateChooser_Insurance_ToDate.Value);

                //HiddenField_Insurance_FromDate.Value = Convert.ToString(Convert.ToString(((HttpCookie)HttpContext.Current.Request.Cookies["WebDateChooser_Insurance_FromDate"]).Value));
                //HiddenField__Insurance_ToDate.Value = Convert.ToString(Convert.ToString(((HttpCookie)HttpContext.Current.Request.Cookies["WebDateChooser_Insurance_ToDate"]).Value));

                if (TextBox_Number.Text != "")
                {
                    if (TextBox_InsuranceNumber.Text == "")
                    {
                        HiddenField__Insurance_ToDate.Value  = "";
                        HiddenField_Insurance_FromDate.Value = "";
                    }
                    SqlDataSource_Save0.Insert();
                    for (int i = 0; i < CheckBoxList_Vehicle_FuelType.Items.Count; i++)
                    {
                        if (CheckBoxList_Vehicle_FuelType.Items[i].Selected == true)
                        {
                            HiddenField_Vehicle_FuelType_Id.Value = CheckBoxList_Vehicle_FuelType.Items[i].Value;
                            //string connection = Convert.ToString(ConfigurationManager.ConnectionStrings["TMSConnectionString"]);
                            //string Qry = "INSERT INTO Vehicle_Fuel (Vehicle_FuelType_Id, Vehicle_id, Emp_Id) VALUES (" + CheckBoxList_Vehicle_FuelType.Items[i].Value + "," + HiddenField_Vehicle_id.Value+ ","+Session["Emp_Id"]+")";
                            //SqlConnection con = new SqlConnection(connection);
                            //SqlCommand cmd = new SqlCommand(Qry, con);
                            //con.Open();
                            //cmd.ExecuteNonQuery();
                            //con.Close();
                            SqlDataSource_Vehicle_FuelType_Id0.Insert();
                        }
                    }
                }
                TextBox_ChassisNumber.Text   = "";
                TextBox_Colour.Text          = "";
                TextBox_CubicCapacity.Text   = "";
                TextBox_EnginNo.Text         = "";
                TextBox_Height.Text          = "";
                TextBox_HorsePower.Text      = "";
                TextBox_InsuranceNumber.Text = "";
                TextBox_Lenght.Text          = "";
                //TextBox_Maker_Name.Text = "";
                DropDownList_ManufactureMonths.DataBind();
                DropDownList_ManufactureMonths.Items.Insert(0, "");
                DropDownList_ManufactureMonths.Items[0].Value = "";
                TextBox_Manufacture_Year.Text = "";
                TextBox_NoOfCylinder.Text     = "";
                // TextBox_OwnerName.Text = "";
                TextBox_Registration_Authority.Text = "";
                TextBox_SeatingCapcity.Text         = "";
                TextBox_UnLandedWeight.Text         = "";
                TextBox_Width.Text          = "";
                TextBox_Number.Text         = "";
                TextBox_Cost.Text           = "";
                TextBox_RegistrationNo.Text = "";
                GridView5.DataBind();
                CheckBoxList_Vehicle_FuelType.DataBind();
                Button_Cancel_P10.Visible = false;
                Button_Update_P10.Visible = false;
                Button_Save.Visible       = true;
                for (int lop = 0; lop < GridView5.Rows.Count; lop++)
                {
                    LinkButton LinkButtona = (LinkButton)GridView5.Rows[lop].FindControl("LinkButton3");
                    LinkButtona.ForeColor = System.Drawing.Color.Blue;
                }
            }
        }