コード例 #1
0
    /// <summary>
    /// Mở cửa sổ cấu hình tỷ lệ điểm, xếp loại cho đợt đánh giá
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    //protected void btnConfig_Click(object sender, DirectEventArgs e)
    //{
    //    try
    //    {
    //        if (new FileInfo(Server.MapPath("../ConfigDotDanhGia.xml")).Exists)
    //        {
    //            XDocument xDoc = XDocument.Load(Server.MapPath("../ConfigDotDanhGia.xml"));
    //            var result = (from t in xDoc.Descendants("Estimate")
    //                          where t.Attribute("id").Value == hdfRecordID.Text
    //                          select t)
    //                          .Descendants("Result")
    //                          .Select(t => new { TuDanhGia = t.Descendants("TuDanhGia").FirstOrDefault().Value, QuanLyDanhGia = t.Descendants("QuanLyDanhGia").FirstOrDefault().Value, NguoiKhacDanhGia = t.Descendants("NguoiKhacDanhGia").FirstOrDefault().Value });
    //            if (result.Count() > 0)
    //            {
    //                foreach (var item in result)
    //                {
    //                    txtTuDanhGia.Text = item.TuDanhGia;
    //                    txtQuanLyDanhGia.Text = item.QuanLyDanhGia;
    //                    txtNguoiKhacDanhGia.Text = item.NguoiKhacDanhGia;
    //                }
    //            }
    //            else
    //            {
    //                // Tạo mới
    //                XElement estimate = new XElement("Estimate",
    //                    new XElement("Result",
    //                        new XElement("TuDanhGia", 20),
    //                        new XElement("QuanLyDanhGia", 50),
    //                        new XElement("NguoiKhacDanhGia", 30)),
    //                    new XElement("Rank"));
    //                estimate.SetAttributeValue("id", hdfRecordID.Text);
    //                xDoc.Root.Add(estimate);
    //                xDoc.Save(Server.MapPath("../ConfigDotDanhGia.xml"));

    //                txtTuDanhGia.Text = "20";
    //                txtQuanLyDanhGia.Text = "50";
    //                txtNguoiKhacDanhGia.Text = "30";
    //            }
    //            wdConfig.Show();
    //        }
    //    }
    //    catch (Exception ex)
    //    {
    //        X.Msg.Alert("Thông báo", "Có lỗi xảy ra: " + ex.Message.ToString());
    //    }
    //}

    /// <summary>
    /// Lưu cấu hình cho đợt đánh giá khi sửa thông tin
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    //protected void btnLuuLai_Click(object sender, DirectEventArgs e)
    //{
    //    try
    //    {
    //        if (new FileInfo(Server.MapPath("../ConfigDotDanhGia.xml")).Exists)
    //        {
    //            XDocument xDoc = XDocument.Load(Server.MapPath("../ConfigDotDanhGia.xml"));
    //            var result = from t in xDoc.Descendants("Estimate")
    //                         where t.Attribute("id").Value == hdfRecordID.Text
    //                         select t;

    //            if (result.Count() > 0)
    //            {
    //                foreach (XElement item in result)
    //                {
    //                    item.Element("Result").Element("TuDanhGia").Value = txtTuDanhGia.Text;
    //                    item.Element("Result").Element("QuanLyDanhGia").Value = txtQuanLyDanhGia.Text;
    //                    item.Element("Result").Element("NguoiKhacDanhGia").Value = txtNguoiKhacDanhGia.Text;
    //                }
    //            }
    //            xDoc.Save(Server.MapPath("../ConfigDotDanhGia.xml"));
    //            wdConfig.Hide();
    //        }
    //    }
    //    catch (Exception ex)
    //    {
    //        X.Msg.Alert("Thông báo", "Có lỗi xảy ra: " + ex.Message.ToString());
    //    }
    //}

    private void InsertCanBo(DotDanhGia obj)
    {
        if (obj.HinhThucDanhGia == 0 || obj.HinhThucDanhGia == 1)   // Đánh giá cả đơn vị, trong phòng
        {
            // lấy danh sách các cán bộ của cả đơn vị
            List <string> macbs = new HoSoController().GetAllMaCB();
            // Thêm vào bảng CanBoDuocDanhGia, CanBoThamGiaDanhGia
            foreach (var item in macbs)
            {
                CanBoDuocDanhGiaInfo info = new CanBoDuocDanhGiaInfo()
                {
                    CreatedBy    = CurrentUser.ID,
                    CreatedDate  = DateTime.Now,
                    MaCB         = item,
                    MaDotDanhGia = obj.ID
                };
                new CanBoDuocDanhGiaController().Insert(info);

                CanBoThamGiaDanhGiaInfo info1 = new CanBoThamGiaDanhGiaInfo()
                {
                    CreatedBy     = CurrentUser.ID,
                    CreatedDate   = DateTime.Now,
                    MaCBBiDanhGia = "",
                    MaCBDanhGia   = item,
                    MaDotDanhGia  = obj.ID
                };
                new CanBoThamGiaDanhGiaController().Insert(info1);
            }
            //// Thêm vào kết quả đánh giá
            //foreach (var item in macbs)
            //{
            //    CreateKetQuaDanhGiaByMaCB(item);
            //}
        }
    }
