private void btnBeforePage_Click(object sender, EventArgs e) { if (startIndex - 6 < 0) { MyMsg.MsgInfo("已经是第一页了!"); return; } startIndex = startIndex - 6; DataBind(isZJ); }
//保存文件 void Menuitem_saveClick(object sender, EventArgs e) { if (this.dockPanel.ActiveContent is IEditForm cf) { if (cf.Save())//是否保存成功 { MyMsg.Show(LMSG.SaveFileOK); } } }
public MyMsg pull() { if (data.Count <= 0) { return(null); } MyMsg ret = data[0]; data.RemoveAt(0); return(ret); }
void Menuitem_saveAsClick(object sender, EventArgs e) { if (dockPanel.ActiveContent is IEditForm cf) { if (cf.Save(true))//是否保存成功 { history.AddHistory(cf.GetOpenFile()); MyMsg.Show(LMSG.SaveFileOK); } } }
//保存文件 void Menuitem_saveClick(object sender, EventArgs e) { IEditForm cf = dockPanel1.ActiveContent as IEditForm; if (cf != null) { if (cf.Save())//是否保存成功 { MyMsg.Show(LMSG.SaveFileOK); } } }
public bool Execute(params object[] args) { if (!dataform.CheckOpen()) { return(false); } Card c = dataform.GetCard(); if (c.id <= 0)//卡片密码不能小于等于0 { MyMsg.Error(LMSG.CodeCanNotIsZero); return(false); } else if (c.id > 268435455) { MyMsg.Error(LMSG.AddFail); return(false); } else if (c.omega[0] > 0) { if (c.ot > 0x7) { MyMsg.Error(LMSG.AddFail); return(false); } else if (c.id > 134217727) { MyMsg.Warning("Strings will fail to show up for this passcode."); } } Card[] cards = dataform.GetCardList(false); foreach (Card ckey in cards)//卡片id存在 { if (c.id == ckey.id) { MyMsg.Warning(LMSG.ItIsExists); return(false); } } if (DataBase.Command(dataform.GetOpenFile(), (dataform.GetOpenFile().EndsWith(".db", StringComparison.OrdinalIgnoreCase) || dataform.GetOpenFile().EndsWith(".bytes", StringComparison.OrdinalIgnoreCase) ? DataBase.OmegaGetInsertSQL(c, true) : DataBase.GetInsertSQL(c, true))) >= 2) { MyMsg.Show(LMSG.AddSucceed); undoSQL = DataBase.GetDeleteSQL(c); dataform.Search(true); dataform.SetCard(c); return(true); } MyMsg.Error(LMSG.AddFail); return(false); }
public async Task Handle(MyMsg message) { if (Data.Child == null) { Data.Child = new Child { Property = message.CorrId }; } _messagesBySagaId.AddOrUpdate(Data.Id, 1, (_, count) => count + 1); _counter.Decrement(); }
/// <summary> /// 将消息分发至用户 /// </summary> /// <param name="sm"></param> /// <param name="UserList"></param> /// <returns></returns> public bool DispatchMsg(SystemMsg sm, string[] UserList) { foreach (string userid in UserList) { MyMsg mm = new MyMsg(); mm.SystemMsgID = sm.ID; mm.UserID = userid; this.m_UnitOfWork.GetRepositoryBase <MyMsg>().Add(mm); } //开启另外一个线程进行短信发送 return(true); }
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { Msgvisable(this.lblMsg, true); PutCardUniversal pc = new PutCardUniversal(); int i = pc.OutCardD1000(0, 0, FrmMain.userInfo, 0); if (i == -1) { //退卡 this.Close(); } SkyComm skyComm = new SkyComm(); DataSet parInfo = skyComm.QueryPatInfo(FrmMain.cardInfoStruct.CardNo); if (parInfo.Tables[0].Rows.Count <= 0) { e.Result = "失败"; MyMsg.MsgInfo("卡号无效! 卡号:" + FrmMain.cardInfoStruct.CardNo); this.Close(); } FrmMain.patientInfoData = parInfo; FrmMain.cardBlance = Convert.ToDecimal(FrmMain.patientInfoData.Tables[0].Rows[0]["LeftJinE"]); MyAlert m = new MyAlert(); m.alerttype = "开始充值"; if (m.ShowDialog() == DialogResult.OK) { parInfo = skyComm.QueryPatInfo(FrmMain.cardInfoStruct.CardNo); if (parInfo.Tables[0].Rows.Count <= 0) { e.Result = "失败"; MyMsg.MsgInfo("卡号无效! 卡号:" + FrmMain.cardInfoStruct.CardNo); this.Close(); } FrmMain.patientInfoData = parInfo; FrmMain.cardBlance = Convert.ToDecimal(FrmMain.patientInfoData.Tables[0].Rows[0]["LeftJinE"]); FrmRecharge fr = new FrmRecharge(); fr.ShowDialog(); } else { //退卡 this.Close(); } }
//新建文件 void Menuitem_newClick(object sender, EventArgs e) { using SaveFileDialog dlg = new(); dlg.Title = LanguageHelper.GetMsg(LMSG.NewFile); if (GetActive() != null)//判断当前窗口是不是DataEditor { try { dlg.Filter = LanguageHelper.GetMsg(LMSG.CdbType); } catch { } } else { try { dlg.Filter = LanguageHelper.GetMsg(LMSG.ScriptFilter); } catch { } } if (dlg.ShowDialog() == DialogResult.OK) { string file = dlg.FileName; if (File.Exists(file)) { File.Delete(file); } //是否是数据库 if (YGOUtil.IsDataBase(file)) { if (DataBase.Create(file)) //是否创建成功 { if (MyMsg.Question(LMSG.IfOpenDataBase)) //是否打开新建的数据库 { Open(file); } } } else { try { File.Create(file).Dispose(); } catch { } Open(file); } } }
//复制选中 void Menuitem_copyselecttoClick(object sender, EventArgs e) { DataEditForm df = GetActive();//获取当前的数据库编辑 if (df != null) { tCards = df.GetCardList(true); //获取选中的卡片 if (tCards != null) { SetCopyNumber(tCards.Length);//显示复制卡片的数量 MyMsg.Show(LMSG.CopyCards); } } }
//复制当前结果 void Menuitem_copyallClick(object sender, EventArgs e) { DataEditForm df = this.GetActive();//获取当前的数据库编辑 if (df != null) { this.tCards = df.GetCardList(false);//获取结果的所有卡片 if (this.tCards != null) { this.SetCopyNumber(this.tCards.Length);//显示复制卡片的数量 MyMsg.Show(LMSG.CopyCards); } } }
}// AlarmStart_Click() // // // private void AlarmCallback(object sender, EventArgs eventArgs) { if (this.InvokeRequired) { this.Invoke(new EventHandler(AlarmCallback), sender, eventArgs); } else { DateTime dt = DateTime.Now; MyMsg e = (MyMsg)eventArgs; string s = string.Format("\r\nAlarm set for {0:HH:mm:ss.fff}. Callback received {1:HH:mm:ss.fff}.", e.dateTime, dt); textBoxOutput.AppendText(s); } }// AlarmCallback()
//删除 public bool DelCards(bool deletefiles) { if (!dataform.CheckOpen()) { return(false); } Card[] cards = dataform.GetCardList(true); if (cards == null || cards.Length == 0) { return(false); } string undo = ""; if (!MyMsg.Question(LMSG.IfDeleteCard)) { return(false); } List <string> sql = new List <string>(); FileDeleted delete = new FileDeleted(); foreach (Card c in cards) { sql.Add(DataBase.GetDeleteSQL(c));//删除 undo += DataBase.GetInsertSQL(c, true); //删除资源 if (deletefiles) { YGOUtil.CardDelete(c.id, dataform.GetPath(), YGOUtil.DeleteOption.BACKUP); delete.deleted = true; delete.ids.Add(c.id); } } if (DataBase.Command(dataform.GetOpenFile(), sql.ToArray()) >= (sql.Count * 2)) { MyMsg.Show(LMSG.DeleteSucceed); dataform.Search(true); undoSQL.Add(undo); undoDeleted.Add(delete); undoModified.Add(new FileModified()); undoCopied.Add(new DBcopied()); return(true); } else { MyMsg.Error(LMSG.DeleteFail); dataform.Search(true); } return(false); }
// private void AlarmStart_Click(object sender, EventArgs e) { // Create alarm if not already existing if (m_Alarm == null) { m_Alarm = new Alarm(); m_Alarm.SlopSeconds = 0.20; // lower the slop } // Load events DateTime dt = DateTime.Now.AddSeconds(2.0); // ask for call back in two seconds MyMsg msg = new MyMsg(); msg.dateTime = dt; m_Alarm.Set(dt, AlarmCallback, msg); }// AlarmStart_Click()
//粘贴卡片 void Menuitem_pastecardsClick(object sender, EventArgs e) { if (tCards == null) { return; } DataEditForm df = GetActive(); if (df == null) { return; } df.SaveCards(tCards);//保存卡片 MyMsg.Show(LMSG.PasteCards); }
public bool Excute(params object[] args) { if (!this.dataform.CheckOpen()) { return(false); } bool deletefiles = (bool)args[0]; Card[] cards = this.dataform.GetCardList(true); if (cards == null || cards.Length == 0) { return(false); } string undo = ""; if (!MyMsg.Question(LMSG.IfDeleteCard)) { return(false); } List <string> sql = new List <string>(); foreach (Card c in cards) { sql.Add(DataBase.GetDeleteSQL(c)); //删除 undo += DataBase.GetInsertSQL(c, true); //删除资源 if (deletefiles) { YGOUtil.CardDelete(c.id, this.dataform.GetPath()); } } if (DataBase.Command(this.dataform.GetOpenFile(), sql.ToArray()) >= (sql.Count * 2)) { MyMsg.Show(LMSG.DeleteSucceed); this.dataform.Search(true); this.undoSQL = undo; return(true); } else { MyMsg.Error(LMSG.DeleteFail); this.dataform.Search(true); } return(false); }
public bool Execute(params object[] args) { if (!dataform.CheckOpen()) { return(false); } bool deletefiles = (bool)args[0]; Card[] cards = dataform.GetCardList(true); if (cards == null || cards.Length == 0) { return(false); } string undo = ""; if (!MyMsg.Question(LMSG.IfDeleteCard)) { return(false); } List <string> sql = new(); foreach (Card c in cards) { sql.Add(DataBase.GetDeleteSQL(c));//删除 undo += (dataform.GetOpenFile().EndsWith(".db", StringComparison.OrdinalIgnoreCase) || dataform.GetOpenFile().EndsWith(".bytes", StringComparison.OrdinalIgnoreCase)) ? DataBase.OmegaGetInsertSQL(c, true) : DataBase.GetInsertSQL(c, true); //删除资源 if (deletefiles) { YGOUtil.CardDelete(c.id, dataform.GetPath()); } } if (DataBase.Command(dataform.GetOpenFile(), sql.ToArray()) >= (sql.Count * 2)) { MyMsg.Show(LMSG.DeleteSucceed); dataform.Search(true); undoSQL = undo; return(true); } else { MyMsg.Error(LMSG.DeleteFail); dataform.Search(true); } return(false); }
private void backgroundWorker2_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (e.Error != null) { MyMsg.MsgInfo(e.Error.Message); this.ParentForm.DialogResult = DialogResult.Cancel; } else { this.guahaoVisable(false); this.LableVisable(lblmsg1, false); this.LableVisable(lblmsg2, false); this.LableVisable(lblmsg3, false); this.ParentForm.DialogResult = DialogResult.OK; } }
//消费明细 private void lblXf_MouseClick(object sender, MouseEventArgs e) { if (string.IsNullOrEmpty(FrmMain.cardInfoStruct.CardNo)) { MyMsg.MsgInfo("请插入您的就诊卡"); this.Close(); return; } Label lb = sender as Label; FrmRechargeDetail fc = new FrmRechargeDetail(); // fc.lblName.Text = dt.Rows[0]["DoctorName"].ToString(); Point p = lb.PointToScreen(e.Location); fc.Location = new Point(p.X - fc.Width, p.Y); fc.ShowDialog(); }
public bool Excute(params object[] args) { if (!this.dataform.CheckOpen()) { return(false); } Card[] cards = (Card[])args[0]; if (cards == null || cards.Length == 0) { return(false); } bool replace = false; Card[] oldcards = DataBase.Read(this.dataform.GetOpenFile(), true, ""); if (oldcards != null && oldcards.Length != 0) { int i = 0; foreach (Card oc in oldcards) { foreach (Card c in cards) { if (c.id == oc.id) { i += 1; if (i == 1) { replace = MyMsg.Question(LMSG.IfReplaceExistingCard); break; } } } if (i > 0) { break; } } } DataBase.CopyDB(this.dataform.GetOpenFile(), !replace, cards); this.copied = true; this.newCards = cards; this.replace = replace; this.oldCards = oldcards; return(true); }
//打开脚本 public bool OpenScript(bool openinthis) { if (!dataform.CheckOpen()) { return(false); } Card c = dataform.GetCard(); if (c.id <= 0)//卡片密码不能小于等于0 { return(false); } string lua = dataform.GetPath().GetScript(c.id); if (!File.Exists(lua)) { MyPath.CreateDirByFile(lua); if (MyMsg.Question(LMSG.IfCreateScript))//是否创建脚本 { using (FileStream fs = new FileStream(lua, FileMode.OpenOrCreate, FileAccess.Write)) { StreamWriter sw = new StreamWriter(fs, new UTF8Encoding(false)); sw.WriteLine("--" + c.name); sw.WriteLine("function c" + c.id.ToString() + ".initial_effect(c)"); sw.WriteLine("\t"); sw.WriteLine("end"); sw.Close(); fs.Close(); } } } if (File.Exists(lua)) //如果存在,则打开文件 { if (openinthis) //是否用本程序打开 { MyConfig.OpenFileInThis(lua); } else { System.Diagnostics.Process.Start(lua); } return(true); } return(false); }
private void timer1_Tick(object sender, EventArgs e) { timer1.Stop(); string cardid = string.Empty; string cardType = SkyComm.getvalue("卡类型"); //if (cardType == "磁条卡") //{ cardid = m100ReadCard.ReadCard(); //} //else if (cardType == "IC卡") //{ // cardid = m100ICReadCard.ReadCard(); //} if (cardid == string.Empty) { this.Close(); } //MessageBox.Show("卡号: " + cardid); FrmMain.cardInfoStruct.CardNo = cardid; //FrmMain.cardInfoStruct.CardNo = "002000000024153734"; if (FrmMain.cardInfoStruct.CardNo != string.Empty && FrmMain.cardInfoStruct.CardNo.Length >= 6) { //MyMsg.MsgInfo(FrmMain.cardInfoStruct.CardNo); //FrmMain.cardInfoStruct.CardNo = "002000000024153734";// "001000776394154179"; backgroundWorker1.RunWorkerAsync(); //FrmMain.cardInfoStruct.CardNo = aa; timer1.Stop(); this.top1.timer1.Stop(); } else { if (incardcount > 0) { MyMsg.MsgInfo("卡片无效,请确认插入方向后重新插卡!"); incardcount--; timer1.Start(); } else { this.DialogResult = DialogResult.Cancel; } } }
public static void CheckVersion(bool showNew) { string newver = CheckUpdate.GetNewVersion(MyConfig.ReadString(MyConfig.TAG_UPDATE_URL)); if (newver == CheckUpdate.DEFAULT) { //检查失败 if (!showNew) { return; } MyMsg.Error(LMSG.CheckUpdateFail); return; } if (CheckUpdate.CheckVersion(newver, Application.ProductVersion)) {//有最新版本 if (!MyMsg.Question(LMSG.HaveNewVersion)) { return; } } else {//现在就是最新版本 if (!showNew) { return; } if (!MyMsg.Question(LMSG.NowIsNewVersion)) { return; } } //下载文件 if (CheckUpdate.DownLoad( MyPath.Combine(Application.StartupPath, newver + ".zip"))) { MyMsg.Show(LMSG.DownloadSucceed); } else { MyMsg.Show(LMSG.DownloadFail); } }
public string ReadCard() { IntPtr hadler = Init(); int rs = 0; if (hadler.ToInt32() == 0) { MyMsg.MsgInfo("端口打开失败!"); return(string.Empty); } try { string cardNo = string.Empty; StringBuilder sb = new StringBuilder(1024); StringBuilder ByteArray2 = new StringBuilder(1024); byte _track = Convert.ToByte(0x31); byte[] _DataLen = new byte[1]; int i = K101_DLL.K101_ReadMagcardDecode(hadler, false, Convert.ToByte(0), _track, _DataLen, ByteArray2, sb); if (i != 0) { MyMsg.MsgInfo("卡机读卡失败!"); return(cardNo); } if (Convert.ToInt32(_DataLen[0]) > 0) { cardNo = ByteArray2.ToString().Trim().Substring(2, Convert.ToInt32(_DataLen[0]) - 2); } else { MyMsg.MsgInfo("磁卡数据错误!或是空卡"); } return(cardNo); } catch (Exception ex) { throw new Exception(ex.Message); } finally { ClosePort(hadler); } }
public async Task Handle(MyMsg message) { #if NETSTANDARD1_3 await Task.CompletedTask; #else await Task.FromResult(false); #endif if (Data.Child == null) { Data.Child = new Child { Property = message.CorrId }; } _messagesBySagaId.AddOrUpdate(Data.Id, 1, (_, count) => count + 1); _counter.Decrement(); }
/// <summary> /// 发送指令 /// </summary> /// <param name="hadler">打开的串口句柄</param> /// <param name="add">机器地址 0——15</param> /// <param name="cmd">指令内容 具体参考发卡器文档</param> /// <returns></returns> public bool sendcmd(string cmd) { IntPtr hadler = Init(); int rs = 0; if (hadler.ToInt32() == 0) { MyMsg.MsgInfo("端口打开失败!"); return(false); } try { rs = CRTCard.D1000_SendCmd(hadler, Convert.ToByte(0), "RS", 2); if (rs == 0) { Thread.Sleep(2000); string rsmsg = checkD1000(getstatus(hadler)); if (rsmsg == string.Empty) { rs = CRTCard.D1000_SendCmd(hadler, Convert.ToByte(0), cmd, cmd.Length); if (rs == 0) { return(true); } } else { MyMsg.MsgInfo(rsmsg); return(false); } } return(false); } catch (Exception ex) { throw new Exception(ex.Message); } finally { ClosePort(hadler); } }
void CodeEditFormFormClosing(object sender, FormClosingEventArgs e) { if (!string.IsNullOrEmpty(oldtext)) { if (fctb.Text != oldtext) { if (MyMsg.Question(LMSG.IfSaveScript)) { Save(); } } } else if (fctb.Text.Length > 0) { if (MyMsg.Question(LMSG.IfSaveScript)) { Save(); } } }
private void FrmInMoney_Load(object sender, EventArgs e) { try { string port = SkyComm.getvalue("钞箱Port"); cardSavingData = new DataSet(); this.lblClose.Visible = true; this.lblOK.Visible = false; sum = 0; money.init(Convert.ToInt32(port), 3); #region 纸币器开始接收纸币模块 //打开验钞 等待纸币进入 this.timer1.Start(); } catch (Exception ex) { MyMsg.MsgInfo(ex.Message); } #endregion }
static void Main(string[] args) { Console.WriteLine("IN console. Will make the pipe class"); APipeProcess pp = new APipeProcess(); MyMsg msg = new MyMsg(); //msg.AMessage = "I wrote a message"; pp.msg = msg; Filter1 f1 = new Filter1(); pp.Register(f1); Filter2 f2 = new Filter2(); pp.Register(f2); Filter3 f3 = new Filter3(); pp.Register(f3); pp.ExecutePipeLine(); Console.ReadKey(); }