示例#1
0
        /// <summary>
        /// tạo grid janus
        /// </summary>
        private void CreateGrid()
        {
            gridEX1.RootTable.Columns.Clear();
            GridEXColumn col1 = new GridEXColumn();

            col1.DataMember    = "SoHieuXe";
            col1.Key           = "SoHieuXe";
            col1.Caption       = " Số hiệu xe";
            col1.TextAlignment = TextAlignment.Center;
            col1.Width         = 90;
            gridEX1.RootTable.Columns.Add(col1);

            for (int iGio = 0; iGio <= 23; iGio++)
            {
                GridEXColumn col = new GridEXColumn();
                col.DataMember    = "Gio_" + iGio.ToString();
                col.Key           = "Gio_" + iGio.ToString();
                col.Caption       = " " + iGio.ToString() + " h";
                col.TextAlignment = TextAlignment.Center;
                col.Width         = 50;
                GridEXFormatStyle headerStyle = new GridEXFormatStyle();
                headerStyle.TextAlignment = TextAlignment.Center;
                col.HeaderStyle           = headerStyle;
                gridEX1.RootTable.Columns.Add(col);
            }

            GridEXColumn col2 = new GridEXColumn();

            col2.DataMember    = "Tong";
            col2.Key           = "Tong";
            col2.Caption       = "  Tổng ";
            col2.TextAlignment = TextAlignment.Center;
            col2.Width         = 90;
            gridEX1.RootTable.Columns.Add(col2);
        }
        public void XemLaiDuLieuPA(int iRowPosition)
        {
            grdDaGiaiQuyetPA.SelectionMode = Janus.Windows.GridEX.SelectionMode.SingleSelection;
            if (grdDaGiaiQuyetPA.SelectedItems.Count > 0)
            {
                PhanAnh objThongTinPA = (PhanAnh)((GridEXSelectedItem)grdDaGiaiQuyetPA.SelectedItems[0]).GetRow().DataRow;
                //Thu doi mau
                GridEXRow         rowSelect = ((GridEXSelectedItem)grdDaGiaiQuyetPA.SelectedItems[0]).GetRow();
                GridEXFormatStyle RowStyle  = new GridEXFormatStyle();
                RowStyle.BackColor = System.Drawing.SystemColors.Highlight;
                rowSelect.RowStyle = RowStyle;

                //End - Thu doi mau
                //true : da giai quyet
                using (frmGhiNhanPhanAnh frmPAInPut = new frmGhiNhanPhanAnh(objThongTinPA, ThongTinDangNhap.RoleNhanVienPA, true))
                {
                    DialogResult _dialogResult = frmPAInPut.ShowDialog(this);
                    if (_dialogResult == DialogResult.Yes)
                    {
                        LoadPhanAnh_DaGiaiQuyet(rowSelect.Position);
                    }
                }
                //tra ve mau cu
                RowStyle           = new GridEXFormatStyle();
                RowStyle.BackColor = System.Drawing.SystemColors.Window;
                rowSelect.RowStyle = RowStyle;
            }
        }
示例#3
0
        private void grdVeHuy_FormattingRow(object sender, RowLoadEventArgs e)
        {
            if ((((int)e.Row.Cells["SeriDau"].Value) == 0) && (((int)e.Row.Cells["SeriCuoi"].Value) == 0))
            {
                GridEXFormatStyle RowStyle = new GridEXFormatStyle();
                RowStyle.BackColor = Color.Cyan;
                e.Row.Cells["SoHopDong"].FormatStyle = RowStyle;
            }

            bool IsTamNhap = false;

            try
            {
                IsTamNhap = Convert.ToBoolean(e.Row.Cells["IsTamNhap"].Value.ToString());
            }
            catch (Exception ex)
            {
                IsTamNhap = false;
            }

            if (IsTamNhap)
            {
                GridEXFormatStyle RowStyle = new GridEXFormatStyle();
                RowStyle.BackColor = Color.Red;
                e.Row.Cells["SoHopDong"].FormatStyle = RowStyle;
            }
        }
示例#4
0
        /// <summary>
        /// - Hien thi anh trang thai tuong ung voi trang thai lenh
        /// - thay doi mau nen cua khach VIP, moi gioi, khach binh thuong
        /// - Thay mau chu cua dia chi cua khach goi lai
        /// - thay doi may cua cuoc goi khong phai cua minh phu trach
        /// </summary>
        private void HienThiAnhTrangThai_MauChu(GridEXRow row)
        {
            try
            {
                BaoCaoBieuMau3 objBC3 = (BaoCaoBieuMau3)row.DataRow;

                // thay doi mau nen cua khach VIP, moi gioi, khach binh thuong
                if (objBC3.KieuKhachHangGoiDen == Taxi.Utils.KieuKhachHangGoiDen.KhachHangMoiGioi)
                {
                    GridEXFormatStyle RowStyle = new GridEXFormatStyle();
                    RowStyle.BackColor = Color.Yellow;
                    row.Cells["PhoneNumber"].FormatStyle = RowStyle;
                }
                if (objBC3.GoiLai)
                {
                    GridEXFormatStyle RowStyle = new GridEXFormatStyle();
                    RowStyle.ForeColor = Color.Red;
                    row.Cells["DiaChiDon"].FormatStyle = RowStyle;
                }
                if (objBC3.KieuKhachHangGoiDen == Taxi.Utils.KieuKhachHangGoiDen.KhachHangMoiGioi)
                {
                    GridEXFormatStyle RowStyle = new GridEXFormatStyle();
                    RowStyle.BackColor = Color.Yellow;
                    row.Cells["PhoneNumber"].FormatStyle = RowStyle;
                }
            }
            catch (Exception ex)
            {
                ////  LogError.WriteLog("Lỗi xử lý hiển thị màu của lưới", ex);
            }
        }
示例#5
0
        private void HienThiTrangThaiChu(GridEXRow row)
        {
            ThongTinPhanAnh objPhanAnh = (ThongTinPhanAnh)row.DataRow;

            if (objPhanAnh.ThoiGianPhanAnh == DateTime.MinValue)
            {
                row.Cells["ThoiGianPhanAnh"].Text = string.Empty;
            }
            else if (objPhanAnh.NgayGiaiQuyet == DateTime.MinValue)
            {
                row.Cells["NgayGiaiQuyet"].Text = string.Empty;
            }
            else if (objPhanAnh.KieuKhachHangGoiDen == EFiling.Utils.KieuKhachHangGoiDen.KhachHangVIP)
            {
                GridEXFormatStyle RowStyle = new GridEXFormatStyle();
                RowStyle.BackColor = Color.Blue;
                row.Cells["TenKhachHang"].FormatStyle = RowStyle;
            }
            else if (objPhanAnh.KieuKhachHangGoiDen == EFiling.Utils.KieuKhachHangGoiDen.KhachHangVang ||
                     objPhanAnh.KieuKhachHangGoiDen == EFiling.Utils.KieuKhachHangGoiDen.KhachHangBac)
            {
                GridEXFormatStyle RowStyle = new GridEXFormatStyle();
                RowStyle.BackColor = Color.ForestGreen;
                row.Cells["TenKhachHang"].FormatStyle = RowStyle;
            }
        }
 private void HienThiAnhTrangThai_MauChu(GridEXRow row)
 {
     try
     {
         DateTime tempDate  = new DateTime(2000, 1, 1, 0, 0, 1);
         DoiTac   objDoiTac = (DoiTac)row.DataRow;
         if (objDoiTac.NgayTao <= tempDate)
         {
             row.Cells["NgayTao"].Text = string.Empty;
         }
         if (objDoiTac.NgaySua <= tempDate)
         {
             row.Cells["NgaySua"].Text = string.Empty;
         }
         if (objDoiTac.NgayKetThuc <= tempDate)
         {
             row.Cells["NgayKetThuc"].Text = string.Empty;
         }
         else
         {
             GridEXFormatStyle RowStyle = new GridEXFormatStyle();
             RowStyle.BackColor = Color.Pink;
             row.RowStyle       = RowStyle;
         }
     }
     catch (Exception ex)
     {
         //  LogError.WriteLog("Lỗi xử lý hiển thị màu của lưới", ex);
     }
 }
