void BindSupply()
    {
        DataTable dt = new ElectricSupplyingService().GetElectrict(ReportId, true);

        rptSelf.DataSource = dt;
        rptSelf.DataBind();
    }
    void BindMBA()
    {
        DataTable dt = new ElectricSupplyingService().GetElectrict(ReportId, false);

        rptMBA.DataSource = dt;
        rptMBA.DataBind();
    }
Exemple #3
0
    protected void btnDeleteSupply_Click(object sender, EventArgs e)
    {
        int        MBAId      = 0;
        LinkButton lbtnDelete = (LinkButton)sender;

        if (lbtnDelete != null)
        {
            MBAId = Convert.ToInt32(lbtnDelete.CommandArgument);
            long i = new ElectricSupplyingService().Delete(MBAId);
            if (i > 0)
            {
                BindSupply();
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "showtb", "alert('Xóa không thành không. Vui lòng thử lại');", true);
            }
        }
    }
Exemple #4
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        ElectricSupplyingService otherService      = new ElectricSupplyingService();
        ElectricSupplying        electricSupplying = new ElectricSupplying();

        electricSupplying.AuditReportId   = ReportId;
        electricSupplying.IsSelf          = false;
        electricSupplying.PlacingCapacity = Convert.ToInt32(txtPlacingCapacity.Text.Trim());
        electricSupplying.VoltageLevel    = txtVoltageLevel.Text.Trim();
        electricSupplying.DeviceName      = txtMBAName.Text.Trim();
        electricSupplying.Capacity        = Convert.ToInt32(txtCapacity.Text.Trim());
        electricSupplying.Cos             = Convert.ToDecimal(txtCos.Text.Trim());
        electricSupplying.Coefficient     = Convert.ToDecimal(txtCoefficient.Text.Trim());
        electricSupplying.Performance     = Convert.ToDecimal(txtPerformance.Text.Trim());
        if (hdnId.Value != "" && Convert.ToInt32(hdnId.Value) > 0)
        {
            electricSupplying.Id = Convert.ToInt32(hdnId.Value);
            if (otherService.Update(electricSupplying) != null)
            {
                BindMBA();
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "showgpkh", "ShowDialogElectrictMBA();alert('Cập nhật không thành công');", true);
            }
        }
        else
        {
            if (otherService.Insert(electricSupplying) > 0)
            {
                BindMBA();
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "showgpkh", "ShowDialogElectrictMBA(); alert('Cập nhật không thành công');", true);
            }
        }
    }
Exemple #5
0
    protected void btnEditSupply_Click(object sender, EventArgs e)
    {
        int        MBAId      = 0;
        LinkButton lbtnDelete = (LinkButton)sender;

        if (lbtnDelete != null)
        {
            MBAId = Convert.ToInt32(lbtnDelete.CommandArgument);
            ElectricSupplying obj = new ElectricSupplyingService().FindByKey(MBAId);
            if (obj != null)
            {
                hdnIdS.Value = obj.Id.ToString();
                if (obj.Capacity > 0)
                {
                    txtCapacityS.Text = obj.Capacity.ToString();
                }
                if (obj.Coefficient > 0)
                {
                    txtCoefficientS.Text = obj.Coefficient.ToString();
                }
                if (obj.Cos > 0)
                {
                    txtCosS.Text = obj.Cos.ToString();
                }
                if (obj.PlacingCapacity > 0)
                {
                    txtPlacingCapacityS.Text = obj.PlacingCapacity.ToString();
                }
                if (obj.Performance > 0)
                {
                    txtPerformanceS.Text = obj.Performance.ToString();
                }
                txtMBANameS.Text      = obj.DeviceName;
                txtVoltageLevelS.Text = obj.VoltageLevel;
                ScriptManager.RegisterStartupScript(this, GetType(), "showgpkh", "ShowDialogElectrictSupply();", true);
            }
        }
    }