Example #1
0
        public void HienThi(DataGridViewX dGV,
                            BindingNavigator bN,
                            TextBoxX txtMaKH,
                            TextBoxX txtHoTen,
                            TextBoxX txtDiaChi,
                            TextBoxX txtSoDienThoai
                            )
        {
            BindingSource bS = new BindingSource();

            bS.DataSource = m_KhachHangData.LayKhachHang();

            txtMaKH.DataBindings.Clear();
            txtMaKH.DataBindings.Add("Text", bS, "MaKH");

            txtHoTen.DataBindings.Clear();
            txtHoTen.DataBindings.Add("Text", bS, "HoTen");

            txtDiaChi.DataBindings.Clear();
            txtDiaChi.DataBindings.Add("Text", bS, "DiaChi");

            txtSoDienThoai.DataBindings.Clear();
            txtSoDienThoai.DataBindings.Add("Text", bS, "DienThoai");

            bN.BindingSource = bS;
            dGV.DataSource   = bS;
        }
Example #2
0
        public frmPrintInvoice(DataGridViewX datagridviewX, NhanVienDTO nhanVienDTO,
                               string strTongTien, string strTongSo, string PathName, string MaSoPhieu)
        {
            InitializeComponent();

            TongTien           = strTongTien;
            TongSoLuong        = strTongSo.ToString();
            dataCTHoaDon       = (DataTable)(datagridviewX.DataSource);
            NhanVienHoaDon     = nhanVienDTO;
            lbSellerName.Text += " " + nhanVienDTO.StrHoTen;
            PathName           = PathName.ToString();
            soHoaDon           = MaSoPhieu.ToString();
            lbInvoiceNum.Text += " " + MaSoPhieu;

            string   timeNow = DateTime.Now.ToString("hh:mm:ss tt", System.Globalization.DateTimeFormatInfo.InvariantInfo);
            DateTime today   = DateTime.Today;

            Date.Text += today.ToShortDateString();
            Time.Text += timeNow;

            lbCompany.Text     = "SIÊU THỊ MINI FFARM";
            lbCompanyAddr.Text = "90 Vo Van Ngan - Thu Duc - Hcmc ";
            lbCompanyTel.Text  = "0123456789";
            lbBranchAddr.Text  = " ";
            lbBranchTel.Text   = " ";
        }
Example #3
0
        private string SelectedIdToStringForSql(DataGridViewX grd, string colXName, string colIDName)
        {
            if (grd == null)
            {
                return("-1");
            }

            string strDoctor = "-1";
            Int32  count     = 0;

            for (int i = 0; i < grd.Rows.Count; i++)
            {
                if (grd.Rows[i].Cells[colXName].Value.ToString() == "1")
                {
                    strDoctor += "," + Utility.Int32Dbnull(grd.Rows[i].Cells[colIDName].Value, -1);
                    count     += 1;
                }
            }
            if ((count == 0) || (count == grd.Rows.Count))
            {
                return("-1");
            }
            else
            {
                return(strDoctor);
            }
        }
Example #4
0
        private static void Grid_DataSourceChanged(object sender, EventArgs e)
        {
            DataGridViewX grid = sender as DataGridViewX;

            SetColoumns(grid);
            //grid?.AutoResizeColumns();
        }