示例#7
0
        private void gridEX1_FormattingRow(object sender, Janus.Windows.GridEX.RowLoadEventArgs e)
        {
            CSKHChiTiet objCSKH = (CSKHChiTiet)e.Row.DataRow;

            if (objCSKH.LAN1_Gio == DateTime.MinValue)
            {
                e.Row.Cells["LAN1_Gio"].Text = "";
            }
            if (objCSKH.LAN2_Gio == DateTime.MinValue)
            {
                e.Row.Cells["LAN2_Gio"].Text = "";
            }
            if (objCSKH.LAN3_Gio == DateTime.MinValue)
            {
                e.Row.Cells["LAN3_Gio"].Text = "";
            }
            else
            {
                GridEXFormatStyle RowStyle = new GridEXFormatStyle();
                RowStyle.BackColor = Color.Yellow;
                e.Row.RowStyle     = RowStyle;
            }
            if (objCSKH.LAN4_Gio == DateTime.MinValue)
            {
                e.Row.Cells["LAN4_Gio"].Text = "";
            }
            else
            {
                GridEXFormatStyle RowStyle = new GridEXFormatStyle();
                RowStyle.BackColor = Color.Red;
                e.Row.RowStyle     = RowStyle;
            }

            if (objCSKH.CSKH_Lan1_Gio == DateTime.MinValue)
            {
                e.Row.Cells["CSKH_Lan1_Gio"].Text = "";
            }
            if (objCSKH.CSKH_Lan2_Gio == DateTime.MinValue)
            {
                e.Row.Cells["CSKH_Lan2_Gio"].Text = "";
            }
            if (objCSKH.CSKH_Lan3_Gio == DateTime.MinValue)
            {
                e.Row.Cells["CSKH_Lan3_Gio"].Text = "";
            }
            if (objCSKH.CSKH_Lan4_Gio == DateTime.MinValue)
            {
                e.Row.Cells["CSKH_Lan4_Gio"].Text = "";
            }

            if (objCSKH.GioDonKhach == DateTime.MinValue)
            {
                e.Row.Cells["GioDon"].Text = "";
            }
        }
示例#8
0
        private void grdTestResult_FormattingRow(object sender, RowLoadEventArgs e)
        {
            if (e == null)
            {
                return;
            }
            var        gf         = new GridEXFormatStyle();
            GridEXCell gridExCell = e.Row.Cells[TResultDetail.Columns.TestResult];

            gf.TextAlignment       = Utility.IsNumeric(gridExCell.Value) ? TextAlignment.Far : TextAlignment.Center;
            gridExCell.FormatStyle = gf;
        }
示例#9
0
        private void gridCauHinhBatThoatCuoc_FormattingRow(object sender, RowLoadEventArgs e)
        {
            GridEXRow row = e.Row;

            if (row.Cells["ThoiDiemKetThuc999"].Value != null && row.Cells["ThoiDiemKetThuc999"].Value.ToString().Length <= 0 &&
                row.Cells["ThoiDiemBatDau999"].Value != null && row.Cells["ThoiDiemBatDau999"].Value.ToString().Length > 0)      // chua co gio ket thuc
            {
                GridEXFormatStyle RowStyle = new GridEXFormatStyle();
                RowStyle.BackColor            = Color.Lime;
                row.Cells["Vung"].FormatStyle = RowStyle;
            }
        }
示例#10
0
        /// <summary>
        /// Special formatting, image display, tooltips
        /// </summary>
        private void GridExVillage_FormattingRow(object sender, RowLoadEventArgs e)
        {
            // GroupHeaders
            UpdateGroupRecordText(e.Row);

            // Normal Rows
            if (e.Row.RowType == RowType.Record)
            {
                var record = e.Row.GetDataRow <PolygonDataSet.VILLAGERow>();

                // SetVillageVisibility()
                if (record.ISVISIBLE)
                {
                    e.Row.Cells["ISVISIBLE"].Image       = Properties.Resources.Visible;
                    e.Row.Cells["ISVISIBLE"].ToolTipText = VillageGridExRes.VisibleTooltip;
                }

                // SetVillageType()
                if (record.Village.Type != VillageType.None)
                {
                    e.Row.Cells["TYPE"].Image = record.Village.Type.GetImage(true);
                    if (record.Village.HasComments)
                    {
                        e.Row.Cells["TYPE"].ToolTipText = record.Village.Comments;
                    }
                    else
                    {
                        e.Row.Cells["TYPE"].ToolTipText = record.Village.Type.GetDescription();
                    }
                }

                // Display You and your tribe in special color
                if (record.Village.HasPlayer)
                {
                    var you = World.Default.You;
                    if (record.Village.Player == you)
                    {
                        var style = new GridEXFormatStyle();
                        style.ForeColor = Color.Red;
                        style.FontBold  = TriState.True;
                        e.Row.Cells["PLAYER"].FormatStyle = style;
                    }
                    else if (you != null && record.Village.Player.Tribe == you.Tribe)
                    {
                        var style = new GridEXFormatStyle();
                        style.ForeColor = Color.Blue;
                        style.FontBold  = TriState.True;
                        e.Row.Cells["PLAYER"].FormatStyle = style;
                    }
                }
            }
        }
示例#11
0
        private void GridExVillage_FormattingRow(object sender, RowLoadEventArgs e)
        {
            if (e.Row.RowType == RowType.Record)
            {
                var record = GetVillageRow(e.Row);

                // SetVillageVisibility()
                if (record.Visible)
                {
                    e.Row.Cells["Visible"].Image       = Properties.Resources.Visible;
                    e.Row.Cells["Visible"].ToolTipText = VillageGridExRes.VisibleCellTooltip;
                }

                // SetVillageType()
                if (record.Village.Type != VillageType.None)
                {
                    e.Row.Cells["Type"].Image = record.Village.Type.GetImage(true);
                    if (record.Village.HasComments)
                    {
                        e.Row.Cells["Type"].ToolTipText = record.Village.Comments;
                    }
                    else
                    {
                        e.Row.Cells["Type"].ToolTipText = record.Village.Type.GetDescription();
                    }
                }

                // Display You and your tribe in special color
                if (ShowPlayer)
                {
                    if (record.Village.HasPlayer)
                    {
                        var you = World.Default.You;
                        if (record.Village.Player == you)
                        {
                            var style = new GridEXFormatStyle();
                            style.ForeColor = Color.Red;
                            style.FontBold  = TriState.True;
                            e.Row.Cells["Player"].FormatStyle = style;
                        }
                        else if (you != null && record.Village.Player.Tribe == you.Tribe)
                        {
                            var style = new GridEXFormatStyle();
                            style.ForeColor = Color.Blue;
                            style.FontBold  = TriState.True;
                            e.Row.Cells["Player"].FormatStyle = style;
                        }
                    }
                }
            }
        }
