Example #1
0
        //SELECT id, noms, adresse, contact, mail, sexe, datenaissance, lieunaissance, etatcivil, niveauetude, fonction, image, username FROM `tagent` WHERE 1
        void Modifier(int index)
        {
            spl.ShowWaitForm();
            rowHandle = gridView1.FocusedRowHandle;

            object[] data = new object[]
            {
                gridView1.GetRowCellValue(rowHandle, "id").ToString(),
                gridView1.GetRowCellValue(rowHandle, "noms").ToString(),
                gridView1.GetRowCellValue(rowHandle, "adresse").ToString(),
                gridView1.GetRowCellValue(rowHandle, "contact").ToString(),
                gridView1.GetRowCellValue(rowHandle, "mail").ToString(),
                gridView1.GetRowCellValue(rowHandle, "sexe").ToString(),
                gridView1.GetRowCellValue(rowHandle, "datenaissance").ToString(),
                gridView1.GetRowCellValue(rowHandle, "lieunaissance").ToString(),
                gridView1.GetRowCellValue(rowHandle, "etatcivil").ToString(),
                gridView1.GetRowCellValue(rowHandle, "niveauetude").ToString(),
                gridView1.GetRowCellValue(rowHandle, "fonction").ToString(),
                gridView1.GetRowCellValue(rowHandle, "image"),
                gridView1.GetRowCellValue(rowHandle, "qrCode"),
                gridView1.GetRowCellValue(rowHandle, "username").ToString(),
                gridView1.GetRowCellValue(rowHandle, "password").ToString(),
                gridView1.GetRowCellValue(rowHandle, "usersession").ToString()
            };

            if (index == 1)
            {
                new frm_AddAgent(spl, this, data).ShowDialog();
            }
        }
Example #2
0
        void Modifier(int index)
        {
            spl.ShowWaitForm();
            rowHandle = gridView1.FocusedRowHandle;

            object[] data = new object[]
            {
                gridView1.GetRowCellValue(rowHandle, "id").ToString(),
                gridView1.GetRowCellValue(rowHandle, "noms").ToString(),
                gridView1.GetRowCellValue(rowHandle, "adresse").ToString(),
                gridView1.GetRowCellValue(rowHandle, "contact").ToString(),
                gridView1.GetRowCellValue(rowHandle, "mail").ToString(),
                gridView1.GetRowCellValue(rowHandle, "typepieceid").ToString(),
                gridView1.GetRowCellValue(rowHandle, "numeropieceid").ToString(),
                gridView1.GetRowCellValue(rowHandle, "image").ToString(),
                gridView1.GetRowCellValue(rowHandle, "username").ToString(),
                gridView1.GetRowCellValue(rowHandle, "password").ToString(),
                gridView1.GetRowCellValue(rowHandle, "usersession").ToString()
            };

            if (index == 1)
            {
                new frm_AddChauffeur(spl, this, data).ShowDialog();
            }
            //else if (index == 2) new frm_AddPasser(spl, data).ShowDialog();
        }
Example #3
0
 public static void ShowWaitForm()
 {
     if (_splashScreenManager == null)
     {
         return;
     }
     _splashScreenManager.ShowWaitForm();
 }
Example #4
0
 private void Item_ItemClick(object sender, TileItemEventArgs e)
 {
     if (e.Item.Tag != null || File.Exists(e.Item.Tag.ToString()))
     {
         splashManager.ShowWaitForm();
         XSheetMain xshet = new XSheetMain(e.Item.Tag.ToString());
         this.Hide();
         xshet.Owner = this;
         splashManager.CloseWaitForm();
     }
 }
Example #5
0
 private static void SplashBaslat(SplashScreenManager manager)
 {
     if (manager.IsSplashFormVisible)
     {
         manager.CloseWaitForm();
         manager.ShowWaitForm();
     }
     else
     {
         manager.ShowWaitForm();
     }
 }