Example #5
0
        public void HienThi(DataGridViewX dGV,
                            BindingNavigator bN,
                            TextBoxX txtSTT,
                            ComboBoxEx cmbNamHoc,
                            ComboBoxEx cmbLop,
                            ComboBoxEx cmbMonHoc,
                            ComboBoxEx cmbGiaoVien)
        {
            BindingSource bS = new BindingSource();

            bS.DataSource = m_PhanCongData.LayDsPhanCong();

            txtSTT.DataBindings.Clear();
            txtSTT.DataBindings.Add("Text", bS, "STT");

            cmbNamHoc.DataBindings.Clear();
            cmbNamHoc.DataBindings.Add("SelectedValue", bS, "MaNamHoc");

            cmbLop.DataBindings.Clear();
            cmbLop.DataBindings.Add("SelectedValue", bS, "MaLop");

            cmbMonHoc.DataBindings.Clear();
            cmbMonHoc.DataBindings.Add("SelectedValue", bS, "MaMonHoc");

            cmbGiaoVien.DataBindings.Clear();
            cmbGiaoVien.DataBindings.Add("SelectedValue", bS, "MaGiaoVien");

            bN.BindingSource = bS;
            dGV.DataSource   = bS;
        }
        public void HienThi(DataGridViewX dGV,
                            BindingNavigator bN,
                            DateTimeInput dtNgayCapNhat,
                            TextBoxX txtSoDuDauNgay,
                            TextBoxX txtSoPhatSinhNo,
                            TextBoxX txtSoPhatSinhCo,
                            ComboBoxEx cmbSoHieuTaiKhoan)
        {
            BindingSource bS = new BindingSource();

            bS.DataSource = m_TaiKhoanData.LayTaiKhoan();

            txtSoDuDauNgay.DataBindings.Clear();
            txtSoDuDauNgay.DataBindings.Add("Text", bS, "SoDuDauNgay");

            txtSoPhatSinhNo.DataBindings.Clear();
            txtSoPhatSinhNo.DataBindings.Add("Text", bS, "SoPhatSinhNo");

            txtSoPhatSinhCo.DataBindings.Clear();
            txtSoPhatSinhCo.DataBindings.Add("Text", bS, "SoPhatSinhCo");

            dtNgayCapNhat.DataBindings.Clear();
            dtNgayCapNhat.DataBindings.Add("Value", bS, "NgayCapNhat");

            cmbSoHieuTaiKhoan.DataBindings.Clear();
            cmbSoHieuTaiKhoan.DataBindings.Add("SelectedValue", bS, "SoHieuTaiKhoan");


            bN.BindingSource = bS;
            dGV.DataSource   = bS;
        }
Example #7
0
        public static void AdminSales()
        {
            var AdminDataSet = new DataSet(CurrentUser);
            var table        = AdminDataSet.Tables.Add("Managers");

            table.AddColumns("", "Managers", "Total Team Sales");
            foreach (var account in Accounts.AccountsList)
            {
                if (Accounts.IsAdmin(account.Key))
                {
                    continue;
                }
                var ManagerDataSet = new DataSet(account.Key);
                ManagerDataSet.LoadXML();
                if (ManagerDataSet.Tables.Count < 1)
                {
                    table.Rows.Add(account.Key, 0);
                    continue;
                }
                table.Rows.Add(account.Key, ManagerDataSet.GetAllSales());
            }
            var total = 0;

            foreach (DataRow row in table.Rows)
            {
                total += row["Total Team Sales"].ToInt();
            }
            SelectedForm.GetControl <LabelX>("StatusLabel").Text = $"Total Managers Sales: {total}";
            SalesView          = SelectedForm.GetControl <DataGridViewX>("SalesView");
            SalesView.ReadOnly = true;
            SalesView.AllowUserToDeleteRows = false;
            SalesView.DataSource            = AdminDataSet;
            SalesView.DataMember            = table.TableName;
        }
Example #8
0
        public void RaiseLlenaGrid(ref DataGridViewX unObjeto, string unModulo, short unId)
        {
            AsignacionPr proveedor = new AsignacionPr();

            unObjeto.DataSource = proveedor.ListaDetalle(unId, ref unModulo);
            proveedor           = null;
        }
Example #9
0
        public bool RaiseGrabar(ref DataGridViewX unObjeto, string unModulo, short unIdMaestra)
        {
            bool res = false;

            try
            {
                AsignacionPr proveedor = new AsignacionPr();
                switch (unModulo)
                {
                case "Perfil":
                    proveedor.GrabarPerfiles(unObjeto.DataSource, unIdMaestra);
                    break;

                case "Usuario":
                    proveedor.GrabarUsuarios(unObjeto.DataSource, unIdMaestra);
                    break;

                default:
                    break;
                }
                res = true;
            }
            catch (Exception ex)
            {
                res = false;
                General.Mensaje(ex.Message, MessageBoxIcon.Error);
            }
            return(res);
        }
Example #10
0
 public void DataBingding̣(DataGridViewX data, TextBoxX txt_ma, TextBoxX txt_ten, TextBoxX txt_giatri, TextBoxX txt_ghichu)
 {
     try
     {
         txt_ma.Text = data.CurrentRow.Cells[0].Value.ToString();
         if (data.CurrentRow.Cells[1].Value == null)
         {
             txt_ten.Text = String.Empty;
         }
         else
         {
             txt_ten.Text = data.CurrentRow.Cells[1].Value.ToString();
         }
         if (data.CurrentRow.Cells[2].Value == null)
         {
             txt_giatri.Text = String.Empty;
         }
         else
         {
             txt_giatri.Text = data.CurrentRow.Cells[2].Value.ToString();
         }
         if (data.CurrentRow.Cells[5].Value == null)
         {
             txt_ghichu.Text = String.Empty;
         }
         else
         {
             txt_ghichu.Text = data.CurrentRow.Cells[5].Value.ToString();
         }
     }
     catch (Exception e)
     {
         MessageBox.Show("Error");
     }
 }