示例#12
0
        private void gridDSXe_FormattingRow(object sender, Janus.Windows.GridEX.RowLoadEventArgs e)
        {
            KiemSoatXeLienLac objKSLL = (KiemSoatXeLienLac)e.Row.DataRow;

            if (objKSLL.ThoiDiemBao == DateTime.MinValue)
            {
                e.Row.Cells["ThoiDiemBao"].Text = "";
            }
            if (objKSLL.TrangThaiTong == 1) // ve mat lien lac Ăn ca
            {
                GridEXFormatStyle RowStyle = new GridEXFormatStyle();
                RowStyle.ForeColor = Color.Red;
                e.Row.RowStyle     = RowStyle;
            }
            else if (objKSLL.TrangThaiTong == 2) // xe hoat dong
            {
                GridEXFormatStyle RowStyle = new GridEXFormatStyle();
                RowStyle.ForeColor = Color.Blue;
                e.Row.RowStyle     = RowStyle;
            }
            else if (objKSLL.TrangThaiTong == 3) //  xe vê
            {
                GridEXFormatStyle RowStyle = new GridEXFormatStyle();
                RowStyle.ForeColor = Color.DeepPink;
                e.Row.Cells["SoHieuXe"].FormatStyle = RowStyle;
            }
            else if (objKSLL.TrangThaiTong == 4) //  xe nghi
            {
                GridEXFormatStyle RowStyle = new GridEXFormatStyle();
                RowStyle.ForeColor = Color.Gold;
                e.Row.Cells["SoHieuXe"].FormatStyle = RowStyle;
            }
            else if (objKSLL.TrangThaiTong == 5) //  xe
            {
                GridEXFormatStyle RowStyle = new GridEXFormatStyle();
                RowStyle.ForeColor = Color.Green;
                e.Row.Cells["SoHieuXe"].FormatStyle = RowStyle;
            }

            else
            {
                GridEXFormatStyle RowStyle = new GridEXFormatStyle();
                RowStyle.ForeColor = Color.Black;
                e.Row.Cells["SoHieuXe"].FormatStyle = RowStyle;
            }
        }
示例#13
0
        private void LoadAllRoad(string MaCungXN, int ProvinceID)
        {
            try
            {
                clsRoad           clsRoads = new clsRoad();
                List <RoadEntity> lstRoad  = clsRoads.GetAllRoadbyMAXN_ProvinceID(MaCungXN, ProvinceID);
                #region Update All Kinh Do - Vi Do
                //gridBaoCaoBieuMau1.DataSource = lstRoad;
                //float viDo = 0;
                //float kinhDo = 0;
                //string toaDo = "";
                //foreach (clsRoadEntity item in lstRoad)
                //{
                //    if (item.KinhDo > 0 && item.ViDo > 0) continue;

                //    toaDo = GetGeobyAddressBA2(item.NameVN);
                //    if (toaDo != "*" && toaDo != string.Empty)
                //    {
                //        string[] arrString = toaDo.Split(' ');
                //        float.TryParse(arrString[0], NumberStyles.AllowDecimalPoint ,new CultureInfo("vi-VN", true), out viDo);
                //        float.TryParse(arrString[1], NumberStyles.AllowDecimalPoint, new CultureInfo("vi-VN", true), out kinhDo);
                //    }

                //    new clsRoad().Update_TenVietTat(item.ID, item.VietTat, item.NameVN, item.NameEN, kinhDo, viDo);
                //}
                #endregion

                gridVietTatTenDuong.SetDataBinding(lstRoad, "ListRoad");

                GridEXFilterCondition Filter = new GridEXFilterCondition(gridVietTatTenDuong.RootTable.Columns["NameVN"], ConditionOperator.Equal, G_NameVN);

                if (gridVietTatTenDuong.Find(Filter, -1, 1))
                {
                    GridEXRow row = ((GridEXSelectedItem)gridVietTatTenDuong.SelectedItems[0]).GetRow();

                    GridEXFormatStyle RowStyle = new GridEXFormatStyle();
                    RowStyle.BackColor = System.Drawing.Color.DodgerBlue;
                    row.RowStyle       = RowStyle;
                    //gridVietTatTenDuong.RootTable.ApplyFilter(ab);
                }
            }
            catch (Exception ex)
            {
                LogError.WriteLogError(this.Name, ex);
            }
        }
示例#14
0
        /// <summary>
        /// - Hien thi anh trang thai tuong ung voi trang thai lenh
        /// - thay doi mau nen cua khach VIP, moi gioi, khach binh thuong
        /// - Thay mau chu cua dia chi cua khach goi lai
        /// - thay doi may cua cuoc goi khong phai cua minh phu trach
        /// </summary>
        private void HienThiAnhTrangThai_MauChu(GridEXRow row)
        {
            try
            {
                BaoCaoBieuMau3 objBC3 = (BaoCaoBieuMau3)row.DataRow;

                // thay doi mau nen cua khach VIP, moi gioi, khach binh thuong
                if (objBC3.KieuKhachHangGoiDen == Taxi.Utils.KieuKhachHangGoiDen.KhachHangMoiGioi)
                {
                    GridEXFormatStyle RowStyle = new GridEXFormatStyle();
                    RowStyle.BackColor = Color.MediumOrchid;
                    RowStyle.ForeColor = Color.White;
                    row.Cells["PhoneNumber"].FormatStyle = RowStyle;
                }
                else if (objBC3.KieuKhachHangGoiDen == Taxi.Utils.KieuKhachHangGoiDen.KhachHangVIP)
                {
                    GridEXFormatStyle RowStyle = new GridEXFormatStyle();
                    RowStyle.BackColor = Color.Blue;
                    row.Cells["PhoneNumber"].FormatStyle = RowStyle;
                }
                else if (objBC3.KieuKhachHangGoiDen == Taxi.Utils.KieuKhachHangGoiDen.KhachHangVang ||
                         objBC3.KieuKhachHangGoiDen == Taxi.Utils.KieuKhachHangGoiDen.KhachHangBac)
                {
                    GridEXFormatStyle RowStyle = new GridEXFormatStyle();
                    RowStyle.BackColor = Color.ForestGreen;
                    row.Cells["PhoneNumber"].FormatStyle = RowStyle;
                }
                if (objBC3.GoiLai || objBC3.LenhDienThoai.Contains("gọi lại"))
                {
                    GridEXFormatStyle RowStyle = new GridEXFormatStyle();
                    RowStyle.ForeColor = Color.Red;
                    row.RowStyle       = RowStyle;
                }
                if (objBC3.FileVoicePath.Length <= 0)
                {
                    GridEXFormatStyle RowStyle = new GridEXFormatStyle();
                    RowStyle.BackColor = Color.Violet;
                    row.Cells["RingNumber"].FormatStyle = RowStyle;
                }
            }
            catch (Exception ex)
            {
                ////  LogError.WriteLog("Lỗi xử lý hiển thị màu của lưới", ex);
            }
        }
示例#15
0
        private void grdDaGiaiQuyetPA_FormattingRow(object sender, RowLoadEventArgs e)
        {
            ThongTinPhanAnh objPhanAnh = (ThongTinPhanAnh)e.Row.DataRow;

            if (objPhanAnh.KieuKhachHangGoiDen == EFiling.Utils.KieuKhachHangGoiDen.KhachHangVIP)
            {
                GridEXFormatStyle RowStyle = new GridEXFormatStyle();
                RowStyle.BackColor = Color.Blue;
                e.Row.Cells["TenKhachHang"].FormatStyle = RowStyle;
            }
            else if (objPhanAnh.KieuKhachHangGoiDen == EFiling.Utils.KieuKhachHangGoiDen.KhachHangVang ||
                     objPhanAnh.KieuKhachHangGoiDen == EFiling.Utils.KieuKhachHangGoiDen.KhachHangBac)
            {
                GridEXFormatStyle RowStyle = new GridEXFormatStyle();
                RowStyle.BackColor = Color.ForestGreen;
                e.Row.Cells["TenKhachHang"].FormatStyle = RowStyle;
            }
        }
