Ejemplo n.º 1
0
        /// <summary>
        /// Despliega los mensajes de error de la aplicacion
        /// </summary>
        /// <history>
        ///   [jorcanche]  22/04/2016 Created
        /// </history>
        private void App_UnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
        {
            e.Handled = true;
            var frm = new frmError(e.Exception);

            frm.ShowDialog();
            if (frm.DialogResult.HasValue && !frm.DialogResult.Value)
            {
                Application.Current.Shutdown();
            }
        }
 public DialogResult LoadErrorForm(string errorMessage)
 {
     if (InvokeRequired)
     {
         var d = new LoadErrorFormDelegate(LoadErrorForm);
         return((DialogResult)Invoke(d, new object[] { errorMessage }));
     }
     else
     {
         frmError errorForm = new frmError(errorMessage);
         errorForm.Owner = this;
         errorForm.ShowDialog();
         return(errorForm.DialogResult);
     }
 }
Ejemplo n.º 3
0
        private void frmAvisoPregunta_Load(object sender, EventArgs e)
        {
            if (tipo == "modal")
            {
                this.BackColor          = Color.Black;
                this.ventanaModal.Owner = this;
                this.ventanaModal.Show();
                return;
            }


            if (tipo == "")
            {
                p          = new yesno(this, this.mensaje);
                p.enviando = recibiendo;
                p.Show();
            }
            else if (tipo == "informacion")
            {
                informacion          = new frmInformacion(this, this.mensaje, this.titulo);
                informacion.enviando = recibiendo;
                informacion.Show();
            }
            else if (tipo == "error")
            {
                error          = new frmError(this.mensaje, this.titulo, this);
                error.enviando = recibiendo;
                error.Show();
            }
            else if (tipo == "exclamation")
            {
                exclamation          = new frmExclamacion(this.mensaje, this.titulo, this);
                exclamation.enviando = recibiendo;
                exclamation.Show();
            }
            else if (tipo == "question")
            {
                question          = new frmQuestion(this.mensaje, this.titulo, this);
                question.enviando = recibiendo;
                question.Show();
            }
            else
            {
                success          = new frmSuccess(this.mensaje, this.titulo, this);
                success.enviando = recibiendo;
                success.Show();
            }
        }
Ejemplo n.º 4
0
        private void btnSmInsert_Click(object sender, EventArgs e)
        {
            string table  = cboSmTable.SelectedItem.ToString();
            string column = cboSmColumn.SelectedItem.ToString();
            string value  = txtSmValue.Text;

            lstStringMapValues.Items.Clear();
            txtSmValue.Text = null;

            try
            {
                ISP.Business.Entities.StringMap.Insert(value, column, table);

                foreach (DataRow dr in ISP.Business.Entities.StringMap.GetAssociatedFromTableColumn(table, column).Rows)
                {
                    lstStringMapValues.Items.Add(new ListItem(dr["Name"].ToString(), dr["StringMapId"].ToString()));
                }
            }
            catch (Exception ex)
            {
                frmError _frmError = new frmError(frmMainParent, ex);
            }
        }
Ejemplo n.º 5
0
        public static void ReportError(Exception ex, string password = "")
        {
            if (password != AccessManager.AccessKey)
            {
                if (!AccessManager.GetPluginPermission(AccessManager.PluginPermission.Environment_ReportError))
                {
                    throw new UnabletoAccessPermission();
                }
            }

            if (RTAPI.WebAPI.CheckInternetConnection())
            {
                System.Collections.Specialized.NameValueCollection data = new System.Collections.Specialized.NameValueCollection();
                data.Add("entry.1674123617", ex.ToString());
                data.Add("entry.713681991", Version);
                data.Add("entry.521569291", "false");
                System.Net.WebClient wc = new System.Net.WebClient();
                wc.UploadValuesAsync(new Uri("https://docs.google.com/forms/d/1K2hLlZmlCjur28khh8HYSCjPpl4kLz6nifWEVXKE1sE/formResponse"), "POST", data, Guid.NewGuid().ToString());
            }
            LogManager.ExceptMessage(ex);
            frmError err = new frmError(ex.ToString());

            err.ShowDialog();
        }
