Exemple #1
0
    //protected void rptResultTB_ItemDataBound(object sender, RepeaterItemEventArgs e)
    //{
    //    if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
    //    {
    //        LinkButton btnDelete = (LinkButton)e.Item.FindControl("btnDelete");
    //        LinkButton btnEdit = (LinkButton)e.Item.FindControl("btnEdit");
    //        btnDelete.Visible = AllowEdit;
    //        btnEdit.Visible = AllowEdit;
    //    }
    //}
    public void btnSaveSolution_Click(object sender, EventArgs e)
    {
        GiaiPhap        gp    = new GiaiPhap();
        GiaiPhapService gpser = new GiaiPhapService();

        gp.EnterpriseId = Convert.ToInt32(memVal.OrgId);
        if (txtnamegp.Text != "")
        {
            gp.MoTa        = txtmotagp.Text;
            gp.TenGiaiPhap = txtnamegp.Text;
            if (gpser.Insert(gp) > 0)
            {
                ltNoticeSolution.Text = "Lưu giải pháp mới thành công";
                BindSolution();
            }
            else
            {
                ltNoticeSolution.Text = "Không lưu được giải pháp mới. Vui lòng thử lại";
            }
        }
        else
        {
            ScriptManager.RegisterStartupScript(this, GetType(), "showGP", "showgiaiphap();", true);
            ScriptManager.RegisterStartupScript(this, GetType(), "ac", "alert('Chưa nhập tên giải pháp!');", true);
        }
    }
Exemple #2
0
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        LinkButton btnDelete = (LinkButton)sender;
        int        eid       = 0;

        if (btnDelete.CommandArgument != "")
        {
            eid = Convert.ToInt32(btnDelete.CommandArgument);
            if (eid > 0)
            {
                GiaiPhap gp = new GiaiPhapService().FindByKey(eid);
                if (m_UserValidation != null && m_UserValidation.OrgId > 0)
                {
                    if (gp != null && gp.EnterpriseId == m_UserValidation.OrgId)
                    {
                        gp.IsDelete = true;
                        if (new GiaiPhapService().Update(gp) != null)
                        {
                            BindData();
                        }
                        else
                        {
                            ScriptManager.RegisterStartupScript(this, GetType(), "showform", "alert('Chưa xóa được giải pháp này. Vui lòng thử lại');", true);
                        }
                    }
                }
            }
        }
    }
    void BindSolution()
    {
        GiaiPhapService gps = new GiaiPhapService();
        DataTable       lst = gps.GetGiaiPhepByEnerprise(memVal.OrgId);

        ddlSolution.DataSource = lst;
        ddlSolution.DataBind();
        ddlSolution.Items.Insert(0, new ListItem("---Chọn giải pháp---", ""));
    }
Exemple #4
0
    void BindSolution()
    {
        GiaiPhapService gps = new GiaiPhapService();
        DataTable       lst = gps.GetGiaiPhepByEnerprise(Convert.ToInt32(m_UserValidation.OrgId));

        dllgiaiphap.DataSource = lst;
        dllgiaiphap.DataBind();
        dllgiaiphap.Items.Insert(0, new ListItem("---Chọn giải pháp---", ""));

        ddlSolution2.DataSource = lst;
        ddlSolution2.DataBind();
        ddlSolution2.Items.Insert(0, new ListItem("---Chọn giải pháp---", ""));
    }
Exemple #5
0
    public void btnSaveSolution_Click(object sender, EventArgs e)
    {
        int eid = 0;

        if (hdnSolutionId.Value != "0")
        {
            eid = Convert.ToInt32(hdnSolutionId.Value);
        }
        GiaiPhap        gp    = new GiaiPhap();
        GiaiPhapService gpser = new GiaiPhapService();

        if (eid > 0)
        {
            if (txtnamegp.Text != "")
            {
                gp.EnterpriseId = m_UserValidation.OrgId;
                gp.Id           = eid;
                gp.MoTa         = txtmotagp.Text;
                gp.TenGiaiPhap  = txtnamegp.Text;
                if (gpser.Update(gp) != null)
                {
                    ltNoticeSolution.Text = "<div class='alert alert-info'>Cập nhật thành công !</div>";
                    BindData();
                }
                else
                {
                    ltNoticeSolution.Text = "<div class='alert alert-danger'>Không lưu được giải pháp mới. Vui lòng thử lại</div>";
                }
            }
        }
        else
        {
            gp.EnterpriseId = m_UserValidation.OrgId;
            if (txtnamegp.Text != "")
            {
                gp.MoTa        = txtmotagp.Text;
                gp.TenGiaiPhap = txtnamegp.Text;
                gp.IsDelete    = false;
                if (gpser.Insert(gp) > 0)
                {
                    ltNoticeSolution.Text = "<div class='alert alert-info'>Đã thêm giải pháp mới thành công</div>";
                    BindData();
                }
                else
                {
                    ltNoticeSolution.Text = "<div class='alert alert-danger'>Không lưu được giải pháp mới. Vui lòng thử lại</div>";
                }
            }
        }
    }
