Exemplo n.º 1
0
    protected void rptResultTB_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (e.CommandName.Equals("delete"))
        {
            PlanTB        rpt       = new PlanTB();
            PlanTBService rptbso    = new PlanTBService();
            LinkButton    btnDelete = (LinkButton)e.CommandSource;
            btnDelete.Visible = AllowEdit;
            rptbso.Delete(int.Parse(((LinkButton)e.CommandSource).CommandArgument));
            BindResultTB();
        }
        else if (e.CommandName.Equals("edit"))
        {
            LinkButton btnDelete = (LinkButton)e.CommandSource;
            btnDelete.Visible = AllowEdit;
            PlanTB        rpt    = new PlanTB();
            PlanTBService rptbso = new PlanTBService();
            rpt = rptbso.FindByKey(int.Parse(((LinkButton)e.CommandSource).CommandArgument));
            if (rpt.CachLapDat != "")
            {
                try
                {
                    ddlCacThucLDBS.SelectedValue = rpt.CachLapDat;
                }
                catch { }
            }

            txtMoTaTinhNangBS.Text    = rpt.TinhNang;
            txtTenTietBiBS.Text       = rpt.NameTB;
            txtLyDoKhongThucHien.Text = rpt.LyDo;
            if (rpt.IsExecuted)
            {
                rblThucHien.SelectedIndex = 0;
            }
            else
            {
                rblThucHien.SelectedIndex = 1;
            }
            if (rpt.IsNew)
            {
                rblIsNew.SelectedIndex = 1;
            }
            else
            {
                rblIsNew.SelectedIndex = 0;
            }

            txtLyDoKhongThucHien.Text = rpt.LyDoLapDat;

            txtLyDoKhongThucHien.Text = rpt.LyDoLapDat;

            hddkhTB.Value = rpt.Id.ToString();
            ScriptManager.RegisterStartupScript(this, GetType(), "showtb", "ShowDialogDeviceResultOne(" + hddkhTB.Value + ");", true);
        }
    }
Exemplo n.º 2
0
    protected void rptResultTB_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (e.CommandName.Equals("delete"))
        {
            PlanTB        rpt    = new PlanTB();
            PlanTBService rptbso = new PlanTBService();
            rptbso.Delete(int.Parse(((LinkButton)e.CommandSource).CommandArgument));
            BindResultTB();
        }
        else if (e.CommandName.Equals("edit"))
        {
            PlanTB        rpt    = new PlanTB();
            PlanTBService rptbso = new PlanTBService();
            rpt = rptbso.FindByKey(int.Parse(((LinkButton)e.CommandSource).CommandArgument));
            if (rpt.CachLapDat != "")
            {
                try
                {
                    ddlCacThucLDBS.SelectedValue = rpt.CachLapDat;
                }
                catch { }
            }

            txtMoTaTinhNangBS.Text    = rpt.TinhNang;
            txtTenTietBiBS.Text       = rpt.NameTB;
            txtLyDoKhongThucHien.Text = rpt.LyDo;
            cbxThucHien.Checked       = rpt.IsExecuted;
            if (rpt.IsNew)
            {
                if (cbxThucHien.Checked)
                {
                    txtLyDoKhongThucHien.Text = rpt.LyDoLapDat;
                }
                else
                {
                    txtLyDoKhongThucHien.Text = rpt.LyDo;
                }
            }
            else
            {
                txtLyDoKhongThucHien.Text = rpt.LyDoLapDat;
            }
            hddkhTB.Value = rpt.Id.ToString();
            ScriptManager.RegisterStartupScript(this, GetType(), "showtb", "updategiaiphapTB();", true);
        }
    }
Exemplo n.º 3
0
    protected void rptKetQuaTB_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (e.CommandName.Equals("delete"))
        {
            PlanTB        rpt    = new PlanTB();
            PlanTBService rptbso = new PlanTBService();
            rptbso.Delete(int.Parse(((LinkButton)e.CommandSource).CommandArgument));
            BindResultTB();
        }
        else if (e.CommandName.Equals("edit"))
        {
            PlanTB        rpt    = new PlanTB();
            PlanTBService rptbso = new PlanTBService();
            rpt = rptbso.FindByKey(int.Parse(((LinkButton)e.CommandSource).CommandArgument));

            hddkhTB.Value = rpt.Id.ToString();
            ScriptManager.RegisterStartupScript(this, GetType(), "showtb", "updateiaiphapTB5(" + hdnFiveYear.Value + "," + hdnPlan.Value + ");", true);
        }
    }
