Example #1
0
        /// <summary>
        /// Method override untuk menghandle item yang dipilih
        /// </summary>
        /// <param name="index">Diisi dengan index grid list</param>
        /// <param name="prompt">Informasi data yang dipilih</param>
        /// <returns></returns>
        protected bool IsSelectedItem(int index, string prompt)
        {
            if (index < 0)
            {
                var msg = "Maaf data '" + prompt + "' belum dipilih.";
                MsgHelper.MsgWarning(msg);

                return(false);
            }

            return(true);
        }
Example #2
0
        private void OpenMenu(DMenu dMenu, bool IsExpandTreeNode = true)
        {
            if (dMenu == null || dMenu.MenuType != MenuTypeEnum.Menu)
            {
                return;
            }

            if (IsExpandTreeNode)
            {
                OpenTreeNodeMenu(dMenu.Name);
            }
            //判断窗体是否已经打开
            foreach (Form frm in this.MdiChildren)
            {
                DMenu dMenuFrm = frm.Tag as DMenu;
                if (dMenuFrm.Guid.Equals(dMenu.Guid))
                {
                    //选中页签
                    if (tcMenu.SelectedTab != tcMenu.TabPages[dMenu.Guid])
                    {
                        tcMenu.SelectedTab = tcMenu.TabPages[dMenu.Guid];
                    }
                    txbMenuPath.Text = dMenu.FullPath;
                    pnlDestop.Hide();
                    frm.Activate();
                    return;
                }
            }
            //反射得到窗体
            Assembly dll  = Assembly.LoadFile(Path.Combine(_strAppPath, dMenu.DLLName));
            object   form = dll.CreateInstance(dMenu.FormName);

            if (form is Form)
            {
                Form newForm = form as Form;
                newForm.Tag         = dMenu;
                newForm.MdiParent   = this;
                newForm.WindowState = FormWindowState.Maximized;
                newForm.Activated  += ChildForm_Active;
                newForm.FormClosed += MdiChild_Close;
                //增加页签
                tcMenu.TabPages.Add(dMenu.Guid, dMenu.Name);
                tcMenu.TabPages[dMenu.Guid].Tag = dMenu;
                tcMenu.SelectedTab = tcMenu.TabPages[dMenu.Guid];
                txbMenuPath.Text   = dMenu.FullPath;

                newForm.Show();
            }
            else
            {
                MsgHelper.ShowErr("配置错误,【" + dMenu.Name + "】菜单不是窗体类型!");
            }
        }
Example #3
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            //messageBox title
            string loginIDError  = ValidationRegex.ValidteEmpty(this.lblLoginId.Text, this.txtLoginId.Text);
            string passwordError = ValidationRegex.ValidteEmpty(this.lblLoginPass.Text, this.txtLoginPass.Text);

            if (loginIDError != "")
            {
                MsgHelper.WarningMsg(loginIDError, ValidationRegex.publicTitle);
                return;
            }
            else if (passwordError != "")
            {
                MsgHelper.WarningMsg(passwordError, ValidationRegex.publicTitle);
                return;
            }

            IUserInfoService uiService = BLLFactory.ServiceAccess.CreateUserInfoService();
            UserInfo         userInfo  = new UserInfo();

            userInfo.loginID  = this.txtLoginId.Text;
            userInfo.password = this.txtLoginPass.Text;
            UserInfo us;

            try
            {
                us = uiService.userExist(userInfo);
                if (us != null)
                {
                    userinfo = us;
                    logger.Info(us.loginID + "ログイン成功。");
                    FrmMain.userinfo = us;
                    this.Dispose();
                    FrmMain mainForm = new FrmMain();
                    mainForm.ShowDialog();
                }
                else
                {
                    logger.Info("ログイン失敗。" + ValidationRegex.I003);
                    MsgHelper.WarningMsg(ValidationRegex.I003, ValidationRegex.publicTitle);
                }
            }
            catch (OdbcException ex)
            {
                // 例外処理
                MsgHelper.WarningMsg(ValidationRegex.I004, ValidationRegex.publicTitle);
            }
            catch (Exception ex)
            {
                // 例外処理
                MsgHelper.WarningMsg(ValidationRegex.I005, ValidationRegex.publicTitle);
            }
        }