Ejemplo n.º 6
0
 private void btnLogWindow_Click(object sender, EventArgs e)
 {
     using (frmError fErr = new frmError())
         fErr.ShowDialog();
 }
        private void btnThem_Click(object sender, EventArgs e)
        {
            if (XL2.KiemtraKetnoiCSDL() == false)
            {
                return;
            }

            // xác nhận thực hiện
            if (MessageBox.Show("Khai báo vắng cho các nhân viên?", Resources.Caption_XacNhan, MessageBoxButtons.OKCancel) == DialogResult.Cancel)
            {
                return;
            }
            #region             //lấy loại vắng, workingDay, workingTime, absentCode, XL2.currUserID

            if (cbLoaiVang.SelectedItem == null)
            {
                ACMessageBox.Show("Bạn chưa chọn loại vắng", Resources.Caption_ThongBao, 2000);
                return;
            }
            var rowLV        = cbLoaiVang.SelectedItem as DataRowView;
            var absentCode   = rowLV["AbsentCode"].ToString();
            var workingDay   = (float)((frm_KBVang.Working)cbSoBuoi.SelectedItem).Cong;
            var phuCapString = maskedTextBox1.Text;
            var phuCapInt    = 0;
            var phuCapFloat  = 0f;
            if (int.TryParse(phuCapString, out phuCapInt) == false || phuCapString.Length < 3)
            {
                ACMessageBox.Show("Nhập phụ cấp chưa đúng định dạng.", Resources.Caption_Loi, 2000); return;
            }
            phuCapFloat = Convert.ToSingle(phuCapInt) / 100f;

            #region set working time tùy theo workingDay

            var workingTime = 0f;

            if (Math.Abs(workingDay - 0f) < 0.01f)
            {
                workingTime = 0f;
            }
            else if (Math.Abs(workingDay - 0.25f) < 0.01f)
            {
                workingTime = 2f;
                if (!(absentCode.ToLower() == "p" || absentCode.ToLower() == "ro"))
                {
                    ACMessageBox.Show("Chưa hỗ trợ vắng 2 tiếng ngoài phép và việc riêng.", "Chức năng chưa được hỗ trợ", 3000);
                    return;
                }
            }
            else if (Math.Abs(workingDay - 0.5f) < 0.01f)
            {
                workingTime = 4f;
            }
            else if (Math.Abs(workingDay - 1f) < 0.01f)
            {
                workingTime = 8f;
            }

            #endregion

            #endregion

            IsReload = true;
            List <Error> listError = new List <Error>();
            XL.ThemNgayVang(listMaCC_NgayVang, workingDay, workingTime, phuCapFloat, absentCode, listError);
            if (listError.Count > 0)
            {
                frmError frm = new frmError {
                    StartPosition = FormStartPosition.CenterParent, listError = listError
                };
                frm.ShowDialog();
            }
            Close();
        }