Example #11
0
        public void HienThi(DataGridViewX dGV,
                            BindingNavigator bN,
                            TextBoxX txtMaNV,
                            TextBoxX txtHanmucthu,
                            TextBoxX txtHanmucchi,
                            TextBoxX txtMuctonquy
                            )
        {
            BindingSource bS = new BindingSource();

            bS.DataSource = m_GiaoDichVienData.GetGiaoDichVien();

            txtMaNV.DataBindings.Clear();//SelectedValue
            txtMaNV.DataBindings.Add("Text", bS, "MaNV");

            txtHanmucthu.DataBindings.Clear();
            txtHanmucthu.DataBindings.Add("Text", bS, "HanMucThu");

            txtHanmucchi.DataBindings.Clear();
            txtHanmucchi.DataBindings.Add("Text", bS, "HanMucChi");

            txtMuctonquy.DataBindings.Clear();
            txtMuctonquy.DataBindings.Add("Text", bS, "HanMucTonQuy");

            bN.BindingSource = bS;
            dGV.DataSource   = bS;
        }
Example #12
0
        public void HienThi(DataGridViewX dGV,
                            BindingNavigator bN,
                            TextBoxX txtMaGiaoVien,
                            TextBoxX txtTenGiaoVien,
                            TextBoxX txtDiaChi,
                            TextBoxX txtDienThoai,
                            ComboBoxEx cmbMonHoc)
        {
            BindingSource bS = new BindingSource();

            bS.DataSource = m_GiaoVienData.LayDsGiaoVien();

            txtMaGiaoVien.DataBindings.Clear();
            txtMaGiaoVien.DataBindings.Add("Text", bS, "MaGiaoVien");

            txtTenGiaoVien.DataBindings.Clear();
            txtTenGiaoVien.DataBindings.Add("Text", bS, "TenGiaoVien");

            txtDiaChi.DataBindings.Clear();
            txtDiaChi.DataBindings.Add("Text", bS, "DiaChi");

            txtDienThoai.DataBindings.Clear();
            txtDienThoai.DataBindings.Add("Text", bS, "DienThoai");

            cmbMonHoc.DataBindings.Clear();
            cmbMonHoc.DataBindings.Add("SelectedValue", bS, "MaMonHoc");

            bN.BindingSource = bS;
            dGV.DataSource   = bS;
        }
        public void HienThi(DataGridViewX dGV)
        {
            BindingSource bS = new BindingSource();

            bS.DataSource  = m_LoaiNguoiDungData.LayDsLoaiNguoiDung();
            dGV.DataSource = bS;
        }
Example #14
0
        public void HienThi(DataGridViewX dGV,
                            BindingNavigator bN,
                            TextBoxX txtMaNV,
                            TextBoxX txtHoTen,
                            DateTimeInput dtNgaySinh,
                            TextBoxX txtDiaChi,
                            TextBoxX txtSoDienThoai,
                            ComboBoxEx cmbQuayGiaoDich)
        {
            BindingSource bS = new BindingSource();

            bS.DataSource = m_NhanVienData.LayNhanVien();

            txtMaNV.DataBindings.Clear();
            txtMaNV.DataBindings.Add("Text", bS, "MaNV");

            txtHoTen.DataBindings.Clear();
            txtHoTen.DataBindings.Add("Text", bS, "HoTenNV");

            txtSoDienThoai.DataBindings.Clear();
            txtSoDienThoai.DataBindings.Add("Text", bS, "DienThoai");

            dtNgaySinh.DataBindings.Clear();
            dtNgaySinh.DataBindings.Add("Value", bS, "NgaySinh");

            txtDiaChi.DataBindings.Clear();
            txtDiaChi.DataBindings.Add("Text", bS, "DiaChi");

            cmbQuayGiaoDich.DataBindings.Clear();
            cmbQuayGiaoDich.DataBindings.Add("SelectedValue", bS, "MaQuayGiaoDich");


            bN.BindingSource = bS;
            dGV.DataSource   = bS;
        }