示例#16
0
        public void NhapDuLieuVaoTruyenDi2(int iRowPosition)
        {
            grdChuyenDV.SelectionMode = Janus.Windows.GridEX.SelectionMode.SingleSelection;
            if (grdChuyenDV.SelectedItems.Count > 0)
            {
                ThongTinPhanAnh objThongTinPA = (ThongTinPhanAnh)((GridEXSelectedItem)grdChuyenDV.SelectedItems[0]).GetRow().DataRow;
                //Thu doi mau
                GridEXRow         rowSelect = ((GridEXSelectedItem)grdChuyenDV.SelectedItems[0]).GetRow();
                GridEXFormatStyle RowStyle  = new GridEXFormatStyle();
                RowStyle.BackColor = System.Drawing.SystemColors.Highlight;
                rowSelect.RowStyle = RowStyle;

                List <int> lstCongTyID = new List <int>();
                lstCongTyID = objThongTinPA.GetDonViXuLy(Convert.ToInt32(objThongTinPA.ID));
                //End - Thu doi mau
                frmThongTinPhanAnhInput frmPAInPut = new frmThongTinPhanAnhInput(objThongTinPA, RoleNhanVien, true, lstCongTyID);

                DialogResult _dialogResult = frmPAInPut.ShowDialog(this);
                if (_dialogResult == DialogResult.Yes)
                {
                    LoadPhanAnh_ChuyenDonVi(rowSelect.Position);
                }
                else if (_dialogResult == DialogResult.OK)
                {
                    if (frmPAInPut.chkTrangThai.Checked)
                    {
                        LoadPhanAnh_ChuyenDonVi(0);
                    }
                    else
                    {
                        LoadPhanAnh_ChuyenDonVi(rowSelect.Position);
                    }
                }
                else
                {
                    LoadPhanAnh_ChuyenDonVi(rowSelect.Position);
                }

                //tra ve mau cu
                RowStyle           = new GridEXFormatStyle();
                RowStyle.BackColor = System.Drawing.SystemColors.Window;
                rowSelect.RowStyle = RowStyle;
            }
        }
        private void LoadAllRoad(string MaCungXN, int ProvinceID)
        {
            try
            {
                clsRoad           clsRoads = new clsRoad();
                List <RoadEntity> lstRoad  = clsRoads.GetAllRoadbyMAXN_ProvinceID(MaCungXN, ProvinceID);
                gridVietTatTenDuong.SetDataBinding(lstRoad, "ListRoad");
                GridEXFilterCondition Filter = new GridEXFilterCondition(gridVietTatTenDuong.RootTable.Columns["NameVN"], ConditionOperator.Equal, G_NameVN);

                if (gridVietTatTenDuong.Find(Filter, -1, 1))
                {
                    GridEXRow         row      = (gridVietTatTenDuong.SelectedItems[0]).GetRow();
                    GridEXFormatStyle RowStyle = new GridEXFormatStyle();
                    RowStyle.BackColor = System.Drawing.Color.DodgerBlue;
                    row.RowStyle       = RowStyle;
                }
            }
            catch (Exception ex)
            {
                LogError.WriteLogError("LoadAllRoad: ", ex);
            }
        }
        /// <summary>
        /// hiển thị thay đổi màu đồi với những những dòng chưa có Kmtrả
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void grdNhanVien_FormattingRow(object sender, RowLoadEventArgs e)
        {
            //objThueBao.ThoiGianTra = new DateTime(1900, 01, 01);
            //objThueBao.KmTra = -1;
            //objThueBao.TienThucThu = -1;
            //objThueBao.KmThucDi = -1;
            //objThueBao.DongHoTien = -1;
            //objThueBao.GhiChu = "";
            //objThueBao.PhuTroi = "";
            GridEXRow row = e.Row;

            if (row.Cells["KmTra"].Text == "-1")
            {
                row.Cells["ThoiGianTra"].Text = "";
                row.Cells["KmTra"].Text       = "";
                row.Cells["KmThucDi"].Text    = "";
                row.Cells["DongHoTien"].Text  = "";
                row.Cells["TienThucThu"].Text = "";
                GridEXFormatStyle RowStyle = new GridEXFormatStyle();
                RowStyle.BackColor = Color.Yellow;
                row.Cells["SoHieuXe"].FormatStyle = RowStyle;
            }
        }
示例#19
0
        private void GridExVillage_FormattingRow(object sender, RowLoadEventArgs e)
        {
            if (e.Row.RowType == RowType.Record)
            {
                var record = GetVillageRow(e.Row);

                // SetVillageVisibility()
                if (record.Visible)
                {
                    e.Row.Cells["Visible"].Image = Properties.Resources.Visible;
                    e.Row.Cells["Visible"].ToolTipText = "Currently visible on the map";
                }

                // SetVillageType()
                if (record.Village.Type != VillageType.None)
                {
                    e.Row.Cells["Type"].Image = record.Village.Type.GetImage(true);
                    if (record.Village.HasComments)
                    {
                        e.Row.Cells["Type"].ToolTipText = record.Village.Comments;
                    }
                    else
                    {
                        e.Row.Cells["Type"].ToolTipText = record.Village.Type.GetDescription();
                    }
                }

                // Display You and your tribe in special color
                if (ShowPlayer)
                {
                    if (record.Village.HasPlayer)
                    {
                        var you = World.Default.You;
                        if (record.Village.Player == you)
                        {
                            var style = new GridEXFormatStyle();
                            style.ForeColor = Color.Red;
                            style.FontBold = TriState.True;
                            e.Row.Cells["Player"].FormatStyle = style;
                        }
                        else if (you != null && record.Village.Player.Tribe == you.Tribe)
                        {
                            var style = new GridEXFormatStyle();
                            style.ForeColor = Color.Blue;
                            style.FontBold = TriState.True;
                            e.Row.Cells["Player"].FormatStyle = style;
                        }
                    }
                }
            }
        }