Example #4
0
        public string WarnInfo(CedaObject co)
        {
            string str = "";

            if (co.Topic.Contains("YM.M.W"))
            {
                TMonitorLog tml = MsgHelper.Deserialize <TMonitorLog>(co.MessageBody);
                str = string.Format("{0} {1}--{2}", tml.MUpdatetime, tml.MDesc, tml.MKey);
                addCommon(str);
            }
            return(str);
        }
Example #5
0
        private void FrmGroupFile_FormClosing(object sender, FormClosingEventArgs e)
        {
            string sysChk = "0";
            string hidChk = "0";

            if (this.chkSystemFileFlg.Checked == true)
            {
                sysChk = "1";
            }
            if (this.chkSystemFileFlg.Checked == true)
            {
                hidChk = "1";
            }
            string chkExceptAttrFlg1 = this.chkExceptAttr1.Checked == true ? "1" : "0";
            string chkExceptAttrFlg2 = this.chkExceptAttr2.Checked == true ? "1" : "0";
            string chkExceptAttrFlg3 = this.chkExceptAttr3.Checked == true ? "1" : "0";

            if (gFlag == false)
            {
                if ((fileTypeSetLists.id == "" || fileTypeSetLists.id == null) &&
                    ((this.chkExceptAttr1.Checked == true || this.txtExceptAttr1.Text.Trim() != "") ||
                     (this.chkExceptAttr2.Checked == true || this.txtExceptAttr2.Text.Trim() != "") ||
                     (this.chkExceptAttr3.Checked == true || this.txtExceptAttr3.Text.Trim() != "") ||
                     this.chkSystemFileFlg.Checked == true || this.chkHiddenFileFlg.Checked == true))
                {
                    if (MsgHelper.QuestionMsg(ValidationRegex.Q003, ValidationRegex.publicTitle))
                    {
                        e.Cancel = false;
                    }
                    else
                    {
                        e.Cancel = true;
                    }
                }
                else if ((fileTypeSetLists.id != "" && fileTypeSetLists.id != null) && (fileTypeSetLists.exceptAttribute1 != this.txtExceptAttr1.Text.Trim() ||
                                                                                        fileTypeSetLists.exceptAttributeFlg1 != chkExceptAttrFlg1 ||
                                                                                        fileTypeSetLists.exceptAttribute2 != this.txtExceptAttr2.Text.Trim() ||
                                                                                        fileTypeSetLists.exceptAttributeFlg2 != chkExceptAttrFlg2 ||
                                                                                        fileTypeSetLists.exceptAttribute3 != this.txtExceptAttr3.Text.Trim() ||
                                                                                        fileTypeSetLists.exceptAttributeFlg3 != chkExceptAttrFlg3 ||
                                                                                        fileTypeSetLists.systemFileFlg != sysChk || fileTypeSetLists.hiddenFileFlg != hidChk))
                {
                    if (MsgHelper.QuestionMsg(ValidationRegex.Q003, ValidationRegex.publicTitle))
                    {
                        e.Cancel = false;
                    }
                    else
                    {
                        e.Cancel = true;
                    }
                }
            }
        }
Example #6
0
        protected override void Simpan()
        {
            if (_isNewData)
            {
                _golongan = new Golongan();
            }

            _golongan.nama_golongan         = txtGolongan.Text;
            _golongan.persentase_keuntungan = NumberHelper.StringToDouble(txtKeuntungan.Text, true);
            _golongan.diskon = NumberHelper.StringToDouble(txtDiskon.Text, true);

            var result          = 0;
            var validationError = new ValidationError();

            using (new StCursor(Cursors.WaitCursor, new TimeSpan(0, 0, 0, 0)))
            {
                if (_isNewData)
                {
                    result = _bll.Save(_golongan, ref validationError);
                }
                else
                {
                    result = _bll.Update(_golongan, ref validationError);
                }

                if (result > 0)
                {
                    Listener.Ok(this, _isNewData, _golongan);

                    if (_isNewData)
                    {
                        base.ResetForm(this);
                        txtGolongan.Focus();
                    }
                    else
                    {
                        this.Close();
                    }
                }
                else
                {
                    if (validationError.Message.NullToString().Length > 0)
                    {
                        MsgHelper.MsgWarning(validationError.Message);
                        base.SetFocusObject(validationError.PropertyName, this);
                    }
                    else
                    {
                        MsgHelper.MsgUpdateError();
                    }
                }
            }
        }