Exemple #6
0
    private void BindData()
    {
        GiaiPhapService comBSO = new GiaiPhapService();
        DataTable       list   = new DataTable();

        ePower.Core.PagingInfo paging = new ePower.Core.PagingInfo(PageSize, CurrentPage);
        string strKey = string.Empty;

        if (txtKeyword.Text != "" && txtKeyword.Text.Trim() != "")
        {
            strKey = txtKeyword.Text.Trim();
        }
        if (m_UserValidation != null && m_UserValidation.OrgId > 0)
        {
            list = comBSO.FindList(m_UserValidation.OrgId, strKey, paging);
            if (list != null && list.Rows.Count > 0)
            {
                paging.RowsCount   = Convert.ToInt32(list.Rows[0]["Total"]);
                Paging.PageSize    = PageSize;
                Paging.CurrentPage = CurrentPage;
                Paging.TotalRecord = Convert.ToInt32(list.Rows[0]["Total"]);
                Paging.DataLoad();
                if (paging.PagesCount <= 1)
                {
                    ltrTotal.Text  = "Tổng số " + paging.RowsCount + " giải pháp";
                    Paging.Visible = false;
                }
                else
                {
                    int  st  = (CurrentPage - 1) * PageSize + 1;
                    long end = CurrentPage * PageSize;
                    if (end > paging.RowsCount)
                    {
                        end = paging.RowsCount;
                    }
                    ltrTotal.Text  = "Đang xem trang " + CurrentPage + ". Hiển thị từ " + st + " - " + end + " trên tổng số " + paging.RowsCount + " giải pháp";
                    Paging.Visible = true;
                }
            }
            else
            {
                ltrTotal.Text  = "";
                Paging.Visible = false;
            }
            rptSolution.DataSource = list;
            rptSolution.DataBind();
        }
    }
    public void btnSaveSolution_Click(object sender, EventArgs e)
    {
        GiaiPhap        gp    = new GiaiPhap();
        GiaiPhapService gpser = new GiaiPhapService();

        gp.EnterpriseId = memVal.OrgId;

        gp.MoTa        = txtDes.Text;
        gp.TenGiaiPhap = txtSolutionName.Text;
        if (gpser.Insert(gp) > 0)
        {
            ltNoticeSolution.Text = "Lưu giải pháp mới thành công";
            BindSolution();
        }
        else
        {
            ltNoticeSolution.Text = "Không lưu được giải pháp mới. Vui lòng thử lại";
        }
    }