Example #15
0
        public static void FillGrid(ref DataGridViewX GridView, EathenaConfigFile File, bool PrintComments)
        {
            GridView.Rows.Clear();
            int n = 0;

            for (int i = 0; i < File.Configs.Count; i++)
            {
                if (PrintComments == true)
                {
                    for (int c = 0; c < File.Configs[i].Comments.Length; c++)
                    {
                        n = GridView.Rows.Add();
                        GridView.Rows[n].Tag                        = i;    // save the "real" index
                        GridView.Rows[n].Cells[0].Value             = "// " + File.Configs[i].Comments[c];
                        GridView.Rows[n].Cells[0].ReadOnly          = true;
                        GridView.Rows[n].DefaultCellStyle.ForeColor = Color.DarkGreen;
                    }
                }

                n = GridView.Rows.Add();
                GridView.Rows[n].Tag                        = i; // save the "real" index
                GridView.Rows[n].Cells[0].Value             = File.Configs[i].Name;
                GridView.Rows[n].Cells[1].Value             = File.Configs[i].Value;
                GridView.Rows[n].DefaultCellStyle.ForeColor = Color.DarkBlue;
                GridView.Rows[n].DefaultCellStyle.Font      = new Font("Tahoma", 8.0f, FontStyle.Bold);

                GridView.Rows[n].Cells[0].ReadOnly = true;
            }
        }
