private void BindBoiler()
    {
        BoilerService productConsumeService = new BoilerService();
        DataTable     tbl = new DataTable();

        tbl = productConsumeService.GetBoilerList(ReportId);
        rptBoiler.DataSource = tbl;
        rptBoiler.DataBind();
    }
Exemple #2
0
    public void btnSaveB_Click(object sender, EventArgs e)
    {
        BoilerService productCapacityService = new BoilerService();
        Boiler        productCapacity        = new Boiler();

        productCapacity.BoilerName = txtDeviceNameB.Text.Trim();
        if (txtQuantityB.Text.Trim() != "")
        {
            productCapacity.Quantity = Convert.ToInt32(txtQuantityB.Text.Trim());
        }
        if (txtHoursB.Text.Trim() != "")
        {
            productCapacity.OperationHours = Convert.ToInt32(txtHoursB.Text.Trim());
        }
        if (txtCapacityB.Text.Trim() != "")
        {
            productCapacity.CapacityInstalled = Convert.ToDecimal(txtCapacityB.Text.Trim());
        }
        if (ddlFuelB.SelectedIndex > 0)
        {
            productCapacity.FuelId = Convert.ToInt32(ddlFuelB.SelectedValue);
        }
        productCapacity.AuditReportId = ReportId;

        int i = 0;

        if (hdnId.Value != "" && Convert.ToInt32(hdnId.Value) > 0)
        {
            productCapacity.Id = Convert.ToInt32(hdnId.Value);
            productCapacity    = productCapacityService.Update(productCapacity);
            if (productCapacity != null)
            {
                i = 1;
            }
        }
        else
        {
            i = productCapacityService.Insert(productCapacity);
        }
        if (i <= 0)
        {
            ScriptManager.RegisterStartupScript(this, GetType(), "showgpkh", "ShowDialogCompress(" + hdnId.Value + ");", true);
            ScriptManager.RegisterStartupScript(this, GetType(), "message", "alert('Cập nhật không thành công. Vui lòng thử lại!');", true);
        }
        else
        {
            BindBoiler();
        }
    }
Exemple #3
0
 protected void rptBoiler_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     if (e.CommandName.Equals("delete"))
     {
         BoilerService productCapacityService = new BoilerService();
         long          i = productCapacityService.Delete(int.Parse(((LinkButton)e.CommandSource).CommandArgument));
         if (i > 0)
         {
             BindBoiler();
         }
         else
         {
             ScriptManager.RegisterStartupScript(this, GetType(), "showtb", "alert('Xóa không thành không. Vui lòng thử lại');", true);
         }
     }
     else if (e.CommandName.Equals("edit"))
     {
         Boiler        productCapacity        = new Boiler();
         BoilerService productCapacityService = new BoilerService();
         int           ProductCapacityId      = int.Parse(((LinkButton)e.CommandSource).CommandArgument);
         productCapacity = productCapacityService.FindByKey(ProductCapacityId);
         if (productCapacity != null)
         {
             txtDeviceNameB.Text = productCapacity.BoilerName;
             if (productCapacity.Quantity > 0)
             {
                 txtQuantityB.Text = productCapacity.Quantity.ToString();
             }
             if (productCapacity.CapacityInstalled > 0)
             {
                 txtCapacityB.Text = productCapacity.CapacityInstalled.ToString();
             }
             if (productCapacity.FuelId > 0)
             {
                 ddlFuelB.SelectedValue = productCapacity.FuelId.ToString();
             }
             if (productCapacity.OperationHours > 0)
             {
                 txtHoursB.Text = productCapacity.OperationHours.ToString();
             }
         }
         hdnId.Value = ProductCapacityId.ToString();
         ScriptManager.RegisterStartupScript(this, GetType(), "showtb", "ShowDialogBoiler(" + hdnId.Value + ");", true);
     }
 }