コード例 #2
0
    private void GenerateXrTable(DotDanhGia item, float add)
    {
        float WIDTH  = (float)180;
        float HEIGHT = (float)75.62;
        // #############################################
        // tạo 1 cell chứa table vừa tạo
        XRTableCell xrtc = new XRTableCell()
        {
            Name = "xrTableCellh" + item.ID,
            //Borders = DevExpress.XtraPrinting.BorderSide.Top | DevExpress.XtraPrinting.BorderSide.Right,
            HeightF = HEIGHT,
            WidthF  = WIDTH + add,
        };

        this.xrTableRow1.Cells.Add(xrtc);
        //
        // tạo mới 1 table header
        //
        XRTable xrtableh1 = new XRTable()
        {
            Name    = "xrth1_" + item.ID,
            HeightF = HEIGHT,
            WidthF  = WIDTH + add,
            Borders = DevExpress.XtraPrinting.BorderSide.Top | DevExpress.XtraPrinting.BorderSide.Bottom | DevExpress.XtraPrinting.BorderSide.Right,
        };

        xrtc.Controls.Add(xrtableh1);
        //
        // tạo 2 table row
        //
        XRTableRow xrtablerowh1 = new XRTableRow()
        {
            Name   = "xrtrh_" + item.ID + "1",
            WidthF = WIDTH + add,
        };
        XRTableRow xrtablerowh2 = new XRTableRow()
        {
            Name   = "xrtrh_" + item.ID + "2",
            WidthF = WIDTH + add,
        };

        xrtableh1.Rows.Add(xrtablerowh1);
        xrtableh1.Rows.Add(xrtablerowh2);
        //
        // tạo 1 cell cho table row 1
        //
        XRTableCell xrtablecellh1 = new XRTableCell()
        {
            Name          = "xrtch_" + item.ID + "1",
            Text          = item.TenDotDanhGia,
            TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter,
            WidthF        = WIDTH + add,
        };

        xrtablecellh1.StylePriority.UseTextAlignment = false;

        xrtablerowh1.Cells.Add(xrtablecellh1);
        //
        // tạo 2 cell cho table row 2
        //
        // cell 1
        XRTableCell xrtablecellh2 = new XRTableCell()
        {
            Name          = "xrtch_" + item.ID + "2",
            Text          = "Điểm",
            TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter,
            WidthF        = WIDTH / 2,
            Borders       = DevExpress.XtraPrinting.BorderSide.Top | DevExpress.XtraPrinting.BorderSide.Right,
        };

        xrtablecellh2.StylePriority.UseTextAlignment = false;
        // cell 2
        XRTableCell xrtablecellh3 = new XRTableCell()
        {
            Name          = "xrtch_" + item.ID + "3",
            Text          = "Xếp loại",
            TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft,
            WidthF        = WIDTH / 2 + add,
            Borders       = DevExpress.XtraPrinting.BorderSide.Top | DevExpress.XtraPrinting.BorderSide.Right,
            Padding       = new DevExpress.XtraPrinting.PaddingInfo(10, 0, 0, 0, 100F)
        };

        xrtablecellh3.StylePriority.UseTextAlignment = false;

        xrtablerowh2.Cells.Add(xrtablecellh2);
        xrtablerowh2.Cells.Add(xrtablecellh3);
        // ####################################################
        // tạo 1 cell chứa table vừa tạo
        XRTableCell xrtc2 = new XRTableCell()
        {
            Name    = "xrTableCelld" + item.ID,
            Borders = DevExpress.XtraPrinting.BorderSide.Bottom | DevExpress.XtraPrinting.BorderSide.Right,
            //Borders = DevExpress.XtraPrinting.BorderSide.None,
            WidthF = WIDTH + add,
            //HeightF = (float)29.79,
        };

        this.xrTableRow6.Cells.Add(xrtc2);
        //
        // tạo mới một table detail
        //
        XRTable xrtabled = new XRTable()
        {
            Name = "xrtd_" + item.ID,
            //HeightF = (float)29.79,
            WidthF  = WIDTH + add - 1,
            Borders = DevExpress.XtraPrinting.BorderSide.None,
        };

        xrtc2.Controls.Add(xrtabled);
        //
        // tạo 1 table row
        //
        XRTableRow xrtablerowd1 = new XRTableRow()
        {
            Name    = "xrtrd_" + item.ID + "1",
            WidthF  = WIDTH + add - 1,
            Borders = DevExpress.XtraPrinting.BorderSide.None,
        };

        xrtabled.Rows.Add(xrtablerowd1);
        //
        // tạo 2 cell cho table row
        //
        // cell 1
        XRTableCell xrtablecelld1 = new XRTableCell()
        {
            Name          = "xrtcd_" + item.ID + "1",
            TextAlignment = DevExpress.XtraPrinting.TextAlignment.BottomCenter,
            WidthF        = WIDTH / 2,
            Font          = new Font(Font.FontFamily, Font.Size, FontStyle.Regular),
            Borders       = DevExpress.XtraPrinting.BorderSide.None,
            Multiline     = true,
        };

        xrtablecelld1.StylePriority.UseTextAlignment = false;
        xrtablecelld1.DataBindings.Add("Text", DataSource, "Diem" + item.ID, "{0:0.00}");
        // cell 2
        XRTableCell xrtablecelld2 = new XRTableCell()
        {
            Name          = "xrtcd_" + item.ID + "2",
            TextAlignment = DevExpress.XtraPrinting.TextAlignment.BottomLeft,
            WidthF        = WIDTH / 2 + add,
            Font          = new Font(Font.FontFamily, Font.Size, FontStyle.Regular),
            Borders       = DevExpress.XtraPrinting.BorderSide.Right,
            Multiline     = true,
        };

        xrtablecelld2.StylePriority.UseTextAlignment = false;
        xrtablecelld2.Padding = new DevExpress.XtraPrinting.PaddingInfo(7, 0, 0, 0, 100F);
        xrtablecelld2.DataBindings.Add("Text", DataSource, "XepLoai" + item.ID);

        xrtablerowd1.Cells.Add(xrtablecelld1);
        xrtablerowd1.Cells.Add(xrtablecelld2);
    }