Example #7
0
 private void next_Click(object sender, EventArgs e)
 {
     if (i + 1 > maxpage) { MessageBox.Show("已经到最后一页了,再向后,臣妾做不到啊"); }
     else
     {
     i = i + 1;
     page.Text = i.ToString();
     dic["offset"] = (i - 1) * 20;
     msgbody = MsgHelper.Serializer<Dictionary<string, object>>(dic);
     request.MessageBody.addString((short)3, msgbody);
     sentMsg();}
 }
Example #8
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            var isConnected = false;

            SaveAppConfig();

            // tes koneksi ke server
            using (new StCursor(Cursors.WaitCursor, new TimeSpan(0, 0, 0, 0)))
            {
                IDbConnectionHelper dbConn = new DbConnectionHelper();
                isConnected = dbConn.IsOpenConnection();
            }

            if (!isConnected)
            {
                var msg = "Maaf koneksi ke server database gagal !!!\n" +
                          "Silahkan cek koneksi jaringan Anda.";
                MsgHelper.MsgError(msg);
                return;
            }

            using (new StCursor(Cursors.WaitCursor, new TimeSpan(0, 0, 0, 0)))
            {
                IPenggunaBll penggunaBll = new PenggunaBll(_log);

                var pass    = CryptoHelper.GetMD5Hash(txtPassword.Text, MainProgram.securityCode);
                var isLogin = penggunaBll.IsValidPengguna(txtUserName.Text, pass);

                if (isLogin)
                {
                    log4net.GlobalContext.Properties["UserName"] = txtUserName.Text;
                    MainProgram.pengguna = penggunaBll.GetByID(txtUserName.Text);

                    SetProfil();

                    //TODO: fix me, aktifkan jika module report sudah selesai

                    /*
                     * if (!Utils.IsRunningUnderIDE())
                     * {
                     *  LoadCrystalReportLib();
                     * }*/

                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
                else
                {
                    MsgHelper.MsgWarning("User name atau password salah !!!");
                    txtUserName.Focus();
                }
            }
        }
Example #9
0
        //请求订阅
        private void cedaManager_OnCedaMessage(Message obj)
        {
            CedaObject     co  = CedaObject.ToCedaObject(obj);
            MonitorMessage ts  = MsgHelper.Deserialize <MonitorMessage>(co.MessageBody, MsgSerializerType.Json);
            string         key = ts.type;
            DateTime       dt  = zedgraphHelper.stringToDateTime(ts.date + " " + ts.time);
            XDate          xd  = new XDate(dt);
            double         d   = Convert.ToDouble(ts.num);

            if (d != 0 && i > d)
            {
                PointPair pointPair = new PointPair((double)xd, d);
                addPointData(key, pointPair);
                if (pointData.getPointPairListByKey(key).Count <= 0)
                {
                    this.createLines();
                }

                if (pointData.getPointPairListByKey(key).Count > c)
                {
                    pointData.getPointPairListByKey(key).RemoveRange(0, pointData.getPointPairListByKey(key).Count - c);
                    this.refreshPane();
                }
                else
                {
                    this.refreshPane();
                }
            }


            if (d != 0 && i <= d)
            {
                i = d;
                gp.YAxis.Scale.Max       = i * 2;
                gp.YAxis.Scale.MinorStep = gp.YAxis.Scale.MajorStep = i / 10;
                PointPair pointPair = new PointPair((double)xd, d);
                addPointData(key, pointPair);
                if (pointData.getPointPairListByKey(key).Count <= 0)
                {
                    this.createLines();
                }

                if (pointData.getPointPairListByKey(key).Count > c)
                {
                    pointData.getPointPairListByKey(key).RemoveRange(0, pointData.getPointPairListByKey(key).Count - c);
                    this.refreshPane();
                }
                else
                {
                    this.refreshPane();
                }
            }
        }
        protected override void Simpan()
        {
            if (_isNewData)
            {
                _dropshipper = new Dropshipper();
            }

            _dropshipper.nama_dropshipper = txtDropshipper.Text;
            _dropshipper.alamat           = txtAlamat.Text;
            _dropshipper.telepon          = txtTelepon.Text;

            var result          = 0;
            var validationError = new ValidationError();

            using (new StCursor(Cursors.WaitCursor, new TimeSpan(0, 0, 0, 0)))
            {
                if (_isNewData)
                {
                    result = _bll.Save(_dropshipper, ref validationError);
                }
                else
                {
                    result = _bll.Update(_dropshipper, ref validationError);
                }

                if (result > 0)
                {
                    Listener.Ok(this, _isNewData, _dropshipper);

                    if (_isNewData)
                    {
                        base.ResetForm(this);
                        txtDropshipper.Focus();
                    }
                    else
                    {
                        this.Close();
                    }
                }
                else
                {
                    if (validationError.Message.NullToString().Length > 0)
                    {
                        MsgHelper.MsgWarning(validationError.Message);
                        base.SetFocusObject(validationError.PropertyName, this);
                    }
                    else
                    {
                        MsgHelper.MsgUpdateError();
                    }
                }
            }
        }