Exemplo n.º 4
0
    protected void rptKHBoSungTB_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (e.CommandName.Equals("delete"))
        {
            PlanTB        rpt       = new PlanTB();
            PlanTBService rptbso    = new PlanTBService();
            LinkButton    btnDelete = (LinkButton)e.CommandSource;
            btnDelete.Visible = AllowEdit;
            rptbso.Delete(int.Parse(((LinkButton)e.CommandSource).CommandArgument));
            BindThietBi();
        }
        else if (e.CommandName.Equals("edit"))
        {
            PlanTB        rpt       = new PlanTB();
            PlanTBService rptbso    = new PlanTBService();
            LinkButton    btnDelete = (LinkButton)e.CommandSource;
            btnDelete.Visible = AllowEdit;
            rpt = rptbso.FindByKey(int.Parse(((LinkButton)e.CommandSource).CommandArgument));

            if (rpt.CachLapDat != "")
            {
                try
                {
                    ddlCacThucLD.SelectedValue = rpt.CachLapDat;
                }
                catch { }
            }
            txtlydoTB.Text = rpt.LyDo;
            txtTenTB.Text  = rpt.NameTB;
            try
            {
                ddlCamKetTB.SelectedValue = rpt.CamKet;
            }
            catch { }
            txtKhaNangTB.Text  = rpt.KhaNang;
            txtTinhNangTB.Text = rpt.TinhNang;
            hddkhTB.Value      = rpt.Id.ToString();
            ScriptManager.RegisterStartupScript(this, GetType(), "showtb", "ShowDialogDevicePlanOne(" + hddkhTB.Value + ");", true);
        }
    }
Exemplo n.º 5
0
    protected void cpRepeaterTB_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (e.CommandName.Equals("delete"))
        {
            PlanTB        rpt    = new PlanTB();
            PlanTBService rptbso = new PlanTBService();
            rptbso.Delete(int.Parse(((LinkButton)e.CommandSource).CommandArgument));
            BindThietBi();
            ScriptManager.RegisterStartupScript(this, GetType(), "showkh", "showkehoach();", true);
        }
        else if (e.CommandName.Equals("edit"))
        {
            PlanTB        rpt    = new PlanTB();
            PlanTBService rptbso = new PlanTBService();
            rpt = rptbso.FindByKey(int.Parse(((LinkButton)e.CommandSource).CommandArgument));
            //txtMucCamKetTB.Text = rpt.CamKet;

            if (rpt.CachLapDat != "")
            {
                try
                {
                    ddlCacThucLD.SelectedValue = rpt.CachLapDat;
                }
                catch { }
            }
            txtlydoTB.Text             = rpt.LyDo;
            txtnamTB.Text              = rpt.Nam.ToString();
            txtTenTB.Text              = rpt.NameTB;
            txtCamKetTB.Text           = rpt.CamKet;
            ddlKhaNangTB.SelectedValue = rpt.KhaNang;
            txtTinhNangTB.Text         = rpt.TinhNang;
            hddkhTB.Value              = rpt.Id.ToString();
            //BindThietBi();
            ScriptManager.RegisterStartupScript(this, GetType(), "showkhd", "showkehoach();", true);
            ScriptManager.RegisterStartupScript(this, GetType(), "showtb", "showgiaiphapTB('1');", true);
        }
    }