Ejemplo n.º 8
0
        private void btnThem_Click(object sender, EventArgs e)
        {
            if (XL2.KiemtraKetnoiCSDL() == false)
            {
                return;
            }

            // lấy ngày check
            var ngayBD = dtpNgayBD.Value.Date;
            var ngayKT = dtpNgayKT.Value.Date;

            if (ngayBD > ngayKT)
            {
                MyUtility.Swap(ref ngayBD, ref ngayKT);
            }
            List <DateTime> DSNgayCheck = new List <DateTime>();

            for (DateTime indexNgay = ngayBD; indexNgay <= ngayKT; indexNgay = indexNgay.AddDays(1d))
            {
                DSNgayCheck.Add(indexNgay);
            }


            #region ko cho chỉnh sửa giờ nếu khoảng thời gian xem công tồn tại các ngày đã kết lương

            if (XL.Kiemtra(DSNgayCheck[0], DSNgayCheck[DSNgayCheck.Count - 1]))
            {
                MessageBox.Show(String.Format(Resources.Text_KhoangTGDaKetCong_KoChinhSuaGioCC, "khai báo vắng", "khai báo vắng", "khai báo vắng"),
                                Resources.Caption_ThongBao, MessageBoxButtons.OK);
                return;
            }

            #endregion

            #region hỏi lại trước khi thực hiện
            if (MessageBox.Show(Resources.Text_XacNhanThemKhaiVang, Resources.Caption_XacNhan, MessageBoxButtons.YesNo) == DialogResult.No)
            {
                return;
            }
            #endregion

            // lấy loại vắng
            if (cbLoaiVang.SelectedItem == null)
            {
                ACMessageBox.Show("Bạn chưa chọn loại vắng", "Thông báo", 2000);
                return;
            }
            var rowLV = cbLoaiVang.SelectedItem as DataRowView;

            var absentCode  = rowLV["AbsentCode"].ToString();
            var workingDay  = 1f;
            var workingTime = 8f;

            var formatString = "[{0}] đã xin phép vắng [{1}] [{2}] ngày ngày [{3}]";
            var tableVang    = DAO.LietKeNgayVangChoNV(listMaCC_NV, DSNgayCheck.Min(), DSNgayCheck.Max());

            if (tableVang.Rows.Count > 0)
            {
                List <Warning> listWarning = new List <Warning>();
                foreach (var nv in listMaCC_NV)                  //duyệt từng nhân viên
                {
                    foreach (var ngay in DSNgayCheck)            // duyệt từng ngày check vắng của nhân viên
                    {
                        DateTime ngay1  = ngay;
                        int      nv1    = nv;
                        var      result = (from DataRow item in tableVang.Rows
                                           where (int)item["UserEnrollNumber"] == nv1 && (DateTime)item["TimeDate"] == ngay1
                                           select item).ToList();                                // lấy danh sách các xin phép vắng trong ngày xác định
                        if (result.Any())
                        {
                            // nếu có xin phép vắng thì ghi lại chuỗi các xin phép vắng đó
                            var userfullname = result[0]["UserFullName"].ToString();
                            listWarning.AddRange(result.Select(row123 => new Warning()
                            {
                                CB = "Đã có xin phép vắng",
                                ND = string.Format(formatString, userfullname, row123["AbsentCode"],
                                                   ((float)row123["Workingday"]).ToString("0.0#"),
                                                   ((DateTime)row123["TimeDate"]).ToString("dd/MM/yyyy"))
                            }));
                        }
                    }
                }

                // hiện form cảnh báo, nếu xác nhận tiếp tục thì thực hiện , ko thì dừng
                frmWarning frm = new frmWarning {
                    listWarning = listWarning, WindowState = FormWindowState.Normal, StartPosition = FormStartPosition.CenterParent
                };
                //Point temp = XL2.GetCenterLocation(this.MdiParent.Size.Width, this.MdiParent.Size.Height, frm.Size.Width, frm.Size.Height);
                //frm.Location = new Point(this.MdiParent.Location.X + temp.X, this.MdiParent.Location.Y + temp.Y);
                frm.ShowDialog();
                if (frm.TiepTuc == false)
                {
                    return;
                }
            }

            IsReload = true;
            IEnumerable <dynamic> listMaCC_NgayVang = (from macc in listMaCC_NV
                                                       from ngay in DSNgayCheck
                                                       select new { MaCC = macc, NgayVang = ngay });

            List <Error> listError = new List <Error>();
            XL.ThemNgayVang(listMaCC_NgayVang, workingDay, workingTime, 0f, absentCode, listError);
            if (listError.Count > 0)
            {
                frmError frm = new frmError {
                    StartPosition = FormStartPosition.CenterParent, listError = listError
                };
                frm.ShowDialog();
            }

            Close();
        }