Example #11
0
        protected override void Simpan()
        {
            if (_isNewData)
            {
                _customer = new Customer();
            }

            _customer.nama_customer  = txtCustomer.Text;
            _customer.alamat         = txtAlamat.Text;
            _customer.kontak         = txtKontak.Text;
            _customer.telepon        = txtTelepon.Text;
            _customer.plafon_piutang = NumberHelper.StringToDouble(txtPlafonPiutang.Text);

            var result          = 0;
            var validationError = new ValidationError();

            if (_isNewData)
            {
                result = _bll.Save(_customer, ref validationError);
            }
            else
            {
                result = _bll.Update(_customer, ref validationError);
            }

            if (result > 0)
            {
                Listener.Ok(this, _isNewData, _customer);

                if (_isNewData)
                {
                    base.ResetForm(this);
                    txtCustomer.Focus();
                }
                else
                {
                    this.Close();
                }
            }
            else
            {
                if (validationError.Message.Length > 0)
                {
                    MsgHelper.MsgWarning(validationError.Message);
                    base.SetFocusObject(validationError.PropertyName, this);
                }
                else
                {
                    MsgHelper.MsgUpdateError();
                }
            }
        }
Example #12
0
        private void PreviewReport()
        {
            var periode = string.Empty;

            IReportJualProdukBll        reportBll = new ReportJualProdukBll(_log);
            IList <ReportProdukFavorit> listOfReport;

            var limit = (int)updLimit.Value;

            if (rdoTanggal.Checked)
            {
                if (!DateTimeHelper.IsValidRangeTanggal(dtpTanggalMulai.Value, dtpTanggalSelesai.Value))
                {
                    MsgHelper.MsgNotValidRangeTanggal();
                    return;
                }

                var tanggalMulai   = DateTimeHelper.DateToString(dtpTanggalMulai.Value);
                var tanggalSelesai = DateTimeHelper.DateToString(dtpTanggalSelesai.Value);

                periode = dtpTanggalMulai.Value == dtpTanggalSelesai.Value ? string.Format("Periode : {0}", tanggalMulai) : string.Format("Periode : {0} s.d {1}", tanggalMulai, tanggalSelesai);

                listOfReport = reportBll.ProdukFavoritGetByTanggal(dtpTanggalMulai.Value, dtpTanggalSelesai.Value, limit);
            }
            else
            {
                periode = string.Format("Periode : {0} {1}", cmbBulan.Text, cmbTahun.Text);

                var bulan = cmbBulan.SelectedIndex + 1;
                var tahun = int.Parse(cmbTahun.Text);

                listOfReport = reportBll.ProdukFavoritGetByBulan(bulan, tahun, limit);
            }

            if (listOfReport.Count > 0)
            {
                var reportDataSource = new ReportDataSource
                {
                    Name  = "DsProdukFavorit",
                    Value = listOfReport
                };

                var parameters = new List <ReportParameter>();
                parameters.Add(new ReportParameter("periode", periode));

                base.ShowReport(this.Text, "RvProdukFavorit", reportDataSource, parameters);
            }
            else
            {
                MsgHelper.MsgInfo("Maaf laporan data penjualan produk favorit tidak ditemukan");
            }
        }
        private void PreviewReport()
        {
            var periode = string.Empty;

            IReportRugiLabaBll reportBll      = new ReportRugiLabaBll(_log);
            ReportRugiLaba     reportLabaRugi = null;

            if (rdoTanggal.Checked)
            {
                if (!DateTimeHelper.IsValidRangeTanggal(dtpTanggalMulai.Value, dtpTanggalSelesai.Value))
                {
                    MsgHelper.MsgNotValidRangeTanggal();
                    return;
                }

                var tanggalMulai   = DateTimeHelper.DateToString(dtpTanggalMulai.Value);
                var tanggalSelesai = DateTimeHelper.DateToString(dtpTanggalSelesai.Value);

                periode = dtpTanggalMulai.Value == dtpTanggalSelesai.Value ? string.Format("Periode : {0}", tanggalMulai) : string.Format("Periode : {0} s.d {1}", tanggalMulai, tanggalSelesai);

                reportLabaRugi = reportBll.GetByTanggal(dtpTanggalMulai.Value, dtpTanggalSelesai.Value);
            }
            else
            {
                periode = string.Format("Periode : {0} {1}", cmbBulan.Text, cmbTahun.Text);

                var bulan = cmbBulan.SelectedIndex + 1;
                var tahun = int.Parse(cmbTahun.Text);

                reportLabaRugi = reportBll.GetByBulan(bulan, tahun);
            }

            if (reportLabaRugi != null)
            {
                var reportDataSource = new ReportDataSource
                {
                    Name  = "DsReportRugiLaba",
                    Value = new List <ReportRugiLaba> {
                        reportLabaRugi
                    }
                };

                var parameters = new List <ReportParameter>();
                parameters.Add(new ReportParameter("periode", periode));

                base.ShowReport(this.Text, "RvRugiLaba", reportDataSource, parameters);
            }
            else
            {
                MsgHelper.MsgInfo("Maaf laporan data laba rugi tidak ditemukan");
            }
        }