Exemplo n.º 6
0
 public void btnSaveAddDevice_Click(object sender, EventArgs e)
 {
     try
     {
         PlanTB        plantb        = new PlanTB();
         PlanTBService plantbservice = new PlanTBService();
         if (hddkhTB.Value != "")
         {
             plantb = plantbservice.FindByKey(Convert.ToInt32(hddkhTB.Value));
             if (ddlCacThucLDBS.SelectedIndex > 0)
             {
                 plantb.CachLapDat = ddlCacThucLDBS.SelectedValue;
             }
             plantb.EnterpriseId = m_UserValidation.OrgId;
             plantb.NameTB       = txtTenTietBiBS.Text;
             plantb.TinhNang     = txtMoTaTinhNangBS.Text;
             if (cbxThucHien.Checked)
             {
                 plantb.LyDoLapDat = txtLyDoKhongThucHien.Text;
             }
             else
             {
                 plantb.LyDo = txtLyDoKhongThucHien.Text;
             }
             plantb.Nam        = ReportYear;
             plantb.IsExecuted = cbxThucHien.Checked;
             plantb.IdPlan     = ReportId;
             plantb.IsFiveYear = false;
             plantb.IsPlan     = false;
             plantb.IsNew      = false;
             int i = plantbservice.Update(plantb).Id;
             if (i > 0)
             {
                 BindResultTB();
             }
             else
             {
                 ScriptManager.RegisterStartupScript(this, GetType(), "showkhd", "updateiaiphapTB();", true);
                 ScriptManager.RegisterStartupScript(this, GetType(), "message", "alert('Cập nhật không thành công!');", true);
             }
         }
         else
         {
             plantb.EnterpriseId = m_UserValidation.OrgId;
             if (ddlCacThucLDBS.SelectedIndex > 0)
             {
                 plantb.CachLapDat = ddlCacThucLDBS.SelectedValue;
             }
             plantb.NameTB     = txtTenTietBiBS.Text;
             plantb.TinhNang   = txtMoTaTinhNangBS.Text;
             plantb.Nam        = ReportYear;
             plantb.IsExecuted = cbxThucHien.Checked;
             if (cbxThucHien.Checked)
             {
                 plantb.LyDoLapDat = txtLyDoKhongThucHien.Text;
             }
             else
             {
                 plantb.LyDo = txtLyDoKhongThucHien.Text;
             }
             plantb.IsNew      = true;
             plantb.IsFiveYear = false;
             plantb.IsPlan     = false;
             plantb.IdPlan     = ReportId;
             int i = plantbservice.Insert(plantb);
             if (i > 0)
             {
                 BindResultTB();
             }
             else
             {
                 ScriptManager.RegisterStartupScript(this, GetType(), "showkhd", "updateiaiphapTB();", true);
                 ScriptManager.RegisterStartupScript(this, GetType(), "showx", "alert('Cập nhật không thành công!');", true);
             }
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 7
0
 public void btnSaveDevice_Click(object sender, EventArgs e)
 {
     try
     {
         PlanTB        plantb        = new PlanTB();
         PlanTBService plantbservice = new PlanTBService();
         if (hddkhTB.Value != "")
         {
             plantb = plantbservice.FindByKey(Convert.ToInt32(hddkhTB.Value));
             if (ddlCacThucLD.SelectedIndex > 0)
             {
                 plantb.CachLapDat = ddlCacThucLD.SelectedValue;
             }
             plantb.EnterpriseId = m_UserValidation.OrgId;
             plantb.NameTB       = txtTenTB.Text;
             plantb.TinhNang     = txtTinhNangTB.Text;
             plantb.LyDo         = txtlydoTB.Text;
             plantb.Nam          = Convert.ToInt32(txtnamTB.Text);
             if (ddlKhaNangTB.SelectedIndex > 0)
             {
                 plantb.KhaNang = ddlKhaNangTB.SelectedValue;
             }
             plantb.CamKet     = txtCamKetTB.Text.Trim();
             plantb.IdPlan     = ReportId;
             plantb.IsFiveYear = false;
             plantb.IsPlan     = true;
             plantb.IsNew      = false;
             int i = plantbservice.Update(plantb).Id;
             if (i > 0)
             {
                 BindThietBi();
                 ScriptManager.RegisterStartupScript(this, GetType(), "showtb", "showgiaiphapTB('1');", true);
             }
             else
             {
                 ScriptManager.RegisterStartupScript(this, GetType(), "message", "alert('Cập nhật không thành công!');", true);
             }
         }
         else
         {
             //plantb.CamKet = txtMucCamKetTB.Text;
             if (ddlCacThucLD.SelectedIndex > 0)
             {
                 plantb.CachLapDat = ddlCacThucLD.SelectedValue;
             }
             plantb.EnterpriseId = m_UserValidation.OrgId;
             plantb.NameTB       = txtTenTB.Text;
             plantb.TinhNang     = txtTinhNangTB.Text;
             plantb.LyDo         = txtlydoTB.Text;
             plantb.Nam          = Convert.ToInt32(txtnamTB.Text);
             if (ddlKhaNangTB.SelectedIndex > 0)
             {
                 plantb.KhaNang = ddlKhaNangTB.SelectedValue;
             }
             plantb.CamKet     = txtCamKetTB.Text.Trim();
             plantb.IsFiveYear = false;
             plantb.IsPlan     = true;
             plantb.IsNew      = false;
             plantb.IdPlan     = ReportId;
             int i = plantbservice.Insert(plantb);
             if (i > 0)
             {
                 BindThietBi();
             }
             else
             {
                 ScriptManager.RegisterStartupScript(this, GetType(), "showtb", "showgiaiphapTB('1');", true);
                 ScriptManager.RegisterStartupScript(this, GetType(), "showx", "alert('Cập nhật không thành công!');", true);
             }
         }
     }
     catch (Exception)
     {
         throw;
     }
 }