示例#20
0
 public Assets(TTSFormState state)
     : base(state)
 {
     this.InitializeComponent();
     InheritableBoolean repeatHeaders = InheritableBoolean.False;
     GridEXFormatStyle formatStyle = new GridEXFormatStyle(ColorHelper.RowStyleYellow)
     {
         FontBold = TriState.True
     };
     int rowHeight = 30;
     this.ContainersGrid.SuspendLayout();
     this.ContainersGrid.DataSource = Game.State.AssetContainerView;
     this.ContainersGrid.RetrieveStructure(true);
     this.ContainersGrid.Format();
     this.ContainersGrid.AlternatingColors = false;
     this.ContainersGrid.RootTable.FormatColumns(new string[]
     {
         "Ticker",
         "LeaseCount",
         "LeasePrice",
         "TicksPerLease",
         "Containment",
         "Realized"
     }, null);
     this.ContainersGrid.RootTable.AddButtonColumn("LeaseAsset", "Lease", "");
     this.ContainersGrid.RootTable.AddProgressBarFormatter("LeaseCount", "TotalQuantity");
     this.ContainersGrid.RepeatHeaders = repeatHeaders;
     this.ContainersGrid.RootTable.RowFormatStyle = new GridEXFormatStyle(formatStyle);
     this.ContainersGrid.RootTable.RowHeight = rowHeight;
     this.ContainersGrid.RootTable.ChildTables[0].FormatColumns(new string[]
     {
         "StartLeasePeriod",
         "StartLeaseTick",
         "NextLeasePeriod",
         "NextLeaseTick",
         "ContainmentUsage"
     }, null);
     this.ContainersGrid.RootTable.ChildTables[0].AddButtonColumn("UnleaseAsset", "End Lease", "");
     this.ContainersGrid.RootTable.ChildTables[0].AddPeriodTickFormatter("StartLeasePeriod", "StartLeaseTick", "");
     this.ContainersGrid.RootTable.ChildTables[0].AddPeriodTickFormatter("NextLeasePeriod", "NextLeaseTick", "");
     this.ContainersGrid.ColumnButtonClick += delegate(object sender, ColumnActionEventArgs e)
     {
         try
         {
             if (e.Column.Key == "LeaseAsset")
             {
                 ServiceManager.Execute(delegate(IClientService p)
                 {
                     p.LeaseAsset(e.Column.GridEX.GetRow().Cells["Ticker"].Value.ToString());
                 });
             }
             else
             {
                 if (e.Column.Key == "UnleaseAsset")
                 {
                     ServiceManager.Execute(delegate(IClientService p)
                     {
                         p.UnleaseAsset((int)e.Column.GridEX.GetRow().Cells["ID"].Value);
                     });
                 }
             }
             e.Column.GridEX.GetRow().Expanded = true;
         }
         catch (FaultException ex)
         {
             DialogHelper.ShowError(ex.Message, "Error");
         }
     };
     this.ContainersGrid.RootTable.ChildTables[0].AddProgressBarFormatter("ContainmentUsage", delegate(DrawGridAreaEventArgs e)
     {
         if (e.Row.Cells["ContainmentUsage"].Value != System.DBNull.Value)
         {
             return System.Convert.ToSingle(e.Row.Cells["ContainmentUsage"].Value) / System.Convert.ToSingle(((TickerWeight)Game.State.AssetInfoTable.Rows.Find(e.Row.Cells["Ticker"].Value)["Containment"]).Weight);
         }
         return 0f;
     }, delegate(DrawGridAreaEventArgs e)
     {
         if (e.Row.Cells["ContainmentUsage"].Value != System.DBNull.Value)
         {
             return string.Format("{0} / {1}", e.Row.Cells["ContainmentUsage"].Value, ((TickerWeight)Game.State.AssetInfoTable.Rows.Find(e.Row.Cells["Ticker"].Value)["Containment"]).Weight);
         }
         return "";
     });
     this.ContainersGrid.CollapsingRow += delegate(object sender, RowActionCancelEventArgs e)
     {
         e.Cancel = true;
     };
     this.ContainersGrid.ResumeLayout();
     this.TransportersGrid.SuspendLayout();
     this.TransportersGrid.DataSource = Game.State.AssetTransporterView;
     this.TransportersGrid.RetrieveStructure(true);
     this.TransportersGrid.Format();
     this.TransportersGrid.AlternatingColors = false;
     this.TransportersGrid.RootTable.AddIListColumns(Game.State.AssetInfoTable);
     this.TransportersGrid.RootTable.FormatColumns(new string[]
     {
         "Ticker",
         "Type",
         "LeaseCount",
         "LeasePrice",
         "TicksPerLease",
         "ConvertFrom",
         "ConvertTo",
         "TicksPerConversion",
         "Realized"
     }, null);
     this.TransportersGrid.RootTable.AddButtonColumn("LeaseUseAsset", "Lease & Use", "");
     this.TransportersGrid.RootTable.AddProgressBarFormatter("LeaseCount", "TotalQuantity");
     this.TransportersGrid.RootTable.AddTickerArrayFormatter(new string[]
     {
         "ConvertFrom",
         "ConvertTo"
     });
     this.TransportersGrid.RootTable.AddTickerArrayFormatter(new string[]
     {
         "ConvertFrom",
         "ConvertTo"
     });
     this.TransportersGrid.RepeatHeaders = repeatHeaders;
     this.TransportersGrid.RootTable.RowFormatStyle = new GridEXFormatStyle(formatStyle);
     this.TransportersGrid.RootTable.RowHeight = rowHeight;
     this.TransportersGrid.RootTable.ChildTables[0].AddIListColumns(Game.State.AssetTable);
     this.TransportersGrid.RootTable.ChildTables[0].Columns.Add("Progress", ColumnType.Text);
     this.TransportersGrid.RootTable.ChildTables[0].FormatColumns(new string[]
     {
         "StartLeasePeriod",
         "StartLeaseTick",
         "ConvertFrom",
         "ConvertTo",
         "ConvertFinishPeriod",
         "ConvertFinishTick",
         "Progress"
     }, null);
     this.TransportersGrid.RootTable.ChildTables[0].AddButtonColumn("BackhaulAsset", "Backhaul", "");
     this.TransportersGrid.RootTable.ChildTables[0].AddPeriodTickFormatter("StartLeasePeriod", "StartLeaseTick", "");
     this.TransportersGrid.RootTable.ChildTables[0].AddPeriodTickFormatter("ConvertFinishPeriod", "ConvertFinishTick", "");
     this.TransportersGrid.RootTable.ChildTables[0].AddProgressBarFormatter("Progress", delegate(DrawGridAreaEventArgs e)
     {
         if (e.Row.Cells["ConvertFinishPeriod"].Value != System.DBNull.Value && e.Row.Cells["ConvertFinishTick"].Value != System.DBNull.Value)
         {
             return 1f - (float)(((int)e.Row.Cells["ConvertFinishPeriod"].Value - Game.State.Current.Period) * Game.State.General.TicksPerPeriod + (int)e.Row.Cells["ConvertFinishTick"].Value - Game.State.Current.Tick) / System.Convert.ToSingle((int)Game.State.AssetInfoTable.Rows.Find(e.Row.Cells["Ticker"].Value)["TicksPerConversion"]);
         }
         return 0f;
     }, null);
     this.TransportersGrid.ColumnButtonClick += delegate(object sender, ColumnActionEventArgs e)
     {
         try
         {
             string ticker = e.Column.GridEX.GetRow().Cells["Ticker"].Value.ToString();
             if (e.Column.Key == "LeaseUseAsset")
             {
                 TickerWeight[] toconvert;
                 if (this.ShowAssetUsageDialog("Use " + ticker, "Select amount to transport:", (TickerWeight[])Game.State.AssetInfoTable.Rows.Find(ticker)["ConvertFrom"], (TickerWeight[])Game.State.AssetInfoTable.Rows.Find(ticker)["ConvertTo"], out toconvert) == System.Windows.Forms.DialogResult.OK)
                 {
                     ServiceManager.Execute(delegate(IClientService p)
                     {
                         p.UseAsset(ticker, toconvert);
                     });
                 }
             }
             e.Column.GridEX.GetRow().Expanded = true;
         }
         catch (FaultException ex)
         {
             DialogHelper.ShowError(ex.Message, "Error");
         }
     };
     this.TransportersGrid.LoadingRow += delegate(object sender, RowLoadEventArgs e)
     {
         if (e.Row.DataRow == null)
         {
             return;
         }
         if (e.Row.Parent == null && e.Row.Cells["DisplayCost"].Value != System.DBNull.Value && !string.IsNullOrWhiteSpace(e.Row.Cells["DisplayCost"].Text))
         {
             e.Row.Cells["LeasePrice"].Text = e.Row.Cells["DisplayCost"].Text;
         }
     };
     this.TransportersGrid.CollapsingRow += delegate(object sender, RowActionCancelEventArgs e)
     {
         e.Cancel = true;
     };
     this.TransportersGrid.ResumeLayout();
     this.ConvertersGrid.SuspendLayout();
     this.ConvertersGrid.DataSource = Game.State.AssetConverterView;
     this.ConvertersGrid.RetrieveStructure(true);
     this.ConvertersGrid.Format();
     this.ConvertersGrid.AlternatingColors = false;
     this.ConvertersGrid.RootTable.AddIListColumns(Game.State.AssetInfoTable);
     this.ConvertersGrid.RootTable.FormatColumns(new string[]
     {
         "Ticker",
         "Type",
         "LeaseCount",
         "LeasePrice",
         "TicksPerLease",
         "ConvertFrom",
         "ConvertTo",
         "TicksPerConversion",
         "Realized"
     }, null);
     this.ConvertersGrid.RootTable.AddButtonColumn("LeaseAsset", "Lease", "");
     this.ConvertersGrid.RootTable.AddProgressBarFormatter("LeaseCount", "TotalQuantity");
     this.ConvertersGrid.RootTable.AddTickerArrayFormatter(new string[]
     {
         "ConvertFrom",
         "ConvertTo"
     });
     this.ConvertersGrid.RootTable.AddTickerArrayFormatter(new string[]
     {
         "ConvertFrom",
         "ConvertTo"
     });
     this.ConvertersGrid.RepeatHeaders = repeatHeaders;
     this.ConvertersGrid.RootTable.RowFormatStyle = new GridEXFormatStyle(formatStyle);
     this.ConvertersGrid.RootTable.RowHeight = rowHeight;
     this.ConvertersGrid.RootTable.ChildTables[0].AddIListColumns(Game.State.AssetTable);
     this.ConvertersGrid.RootTable.ChildTables[0].Columns.Add("Progress", ColumnType.Text);
     this.ConvertersGrid.RootTable.ChildTables[0].FormatColumns(new string[]
     {
         "StartLeasePeriod",
         "StartLeaseTick",
         "NextLeasePeriod",
         "NextLeaseTick",
         "ConvertFrom",
         "ConvertTo",
         "ConvertFinishPeriod",
         "ConvertFinishTick",
         "Progress"
     }, null);
     this.ConvertersGrid.RootTable.ChildTables[0].AddButtonColumn("UseAsset", "Use Asset", "");
     this.ConvertersGrid.RootTable.ChildTables[0].AddButtonColumn("UnleaseAsset", "End Lease", "");
     this.ConvertersGrid.RootTable.ChildTables[0].AddPeriodTickFormatter("StartLeasePeriod", "StartLeaseTick", "");
     this.ConvertersGrid.RootTable.ChildTables[0].AddPeriodTickFormatter("NextLeasePeriod", "NextLeaseTick", "");
     this.ConvertersGrid.RootTable.ChildTables[0].AddPeriodTickFormatter("ConvertFinishPeriod", "ConvertFinishTick", "");
     this.ConvertersGrid.RootTable.ChildTables[0].AddProgressBarFormatter("Progress", delegate(DrawGridAreaEventArgs e)
     {
         if (e.Row.Cells["ConvertFinishPeriod"].Value != System.DBNull.Value && e.Row.Cells["ConvertFinishTick"].Value != System.DBNull.Value)
         {
             return 1f - (float)(((int)e.Row.Cells["ConvertFinishPeriod"].Value - Game.State.Current.Period) * Game.State.General.TicksPerPeriod + (int)e.Row.Cells["ConvertFinishTick"].Value - Game.State.Current.Tick) / System.Convert.ToSingle((int)Game.State.AssetInfoTable.Rows.Find(e.Row.Cells["Ticker"].Value)["TicksPerConversion"]);
         }
         return 0f;
     }, null);
     this.ConvertersGrid.ColumnButtonClick += delegate(object sender, ColumnActionEventArgs e)
     {
         try
         {
             string ticker = e.Column.GridEX.GetRow().Cells["Ticker"].Value.ToString();
             if (e.Column.Key == "LeaseAsset")
             {
                 ServiceManager.Execute(delegate(IClientService p)
                 {
                     p.LeaseAsset(ticker);
                 });
             }
             else
             {
                 if (e.Column.Key == "UnleaseAsset")
                 {
                     int id = (int)e.Column.GridEX.GetRow().Cells["ID"].Value;
                     ServiceManager.Execute(delegate(IClientService p)
                     {
                         p.UnleaseAsset(id);
                     });
                 }
                 else
                 {
                     if (e.Column.Key == "UseAsset")
                     {
                         int id = (int)e.Column.GridEX.GetRow().Cells["ID"].Value;
                         TickerWeight[] toconvert;
                         if (this.ShowAssetUsageDialog("Use " + ticker, "Select amount to convert:", (TickerWeight[])Game.State.AssetInfoTable.Rows.Find(ticker)["ConvertFrom"], (TickerWeight[])Game.State.AssetInfoTable.Rows.Find(ticker)["ConvertTo"], out toconvert) == System.Windows.Forms.DialogResult.OK)
                         {
                             ServiceManager.Execute(delegate(IClientService p)
                             {
                                 p.UseLeasedAsset(id, toconvert);
                             });
                         }
                     }
                 }
             }
             e.Column.GridEX.GetRow().Expanded = true;
         }
         catch (FaultException ex)
         {
             DialogHelper.ShowError(ex.Message, "Error");
         }
     };
     this.ConvertersGrid.CollapsingRow += delegate(object sender, RowActionCancelEventArgs e)
     {
         e.Cancel = true;
     };
     this.ConvertersGrid.ResumeLayout();
     base.AddResetHandler(delegate
     {
         this.ContainersGrid.DataSource = Game.State.AssetContainerView;
         this.TransportersGrid.DataSource = Game.State.AssetTransporterView;
         this.ConvertersGrid.DataSource = Game.State.AssetConverterView;
         this.ProducersGrid.DataSource = Game.State.AssetProducerView;
         this.ContainersGrid.ExpandRecords();
         this.TransportersGrid.ExpandRecords();
         this.ConvertersGrid.ExpandRecords();
         this.ProducersGrid.ExpandRecords();
     });
     base.Load += delegate(object sender, System.EventArgs e)
     {
         this.ContainersGrid.ExpandRecords();
         this.TransportersGrid.ExpandRecords();
         this.ConvertersGrid.ExpandRecords();
         this.ProducersGrid.ExpandRecords();
     };
 }
 private void grdTestResult_FormattingRow(object sender, RowLoadEventArgs e)
 {
     if (e == null) return;
     var gf = new GridEXFormatStyle();
     GridEXCell gridExCell = e.Row.Cells[TResultDetail.Columns.TestResult];
     gf.TextAlignment = Utility.IsNumeric(gridExCell.Value) ? TextAlignment.Far : TextAlignment.Center;
     gridExCell.FormatStyle = gf;
 }
        protected override bool ProcessDialogKey(Keys keyData)
        {
            switch (keyData)
            {
            case Keys.F5:     // Mo nhap du lieu dong 1
            {
                //if (gridDSXe.Focused)
                //{
                //    if (gridDSXe.SelectedItems != null && gridDSXe.SelectedItems.Count > 0)
                //    {
                //        //Thu doi mau
                //        GridEXRow rowSelect = ((GridEXSelectedItem)gridDSXe.SelectedItems[0]).GetRow();
                //        GridEXFormatStyle RowStyle = new GridEXFormatStyle();
                //        RowStyle.BackColor = System.Drawing.SystemColors.Highlight;
                //        rowSelect.RowStyle = RowStyle;
                //        //End - Thu doi mau


                //        string SoHieuXe = StringTools.TrimSpace(rowSelect.Cells["SoHieuXe"].Text);
                //        if (SoHieuXe.Length > 0) new frmRaHoatDong(this, 1, SoHieuXe).ShowDialog();
                //        else new frmRaHoatDong(this, 1).ShowDialog();
                //        //tra ve mau cu
                //        RowStyle = new GridEXFormatStyle();
                //        RowStyle.BackColor = System.Drawing.SystemColors.Window;
                //        rowSelect.RowStyle = RowStyle;
                //    }
                //    else new frmRaHoatDong(this, 1).ShowDialog();
                //}
                //else new frmRaHoatDong(this, 1).ShowDialog();
                break;
            }

            case Keys.F6:
            {
                //if (gridDSXe.Focused)
                //{
                //    if (gridDSXe.SelectedItems != null && gridDSXe.SelectedItems.Count > 0)
                //    {
                //        //Thu doi mau
                //        GridEXRow rowSelect = ((GridEXSelectedItem)gridDSXe.SelectedItems[0]).GetRow();
                //        GridEXFormatStyle RowStyle = new GridEXFormatStyle();
                //        RowStyle.BackColor = System.Drawing.SystemColors.Highlight;
                //        rowSelect.RowStyle = RowStyle;
                //        //End - Thu doi mau


                //        string SoHieuXe = StringTools.TrimSpace(rowSelect.Cells["SoHieuXe"].Text);
                //        if (SoHieuXe.Length >0) new frmRaHoatDong(this, 2, SoHieuXe).ShowDialog();
                //        else new frmRaHoatDong(this, 2).ShowDialog();

                //        //tra ve mau cu
                //        RowStyle = new GridEXFormatStyle();
                //        RowStyle.BackColor = System.Drawing.SystemColors.Window;
                //        rowSelect.RowStyle = RowStyle;
                //    }
                //    else new frmRaHoatDong(this, 2).ShowDialog();
                //}
                //else new frmRaHoatDong(this, 2).ShowDialog();
                break;
            }

            case Keys.F7:     // Mo nhap du lieu dong 1
            {
                //if (gridDSXe.Focused)
                //{
                //    if (gridDSXe.SelectedItems != null && gridDSXe.SelectedItems.Count > 0)
                //    {
                //        //Thu doi mau
                //        GridEXRow rowSelect = ((GridEXSelectedItem)gridDSXe.SelectedItems[0]).GetRow();
                //        GridEXFormatStyle RowStyle = new GridEXFormatStyle();
                //        RowStyle.BackColor = System.Drawing.SystemColors.Highlight;
                //        rowSelect.RowStyle = RowStyle;
                //        //End - Thu doi mau

                //        string SoHieuXe = StringTools.TrimSpace(rowSelect.Cells["SoHieuXe"].Text);
                //        if (SoHieuXe.Length > 0) new frmRaHoatDong(this, 3, SoHieuXe).ShowDialog();
                //        else new frmRaHoatDong(this, 3).ShowDialog();


                //        //tra ve mau cu
                //        RowStyle = new GridEXFormatStyle();
                //        RowStyle.BackColor = System.Drawing.SystemColors.Window;
                //        rowSelect.RowStyle = RowStyle;
                //    }
                //    else new frmRaHoatDong(this, 3).ShowDialog();
                //}
                //else new frmRaHoatDong(this, 3).ShowDialog();
                break;
            }

            case Keys.F8:      // Mo nhap du lieu dong 1
            {
                //if (gridDSXe.Focused)
                //{
                //    if (gridDSXe.SelectedItems != null && gridDSXe.SelectedItems.Count > 0)
                //    {
                //        //Thu doi mau
                //        GridEXRow rowSelect = ((GridEXSelectedItem)gridDSXe.SelectedItems[0]).GetRow();
                //        GridEXFormatStyle RowStyle = new GridEXFormatStyle();
                //        RowStyle.BackColor = System.Drawing.SystemColors.Highlight;
                //        rowSelect.RowStyle = RowStyle;
                //        //End - Thu doi mau

                //        string SoHieuXe = StringTools.TrimSpace(rowSelect.Cells["SoHieuXe"].Text);
                //        if (SoHieuXe.Length > 0) new frmRaHoatDong(this, 4, SoHieuXe).ShowDialog();
                //        else new frmRaHoatDong(this, 4).ShowDialog();


                //        //tra ve mau cu
                //        RowStyle = new GridEXFormatStyle();
                //        RowStyle.BackColor = System.Drawing.SystemColors.Window;
                //        rowSelect.RowStyle = RowStyle;
                //    }
                //    else new frmRaHoatDong(this, 4).ShowDialog();
                //}
                //else new frmRaHoatDong(this, 4).ShowDialog();
                break;
            }

            case Keys.F9:      // Mo nhap du lieu dong 1
            {
                if (gridDSXe.Focused)
                {
                    if (gridDSXe.SelectedItems != null && gridDSXe.SelectedItems.Count > 0)
                    {
                        //Thu doi mau
                        GridEXRow         rowSelect = ((GridEXSelectedItem)gridDSXe.SelectedItems[0]).GetRow();
                        GridEXFormatStyle RowStyle  = new GridEXFormatStyle();
                        RowStyle.BackColor = SystemColors.Highlight;
                        rowSelect.RowStyle = RowStyle;
                        //End - Thu doi mau

                        string SoHieuXe = StringTools.TrimSpace(rowSelect.Cells["SoHieuXe"].Text);
                        if (SoHieuXe.Length > 0)
                        {
                            new frmRaHoatDong(this, 5, SoHieuXe).ShowDialog();
                        }
                        else
                        {
                            new frmRaHoatDong(this, 5).ShowDialog();
                        }


                        //tra ve mau cu
                        RowStyle           = new GridEXFormatStyle();
                        RowStyle.BackColor = SystemColors.Window;
                        rowSelect.RowStyle = RowStyle;
                    }
                    else
                    {
                        new frmRaHoatDong(this, 5).ShowDialog();
                    }
                }
                else
                {
                    new frmRaHoatDong(this, 5).ShowDialog();
                }
                break;
            }
            //case Keys.F10:  // Mo nhap du lieu dong 1
            //{
            //if (gridDSXe.Focused)
            //{
            //    if (gridDSXe.SelectedItems != null && gridDSXe.SelectedItems.Count > 0)
            //    {
            //        //Thu doi mau
            //        GridEXRow rowSelect = ((GridEXSelectedItem)gridDSXe.SelectedItems[0]).GetRow();
            //        GridEXFormatStyle RowStyle = new GridEXFormatStyle();
            //        RowStyle.BackColor = SystemColors.Highlight;
            //        rowSelect.RowStyle = RowStyle;
            //        //End - Thu doi mau

            //        string SoHieuXe = StringTools.TrimSpace(rowSelect.Cells["SoHieuXe"].Text);
            //        if (SoHieuXe.Length > 0) new frmRaHoatDong(this, 6, SoHieuXe).ShowDialog();
            //        else new frmRaHoatDong(this, 6).ShowDialog();


            //        //tra ve mau cu
            //        RowStyle = new GridEXFormatStyle();
            //        RowStyle.BackColor = SystemColors.Window;
            //        rowSelect.RowStyle = RowStyle;
            //    }
            //    else new frmRaHoatDong(this,6).ShowDialog();
            //}
            //else new frmRaHoatDong(this, 6).ShowDialog();
            //break;
            //}
            case Keys.F2:     // Minimine
            {
                if (g_PhongTo)
                {
                    this.SetViTriMinDatTrenManHinh(); g_PhongTo = false;
                }
                else
                {
                    this.SetViTriDatTrenManHinh(); g_PhongTo = true;
                }
                break;
            }

            case Keys.Alt | Keys.S:     // Minimine
            {
                txtSoHieuXe.Focus(); return(true);

                break;
            }

            case Keys.Alt | Keys.X:     // Minimine
            {
                txtSoHieuXeKS.Focus(); return(true);

                break;
            }

            case Keys.F1:
            {
                m_frmParent.Activate(); this.Opacity = 0.4;
                return(true);

                break;
            }

            default:
            {
            }
            break;
            }
            return(base.ProcessDialogKey(keyData));
        }