Example #14
0
        protected override void Simpan()
        {
            if (_isNewData)
            {
                _jabatan = new Jabatan();
            }

            _jabatan.nama_jabatan = txtJabatan.Text;
            _jabatan.keterangan   = txtKeterangan.Text;

            var result          = 0;
            var validationError = new ValidationError();

            using (new StCursor(Cursors.WaitCursor, new TimeSpan(0, 0, 0, 0)))
            {
                if (_isNewData)
                {
                    result = _bll.Save(_jabatan, ref validationError);
                }
                else
                {
                    result = _bll.Update(_jabatan, ref validationError);
                }

                if (result > 0)
                {
                    Listener.Ok(this, _isNewData, _jabatan);

                    if (_isNewData)
                    {
                        base.ResetForm(this);
                        txtJabatan.Focus();
                    }
                    else
                    {
                        this.Close();
                    }
                }
                else
                {
                    if (validationError.Message.NullToString().Length > 0)
                    {
                        MsgHelper.MsgWarning(validationError.Message);
                        base.SetFocusObject(validationError.PropertyName, this);
                    }
                    else
                    {
                        MsgHelper.MsgUpdateError();
                    }
                }
            }
        }
        protected override void Simpan()
        {
            if (_isNewData)
            {
                _kasbon = new Kasbon();
            }

            if (cmbKaryawan.SelectedIndex == 0)
            {
                MsgHelper.MsgWarning("Karyawan belum dipilih");
                return;
            }

            _kasbon.nota       = txtNota.Text;
            _kasbon.tanggal    = dtpTanggal.Value;
            _kasbon.nominal    = NumberHelper.StringToDouble(txtJumlah.Text);
            _kasbon.keterangan = txtKeterangan.Text;

            var karyawan = _listOfKaryawan[cmbKaryawan.SelectedIndex - 1];

            _kasbon.karyawan_id = karyawan.karyawan_id;
            _kasbon.Karyawan    = karyawan;

            _kasbon.pengguna_id = this._pengguna.pengguna_id;
            _kasbon.Pengguna    = this._pengguna;

            var result          = 0;
            var validationError = new ValidationError();

            if (_isNewData)
            {
                result = _bll.Save(_kasbon, ref validationError);
            }
            else
            {
                result = _bll.Update(_kasbon, ref validationError);
            }

            if (result > 0)
            {
                Listener.Ok(this, _isNewData, _kasbon);
                this.Close();
            }
            else
            {
                if (validationError.Message != null && validationError.Message.Length > 0)
                {
                    MsgHelper.MsgWarning(validationError.Message);
                    base.SetFocusObject(validationError.PropertyName, this);
                }
            }
        }