Example #16
0
        public void HienThi(DataGridViewX dGV,
                            BindingNavigator bN,
                            TextBoxX txtMaNhanVien,
                            TextBoxX txtTenNhanVien,
                            TextBoxX txtGioiTinh,
                            RadioButton opbNam,
                            RadioButton opbNu,
                            DateTimeInput dtpNgaySinh,

                            ComboBoxEx cmbChucVu)
        {
            BindingSource bS = new BindingSource();

            bS.DataSource = m_NhanVienData.LayDsNhanVien();

            txtMaNhanVien.DataBindings.Clear();
            txtMaNhanVien.DataBindings.Add("Text", bS, "MaNhanVien");

            txtTenNhanVien.DataBindings.Clear();
            txtTenNhanVien.DataBindings.Add("Text", bS, "TenNhanVien");

            dtpNgaySinh.DataBindings.Clear();
            dtpNgaySinh.DataBindings.Add("Value", bS, "NgaySinh");

            txtGioiTinh.DataBindings.Clear();
            txtGioiTinh.DataBindings.Add("Text", bS, "GioiTinh");


            cmbChucVu.DataBindings.Clear();
            cmbChucVu.DataBindings.Add("SelectedValue", bS, "MaChucVu");

            bN.BindingSource = bS;
            dGV.DataSource   = bS;
        }
        public void Sua(ref DataGridViewX dgvChucVu, ref TextBoxX txtMaChucVuQDNV, ref TextBoxX txtTenChucVuQDNV, QDChucVuNhanVienBUS cvnvBUS)
        {
            if (string.IsNullOrEmpty(txtMaChucVuQDNV.Text) == false || string.IsNullOrEmpty(txtTenChucVuQDNV.Text) == false)
            {
                QDChucVuNhanVienDTO cvnvDTO = new QDChucVuNhanVienDTO();
                cvnvBUS.MapDataCVNVFromGUICVNV(ref cvnvDTO, txtMaChucVuQDNV, txtTenChucVuQDNV);
                if (cvnvBUS.IsTrungKhopKhoaChinh(cvnvDTO.Macv, dgvChucVu))
                {
                    MessageBox.Show("Trùng khớp mã chức vụ", "", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    return;
                }

                if (cvnvBUS.Sua(cvnvDTO))
                {
                    MessageBox.Show("Cập nhật thành công");
                    cvnvBUS.LoadPanelCVNV(ref dgvChucVu, ref txtMaChucVuQDNV, ref txtTenChucVuQDNV, cvnvBUS);
                }

                else
                {
                    MessageBox.Show("Cập nhật không thành công", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Dữ liệu không đầy đủ", "Asterrisk", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }
        public void Them(ref DataGridViewX dgvQDPM, ref TextBoxX txtMaQDPM, ref TextBoxX txtQDPMSoSachMax, ref TextBoxX txtQDPMSoNgayMuonMax, QuyDinhPhieuMuonBUS qdpmBUS)
        {
            QuyDinhPhieuMuonDTO qdpmDTO = new QuyDinhPhieuMuonDTO();

            if (!qdpmBUS.MapDataQDPMFromGUIQDPM(ref qdpmDTO, txtMaQDPM, txtQDPMSoSachMax, txtQDPMSoNgayMuonMax, qdpmBUS))
            {
                MessageBox.Show("Dữ liệu không hợp lệ", "", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }
            if (qdpmBUS.IsTrungKhopKhoaChinh(qdpmDTO.Maqd.ToString(), dgvQDPM))
            {
                MessageBox.Show("Trùng mã quy định phiếu mượn", "", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }
            if (dgvQDPM.RowCount != 0)
            {
                QuyDinhPhieuMuonDTO temp = new QuyDinhPhieuMuonDTO();
                qdpmBUS.UpdatePreviousDataRowQDPM(ref temp, dgvQDPM);
                qdpmBUS.Sua(temp);
                qdpmDTO.Ngayra = qdpmDTO.Ngayra.AddDays(1);
            }

            if (qdpmBUS.Them(qdpmDTO))
            {
                MessageBox.Show("Thêm thành công");
                qdpmBUS.LoadTabQDPM(ref dgvQDPM, ref txtMaQDPM, ref txtQDPMSoSachMax, ref txtQDPMSoNgayMuonMax, qdpmBUS);
            }
            else
            {
                MessageBox.Show("Thêm không thành công", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #19
0
        public void Sua(ref DataGridViewX dgvLoaiSach, ref TextBoxX txtMaLoaiSachQDS, ref TextBoxX txtTenLoaiSachQDS, QDLoaiSachBUS lsBUS)
        {
            if (string.IsNullOrEmpty(txtMaLoaiSachQDS.Text) == false || string.IsNullOrEmpty(txtTenLoaiSachQDS.Text) == false)
            {
                QDLoaiSachDTO lsDTO = new QDLoaiSachDTO();
                lsBUS.MapDataLSFromGUILoaiSach(ref lsDTO, txtMaLoaiSachQDS, txtTenLoaiSachQDS);
                if (lsBUS.IsTrungKhopKhoaChinh(lsDTO.Matheloai, dgvLoaiSach))
                {
                    MessageBox.Show("Trùng mã quy định sách", "", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    return;
                }

                if (lsBUS.Sua(lsDTO))
                {
                    MessageBox.Show("Cập nhật thành công");
                    lsBUS.LoadPanelLoaiSach(ref dgvLoaiSach, ref txtMaLoaiSachQDS, ref txtTenLoaiSachQDS, lsBUS);
                }

                else
                {
                    MessageBox.Show("Cập nhật không thành công", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Dữ liệu không đầy đủ", "Asterrisk", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }
Example #20
0
 //比较数据
 public static bool JudgeIsnotMofidy(DataTable aftersave_dt, DataGridViewX dgd)
 {
     try
     {
         DataTable Judge_dt = ((DataTable)dgd.DataSource).Copy();
         if (aftersave_dt != null && aftersave_dt.Rows.Count == Judge_dt.Rows.Count)
         {
             for (int i = 0; i < aftersave_dt.Rows.Count; i++)
             {
                 for (int j = 0; j < aftersave_dt.Columns.Count; j++)
                 {
                     if (aftersave_dt.Rows[i][j] != Judge_dt.Rows[i][j])
                     {
                         return(false);
                     }
                     continue;
                 }
             }
         }
         else
         {
             return(false);
         }
         return(true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #21
0
        public static void SetSalesDataSet(string currentUser, MetroForm tempForm)
        {
            ResetSalesData();
            SelectedForm = tempForm;
            CurrentUser  = currentUser;
            if (Accounts.IsAdmin(CurrentUser) || currentUser == "")
            {
                CurrentAdmin = CurrentUser;
                AdminSales();
                return;
            }

            SalesView = SelectedForm.GetControl <DataGridViewX>("SalesView");
            SalesView.AllowUserToDeleteRows = true;
            SalesCalendar = SelectedForm.GetControl <MonthCalendarAdv>("SalesCalendar");
            SalesCalendar.SelectionStart = DateTime.Now;
            SalesCalendar.SelectionEnd   = DateTime.Now;
            SalesCalendar.MarkedDates    = null;
            SalesCalendar.UpdateMarkedDates();
            InitializeSalesData();

            SelectedForm.GetControl <LabelX>("TotalTeamSales").Text = $"Total Team Sales: {SalesDataSet.GetAllSales()}";

            InitializeEvents();
        }
Example #22
0
 //暂测试保存功能
 public static void Deal_DifDgdValue(string FormName, DataTable aftersave_dt, DataGridViewX dgd, string descrip_str)
 {
     try
     {
         DataTable Judge_dt = ((DataTable)dgd.DataSource).Copy();
         if (aftersave_dt != null && aftersave_dt.Rows.Count == Judge_dt.Rows.Count)
         {
             for (int i = 0; i < aftersave_dt.Rows.Count; i++)
             {
                 for (int j = 0; j < aftersave_dt.Columns.Count; j++)
                 {
                     if (aftersave_dt.Rows[i][j] != Judge_dt.Rows[i][j])
                     {
                         Log4netHelper.Info(new DgdDealHelper().GetType(), string.Format("编辑表:{0}-{1},编辑项:{2},原值:{3},变化值:{4},修改者:{5}", FormName, descrip_str, Judge_dt.Rows[i][0], aftersave_dt.Rows[i][j], Judge_dt.Rows[i][j], Constant.CurUserName()));
                         SQliteHelper.ExecuteDataTable(Constant.strConnectSQLite, CommandType.Text, string.Format("insert into {0} (tablename,tableitem,oldvalue,newvalue,modifiedby,modifieddate,descrip)values('{1}','{2}','{3}','{4}','{5}','{6}','{7}')", Constant.RecordLog_sqlname, FormName, Judge_dt.Rows[i][0], aftersave_dt.Rows[i][j], Judge_dt.Rows[i][j], Constant.CurUserName(), DateTime.Now, descrip_str), null);
                     }
                     continue;
                 }
             }
         }
         else
         {
             Log4netHelper.Warn(new DgdDealHelper().GetType(), string.Format("检查编辑表:{0}时发生错误,修改前后行数不一致,修改者:{1}", FormName, Constant.CurUserName()));
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #23
0
 static void SetGridStyle(DataGridViewX grid)
 {
     grid.DataSourceChanged    += Grid_DataSourceChanged;
     grid.AllowUserToAddRows    = false;
     grid.AllowUserToDeleteRows = false;
     grid.ReadOnly                                = true;
     grid.RowHeadersVisible                       = false;
     grid.EnableHeadersVisualStyles               = false;
     grid.HighlightSelectedColumnHeaders          = false;
     grid.ColumnHeadersDefaultCellStyle.Font      = captionFont;
     grid.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
     grid.DefaultCellStyle                        = DataCellStyle;
     grid.AlternatingRowsDefaultCellStyle         = AlternatingRowsDefaultCellStyle;
     grid.AllowUserToResizeColumns                = false;
     grid.AllowUserToResizeRows                   = false;
     grid.AutoSizeColumnsMode                     = DataGridViewAutoSizeColumnsMode.AllCells;
     grid.ColumnHeadersHeightSizeMode             = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
     grid.RowsDefaultCellStyle.SelectionBackColor = selectedBackColor;
     //grid.Paint += Grid_Paint;
     grid.SelectionMode       = DataGridViewSelectionMode.FullRowSelect;
     grid.RowTemplate.Height  = rowHeight;
     grid.ColumnHeadersHeight = headRowHeight;
     grid.BackgroundColor     = Color.White;
     if (GlobalManager.Renderer is Office2007Renderer)
     {
         (((Office2007Renderer)GlobalManager.Renderer).ColorTable).ButtonItemColors[0].Checked.Background = new LinearGradientColorTable(Color.FromArgb(200, selectedBackColor), Color.FromArgb(200, selectedBackColor));
     }
 }
Example #24
0
        //部分复制
        public static bool SetClipboardToDataGridVIew(ref DataGridViewX dgd)
        {
            try
            {
                //当前单元格是否选择的判断
                if (dgd.CurrentCell == null)
                {
                    return(false);
                }
                int insertRowIndex = dgd.CurrentCell.RowIndex;
                if (dgd.CurrentCell.ColumnIndex != 1)
                {
                    MessageBox.Show("当前列数不允许粘贴,请重新检查", "错误!");//整表复制时,不考虑
                    return(false);
                }
                // 获取剪切板的内容,并按行分割
                string pasteText = Clipboard.GetText();

                if (string.IsNullOrEmpty(pasteText))
                {
                    return(false);
                }
                string[] lines = pasteText.Split('\n');
                if (lines.Length - 1 > dgd.Rows.Count)
                {
                    MessageBox.Show("当前复制的数据超过编辑表行数上限,请重新检查", "错误!");//整表复制时,不考虑
                    return(false);
                }
                foreach (string line in lines)
                {
                    // 按 Tab 分割数据
                    if (string.IsNullOrEmpty(line.Trim()))
                    {
                        continue;
                    }
                    string[] vals = line.Split(new char[] { '\t' });
                    if (vals.Length > 1)
                    {
                        MessageBox.Show("当前复制的数据列数超过一列", "错误!");//整表复制时,不考虑
                        return(false);
                    }
                    DataGridViewRow row = dgd.Rows[insertRowIndex];

                    int insertColumnsIndex = dgd.CurrentCell.ColumnIndex;
                    for (int i = 0; i < vals.Length; i++)
                    {
                        //- ; : not allowed
                        row.Cells[insertColumnsIndex].Value = vals[i].Replace("&", "").Replace(":", "").Replace(";", "").Replace("\n", "").Replace("\t", "").Replace("\r", "");
                        insertColumnsIndex++;
                    }
                    // DataGridView的行索引+1
                    insertRowIndex++;
                }
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public void HienThi(DataGridViewX dGV,
                            BindingNavigator bN,
                            TextBoxX txtMaLop,
                            TextBoxX txtTenLop,
                            ComboBoxEx cmbKhoiLop,
                            ComboBoxEx cmbNamHoc,
                            IntegerInput iniSiSo,
                            ComboBoxEx cmbGiaoVien)
        {
            BindingSource bS = new BindingSource();

            bS.DataSource = m_LopData.LayDsLop();

            bN.BindingSource = bS;
            dGV.DataSource   = bS;

            txtMaLop.DataBindings.Clear();
            txtMaLop.DataBindings.Add("Text", bS, "MaLop");

            txtTenLop.DataBindings.Clear();
            txtTenLop.DataBindings.Add("Text", bS, "TenLop");

            cmbKhoiLop.DataBindings.Clear();
            cmbKhoiLop.DataBindings.Add("SelectedValue", bS, "MaKhoiLop");

            cmbNamHoc.DataBindings.Clear();
            cmbNamHoc.DataBindings.Add("SelectedValue", bS, "MaNamHoc");

            iniSiSo.DataBindings.Clear();
            iniSiSo.DataBindings.Add("Text", bS, "SiSo");

            cmbGiaoVien.DataBindings.Clear();
            cmbGiaoVien.DataBindings.Add("SelectedValue", bS, "MaGiaoVien");
        }
Example #26
0
        public void Them(ref DataGridViewX dgvQDS, ref TextBoxX txtMaQDS, ref TextBoxX txtQDThoiHanSach, QuyDinhSachBUS qdsBUS)
        {
            QuyDinhSachDTO qdsDTO = new QuyDinhSachDTO();

            if (!qdsBUS.MapDataQDSFromGUI(ref qdsDTO, txtMaQDS, txtQDThoiHanSach, qdsBUS))
            {
                MessageBox.Show("Dữ liệu không hợp lệ", "", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }
            if (qdsBUS.IsTrungKhopKhoaChinh(qdsDTO.Maqd, dgvQDS))
            {
                MessageBox.Show("Trùng mã quy định sách", "", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }
            if (dgvQDS.RowCount != 0)
            {
                QuyDinhSachDTO temp = new QuyDinhSachDTO();
                qdsBUS.UpdatePreviousDataRowQDS(ref temp, dgvQDS);
                qdsBUS.Sua(temp);
                qdsDTO.Ngayra = qdsDTO.Ngayra.AddDays(1);
            }

            if (qdsBUS.Them(qdsDTO))
            {
                MessageBox.Show("Thêm thành công");
                qdsBUS.LoadPanelQDS(ref dgvQDS, ref txtMaQDS, ref txtQDThoiHanSach, qdsBUS);
            }
            else
            {
                MessageBox.Show("Thêm không thành công", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public void HienThi(DataGridViewX dGV,
                            BindingNavigator bN,
                            TextBoxX txtSoGiaoDich,
                            TextBoxX txtSoButToan,
                            ComboBoxEx cmbSoHieuCo,
                            ComboBoxEx cmbSoHieuNo,
                            TextBoxX txtSoTien)
        {
            BindingSource bS = new BindingSource();

            bS.DataSource = m_ChiTietPhatSinhGDData.LayChiTietPhatSinhGD();

            txtSoGiaoDich.DataBindings.Clear();
            txtSoGiaoDich.DataBindings.Add("Text", bS, "SoGiaoDich");

            txtSoButToan.DataBindings.Clear();
            txtSoButToan.DataBindings.Add("Text", bS, "SoButToan");

            cmbSoHieuCo.DataBindings.Clear();
            cmbSoHieuCo.DataBindings.Add("SelectedValue", bS, "SoHieuTaiKhoanCo");

            cmbSoHieuNo.DataBindings.Clear();
            cmbSoHieuNo.DataBindings.Add("SelectedValue", bS, "SoHieuTaiKhoanNo");

            txtSoTien.DataBindings.Clear();
            txtSoTien.DataBindings.Add("Text", bS, "SoTien");


            bN.BindingSource = bS;
            dGV.DataSource   = bS;
        }
Example #28
0
 public void TrasladarSelecion(DataGridViewX dOutput, DataGridViewX dInput)
 {
     if (dOutput.SelectedRows.Count >= 1)
     {
         try
         {
             int m = dOutput.SelectedRows.Count;
             for (int i = 0; i < m; i++)
             {
                 dInput.Rows.Add(
                     dOutput.SelectedRows[0].Cells[0].Value, dOutput.SelectedRows[0].Cells[1].Value,
                     dOutput.SelectedRows[0].Cells[2].Value, dOutput.SelectedRows[0].Cells[3].Value,
                     dOutput.SelectedRows[0].Cells[4].Value, dOutput.SelectedRows[0].Cells[5].Value,
                     dOutput.SelectedRows[0].Cells[6].Value, dOutput.SelectedRows[0].Cells[7].Value,
                     dOutput.SelectedRows[0].Cells[8].Value, dOutput.SelectedRows[0].Cells[9].Value,
                     dOutput.SelectedRows[0].Cells[10].Value, dOutput.SelectedRows[0].Cells[11].Value,
                     dOutput.SelectedRows[0].Cells[12].Value, dOutput.SelectedRows[0].Cells[13].Value,
                     dOutput.SelectedRows[0].Cells[14].Value, dOutput.SelectedRows[0].Cells[15].Value,
                     dOutput.SelectedRows[0].Cells[16].Value, dOutput.SelectedRows[0].Cells[17].Value
                     , dOutput.SelectedRows[0].Cells[18].Value);
                 dOutput.Rows.Remove(dOutput.SelectedRows[0]);
             }
         }
         catch (Exception ex) { MessageBox.Show(ex.ToString()); }
     }
     else if (dOutput.SelectedCells.Count >= 1)
     {
         TrasladarSelecionCelda(dOutput, dInput);
     }
     else
     {
         MessageBox.Show("Selección Incorrecta", "CleanServices");
     }
 }
Example #29
0
        private int SelectedIdToStringForSqlV2(DataGridViewX grd, string colXName, string colIDName)
        {
            if (grd == null)
            {
                return(Convert.ToInt32("-1"));
            }

            int   strDoctor = 0;
            Int32 count     = 0;

            for (int i = 0; i < grd.Rows.Count; i++)
            {
                if (grd.Rows[i].Cells[colXName].Value.ToString() == "1")
                {
                    strDoctor += Utility.Int32Dbnull(grd.Rows[i].Cells[colIDName].Value, -1);
                    count     += 1;
                }
            }
            if ((count == 0) || (count == grd.Rows.Count))
            {
                return(Convert.ToInt32("-1"));
            }
            return(Convert.ToInt32(strDoctor));
            // else return Convert.ToInt32(strDoctor.ToString());
        }
Example #30
0
        public void HienThi(DataGridViewX dGV,
                            BindingNavigator bN,
                            TextBoxX txtMaHocSinh,
                            TextBoxX txtTenHocSinh,
                            TextBoxX txtGioiTinh,
                            DateTimeInput dtpNgaySinh,
                            TextBoxX txtNoiSinh
                            )
        {
            BindingSource bS = new BindingSource();

            bS.DataSource = m_HocSinhData.LayDsHocSinh();

            txtMaHocSinh.DataBindings.Clear();

            txtTenHocSinh.DataBindings.Clear();

            txtGioiTinh.DataBindings.Clear();

            dtpNgaySinh.DataBindings.Clear();

            txtNoiSinh.DataBindings.Clear();

            bN.BindingSource = bS;
            dGV.DataSource   = bS;
        }