private void LoadTable()
        {
            // Đoạn này quan trọng. Đăng nhập bằng user nào => connectionString tương ứng
            this.taPX.Connection.ConnectionString                     =
                this.taDSNV.Connection.ConnectionString               =
                    this.taCTPX.Connection.ConnectionString           =
                        this.taDSKHO.Connection.ConnectionString      =
                            this.taDSVTCH.Connection.ConnectionString =
                                UtilDB.ConnectionString;
            try
            {
                this.dataSet.EnforceConstraints = false;

                this.taPX.Fill(this.dataSet.PhieuXuat);

                this.taCTPX.Fill(this.dataSet.CTPX);

                this.taDSNV.Fill(this.dataSet.DSNV);

                this.taDSKHO.Fill(this.dataSet.DSKHO);

                this.taDSVTCH.Fill(this.dataSet.DSVTCONHANG);

                //this.dataSet.EnforceConstraints = true;
            }
            catch (Exception ex)
            {
                UtilDB.ShowError(ex);
            }
        }
        private async void btnSwitch_Click(object sender, EventArgs e)
        {
            if (UtilDB.CurrentDeployment == cboDepartment.SelectedIndex)
            {
                XtraMessageBox.Show(Cons.ErrorSwitchDepartToCurrent, Cons.CaptionError,
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            int    oldEmployeeId = int.Parse(txtEmployeeId.Text);
            string newDepartId   = UtilDB.GetDepartIdInFilterClause(cboDepartment.SelectedValue.ToString());

            SplashScreenManager.ShowForm(null, typeof(WaitFormCustom), true, true, false);
            if (await SwitchDepartment(oldEmployeeId, newDepartId) == false)
            {
                SplashScreenManager.CloseForm(false);
                XtraMessageBox.Show(Cons.ErrorSwitchDepart, Cons.CaptionError,
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                SplashScreenManager.CloseForm(false);
                XtraMessageBox.Show(Cons.SuccessSwitchDepart, Cons.CaptionSuccess,
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #3
0
        private async void DeleteDepot()
        {
            _currentPosition = bdsDepot.Position;

            string ten    = ((DataRowView)bdsDepot[_currentPosition])["TENKHO"].ToString();
            var    result = XtraMessageBox.Show(string.Format(Cons.AskDeleteDepot, ten), Cons.CaptionWarning,
                                                MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (result == DialogResult.Yes)
            {
                try
                {
                    // lưu lại data trước khi xóa
                    _userDo.Push(new ButtonAction(ButtonActionType.Delete, ((DataRowView)bdsDepot[_currentPosition]).Row.ItemArray));

                    //bdsDepot.RemoveCurrent();
                    //this.taDepot.Update(this.dataSet.Kho);
                    if (await UtilDB.DeleteInDB("Kho", "MAKHO", txtDepotId.EditValue))
                    {
                        this.dataSet.EnforceConstraints = false;
                        this.taDepot.Fill(this.dataSet.Kho);
                    }
                }
                catch (Exception ex)
                {
                    UtilDB.ShowError(ex);
                }
            }
        }
Пример #4
0
        private bool SaveDepot()
        {
            try
            {
                if (_buttonAction == ButtonActionType.Add &&
                    IsExistDepot(txtDepotId.EditValue.ToString()))
                {
                    XtraMessageBox.Show(Cons.ErrorDuplicateDeportId, Cons.CaptionWarning,
                                        MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtDepotId.Focus();
                    txtDepotId.SelectAll();
                    return(false);
                }

                bdsDepot.EndEdit();
                this.taDepot.Update(this.dataSet.Kho);
                gbDepot.Enabled = false;
                bdsDepot.ResetCurrentItem();
                DisableEditMode();
                if (_buttonAction == ButtonActionType.Add)
                {
                    // Lưu vô stack trạng thái nút nhấn và data bị thay đổi
                    _userDo.Push(new ButtonAction(_buttonAction, ((DataRowView)bdsDepot[bdsDepot.Position]).Row.ItemArray));
                }
                _buttonAction     = ButtonActionType.None;
                bdsDepot.Position = _currentPosition;
            }
            catch (Exception ex)
            {
                UtilDB.ShowError(ex);
                return(false);
            }

            return(true);
        }
Пример #5
0
        public Xrpt_ReportHDNV(string tenCN, string tenNV, int maNV, string loaiPhieu, string beginDay, string endDay)
        {
            InitializeComponent();

            //lblTenNV.Text = tenNV;
            //lblDate.Text = DateTime.Now.ToString("dddd, dd MMMM yyyy", Cons.CiVNI);

            this.taReport_HDNV.Connection.ConnectionString = UtilDB.ConnectionString;
            try
            {
                this.dataSetReport.EnforceConstraints = false;

                this.taReport_HDNV.Fill(this.dataSetReport.Report_HDNV, maNV, loaiPhieu, beginDay, endDay);
            }
            catch (Exception ex)
            {
                UtilDB.ShowError(ex);
            }

            var bds = UtilDB.BdsDSPM;

            //lblCN.Text = tenCN;
            //lblNhanVienLap.Text = UtilDB.CurrentFullName;
            //lblFromTo.Text = string.Format("TỪ {0} ĐẾN {1}", DateTime.Parse(beginDay, null).ToString("dd/MM/yyyy"), DateTime.Parse(endDay, null).ToString("dd/MM/yyyy"));
        }
Пример #6
0
        private bool IsExistDepot(string depotId)
        {
            bool   exist   = true;
            string strLenh = string.Format(MyConfig.ExecSPTimKho, depotId);

            using (SqlConnection connection = new SqlConnection(UtilDB.ConnectionString))
            {
                connection.Open();
                using (SqlCommand sqlcmd = new SqlCommand(strLenh, connection))
                {
                    sqlcmd.CommandType = CommandType.Text;
                    try
                    {
                        sqlcmd.ExecuteNonQuery();
                    }
                    catch (SqlException ex)
                    {
                        if (ex.Number == MyConfig.ErrorMsgNumNotExistObject)
                        {
                            exist = false;
                        }
                    }
                    catch (Exception ex)
                    {
                        UtilDB.ShowError(ex);
                    }
                }
            }
            return(exist);
        }
Пример #7
0
        private bool IsExistMaterial(string materialId)
        {
            string strLenh = string.Format(MyConfig.ExecSPTimVatTu, materialId);
            bool   exist   = true;

            using (SqlConnection connection = new SqlConnection(UtilDB.ConnectionString))
            {
                connection.Open();
                SqlCommand sqlcmd = new SqlCommand(strLenh, connection);
                sqlcmd.CommandType = CommandType.Text;
                try
                {
                    SqlDataReader myreader = sqlcmd.ExecuteReader();
                }
                catch (SqlException ex)
                {
                    if (ex.Number == MyConfig.ErrorMsgNumNotExistObject)
                    {
                        exist = false;
                    }
                }
                catch (Exception ex)
                {
                    UtilDB.ShowError(ex);
                }
            }
            return(exist);
        }
Пример #8
0
        private void LoadTable()
        {
            // Đoạn này quan trọng. Đăng nhập bằng user nào => connectionString tương ứng
            this.taVT.Connection.ConnectionString               =
                this.taCTDDH.Connection.ConnectionString        =
                    this.taCTPN.Connection.ConnectionString     =
                        this.taCTPX.Connection.ConnectionString =
                            UtilDB.ConnectionString;

            try
            {
                this.dataSet.EnforceConstraints = false;

                this.taVT.Fill(this.dataSet.Vattu);

                this.taCTDDH.Fill(this.dataSet.CTDDH);

                this.taCTPX.Fill(this.dataSet.CTPX);

                this.taCTPN.Fill(this.dataSet.CTPN);

                //this.dataSet.EnforceConstraints = true;
            }
            catch (Exception ex)
            {
                UtilDB.ShowError(ex);
            }
        }
Пример #9
0
        private bool IsExistGoodsReceivedNote(string id)
        {
            bool exist = true;

            using (SqlConnection connection = new SqlConnection(UtilDB.ConnectionString))
            {
                connection.Open();
                using (SqlCommand sqlcmd = new SqlCommand(MyConfig.ExecSPTimPhieuNhap, connection))
                {
                    sqlcmd.CommandType = CommandType.StoredProcedure;
                    sqlcmd.Parameters.AddWithValue("@mapn", id);

                    try
                    {
                        sqlcmd.ExecuteNonQuery();
                    }
                    catch (SqlException ex)
                    {
                        if (ex.Number == MyConfig.ErrorMsgNumNotExistObject)
                        {
                            exist = false;
                        }
                    }
                    catch (Exception ex)
                    {
                        UtilDB.ShowError(ex);
                    }
                }
            }
            return(exist);
        }
Пример #10
0
        private void SilenceBackup(object source, ElapsedEventArgs e)
        {
            List <string> credentials    = UtilVarios.GetCredentialsDB();
            string        server         = credentials[0];
            string        user           = credentials[1];
            string        database       = credentials[2];
            string        pass           = credentials[3];
            DataTable     tbl            = BL.GetDataBLL.RazonSocial();
            string        fileSilenceBck = @"c:\windows\temp\" + tbl.Rows[0][0].ToString() + "_bck.sql";
            string        remoteFile     = tbl.Rows[0][0].ToString() + "_bck.sql.xz";

            UtilDB.DumpDB(server, 3306, user, pass, database, fileSilenceBck);
            if (File.Exists(fileSilenceBck + ".xz"))
            {
                File.Delete(fileSilenceBck + ".xz");
            }
            UtilDB.ZipDB(fileSilenceBck);
            MemoryStream ms = new MemoryStream();

            using (FileStream fs = File.OpenRead(fileSilenceBck + ".xz"))
            {
                fs.CopyTo(ms);
            }
            try
            {
                BL.UtilFTP.UploadFromMemoryStream(ms, remoteFile, "trendsistemas");
            }
            catch (WebException)
            {
                return;
            }
        }
Пример #11
0
        /// <summary>
        /// Kiểm tra username và mật khẩu có connect được với server
        /// Lưu lại username và mật khẩu vào UtilDB
        /// </summary>
        /// <returns>true nếu connect thành công</returns>
        private bool IsLogin()
        {
            UtilDB.CurrentLogin    = txtTK.Text;
            UtilDB.CurrentPassword = txtMK.Text;

            return(UtilDB.Connect());
        }
Пример #12
0
        private void frmLogin_Load(object sender, EventArgs e)
        {
            string cnnStr = $"Data Source={MyConfig.RootServerName};" +
                            $"Initial Catalog={MyConfig.DatabaseName};" +
                            $"Integrated Security=True";

            try
            {
                UtilDB.BdsDSPM.DataSource = UtilDB.ExecSqlDataTable($"SELECT * FROM {MyConfig.ViewDSPMName}  ORDER BY {MyConfig.DisplayMemberDSPM}", cnnStr);
                if (UtilDB.BdsDSPM.DataSource == null)
                {
                    Close();
                    return;
                }

                cboChiNhanh.DataSource    = UtilDB.BdsDSPM;
                cboChiNhanh.DisplayMember = MyConfig.DisplayMemberDSPM;
                cboChiNhanh.ValueMember   = MyConfig.ValueMemberDSPM;

                cboChiNhanh.SelectedIndex = -1;
                cboChiNhanh.SelectedIndex = 0;
            }
            catch (SqlException ex)
            {
                UtilDB.ShowError(ex);
            }
            txtTK.Select();
        }
Пример #13
0
        private bool RemoveLogin(string employeeId)
        {
            bool   isSuccess = false;
            string strLenh   = string.Format(MyConfig.ExecSPXoaLogin, employeeId);

            using (SqlConnection connection = new SqlConnection(UtilDB.ConnectionString))
            {
                connection.Open();
                using (SqlCommand sqlcmd = new SqlCommand(strLenh, connection))
                {
                    sqlcmd.CommandType = CommandType.Text;
                    try
                    {
                        sqlcmd.ExecuteNonQuery();
                        isSuccess = true;
                    }
                    catch (SqlException ex)
                    {
                        if (ex.Number == MyConfig.ErrorMsgNumNotExistObject)
                        {
                            isSuccess = true;
                        }
                    }
                    catch (Exception ex)
                    {
                        UtilDB.ShowError(ex);
                    }
                }
            }
            return(isSuccess);
        }
Пример #14
0
        private bool chechInStockMaterials(string maPhieu, string maVattu, int quantity)
        {
            bool   exist   = true;
            string strLenh = string.Format(MyConfig.ExecSPCheckInStockMaterial, maPhieu, maVattu, quantity);

            using (SqlConnection connection = new SqlConnection(UtilDB.ConnectionString))
            {
                connection.Open();
                using (SqlCommand sqlcmd = new SqlCommand(strLenh, connection))
                {
                    sqlcmd.CommandType = CommandType.Text;
                    try
                    {
                        sqlcmd.ExecuteNonQuery();
                    }
                    catch (SqlException ex)
                    {
                        if (ex.Number == MyConfig.ErrorMsgNumNotExistObject)
                        {
                            exist = false;
                        }
                    }
                    catch (Exception ex)
                    {
                        UtilDB.ShowError(ex);
                    }
                }
            }
            return(exist);
        }
Пример #15
0
        private void LoadTable()
        {
            // Đoạn này quan trọng. Đăng nhập bằng user nào => connectionString tương ứng
            this.taNV.Connection.ConnectionString             =
                this.taDH.Connection.ConnectionString         =
                    this.taPN.Connection.ConnectionString     =
                        this.taPX.Connection.ConnectionString =
                            UtilDB.ConnectionString;
            try
            {
                this.dataSet.EnforceConstraints = false;

                // TODO: This line of code loads data into the 'dataSet.NhanVien' table. You can move, or remove it, as needed.
                this.taNV.Fill(this.dataSet.NhanVien);

                // TODO: This line of code loads data into the 'dataSet.DatHang' table. You can move, or remove it, as needed.
                this.taDH.Fill(this.dataSet.DatHang);

                // TODO: This line of code loads data into the 'dataSet.PhieuXuat' table. You can move, or remove it, as needed.
                this.taPX.Fill(this.dataSet.PhieuXuat);

                // TODO: This line of code loads data into the 'dataSet.PhieuNhap' table. You can move, or remove it, as needed.
                this.taPN.Fill(this.dataSet.PhieuNhap);

                //this.dataSet.EnforceConstraints = true;
            }
            catch (Exception ex)
            {
                UtilDB.ShowError(ex);
            }
        }
Пример #16
0
        private void LoadTable()
        {
            // Đoạn này quan trọng. Đăng nhập bằng user nào => connectionString tương ứng
            this.taDDH.Connection.ConnectionString                          =
                this.taCTDDH.Connection.ConnectionString                    =
                    this.taDSVT.Connection.ConnectionString                 =
                        this.taDSKHO.Connection.ConnectionString            =
                            this.taDSNCC.Connection.ConnectionString        =
                                this.taDSNV.Connection.ConnectionString     =
                                    this.taDSVT.Connection.ConnectionString =
                                        UtilDB.ConnectionString;
            try
            {
                this.dataSet.EnforceConstraints = false;
                this.taDDH.Fill(this.dataSet.DatHang);
                this.taCTDDH.Fill(this.dataSet.CTDDH);
                this.taDSVT.Fill(this.dataSet.DSVT);
                this.taDSNCC.Fill(this.dataSet.DSNCC);
                this.taDSNV.Fill(this.dataSet.DSNV);
                this.taDSKHO.Fill(this.dataSet.DSKHO);
                this.taDSVT.Fill(this.dataSet.DSVT);

                //this.dataSet.EnforceConstraints = true;
            }
            catch (Exception ex)
            {
                UtilDB.ShowError(ex);
            }
        }
Пример #17
0
        private async Task <bool> SwitchDepartment(int oldId, string newDepartment)
        {
            using (SqlConnection connection = new SqlConnection(UtilDB.ConnectionString))
            {
                connection.Open();
                using (SqlCommand command = new SqlCommand(MyConfig.SpChuyenChiNhanh, connection))
                {
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.AddWithValue("@manv", oldId);
                    command.Parameters.AddWithValue("@chinhanhmoi", newDepartment);

                    try
                    {
                        await command.ExecuteNonQueryAsync();

                        return(true);
                    }
                    catch (Exception ex)
                    {
                        UtilDB.ShowError(ex);
                        return(false);
                    }
                }
            }
        }
        private bool SaveDeliveryNote()
        {
            try
            {
                txtCustomerName.Text = txtCustomerName.Text.Trim();

                if (IsSaveGoodsDeliveryNote() == false)
                {
                    return(false);
                }

                SaveALlDataDetail();

                ((DataRowView)bdsPX.Current).Row.ItemArray = GetDataOrder();
                bdsPX.EndEdit();

                //UtilDB.UpdateWithTransaction(() =>
                //{
                //   this.taPX.Update(this.dataSet.PhieuXuat);
                //   this.taCTPX.Update(this.dataSet.CTPX);
                //}, taPX, taCTPX);

                using (var connection = new SqlConnection(UtilDB.ConnectionString))
                {
                    connection.Open();
                    using (var trans = connection.BeginTransaction())
                    {
                        taPX.Connection    = trans.Connection;
                        taCTPX.Connection  = trans.Connection;
                        taPX.Transaction   = trans;
                        taCTPX.Transaction = trans;

                        try
                        {
                            this.taPX.Update(this.dataSet.PhieuXuat);
                            this.taCTPX.Update(this.dataSet.CTPX);
                            trans.Commit();
                        }
                        catch (Exception ex)
                        {
                            trans.Rollback();
                            throw ex;
                        }
                    }
                }
                taDSVTCH.Fill(dataSet.DSVTCONHANG);
            }
            catch (Exception ex)
            {
                UtilDB.ShowError(ex);
                // xử lý tạm thời
                DisableEditMode();
                btnRefresh.PerformClick();
                return(false);
            }
            return(true);
        }
 public frmReportTongHopNhapXuat()
 {
     InitializeComponent();
     if (UtilDB.CurrentGroup.Equals(MyConfig.CongTyGroupName))
     {
         labelControl1.Visible = cboDepartment.Visible = btnFull.Visible = true;
         UtilDB.SetupDSCN(cboDepartment, () => { });
     }
 }
Пример #20
0
 private void ShowControlsByGroup(string grName)
 {
     if (grName.Equals("congty"))
     {
         UtilDB.SetupDSCN(cboDeployment, LoadTable);
         this.pnPickDepartment.Visible = true;
         btnAdd.Enabled = false;
     }
 }
Пример #21
0
 /// <summary>
 /// Uncompress a block of data found in an EncyclopeDIA library.
 /// </summary>
 private byte[] UncompressEncyclopeDiaData(byte[] compressedBytes, int uncompressedSize)
 {
     // Pass -1 in for uncompressed length since EnclyclopeDIA always compresses
     // the bytes even if the uncompressed size is equal to the compresssed size.
     byte[] uncompressedBytes = UtilDB.Uncompress(compressedBytes, -1, false);
     if (uncompressedBytes.Length != uncompressedSize)
     {
         throw new IOException(Resources.UtilDB_Uncompress_Failure_uncompressing_data);
     }
     return(uncompressedBytes);
 }
Пример #22
0
        private bool SaveOrder()
        {
            try
            {
                if (IsSaveOrder() == false)
                {
                    return(false);
                }

                SaveALlDataOrderDetailOnView();

                ((DataRowView)bdsDDH.Current).Row.ItemArray = GetDataOrder();
                bdsDDH.EndEdit();

                //UtilDB.UpdateWithTransaction(() =>
                //{
                //    this.taDDH.Update(this.dataSet.DatHang);
                //    this.taCTDDH.Update(this.dataSet.CTDDH);
                //}, taDDH, taCTDDH);
                using (var connection = new SqlConnection(UtilDB.ConnectionString))
                {
                    connection.Open();
                    using (var trans = connection.BeginTransaction())
                    {
                        taDDH.Connection    = trans.Connection;
                        taCTDDH.Connection  = trans.Connection;
                        taDDH.Transaction   = trans;
                        taCTDDH.Transaction = trans;

                        try
                        {
                            this.taDDH.Update(this.dataSet.DatHang);
                            this.taCTDDH.Update(this.dataSet.CTDDH);
                            trans.Commit();
                        }
                        catch (Exception ex)
                        {
                            trans.Rollback();
                            throw ex;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                UtilDB.ShowError(ex);
                // xử lý tạm thời
                DisableEditMode();
                btnRefresh.PerformClick();
                return(false);
            }
            return(true);
        }
Пример #23
0
 private void cboChiNhanh_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cboChiNhanh.SelectedValue == null)
     {
         return;
     }
     try
     {
         UtilDB.ServerName = cboChiNhanh.SelectedValue.ToString();
     }
     catch (Exception ex) { UtilDB.ShowError(ex); }
 }
Пример #24
0
        private void frmReportHDVN_Load(object sender, EventArgs e)
        {
            taDSNV.Connection.ConnectionString = UtilDB.ConnectionString;

            try
            {
                this.taDSNV.Fill(this.dataSet.DSNV);
            }
            catch (Exception ex)
            {
                UtilDB.ShowError(ex);
            }
        }
Пример #25
0
 public frmReportDSNV()
 {
     InitializeComponent();
     if (UtilDB.CurrentGroup.Equals(MyConfig.CongTyGroupName))
     {
         pnPickDepartment.Visible = true;
         UtilDB.SetupDSCN(cboDepartment, () =>
         {
             danhSachNhanVien = new Xrpt_DanhSachNhanVien(cboDepartment.Text);
             documentViewer.DocumentSource = danhSachNhanVien;
             danhSachNhanVien.CreateDocument();
         });
     }
 }
Пример #26
0
 public frmReportDSDVT()
 {
     InitializeComponent();
     if (UtilDB.CurrentGroup.Equals(MyConfig.CongTyGroupName))
     {
         lblCN.Visible = cboDepartment.Visible = btnPrint.Visible = true;
         UtilDB.SetupDSCN(cboDepartment, () => {
         });
     }
     else
     {
         lblCN.Visible = cboDepartment.Visible = btnPrint.Visible = false;
     }
 }
Пример #27
0
        public ActionResult Index()
        {
            if (Session["usuarioId"] != null)
            {
                ViewBag.EntityFramework = UtilDB.GetVersionAssembly("EntityFramework");
                ViewBag.Postgres        = UtilDB.GetVersionAssembly("Npgsql");
                ViewBag.MVC             = typeof(Controller).Assembly.GetName().Version;// = UtilDB.GetVersionAssembly("System.Web.Mvc");

                return(View());
            }
            else
            {
                return(RedirectToAction("Login"));
            }
        }
Пример #28
0
        private async void Undo()
        {
            ButtonAction action   = (ButtonAction)_userDo.Pop();
            int          position = -1;

            try
            {
                switch (action.ActionType)
                {
                case ButtonActionType.Add:
                    // xóa dữ liệu mới
                    //position = bdsNV.Find("MANV", action.SaveItems[0]);
                    //bdsNV.Remove((DataRowView)bdsNV[position]);
                    if (await UtilDB.DeleteInDB("NhanVien", "MANV", action.SaveItems[0]))
                    {
                        //this.dataSet.EnforceConstraints = false;
                        this.taNV.Fill(this.dataSet.NhanVien);
                        //this.dataSet.EnforceConstraints = true;
                    }
                    break;

                case ButtonActionType.Edit:
                    // sửa lại dữ liệu cũ
                    position = bdsNV.Find("MANV", action.SaveItems[0]);
                    ((DataRowView)bdsNV[position]).Row.ItemArray = action.SaveItems;
                    bdsNV.EndEdit();
                    //bdsNV.ResetCurrentItem();
                    break;

                case ButtonActionType.Delete:
                    // Thêm dữ liệu cũ vào
                    position = bdsNV.Count;
                    bdsNV.AddNew();
                    ((DataRowView)bdsNV[position]).Row.ItemArray = action.SaveItems;
                    bdsNV.EndEdit();
                    break;

                case ButtonActionType.None:
                default:
                    break;
                }
                this.taNV.Update(this.dataSet.NhanVien);
            }
            catch (Exception ex)
            {
                UtilDB.ShowError(ex);
            }
        }
Пример #29
0
        private void backup_Click(object sender, EventArgs e)
        {
            SaveFileDialog fichero = new SaveFileDialog();

            fichero.Filter   = "SQL (*.sql)|*.sql";
            fichero.FileName = "Backup";
            if (fichero.ShowDialog() == DialogResult.OK)
            {
                List <string> credentials = UtilVarios.GetCredentialsDB();
                string        server      = credentials[0];
                string        user        = credentials[1];
                string        database    = credentials[2];
                string        pass        = credentials[3];
                UtilDB.DumpDB(server, 3306, user, pass, database, fichero.FileName);
            }
        }
        private void LoadTable()
        {
            this.taVTCONHANG.Connection.ConnectionString =
                UtilDB.ConnectionString;

            try
            {
                this.dataSet.EnforceConstraints = false;

                this.taVTCONHANG.Fill(this.dataSet.DSVTCONHANG);
            }
            catch (Exception ex)
            {
                UtilDB.ShowError(ex);
            }
        }
Пример #31
0
 private DataSet executeQuery(string command, string datasetName = "DS", string tableName = "TABLE")
 {
     if ((dbFileName == null) || (dbFileName.Length == 0))
     {
         m_lastError = "Internal error: database file missing (function executeQuery)!";
         return null;
     }
     string connectionString = "Data Source=" + dbFileName + ";Version=3;";
     UtilDB dbUtil = new UtilDB(connectionString);
     if (!(dbUtil.Load(command, "")))
     {
         m_lastError = dbUtil.LastError;
         return null;
     }
     DataSet ds = dbUtil.DataSet;
     ds.DataSetName = datasetName;
     ds.Namespace = NAME_SPACE_URN;
     ds.Tables[0].TableName = tableName;
     return ds;
 }