Example #16
0
        protected override void Simpan()
        {
            if (_isNewData)
            {
                _kartu = new Kartu();
            }

            _kartu.nama_kartu = txtNamaKartu.Text;
            _kartu.is_debit   = rdoKartuDebit.Checked;

            var result          = 0;
            var validationError = new ValidationError();

            using (new StCursor(Cursors.WaitCursor, new TimeSpan(0, 0, 0, 0)))
            {
                if (_isNewData)
                {
                    result = _bll.Save(_kartu, ref validationError);
                }
                else
                {
                    result = _bll.Update(_kartu, ref validationError);
                }

                if (result > 0)
                {
                    Listener.Ok(this, _isNewData, _kartu);

                    if (_isNewData)
                    {
                        base.ResetForm(this);
                        txtNamaKartu.Focus();
                    }
                    else
                    {
                        this.Close();
                    }
                }
                else
                {
                    if (validationError.Message.NullToString().Length > 0)
                    {
                        MsgHelper.MsgWarning(validationError.Message);
                        base.SetFocusObject(validationError.PropertyName, this);
                    }
                    else
                    {
                        MsgHelper.MsgUpdateError();
                    }
                }
            }
        }
        public FindNearbyPlacesPage()
        {
            this.InitializeComponent();

            api_findNearbyPlaces             = new APIMASHLib.APIMASHInvoke();
            api_findNearbyPlaces.OnResponse += api_findNearbyPlaces_OnResponse;
            _nearbyplaces = new APIMASH_WikiPediaLib.APIMASH_geonamesCollection();

            m_msghelper = new MsgHelper(TextBlock_Msg);
            m_msghelper.clr();
            m_msghelper.msg("initialized");
            m_msghelper.abouttextblock();
        }
Example #18
0
        private void mnuGantiUser_Click(object sender, EventArgs e)
        {
            if (MsgHelper.MsgKonfirmasi("Apakah proses ingin dilanjutkan ?"))
            {
                using (new StCursor(Cursors.WaitCursor, new TimeSpan(0, 0, 0, 0)))
                {
                    CloseAllDocuments();

                    this.IsLogout = true;
                    this.Close();
                }
            }
        }
Example #19
0
        private void filterRangeTanggal_BtnTampilkanClicked(object sender, EventArgs e)
        {
            var tanggalMulai   = filterRangeTanggal.TanggalMulai;
            var tanggalSelesai = filterRangeTanggal.TanggalSelesai;

            if (!DateTimeHelper.IsValidRangeTanggal(tanggalMulai, tanggalSelesai))
            {
                MsgHelper.MsgNotValidRangeTanggal();
                return;
            }

            LoadData(tanggalMulai, tanggalSelesai);
        }
Example #20
0
        private void btnCetakLabelNota_Click(object sender, EventArgs e)
        {
            if (MsgHelper.MsgKonfirmasi("Apakah proses pencetakan ingin dilanjutkan ?"))
            {
                using (new StCursor(Cursors.WaitCursor, new TimeSpan(0, 0, 0, 0)))
                {
                    IJualProdukBll bll    = new JualProdukBll(_log);
                    var            result = bll.Update(_jual);

                    PreviewLabelNota(_jual, false);
                }
            }
        }
Example #21
0
        void _cedaSubscribe_OnCedaMessage(com.adaptiveMQ2.message.Message msg)
        {
            //   MessageBox.Show("Receive Message...");
            CedaObject co = CedaObject.ToCedaObject(msg);

            listRes = MsgHelper.Deserialize <MonitorUserCount>(co.MessageBody, MsgSerializerType.Json);
            // MessageBox.Show(listRes.Time + "        listRes.Time  ");
            string str = string.Format("地址:{2}:{3}  Topic={0},MessageBody=\n{1}", co.Topic, co.MessageBody, ip, port);

            LogHelper.Info(str);
            //消息窗口显示E
            dealwith_msg(listRes);
        }