Exemple #8
0
    protected void btnEdit_Click(object sender, EventArgs e)
    {
        LinkButton btnEdit = (LinkButton)sender;
        int        eid     = 0;

        if (m_UserValidation != null && m_UserValidation.OrgId > 0)
        {
            if (btnEdit.CommandArgument != "")
            {
                eid = Convert.ToInt32(btnEdit.CommandArgument);
                if (eid > 0)
                {
                    GiaiPhap gp = new GiaiPhapService().FindByKey(eid);
                    if (gp != null && gp.EnterpriseId == m_UserValidation.OrgId)
                    {
                        txtnamegp.Text      = gp.TenGiaiPhap;
                        txtmotagp.Text      = gp.MoTa;
                        hdnSolutionId.Value = btnEdit.CommandArgument;
                        ScriptManager.RegisterStartupScript(this, GetType(), "ac", "updategiaiphap();", true);
                    }
                }
            }
        }
    }
    void BindResultSolution5Year()
    {
        return;

        StringBuilder sb  = new StringBuilder();
        DataTable     tbl = new DataTable();

        tbl.Columns.Add("Year", typeof(string));
        for (int i = 1; i <= 5; i++)
        {
            tbl.Columns.Add(i.ToString(), typeof(double));
        }
        DataTable dtSolution = new DataTable();

        dtSolution = new GiaiPhapService().GetSolutionYear(ReportYear - 4, ReportYear, memVal.OrgId);


        DataTable dtSolutionResult = new DataTable();

        dtSolutionResult = new PlanTKNLService().GetResultSolution5Year(ReportYear - 4, ReportYear, memVal.OrgId);
        if (dtSolution != null && dtSolution.Rows.Count > 0)
        {
            if (dtSolutionResult != null && dtSolutionResult.Rows.Count > 0)
            {
                for (int i = 0; i < dtSolution.Rows.Count; i++)
                {
                    DataTable tblTemp  = tbl.Clone();
                    DataRow[] drResult = dtSolutionResult.Select("IdGiaPhap=" + dtSolution.Rows[i]["Id"]);
                    if (drResult.Count() > 0)
                    {
                        DataRow dr0 = tbl.NewRow();
                        dr0["Year"] = "<b>Giải pháp " + (i + 1) + ": " + dtSolution.Rows[i]["TenGiaiPhap"] + "</b>";
                        tbl.Rows.Add(dr0);
                        for (int j = 0; j < drResult.Count(); j++)
                        {
                            DataRow dr1 = tbl.NewRow();
                            dr1["Year"] = "Mức Mức tiết kiệm năng lượng - Dự kiến theo kế hoạch	(kWh)";

                            DataRow dr2 = tbl.NewRow();
                            dr2["Year"] = "Mức tiết kiệm năng lượng – Thực tế đạt được	(kWh)";

                            DataRow dr3 = tbl.NewRow();
                            dr3["Year"] = "Mức tiết kiệm năng lượng - Dự kiến theo kế hoạch	(%)";

                            DataRow dr4 = tbl.NewRow();
                            dr4["Year"] = "Mức tiết kiệm năng lượng – Thực tế đạt được (%)";

                            DataRow dr5 = tbl.NewRow();
                            dr5["Year"] = "Mức tiết kiệm chi phí – Dự kiến theo kế hoạch (Triệu đồng)";

                            DataRow dr6 = tbl.NewRow();
                            dr6["Year"] = "Mức tiết kiệm chi phí – Thực tế đạt được	(Triệu đồng)";

                            DataRow dr7 = tbl.NewRow();
                            dr7["Year"] = "Chi phí – Dự kiến theo kế họach (Triệu đồng)";

                            DataRow dr8 = tbl.NewRow();
                            dr8["Year"] = "Chi phí – Thực tế thực hiện (Triệu đồng)";

                            int nam = Convert.ToInt32(drResult[j]["NamBatDau"]);

                            int indexYear = 5 - (ReportYear - nam);
                            if (drResult[j]["MucTietKiemDuKien"] != DBNull.Value && drResult[j]["MucTietKiemDuKien"].ToString().Trim() != "")
                            {
                                dr1[indexYear.ToString()] = Convert.ToDouble(drResult[j]["MucTietKiemDuKien"]);
                            }
                            else
                            {
                                dr1[indexYear.ToString()] = 0;
                            }
                            if (drResult[j]["MucTKThucTe"] != DBNull.Value && drResult[j]["MucTKThucTe"].ToString().Trim() != "")
                            {
                                dr2[indexYear.ToString()] = Convert.ToDouble(drResult[j]["MucTKThucTe"]);
                            }
                            else
                            {
                                dr2[indexYear.ToString()] = 0;
                            }
                            if (drResult[j]["TuongDuong"] != DBNull.Value && drResult[j]["TuongDuong"].ToString().Trim() != "")
                            {
                                dr3[indexYear.ToString()] = Convert.ToDouble(drResult[j]["TuongDuong"]);
                            }
                            else
                            {
                                dr3[indexYear.ToString()] = 0;
                            }
                            if (drResult[j]["TuongDuongTT"] != DBNull.Value && drResult[j]["TuongDuongTT"].ToString().Trim() != "")
                            {
                                dr4[indexYear.ToString()] = Convert.ToDouble(drResult[j]["TuongDuongTT"]);
                            }
                            else
                            {
                                dr4[indexYear.ToString()] = 0;
                            }
                            if (drResult[j]["TKCPDuKien"] != DBNull.Value && drResult[j]["TKCPDuKien"].ToString().Trim() != "")
                            {
                                dr5[indexYear.ToString()] = Convert.ToDouble(drResult[j]["TKCPDuKien"]);
                            }
                            else
                            {
                                dr5[indexYear.ToString()] = 0;
                            }
                            if (drResult[j]["MucTKCPThucTe"] != DBNull.Value && drResult[j]["MucTKCPThucTe"].ToString().Trim() != "")
                            {
                                dr6[indexYear.ToString()] = Convert.ToDouble(drResult[j]["MucTKCPThucTe"]);
                            }
                            else
                            {
                                dr6[indexYear.ToString()] = 0;
                            }
                            if (drResult[j]["ChiPhiDuKien"] != DBNull.Value && drResult[j]["ChiPhiDuKien"].ToString().Trim() != "")
                            {
                                dr7[indexYear.ToString()] = Convert.ToDouble(drResult[j]["ChiPhiDuKien"]);
                            }
                            else
                            {
                                dr7[indexYear.ToString()] = 0;
                            }
                            if (drResult[j]["CPThucTe"] != DBNull.Value && drResult[j]["CPThucTe"].ToString().Trim() != "")
                            {
                                dr8[indexYear.ToString()] = Convert.ToDouble(drResult[j]["CPThucTe"]);
                            }
                            else
                            {
                                dr8[indexYear.ToString()] = 0;
                            }
                            tbl.Rows.Add(dr1);
                            tbl.Rows.Add(dr2);
                            tbl.Rows.Add(dr3);
                            tbl.Rows.Add(dr4);
                            tbl.Rows.Add(dr5);
                            tbl.Rows.Add(dr6);
                            tbl.Rows.Add(dr7);
                            tbl.Rows.Add(dr8);
                        }
                    }
                }
            }
        }
        rptResultSolution.DataSource = tbl;
        rptResultSolution.DataBind();
    }