Example #6
0
        private void ExportAllData(string text)
        {
            string selectedPath            = string.Empty;
            FolderBrowserDialog fileDialog = new FolderBrowserDialog();

            if (fileDialog.ShowDialog() == DialogResult.OK)
            {
                selectedPath = fileDialog.SelectedPath;
            }

            if (string.IsNullOrEmpty(selectedPath) == true)
            {
                return;
            }
            string folderPath = string.Empty;

            using (var ssm = new SplashScreenManager(this, typeof(SysWaitForm), true, true))
            {
                ssm.ShowWaitForm();
                ssm.SetWaitFormDescription("正在" + text + "保存...");
                folderPath = Path.Combine(selectedPath, "ExportpData");
                this.ExportDataToPath(folderPath);
                ssm.CloseWaitForm();
                MessageBox.Show(this, "全部数据" + text + "成功!文件夹名:ExportpData", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            Process.Start(folderPath);
        }
Example #7
0
 protected void BeforeOperation()
 {
     if (!_splash.IsSplashFormVisible && _ativo)
     {
         _splash.ShowWaitForm();
     }
 }
Example #8
0
 public static void StartWait()
 {
     if (!splashManager.IsSplashFormVisible)
     {
         splashManager.ShowWaitForm();
     }
 }
Example #9
0
 /// <summary>单击事件
 /// 单击事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void BarButtonItem_ItemClick(object sender, ItemClickEventArgs e)
 {
     try
     {
         //获取左侧栏的name值
         string strPageName = e.Link.Item.Name;
         string strCaption  = e.Link.Caption;
         string strUrl      = e.Link.Item.Tag.ToString();
         if (StaticInfoHelper.IsOpen == 0)
         {
             SplashScreenManager.ShowWaitForm();
             SplashScreenManager.SetWaitFormCaption("正在努力打开");
             SplashScreenManager.SetWaitFormDescription("第一个页面加载稍微慢点,稍等一会");
             OpenForm(this, strPageName, strCaption, strUrl);
             SplashScreenManager.CloseWaitForm();
             StaticInfoHelper.IsOpen = 1;
         }
         else if (StaticInfoHelper.IsOpen == 1)
         {
             OpenForm(this, strPageName, strCaption, strUrl);
         }
         tabControl.Visible = MdiChildren.Length <= 0;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Example #10
0
 internal void ShowLoading(string caption, string description)
 {
     this.Enabled = false;
     ssmLoader.ShowWaitForm();
     ssmLoader.SetWaitFormCaption(caption);
     ssmLoader.SetWaitFormDescription(description);
 }
Example #11
0
 /// <summary>
 /// This method is called to show a form in the MainForm as a MDIChildform
 /// http://www.codeproject.com/Articles/9162/Invoking-methods-Runtime-on-method-name
 /// </summary>
 /// <remarks>Created: Henko Rabie 15/10/2013</remarks>
 public void ShowWaitForm()
 {
     if (!splash.IsSplashFormVisible)
     {
         splash.ShowWaitForm();
     }
 }
Example #12
0
 public void ShowWaitForm()
 {
     if (splash.IsSplashFormVisible)
     {
         splash.CloseWaitForm();
     }
     splash.ShowWaitForm();
 }
 private void switchUC(UserControl uc)
 {
     spl.ShowWaitForm();
     panelConf.Controls.Clear();
     uc.Dock = panelConf.Dock;
     panelConf.Controls.Add(uc);
     spl.CloseWaitForm();
 }
        private void btnImportar_Click(object sender, EventArgs e)
        {
            var resultado = XtraMessageBox.Show("¿Desea importar los empleados del cliente seleccionado a la empresa actual?", "Confirmación", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (resultado.Equals(DialogResult.Yes))
            {
                try
                {
                    string EmpresaNominaID = Properties.Settings.Default["EmpresaNominaID"].ToString();
                    if (splash.IsSplashFormVisible.Equals(false))
                    {
                        splash.ShowWaitForm();
                    }

                    for (int i = 0; i < gridViewEmpl.RowCount; i++)
                    {
                        empleado.Add(new E.Empleado
                        {
                            NumEmpl         = gridViewEmpl.GetRowCellValue(i, gridViewEmpl.Columns[1]).ToString(),
                            Nombre          = gridViewEmpl.GetRowCellValue(i, gridViewEmpl.Columns[2]).ToString(),
                            RFC             = gridViewEmpl.GetRowCellValue(i, gridViewEmpl.Columns[3]).ToString(),
                            Correo          = gridViewEmpl.GetRowCellValue(i, gridViewEmpl.Columns[4]).ToString(),
                            CURP            = gridViewEmpl.GetRowCellValue(i, gridViewEmpl.Columns[5]).ToString(),
                            TipoRegimen     = gridViewEmpl.GetRowCellValue(i, gridViewEmpl.Columns[6]).ToString(),
                            Departamento    = gridViewEmpl.GetRowCellValue(i, gridViewEmpl.Columns[8]).ToString(),
                            cuenta          = gridViewEmpl.GetRowCellValue(i, gridViewEmpl.Columns[9]).ToString(),
                            clabe_bancaria  = gridViewEmpl.GetRowCellValue(i, gridViewEmpl.Columns[10]).ToString(),
                            cve_banco       = gridViewEmpl.GetRowCellValue(i, gridViewEmpl.Columns[11]).ToString(),
                            banco           = gridViewEmpl.GetRowCellValue(i, gridViewEmpl.Columns[12]).ToString(),
                            Puesto          = gridViewEmpl.GetRowCellValue(i, gridViewEmpl.Columns[14]).ToString(),
                            TipoContrato    = gridViewEmpl.GetRowCellValue(i, gridViewEmpl.Columns[15]).ToString(),
                            Periodicidad    = gridViewEmpl.GetRowCellValue(i, gridViewEmpl.Columns[17]).ToString(),
                            Sindicalizado   = gridViewEmpl.GetRowCellValue(i, gridViewEmpl.Columns[10]).ToString(),
                            idEmpresa       = gridViewEmpl.GetRowCellValue(i, gridViewEmpl.Columns[23]).ToString(),
                            empresa         = gridViewEmpl.GetRowCellValue(i, gridViewEmpl.Columns[24]).ToString(),
                            descuento       = Convert.ToDecimal(gridViewEmpl.GetRowCellValue(i, gridViewEmpl.Columns[25]).ToString()),
                            tipoPago        = gridViewEmpl.GetRowCellValue(i, gridViewEmpl.Columns[26]).ToString(),
                            nominaEmpresaID = EmpresaNominaID
                        });
                    }

                    controlador.ImportaEmpleado(lookUpEmpr.Text, empresaActiva, empleado, usuario, splash, EmpresaNominaID);
                    empleado.Clear();
                }
                catch (Exception imp)
                {
                    if (splash.IsSplashFormVisible.Equals(true))
                    {
                        splash.CloseWaitForm();
                    }
                    empleado.Clear();
                    XtraMessageBox.Show("Error btnImportar: " + imp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
        public virtual void BatchSubmit(SplashScreenManager splash)
        {
            string    clipboard = Clipboard.GetText();
            DataTable dtInput   = new DataTable();
            DataRow   nR;

            if (!clipboard.Contains((char)(10)))
            {
                XtraMessageBox.Show("复制的内容格式不正确", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (!clipboard.Contains((char)(9)))
            {
                XtraMessageBox.Show("复制的内容格式不正确", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            dtInput.Columns.Add("SFI单号");
            dtInput.Columns.Add("代理单号");
            string[] strs  = clipboard.Split((char)(10));
            string   enter = ((char)13).ToString();
            string   tmpStr;

            foreach (string s in strs)
            {
                tmpStr = s.Replace(enter, "");
                if (!string.IsNullOrEmpty(tmpStr))
                {
                    nR    = dtInput.NewRow();
                    nR[0] = tmpStr.Split((char)(9))[0];
                    nR[1] = tmpStr.Split((char)(9))[1];
                    dtInput.Rows.Add(nR);
                }
            }

            InputDataFrm inputDataFrm = new InputDataFrm(dtInput, SelectedAgent.AGid);
            DialogResult DResult      = inputDataFrm.ShowDialog();

            if (DResult == DialogResult.OK)
            {
                splash.ShowWaitForm();
                string sqlStr = $"select * from tb_SFI_TrackNum where int_AGid={SelectedAgent.AGid} AND CONVERT(varchar(10),tb_SFI_TrackNum.dttm_updateDttm,112) ='{ImportDate.ToString("yyyyMMdd")}';";
                LoadNewAddedTrackNos(sqlStr);
                splash.CloseWaitForm();
            }
            else if (DResult == DialogResult.Abort)
            {
                XtraMessageBox.Show("添加数据失败", "错误信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else if (DResult == DialogResult.Cancel)
            {
                XtraMessageBox.Show("用户取消操作", "错误信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Example #16
0
 /// <summary>
 /// Показать форму ожидания загрузки
 /// </summary>
 public void ShowWaitForm(string caption = null)
 {
     if (ssManager.IsSplashFormVisible)
     {
         return;
     }
     if (!string.IsNullOrEmpty(caption))
     {
         ssManager.SetWaitFormCaption(caption);
     }
     ssManager.ShowWaitForm();
 }
Example #17
0
 public static void CallWaitForm(XtraForm frmParent)
 {
     try
     {
         if (ssmWait == null || !ssmWait.IsSplashFormVisible)
         {
             ssmWait = new SplashScreenManager(frmParent, typeof(frmWaiting), true, true);
             ssmWait.ShowWaitForm();
             SetCaptionWaitForm("Vui lòng chờ!", "Đang xử lý...");
         }
     }
     catch { }
 }
        public static void ShowWaitForm(this UserControl owner)
        {
            if (Managers.ContainsKey(owner))
            {
                return;
            }
            SplashScreenManager manager = new SplashScreenManager(typeof(UserControlWaitForm),
                                                                  SplashFormStartPosition.Manual, owner.Parent.PointToScreen(owner.Location),
                                                                  new SplashFormProperties());

            Managers.Add(owner, manager);
            manager.ShowWaitForm();
            manager.SendCommand(UserControlWaitFormCommand.SetSize, owner.Size);
        }
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            var respuesta = XtraMessageBox.Show("¿Desea guardar los cambios?", "Confirmación", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (respuesta.Equals(DialogResult.Yes))
            {
                splash.ShowWaitForm();
                var listaBancos = new List <E.Banco>();
                for (int i = 0; i < gridViewSucursales.RowCount; i++)
                {
                    cve     = gridViewSucursales.GetRowCellValue(i, gridViewSucursales.Columns[0]).ToString();
                    desc    = gridViewSucursales.GetRowCellValue(i, gridViewSucursales.Columns[1]).ToString();
                    rsocial = gridViewSucursales.GetRowCellValue(i, gridViewSucursales.Columns[2]).ToString();

                    listaBancos.Add(new E.Banco
                    {
                        cveBanco    = cve,
                        nombre      = desc,
                        razonSocial = rsocial
                    });
                }

                if (controlador.modificaListaBancos(listaBancos, splash).Equals(true))
                {
                    splash.CloseWaitForm();
                    XtraMessageBox.Show("!Información actualizada¡", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    layoutControlBtnAgregar.Visibility  = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
                    layoutControlbtnEliminar.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
                    layoutControlBtnEditar.Visibility   = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
                    layoutControlbtnGuardar.Visibility  = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
                    layoutControlbtnCancelar.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;

                    gridViewSucursales.OptionsBehavior.Editable = false;

                    this.LlenaTabla();
                }
                else
                {
                    XtraMessageBox.Show("!Error al intentar actualizar información¡", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    layoutControlBtnAgregar.Visibility  = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
                    layoutControlbtnEliminar.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
                    layoutControlBtnEditar.Visibility   = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
                    layoutControlbtnGuardar.Visibility  = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
                    layoutControlbtnCancelar.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;

                    gridViewSucursales.OptionsBehavior.Editable = false;
                }
            }
        }
Example #20
0
        public void ShowWaitForm(string description, string caption = "")
        {
            if (!ssm.IsSplashFormVisible)
            {
                ssm.ShowWaitForm();
            }

            if (caption == "")
            {
                ssm.SetWaitFormCaption("请稍等......");
            }
            else
            {
                ssm.SetWaitFormCaption(caption);
            }
            ssm.SetWaitFormDescription(description);
        }
        public virtual void Submit(SplashScreenManager splash)
        {
            splash.ShowWaitForm();
            ImportDate = DateTime.Now;
            AgentNo    = string.Empty;
            OrderNo    = string.Empty;

            if (string.IsNullOrWhiteSpace(OrderNo2))
            {
                splash.CloseWaitForm();
                XtraMessageBox.Show("订单号不能为空", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (string.IsNullOrWhiteSpace(AgentNo2))
            {
                splash.CloseWaitForm();
                XtraMessageBox.Show("DPD单号不能为空", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            string str       = "0123456789";
            string aGawbSign = "";

            for (int i = AgentNo2.Length - 1; i >= 0; i += -1)
            {
                if (str.LastIndexOf(AgentNo2.Substring(i, 1)) != 0)
                {
                    aGawbSign = AgentNo2.Substring(i, 1);
                    break;
                }
            }

            if (string.IsNullOrWhiteSpace(aGawbSign))
            {
                //获取最后一位的值
                aGawbSign = AgentNo2.Substring(AgentNo2.Length - 2, 1);
            }

            string sqlStr = $"INSERT INTO tb_SFI_TrackNum (vchar_SFInum, vchar_AGnum, int_AGid, vchar_updateUser, dttm_updateDttm,char_AG_Syn_sign) VALUES ('{OrderNo2}','{AgentNo2}','{SelectedAgent.AGid}','{MainFrm.CurrentUser}',GETDATE(),'{aGawbSign}');";

            sqlStr = $"{sqlStr} select * from tb_SFI_TrackNum where int_AGid={SelectedAgent.AGid} AND CONVERT(varchar(10),tb_SFI_TrackNum.dttm_updateDttm,112) ='{ImportDate.ToString("yyyyMMdd")}';";
            IList <SFITrackNum> tracks = SQLHelper.GetObject <SFITrackNum>(sqlStr).ToList();

            LoadNewAddedTrackNos(sqlStr);

            splash.CloseWaitForm();
        }
Example #22
0
 public static void Start(string statusText)
 {
     if (!SplashScreenManager.IsSplashFormVisible)
     {
         lock (ThisLock)
         {
             if (!SplashScreenManager.IsSplashFormVisible)
             {
                 SplashScreenManager.ShowWaitForm();
                 SplashScreenManager.SetWaitFormDescription(statusText);
             }
         }
     }
     else
     {
         SplashScreenManager.SetWaitFormDescription(statusText);
     }
 }
Example #23
0
        public static void ExportGridToWord(GridView GridControl1, SplashScreenManager splashScreenManager1)
        {
            try
            {
                SaveFileDialog saveFileDialog = new SaveFileDialog();
                saveFileDialog.Filter       = "Files(*.RTF)|*.RTF";
                saveFileDialog.AddExtension = true;
                saveFileDialog.DefaultExt   = ".RTF";


                if (saveFileDialog.ShowDialog() == DialogResult.OK && saveFileDialog.CheckPathExists)
                {
                    if (splashScreenManager1 != null)
                    {
                        splashScreenManager1.ShowWaitForm();
                        splashScreenManager1.SetWaitFormDescription("Exporting..Please Wait");
                    }
                    GridControl1.ExportToRtf(saveFileDialog.FileName);

                    if (splashScreenManager1 != null)
                    {
                        splashScreenManager1.CloseWaitForm();
                    }

                    if (MessageBox.Show(@"Do you wish to open the RTF file now?", @"Export to RTF", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        Process proc = new Process();
                        proc.StartInfo.FileName = saveFileDialog.FileName;
                        proc.Start();
                    }
                }
            }
            catch (Exception ex)
            {
                if (splashScreenManager1 != null && splashScreenManager1.IsSplashFormVisible)
                {
                    splashScreenManager1.CloseWaitForm();
                }


                MessageBox.Show(ex.ToString());
            }
        }
Example #24
0
        /// <summary>
        /// 生成要显示在Tab中的Form
        /// </summary>
        /// <param name="strTitle"></param>
        /// <param name="strTag"></param>
        /// <param name="frmBase"></param>
        /// <param name="image"></param>
        private void CreateMDIControl(string strTitle, string strTag, Form frmBase)
        {
            try
            {
                DevExpress.XtraTabbedMdi.XtraMdiTabPage currentPage = null;

                if (currentPage == null)
                {
                    // 等待加载窗口
                    loading.ShowWaitForm();

                    // 设置Form属性
                    frmBase.Dock      = DockStyle.Fill;
                    frmBase.Text      = strTitle;
                    frmBase.Tag       = strTag;
                    frmBase.Location  = new Point(100, 100);
                    frmBase.MdiParent = this.parent;

                    frmBase.Show();

                    // 记录当前Tab中的Page
                    currentPage = xtraTabbedMdiMgr.SelectedPage;
                }
                else
                {
                    xtraTabbedMdiMgr.SelectedPage = currentPage;
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message);
            }
            finally
            {
                // 关闭加载窗口
                loading.CloseWaitForm();
            }
        }
Example #25
0
 public void Show()
 {
     sm.ShowWaitForm();
 }
Example #26
0
 /// <summary>
 ///     [EN] ShowWaitForm
 ///     Create By: ManhNV1 -Date:02/25/2016
 ///     Descripton: ShowWaitForm
 /// </summary>
 /// <param name="frmWaitForm">Form Used</param>
 /// <param name="strCaption">
 ///     Title WaitForm:
 ///     if strCaption = null => Value = Please Wait
 ///     else => Value = strCaption
 /// </param>
 /// <param name="strDescription">Description WaitForm</param>
 /// <returns>SplashScreenManager Type</returns>
 public static SplashScreenManager ShowWaitForm(Form frmWaitForm, string strCaption
     , string strDescription)
 {
     var splashScreenManager = new SplashScreenManager(frmWaitForm
         , typeof (WaitFormPlease), true, true);
     splashScreenManager.ShowWaitForm();
     if (strCaption == null)
         splashScreenManager.SetWaitFormCaption(SEDConst.SET_PLEASE_WAIT);
     else splashScreenManager.SetWaitFormCaption(strCaption);
     // Nếu Null thì dùng strDescription không thì  Set_Loading
     splashScreenManager.SetWaitFormDescription(strDescription ?? SEDConst.SET_LOADING);
     return splashScreenManager;
 }
 //TODO Comment
 public static bool CheckConnectTimeOutWait(SplashScreenManager splashScreenManager)
 {
     if (IsConnectedToInternet() == false)
     {
         splashScreenManager.ShowWaitForm();
         //TODO Set Constant
         splashScreenManager.SetWaitFormCaption("Checking the network connection!");
         splashScreenManager.SetWaitFormDescription(SEDConst.SET_PLEASE_WAIT);
         Thread.Sleep(7000);
         splashScreenManager.CloseWaitForm();
         if (IsConnectedToInternet() == false)
         {
             //TODO Set Constant
             XtraMessageBox.Show("Connect Timout. Checking the network connection...!",
                 SEDConst.MESSAGE_WARNING_DISCONNECTED);
             return false;
         }
         return true;
     }
     return true;
 }
Example #28
0
 /// <summary>
 ///  显示进度条
 /// </summary>
 /// <param name="manager">进度条</param>
 /// <param name="caption">标题</param>
 /// <param name="description">描述</param>
 /// Author  : Napoleon
 /// Created : 2015-02-26 20:30:27
 protected void ShowManager(SplashScreenManager manager, string caption, string description)
 {
     manager.ShowWaitForm();
     manager.SetWaitFormCaption(caption);
     manager.SetWaitFormDescription(description);
 }
 public virtual void RefreshLogs(SplashScreenManager splash)
 {
     splash.ShowWaitForm();
     trackRecordLogs = GetTrackRecordLogs();
     splash.CloseWaitForm();
 }
        /// <summary>
        /// 查询运单信息
        /// </summary>
        /// <param name="para"></param>
        public virtual void Search(SplashScreenManager splash)
        {
            splash.ShowWaitForm();

            #region 拼接sql语句的where条件
            string sqlWhere = $" tb_SFI_TrackNum.int_AGid={SelectedAgent.AGid}";

            if (!string.IsNullOrWhiteSpace(OrderNo))
            {
                if (OrderNo.IndexOf(",") > 0)
                {
                    sqlWhere = $"{sqlWhere} AND tb_SFI_TrackNum.vchar_SFInum in (";
                    string[] strs = OrderNo.Split(',');
                    foreach (string str in strs)
                    {
                        sqlWhere = $"{sqlWhere}'{str}',";
                    }
                    sqlWhere = $"{sqlWhere.TrimEnd(',')})";
                }
                else
                {
                    sqlWhere = $"{sqlWhere} AND tb_SFI_TrackNum.vchar_SFInum='{OrderNo}'";
                }
            }

            if (!string.IsNullOrWhiteSpace(AgentNo))
            {
                if (AgentNo.IndexOf(",") > 0)
                {
                    sqlWhere = $"{sqlWhere} AND tb_SFI_TrackNum.vchar_AGnum in (";
                    string[] strs = AgentNo.Split(',');
                    foreach (string str in strs)
                    {
                        sqlWhere = $"{sqlWhere}'{str}',";
                    }
                    sqlWhere = $"{sqlWhere.TrimEnd(',')})";
                }
                else
                {
                    sqlWhere = $"{sqlWhere} AND tb_SFI_TrackNum.vchar_AGnum='{OrderNo}'";
                }
            }

            sqlWhere = $"{sqlWhere} AND CONVERT(varchar(10),tb_SFI_TrackNum.dttm_updateDttm,112) ='{ImportDate.ToString("yyyyMMdd")}'";
            //string sqlSelect = $"SELECT tb_SFI_TrackNum.int_Mappingid AS 数据编号, tb_SFI_TrackNum.vchar_SFInum AS SFI单号,tb_SFI_TrackNum.vchar_AGnum AS 代理单号, (CONVERT(varchar(10),tb_SFI_TrackNum.int_AGid) + N'-' + tb_Agent.vchar_AGname) AS 代理名称, tb_SFI_TrackNum.dttm_updateDttm AS 数据导入时间, tb_SFI_TrackNum.dttm_AG_LastSyn AS 最后同步时间, tb_SFI_TrackNum.char_IsStop AS 运输服务完毕 FROM tb_SFI_TrackNum INNER JOIN tb_Agent ON tb_SFI_TrackNum.int_AGid = tb_Agent.int_AGid WHERE {sqlWhere} ORDER BY tb_SFI_TrackNum.dttm_updateDttm DESC";
            string sqlSelect = $"SELECT tb_SFI_TrackNum.int_Mappingid, tb_SFI_TrackNum.vchar_SFInum,tb_SFI_TrackNum.vchar_AGnum , (CONVERT(varchar(10),tb_SFI_TrackNum.int_AGid) + N'-' + tb_Agent.vchar_AGname), tb_SFI_TrackNum.dttm_updateDttm, tb_SFI_TrackNum.dttm_AG_LastSyn, tb_SFI_TrackNum.char_IsStop FROM tb_SFI_TrackNum INNER JOIN tb_Agent ON tb_SFI_TrackNum.int_AGid = tb_Agent.int_AGid WHERE {sqlWhere} ORDER BY tb_SFI_TrackNum.dttm_updateDttm DESC";

            //DataSet ds = SQLHelper.GetDataSet(sqlSelect);
            //if (ds != null && ds.Tables.Count == 1)
            //{
            //    //para.Grid.BeginUpdate();

            //    //para.Grid.DataSource = ds.Tables[0].DefaultView;
            //    //para.Grid.EndUpdate();

            //}


            var tracks = (SQLHelper.GetObject <SFITrackNum>(sqlSelect)).ToList();
            trackNumInfos.Clear();
            if (tracks.Count > 0)
            {
                foreach (SFITrackNum track in tracks)
                {
                    trackNumInfos.Add(track);
                }
            }
            else
            {
                trackNumInfos.Clear();
            }
            splash.CloseWaitForm();

            #endregion
        }
Example #31
0
        /// <summary>
        /// Backups the database.
        /// </summary>
        /// <returns></returns>
        public static bool BackupDatabase(SplashScreenManager splashScreenManager, string backupName, bool openBackupFolder)
        {
            try
            {
                var globalVariable = new GlobalVariable();
                if (splashScreenManager != null)
                {
                    splashScreenManager.ShowWaitForm();
                    splashScreenManager.SetWaitFormCaption("Đang sao lưu dữ liệu");
                    splashScreenManager.SetWaitFormDescription("Vui lòng đợi ..");
                }

                var databaseNameForBackup = RegistryHelper.GetValueByRegistryKey("DatabaseName");
                var databaseForBackup     = GlobalVariable.Server.Databases[databaseNameForBackup];
                var backup = new Backup
                {
                    //option for backup
                    Action = BackupActionType.Database,
                    BackupSetDescription = "Sao lưu CSDL, ngày " + DateTime.Now,
                    BackupSetName        = databaseNameForBackup + " Backup",
                    Database             = databaseForBackup.Name
                };

                //create backupdevice
                var folderBackup   = globalVariable.DailyBackupPath;
                var dateTimeString = "NG" + DateTime.Now.Day.ToString(CultureInfo.InvariantCulture) +
                                     "T" + DateTime.Now.Month.ToString(CultureInfo.InvariantCulture) +
                                     "N" + DateTime.Now.Year.ToString(CultureInfo.InvariantCulture) +
                                     "_" + DateTime.Now.Hour.ToString(CultureInfo.InvariantCulture) + "GI" +
                                     DateTime.Now.Minute.ToString(CultureInfo.InvariantCulture) + "P";

                var databaseName = databaseNameForBackup + "_" + (string.IsNullOrEmpty(backupName) ? "" : backupName) + "_" + dateTimeString + ".bak";

                //LINHMC kiem tra neu folder ko ton tai thi tao
                if (string.IsNullOrEmpty(folderBackup))
                {
                    DriveInfo[] allDrives = DriveInfo.GetDrives();
                    if (allDrives.Length > 1)
                    {
                        folderBackup = allDrives[1].Name + @"BACKUP_A_BIGTIME";
                    }
                    else
                    {
                        folderBackup = allDrives[0].Name + @"BACKUP_A_BIGTIME";
                    }
                }
                if (!Directory.Exists(folderBackup))
                {
                    Directory.CreateDirectory(folderBackup);
                }

                var fileBackup = folderBackup + @"\" + databaseName;
                if (File.Exists(fileBackup))
                {
                    XtraMessageBox.Show(ResourceHelper.GetResourceValueByName("ResFileBackupExits"),
                                        ResourceHelper.GetResourceValueByName("ResExceptionCaption"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }
                var backupDevice = new BackupDeviceItem(fileBackup, DeviceType.File);

                backup.Devices.Add(backupDevice);
                backup.Incremental = false;

                backup.SqlBackup(GlobalVariable.Server);

                //Cách nén file này chỉ dùng trong trường hợp hệ quản trị dữ liệu và chương trình cùng nằm trên 1 máy
                using (var zip = new ZipFile())
                {
                    zip.AddFile(fileBackup, "");
                    var zipFileName = fileBackup.Replace(".bak", ".zip");
                    zip.ParallelDeflateThreshold = -1;
                    zip.Save(zipFileName);
                    File.Delete(fileBackup);
                }
                if (splashScreenManager != null)
                {
                    splashScreenManager.CloseWaitForm();
                }

                if (openBackupFolder)
                {
                    Process.Start(folderBackup);
                }
                return(true);
            }
            catch (Exception ex)
            {
                if (splashScreenManager != null)
                {
                    splashScreenManager.CloseWaitForm();
                }
                XtraMessageBox.Show(ex.ToString(),
                                    ResourceHelper.GetResourceValueByName("ResExceptionCaption"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
        }
        private void BtnGenerarReporte_Click(object sender, EventArgs e)
        {
            try
            {
                if (LookUpMeses.Text.Equals("Seleccione"))
                {
                    XtraMessageBox.Show("Por favor seleccione mes.", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                else
                {
                    mes = LookUpMeses.EditValue.ToString();
                }
                if (LookUpAño.Text.Equals("Seleccione"))
                {
                    XtraMessageBox.Show("Por favor seleccione año.", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                else
                {
                    año = LookUpAño.EditValue.ToString();
                }
                splash.ShowWaitForm();
                splash.SetWaitFormCaption("Generando Reporte..");
                XtraReport reporte;
                reporte = new Reports.RepNomina(mes, año);
                ReportPrintTool printTool    = new ReportPrintTool(reporte);
                PrintControl    printControl = printTool.PreviewForm.PrintControl;
                //PrintControl printControl = printTool.PreviewRibbonForm.PrintControl;


                // Zoom the document, so that it fits the entire page into the Print Preview's dimensions.
                if (printControl.CanExecCommand(PrintingSystemCommand.ViewWholePage))
                {
                    printControl.ExecCommand(PrintingSystemCommand.ViewWholePage);
                }

                // Invoke the Hand tool to scroll the document using the mouse.
                if (printControl.CanExecCommand(PrintingSystemCommand.HandTool))
                {
                    printControl.ExecCommand(PrintingSystemCommand.HandTool, new object[] { true });
                }

                // Hide the Hand tool.
                //if (printControlCanExecCommand(PrintingSystemCommand.HandTool)) {
                //    printControl.ExecCommand(PrintingSystemCommand.HandTool, new object[] { false });
                //}

                // Show the report's Print Preview in a dialog window.
                printControl.Zoom = 1.2F;
                printTool.ShowPreview();
                splash.CloseWaitForm();
                //printTool.ShowPreviewDialog();
                //printTool.ShowRibbonPreviewDialog();
            }
            catch (Exception genRep)
            {
                splash.CloseWaitForm();
                XtraMessageBox.Show(genRep.Message + "mostrarReporte()", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #33
0
 /// <summary>
 ///  显示进度条
 /// </summary>
 /// <param name="manager">进度条</param>
 /// <param name="caption">标题</param>
 /// <param name="description">描述</param>
 /// Author  : Napoleon
 /// Created : 2015-02-26 20:30:27
 protected void ShowManager(SplashScreenManager manager, string caption, string description)
 {
     manager.ShowWaitForm();
     manager.SetWaitFormCaption(caption);
     manager.SetWaitFormDescription(description);
 }