Example #22
0
        private void FrmGroupDetail_FormClosing(object sender, FormClosingEventArgs e)
        {
            string selectGroupId = this.cobBKServerGroup.SelectedValue.ToString();
            IBackupServerGroupDetailService backGroupDetail = BLLFactory.ServiceAccess.CreateBackupServerGroupDetailService();
            IList <BackupServerGroupDetail> bsgdLists       = backGroupDetail.GetBackupServerGroupDetailByGroupId(selectGroupId);
            List <string> list1 = new List <string>();
            List <string> list2 = new List <string>();

            foreach (BackupServerGroupDetail bsgd in bsgdLists)
            {
                list1.Add(bsgd.backupServerId.ToString());
            }
            for (int i = 0; i < this.dgrdMonitorServer.Rows.Count; i++)
            {
                list2.Add(this.dgrdMonitorServer.Rows[i].Cells[0].Value.ToString());
            }
            if (list1.Count != list2.Count)
            {
                //if (MsgHelper.QuestionMsg(ValidationRegex.Q003, ValidationRegex.publicTitle))
                //{
                //    e.Cancel = false;
                //}
                //else
                //{
                //    e.Cancel = true;
                //}
            }
            else
            {
                bool flag = false;
                foreach (string i in list1)
                {
                    if (!list2.Contains(i))
                    {
                        flag = true;
                        break;
                    }
                }
                if (flag)
                {
                    if (MsgHelper.QuestionMsg(ValidationRegex.Q003, ValidationRegex.publicTitle))
                    {
                        e.Cancel = false;
                    }
                    else
                    {
                        e.Cancel = true;
                    }
                }
            }
        }
Example #23
0
        protected override void Simpan()
        {
            if (_isNewData)
            {
                _supplier = new Supplier();
            }

            _supplier.nama_supplier = txtSupplier.Text;
            _supplier.alamat        = txtAlamat.Text;
            _supplier.kontak        = txtKontak.Text;
            _supplier.telepon       = txtTelepon.Text;

            var result          = 0;
            var validationError = new ValidationError();

            if (_isNewData)
            {
                result = _bll.Save(_supplier, ref validationError);
            }
            else
            {
                result = _bll.Update(_supplier, ref validationError);
            }

            if (result > 0)
            {
                Listener.Ok(this, _isNewData, _supplier);

                if (_isNewData)
                {
                    base.ResetForm(this);
                    txtSupplier.Focus();
                }
                else
                {
                    this.Close();
                }
            }
            else
            {
                if (validationError.Message.Length > 0)
                {
                    MsgHelper.MsgWarning(validationError.Message);
                    base.SetFocusObject(validationError.PropertyName, this);
                }
                else
                {
                    MsgHelper.MsgUpdateError();
                }
            }
        }
Example #24
0
        //建立连接
        public void connect()
        {
            initialize_ip_port_svrID();
            ClientInfo clientInfo = new ClientInfo();

            clientInfo.setAddress(ip, port);
            clientInfo.setUser("monitor", "monitor");
            clientInfo.Protocol = ClientInfo.PROTOCOL_TCP;
            ThreadPool.QueueUserWorkItem(o =>
            {
                cedaManager.Connect(clientInfo);
                if (cedaManager == null)
                {
                    return;
                }
                if (cedaManager.IsConnected)
                {
                    //string msgbody = MsgHelper.Serializer<Dictionary<string, object>>(dic);
                    cedaManager.SubscribeWithImage(topicStr, svrId);
                    List <String> topicList = new List <String>();
                    topicList.Add(topicStr);
                    cedaManager.Subscribe(topicStr);
                    while (cedaManager.IsConnected)
                    {
                        if (cedaManager.IsConnected)
                        {
                            Message reply = cedaManager.Request(getMessage());
                            CedaObject co = CedaObject.ToCedaObject(reply);
                            if (co != null)
                            {
                                LogHelper.Debug(co.Topic + ":" + co.MessageBody);

                                HisMonitorMessages result = MsgHelper.Deserialize <HisMonitorMessages>(co.MessageBody, MsgSerializerType.Json);
                                lock (pointData)
                                {
                                    setLinesData(result.Data);
                                    createLines();
                                }
                                LogHelper.Debug("init end.");
                                break;
                            }
                            else
                            {
                                LogHelper.Error("reply is null.");
                            }
                        }
                        Thread.Sleep(1000);
                    }
                }
            });
        }
        /// <summary>
        /// 导出按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tsbExport_Click(object sender, EventArgs e)
        {
            string    strWhere         = string.IsNullOrEmpty(rtbWhere.Text.Trim()) == true ? "" : " WHERE " + rtbWhere.Text.Trim();
            string    strDataTableName = cbbTableName.Text.Trim();
            DataTable dtCount          = _dataAccess.DataAccess.QueryHadParamSqlData("SELECT * FROM " + strDataTableName + strWhere, _dicQueryCondition);

            if (dtCount.Rows[0][0].ToString() == "0")
            {
                MsgHelper.ShowErr("没有要生成的记录!", "提示");
                return;
            }
            //导出Excel
            ExportHelper.ExportExcel(dtCount, "数据_" + strDataTableName);
        }