示例#23
0
        /// <summary>
        /// Special formatting, image display, tooltips
        /// </summary>
        private void GridExVillage_FormattingRow(object sender, RowLoadEventArgs e)
        {
            // GroupHeaders
            UpdateGroupRecordText(e.Row);

            // Normal Rows
            if (e.Row.RowType == RowType.Record)
            {
                var record = e.Row.GetDataRow<PolygonDataSet.VILLAGERow>();

                // SetVillageVisibility()
                if (record.ISVISIBLE)
                {
                    e.Row.Cells["ISVISIBLE"].Image = Properties.Resources.Visible;
                    e.Row.Cells["ISVISIBLE"].ToolTipText = "Currently visible on the map";
                }

                // SetVillageType()
                if (record.Village.Type != VillageType.None)
                {
                    e.Row.Cells["TYPE"].Image = record.Village.Type.GetImage(true);
                    if (record.Village.HasComments)
                    {
                        e.Row.Cells["TYPE"].ToolTipText = record.Village.Comments;
                    }
                    else
                    {
                        e.Row.Cells["TYPE"].ToolTipText = record.Village.Type.GetDescription();
                    }
                }

                // Display You and your tribe in special color
                if (record.Village.HasPlayer)
                {
                    var you = World.Default.You;
                    if (record.Village.Player == you)
                    {
                        var style = new GridEXFormatStyle();
                        style.ForeColor = Color.Red;
                        style.FontBold = TriState.True;
                        e.Row.Cells["PLAYER"].FormatStyle = style;
                    }
                    else if (you != null && record.Village.Player.Tribe == you.Tribe)
                    {
                        var style = new GridEXFormatStyle();
                        style.ForeColor = Color.Blue;
                        style.FontBold = TriState.True;
                        e.Row.Cells["PLAYER"].FormatStyle = style;
                    }
                }
            }
        }
