Ejemplo n.º 1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (btnSave.Text == "Save")
            {
                // Add new Fuel Types

            }
            else
            {
                 string id = "";
                 if (string.IsNullOrEmpty(Request.QueryString["id"]))
                 {
                     Response.Redirect("FuleType.aspx?act=list", true);
                 }
                 else
                 {
                     id = Request.QueryString["id"];
                     //update
                     FuelTypeDTO dto = new FuelTypeDTO();
                     dto.FuelTypeID = Convert.ToInt32(id);
                     dto.FuleTypeName = txtFuelTypeName.Text;
                     FuelTypeBLL bll = new FuelTypeBLL();
                     if (bll.UpdateFuelType(dto))
                     {
                         Session["Info"] = "Date Edited Successfully";
                         Response.Redirect("FuleType.aspx?act=list", true);
                     }
                     else
                     {
                         Response.Redirect("FuleType.aspx?act=edit&id="+id, true);
                     }
                 }
            }
        }
Ejemplo n.º 2
0
 public bool UpdateFuelType(FuelTypeDTO fuleTypeDTO)
 {
     string sql = "update FuelTypes set FuelTypeName='" + fuleTypeDTO.FuleTypeName
         + @"' where FuelTypeID =" + fuleTypeDTO.FuelTypeID;
     db = new DBAccess();
     int rows_affected = db.ExecuteNonQuery(sql);
     if (rows_affected == 1) return true;
     else return false;
 }
Ejemplo n.º 3
0
 public bool NewFuelType(FuelTypeDTO fuleTypeDTO)
 {
     string sql = "Insert into FuleTypes (FuelTypeName) values ("+
         "'"+fuleTypeDTO.FuleTypeName+@"')";
     db = new DBAccess();
     int rows_affected = db.ExecuteNonQuery(sql);
     if (rows_affected == 1) return true;
     else return false;
 }
Ejemplo n.º 4
0
 public FuelTypeDTO GetFuelType(int fuelTypeID)
 {
     db = new DBAccess();
     DataTable dt = new DataTable();
     string sql = "Select * from FuelTypes where FuelTypeID=" + fuelTypeID;
     dt = db.ExecuteDataTable(sql);
     if (dt.Rows.Count <= 0)
     {
         return null;
     }
     else
     {
         FuelTypeDTO fuelTypeDTO = new FuelTypeDTO();
         fuelTypeDTO.FuelTypeID = int.Parse(dt.Rows[0]["FuelTypeID"].ToString());
         fuelTypeDTO.FuleTypeName = dt.Rows[0]["FuelTypeName"].ToString();
         return fuelTypeDTO;
     }
 }
Ejemplo n.º 5
0
 public bool UpdateFuelType(FuelTypeDTO fuelTypeDTO)
 {
     fuelTypeDLL = new FuelTypeDLL();
     return fuelTypeDLL.UpdateFuelType(fuelTypeDTO);
 }
Ejemplo n.º 6
0
 public bool NewFuelType(FuelTypeDTO fuelTypeDTO)
 {
     fuelTypeDLL = new FuelTypeDLL();
     return fuelTypeDLL.NewFuelType(fuelTypeDTO);
 }