Example #26
0
        private async void Wb_Dc_Login(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            if (wb.DocumentTitle.Contains("QQ音乐"))
            {
                FormBorderStyle = FormBorderStyle.None;
                Opacity         = 0;
                TopMost         = false;
                await Task.Delay(100);

                string qq = TextHelper.XtoYGetTo(wb.Document.Cookie, "pt2gguin=o", ";", 0);
                MsgHelper.SendMsg("Login:"******"###", wind);
                wb.DocumentCompleted -= Wb_Dc_Login;
            }
        }
Example #27
0
        private void CetakLaporan()
        {
            if (MsgHelper.MsgKonfirmasi("Apakah proses pencetakan ingin dilanjutkan ?"))
            {
                var autocutCode = _pengaturanUmum.is_autocut ? _pengaturanUmum.autocut_code : string.Empty;

                IRAWPrinting printerMiniPos = new PrinterMiniPOS(_pengaturanUmum.nama_printer);

                printerMiniPos.Cetak(_listOfMesinKasir, _pengaturanUmum.list_of_header_nota_mini_pos, _pengaturanUmum.jumlah_karakter,
                                     _pengaturanUmum.jumlah_gulung, ukuranFont: _pengaturanUmum.ukuran_font, autocutCode: autocutCode);

                this.Close();
            }
        }
Example #28
0
        private void mnuGolongan_Click(object sender, EventArgs e)
        {
            var header = GetMenuTitle(sender);
            var menuId = _getMenuID[GetFormName(sender)];

            MsgHelper.MsgInfo(GetMenuName(sender));

            if (!IsChildFormExists(_frmListGolongan))
            {
                _frmListGolongan = new FrmListGolongan(header, MainProgram.pengguna, menuId);
            }

            _frmListGolongan.Show(this.mainDock);
        }
Example #29
0
        private void gridControl_CurrentCellValidated(object sender, EventArgs e)
        {
            var grid = (GridControl)sender;

            GridCurrentCell cc = grid.CurrentCell;

            var itemPembayaran  = _listOfItemPembayaranHutang[cc.RowIndex - 1];
            var beli            = itemPembayaran.BeliProduk;
            var isValidSisaNota = true;

            if (beli != null)
            {
                switch (cc.ColIndex)
                {
                case 5:     // kolom pembayaran
                    itemPembayaran.nominal = NumberHelper.StringToDouble(cc.Renderer.ControlValue.ToString());
                    beli.total_pelunasan   = itemPembayaran.nominal + beli.total_pelunasan_old;
                    isValidSisaNota        = beli.sisa_nota >= 0;

                    if (!isValidSisaNota)
                    {
                        beli.total_pelunasan -= itemPembayaran.nominal;

                        MsgHelper.MsgWarning("Maaf, jumlah pembayaran melebihi sisa hutang");

                        GridListControlHelper.SetCurrentCell(grid, cc.RowIndex, cc.ColIndex);
                        GridListControlHelper.SelectCellText(grid, cc.RowIndex, cc.ColIndex);

                        break;
                    }
                    else
                    {
                        GridListControlHelper.SetCurrentCell(grid, cc.RowIndex, cc.ColIndex + 1);
                    }

                    break;

                case 6:     // kolom keterangan
                    itemPembayaran.keterangan = cc.Renderer.ControlValue.ToString();
                    break;

                default:
                    break;
                }

                SetItemBayar(grid, cc.RowIndex, cc.ColIndex, beli, itemPembayaran.nominal, itemPembayaran.keterangan);
                grid.Refresh();
                RefreshTotal();
            }
        }
Example #30
0
        public frmMain(string[] args)
            : base()
        {
            InitializeComponent();

            mStartArgs = args;

            LoadSettings();
            // using Client logger for main messages/logs
            SafeIo.Initialize(Logger);
            MsgHelper.Initialize(Logger);

            LoadPlugins(AppDomain.CurrentDomain.BaseDirectory + @"\Plugins\");
        }