示例#24
0
        private void gridEX1_RowDoubleClick(object sender, RowActionEventArgs e)
        {
            try
            {
                uiPanel2.Closed = true;

                if (gridEX1.GetRow().RowType == RowType.Record)
                {
                    string  TblName;
                    DataRow dr = (DataRow)((DataRowView)gridEX1.GetRow().DataRow).Row;
                    TblName       = (string)dr["TableName"];
                    uiPanel1.Text = TblName;

                    for (int i = cGridEX.RootTable.Columns.Count - 1; i >= 0; i--)
                    {
                        cGridEX.RootTable.Columns.Remove(cGridEX.RootTable.Columns[i]);
                    }

                    obe = AtMng.GetCodeTableBE(TblName);
                    obe.Load();
                    cGridEX.DataSource = obe.myDT;
                    int y = 0;
                    for (int i = 0; obe.myDT.Columns.Count > i; i++)
                    {
                        if ((obe.myDT.Columns[i].ColumnName == "entryUser") ||
                            (obe.myDT.Columns[i].ColumnName == "entryDate") ||
                            (obe.myDT.Columns[i].ColumnName == "updateUser") ||
                            (obe.myDT.Columns[i].ColumnName == "updateDate") ||
                            (obe.myDT.Columns[i].ColumnName == "ts"))
                        {
                        }
                        else
                        {
                            if (cGridEX.RootTable.Columns.Count > i)
                            {
                            }
                            else
                            {
                                cGridEX.RootTable.Columns.Add();
                            }
                            cGridEX.RootTable.Columns[y].DataMember   = obe.myDT.Columns[i].ColumnName;
                            cGridEX.RootTable.Columns[y].Key          = obe.myDT.Columns[i].ColumnName;
                            cGridEX.RootTable.Columns[y].AutoSizeMode = ColumnAutoSizeMode.AllCellsAndHeader;

                            if (obe.myDT.Columns[i].DataType == System.Type.GetType("System.Boolean"))
                            {
                                cGridEX.RootTable.Columns[y].ColumnType = ColumnType.CheckBox;
                                cGridEX.RootTable.Columns[y].EditType   = EditType.CheckBox;
                            }
                            if (TblName == "AccountType")
                            {
                                switch (i)
                                {
                                case 1:
                                    cGridEX.RootTable.Columns[y].Caption = "Code";
                                    break;

                                case 2:
                                    cGridEX.RootTable.Columns[y].Caption = "Desc Eng";
                                    break;

                                case 3:
                                    cGridEX.RootTable.Columns[y].Caption = "Desc Fre";
                                    break;

                                default:
                                    cGridEX.RootTable.Columns[y].Caption = obe.myDT.Columns[i].ColumnName;
                                    break;
                                }
                            }
                            else
                            {
                                cGridEX.RootTable.Columns[y].Caption = obe.myDT.Columns[i].ColumnName;
                                if (obe.myDT.Columns[i].ColumnName == "WFBGColor")
                                {
                                    cGridEX.RootTable.Columns[y].Selectable = false;
                                    uiPanel2.Closed = false;
                                    cGridEX.RootTable.Columns.Add("BGColor");
                                }
                            }
                            y++;
                        }
                    }
                    cGridEX.RootTable.SortKeys.Add(cGridEX.RootTable.Columns[0], Janus.Windows.GridEX.SortOrder.Ascending);

                    if (cGridEX.RootTable.Columns.Contains("Obsolete"))
                    {
                        Janus.Windows.GridEX.GridEXFormatCondition gfc2 = new GridEXFormatCondition(cGridEX.RootTable.Columns["Obsolete"], ConditionOperator.Equal, true);
                        Janus.Windows.GridEX.GridEXFormatStyle     gfs2 = new GridEXFormatStyle();
                        gfs2.FontStrikeout = TriState.True;
                        gfc2.FormatStyle   = gfs2;
                        cGridEX.RootTable.FormatConditions.Add(gfc2);
                    }
                    if (cGridEX.RootTable.Columns.Contains("ReadOnly"))
                    {
                        Janus.Windows.GridEX.GridEXFormatCondition gfc = new GridEXFormatCondition(cGridEX.RootTable.Columns["ReadOnly"], ConditionOperator.Equal, true);
                        Janus.Windows.GridEX.GridEXFormatStyle     gfs = new GridEXFormatStyle();
                        gfs.BackColor   = Color.Gainsboro;
                        gfs.ForeColor   = SystemColors.ControlDarkDark;
                        gfc.FormatStyle = gfs;
                        cGridEX.RootTable.FormatConditions.Add(gfc);
                    }
                    cGridEX.AutoSizeColumns();
                }
            }
            catch (Exception x)
            {
                UIHelper.HandleUIException(x);
            }
        }