public async Task <IHttpActionResult> PostMsg([FromBody] msg message, int id) { string msg = message.message; Utilisateur u = UserHelper.getUser(User, db); DateTime DateMsg = DateTime.Now; Discussion disc = new Discussion(); disc.DateMsg = DateMsg; disc.Message = msg; disc.OffreId = id; disc.UtilisateurId = u.Id; try { if (db.OffreSet.Find(id) != null) { db.DiscussionSet.Add(disc); await db.SaveChangesAsync(); return(Created("Message bien envoyé", disc)); } return(NotFound()); } catch (Exception e) { return(InternalServerError(e)); } }
public bool copy(msg dest) { if (dest == null) { return(false); } if (dest.type != null) { type = new string(dest.type.ToCharArray()); } else { type = "none"; } if (dest.i != null) { i = (int[])dest.i.Clone(); } if (dest.f != null) { f = (float[])dest.f.Clone(); } time = dest.time; return(true); }
protected void btnContactSubmit_Click(object sender, EventArgs e) { //sends email usinig a mail server that requires login credentials and a secure connection e.g. email //create mail client and message with to and from address set message subject and body SmtpClient smtpClient = new SmtpClient(); MailMessage msg = new MailMessage("*****@*****.**", ""); msg Subject = txtSubject_Text; msg Body = txtBody_Text; //settings specific to the mail service, e.g. server location, port number and that ssl is required smtpClient Host = "smtp.gmail.com"; smtpClient Port = 587; smtpClient EnableSsl = true; //create credentials - e.g. username and password for the account System.Net.NetworkCredential credentials = new System.Net.NetworkCredential("*****@*****.**", ""); smtpClient Credentials = credentials; msg = new MailMessage("*****@*****.**", ""); try { smtpClient.Send(msg); litResult.Text = "<p>Success. Mail sent using SMTP with secure connection and credentials</p>"; } catch (Exception ex) { //display the full error to the user litResult.Text = "<p>" + ex.Message + "." + ex.InnerException + "</p>"; } }
void t_Elapsed() { NetMQContext ctx = NetMQContext.Create(); NetMQSocket socket = ctx.CreateSubscriberSocket(); // TODO: change socket connection ip, port socket.Connect("tcp://172.16.12.188:5555"); socket.Subscribe(_tagID.ToString("000")); socket.ReceiveReady += (s, a) => { string topic = socket.ReceiveString(); string message = socket.ReceiveString(); msg m = JsonConvert.DeserializeObject <msg>(message); WriteText(m); //Application.DoEvents(); }; Poller poller = new Poller(); poller.AddSocket(socket); poller.Start(); }
//bool GetDate() //{ // var Basedate = CheckBaseDate(); // if (Basedate == "False") // return true; // if (!string.IsNullOrEmpty(Basedate)) // { // DateText = DateTime.Parse(Basedate + " " + DateTime.Now.ToString("HH:mm:ss")); GetLineForPrint(15); return false; // } // else if (this.DateFas_Start) // { DateText = DateTime.UtcNow.AddHours(2); return false; } // else // { DateText = DateTime.Parse(DateFas_ST_Text + " " + DateTime.Now.ToString("HH:mm:ss")); return false; } // } void Print(string TBTEXT, string FullSN, Label Controllabel) { msg Mes = new msg($"{TBTEXT} уже присвоен \n SN номер{FullSN} \n Хотите перепечатать SN номер?"); //Запрос на перепечатку var Result = Mes.ShowDialog(); if (Result == DialogResult.No) //Если печать отменена { LabelStatus(Controllabel, $"{TBTEXT} уже присвоен SN {FullSN} \n печать отменена!", Color.Black); return; } if (string.IsNullOrEmpty(printName)) //Проверка подклчюение принетера { LabelStatus(Controllabel, $"Принтер не идентифицирован!", Color.Red); return; } //Текстовые переменные для печати var printCodeSN = FullSN.Substring(0, 22) + ">6" + FullSN.Substring(22); var PrintTextSN = FullSN.Substring(0, 2) + " " + FullSN.Substring(2, 4) + " " + FullSN.Substring(6, 2) + " " + FullSN.Substring(8, 2) + " " + FullSN.Substring(10, 2) + " " + FullSN.Substring(12, 3) + " " + FullSN.Substring(15, 8); if (CheckPathPrinterSettings()) //Првоерка координат принтера { CreatePathPrinter(); //Если не найдена настройка, создаем её } var list = Directory.GetFiles(@"C:\PrinterSettings").ToList(); //Берем с папки координаты var X = GetPrSet(list, "XSN"); //Определение X координаты var Y = GetPrSet(list, "YSN"); //Определение Y координаты DateText = GetManufDate(FullSN); //Берем дату на FasStart этого номера print(LabelSN(PrintTextSN, printCodeSN, int.Parse(X), int.Parse(Y))); //Печать номера //Вывод сообщения что все хорошо завершение события LabelStatus(Controllabel, $"{FullSN} \n Печать готова!", Color.Green); }
/// <summary> /// 界面绑定传消息 /// </summary> /// <param name="id"></param> /// <param name="value"></param> /// <param name="type"></param> public static void MSG_THOD(int id, string value, int type) { GlobalVariable.MSG = new GlobalVariable.msg { Msg_ID = id, slave_value = value, type = type }; GlobalVariable.MSGLIST.Add(GlobalVariable.MSG); Read_Value = value; }
//删除一条消息 public int MessageDelete(msg mymsg) { SqlParameter[] parms = { data.MakeInParam("@SendUsername", SqlDbType.VarChar, 50, mymsg.send_username), data.MakeInParam("@RecvUsername", SqlDbType.VarChar, 50, mymsg.recv_username), data.MakeInParam("@Message", SqlDbType.VarChar, 50, mymsg.message), data.MakeInParam("@Sendtime", SqlDbType.DateTime, 100, mymsg.date_time), }; return(data.RunProc("delete from msg where send_username=@SendUsername and recv_username=@RecvUsername and content=@Message and sendtime=@Sendtime", parms)); }
public void WriteText(msg value) { if (InvokeRequired) { this.Invoke(new Action <msg>(WriteText), new object[] { value }); return; } stateIndicatorComponent1.StateIndex = value.state; txtVal.Text = value.data.ToString() + " " + value.uom; }
public int FindmsgIndex(ref msg msgdata, int id) { for (int i = 0; i < msgdata.data.Length; i++) { if (msgdata.data[i].ID == id) { return(i); } } return(0); }
//根据接收人获取消息 public DataSet MessageSelectByRecvUser(msg mymsg) { SqlParameter[] parms = { // data.MakeInParam("@SendUsername",SqlDbType.VarChar,50,mymsg.send_username), data.MakeInParam("@RecvUsername", SqlDbType.VarChar, 50, mymsg.recv_username), //data.MakeInParam("@Message",SqlDbType.VarChar,50,mymsg.message), //data.MakeInParam("@Sendtime",SqlDbType.DateTime,100,mymsg.date_time), }; return(data.RunProcReturn("select * from msg where recv_username=@RecvUsername", parms, "msg")); }
//加入一条消息 public int MessageInsert(msg mymsg) { SqlParameter[] parms = { data.MakeInParam("@SendUsername", SqlDbType.VarChar, 50, mymsg.send_username), data.MakeInParam("@RecvUsername", SqlDbType.VarChar, 50, mymsg.recv_username), data.MakeInParam("@Message", SqlDbType.VarChar, 50, mymsg.message), data.MakeInParam("@Sendtime", SqlDbType.DateTime, 100, mymsg.date_time), data.MakeInParam("@Readed", SqlDbType.TinyInt, 2, mymsg.readed), }; return(data.RunProc("insert into msg(send_username,recv_username,content,sendtime,readed) values(@SendUsername,@RecvUsername,@Message,@Sendtime,@Readed)", parms)); }
public bool entermsg(msg dest) { if (dest == null) { return(false); } else if (dest.type == null) { return(false); } switch (dest.type) { case "phit": //projectile hit { //메시지 체크부터 if (dest.exist("bullet", "owner")) { break; } GameObject bullet = (GameObject)dest.get("bullet"), owner = (GameObject)dest.get("owner"); //투사체 주인, 맞은 방향 등 unitpattern up = GetComponent <unitpattern>(); if (up != null) { var bi = bullet.GetComponent <projectile>(); var oi = owner.GetComponent <Unit>(); msg para = new msg(); para.add("owner", owner); para.add("allyorenemy", bi.team == oi.team); up.addincident(para); } } break; default: return(false); } return(true); }
public Export(Form1 form1, msg msg1, msg msg2, msg msg3, msg msg4, msg msg5) { this.form1 = form1; //UNLEASHED: the following vars are used to get rid of Warning C1690 //apparently, the MSG class refereces Marshal objects or something... Names = msg1; Descs = msg2; Burst = msg3; BurstBTLHUD = msg4; BurstPause = msg5; InitializeComponent(); }
int GetShiftID() { var mes = new msg("Выберите смену", "Ночная смена", "Дневная смена"); var Result = mes.ShowDialog(); if (Result == DialogResult.OK) { return(3); } else { return(4); } }
private void Form_DragEnter(object sender, DragEventArgs e) { string[] FileList = (string[])e.Data.GetData(DataFormats.FileDrop, false); try { doDecrypt(FileList, new byte[0], 0); } catch (Exception ex) { textlog = "Decrypt failure!\r\n"; textBox1.Text = textlog; Form msg = new msg(ex.Message); msg.Show(); } }
public void LogWrite(string logMessage) { this.m_exePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); try { using (StreamWriter streamWriter = fs.File.AppendText(string.Concat(this.m_exePath, "\\log.txt"))) { this.Log(logMessage, streamWriter); } msg m = new msg(); m._msg = "X"; } catch (Exception exception) { } }
public weapon getwp(weapon dest) => getwpbyindex(getwpindex(dest));//현제 게임오브젝트에 있어야 받아옴 public bool addincident(msg dest) { if (dest == null) { return(false); } information i = new information(dest.type, (string)dest.get("name", "string"), null); dest.remove("name"); i.addmsg(dest); incident.Add(i); return(true); }
protected void Page_Load(object sender, EventArgs e) { string username = Request.QueryString["username"]; string msg = Request.QueryString["msg"]; string time = Request.QueryString["time"]; string sendpeople = Request.QueryString["sendpeople"]; msg mymsg = new msg(); mymsg.RecvUsername = username; mymsg.SendUsername = sendpeople; mymsg.Message = msg; mymsg.DateTime = Convert.ToDateTime(time); if (mymsg.MessageUpdate(mymsg) == 0) { WebMessageBox.Show("设置成功", "mymessage.aspx"); } }
public int addmsg(msg dest) { if (dest == null) { return(0); } else if (dest.count() < 1) { return(0); } int r = 0; foreach (msgitem i in dest.getmsgitem()) { addmsg(i.type, i.o); r++; } return(r); }
public void p(msg) { log(msg, "MYLOGS ------------> "); }
static void Main(string[] args) { msg message = new msg(); pseudowyliczenia wyliczenia = new pseudowyliczenia(); string anser = ""; message.wellcome(); Console.ReadKey(); Console.Clear(); do { do { message.startGame(); anser = Console.ReadLine(); anser = anser.ToUpper(); Console.Clear(); } while ((anser != "N") && (anser != "K") && (anser != "Z")); User gracz = new User(); if (anser == "N") //NOWA GRA { string odpowiedz; string text; Console.WriteLine("Powiedz jak Ci na imię?"); odpowiedz = Console.ReadLine(); Console.Clear(); gracz.newName = odpowiedz; Console.Write("Masz na imię "); Console.WriteLine(gracz.newName); Console.ReadKey(); Console.Clear(); do // 1. Pochodzenie { message.nowaPostac(1); odpowiedz = Console.ReadLine(); Console.Clear(); text = wyliczenia.nazwyMiejscPochodzenia(odpowiedz); } while (text == "ERROR"); gracz.newPochodzenie = text; Console.Write("Pochodzisz z "); Console.WriteLine(gracz.newPochodzenie); if ((text == "Południowa Hegemonia") || (text == "Texas")) { gracz.newCechaBudowa += 1; } else if ((text == "Vegas") || (text == "Detroit")) { gracz.newCechaZrecznosc += 1; } else if ((text == "Człowiek Pustyni") || (text == "Miami") || (text == "Missisipi")) { gracz.newCechaPercepcja += 1; } else if ((text == "Nowy York") || (text == "Federacja Appalachów")) { gracz.newCechaCharakter += 1; } else if ((text == "Posterunek") || (text == "Salt Lake City")) { gracz.newCechaSpryt += 1; } else { do { message.bonusCechy(); odpowiedz = Console.ReadLine(); text = wyliczenia.bonusCechy(odpowiedz); Console.Clear(); }while(text == "ERROR"); if(text == "B") { gracz.newCechaBudowa += 1; } if (text == "C") { gracz.newCechaCharakter += 1; } if (text == "P") { gracz.newCechaPercepcja += 1; } if (text == "S") { gracz.newCechaSpryt += 1; } if (text == "Z") { gracz.newCechaZrecznosc += 1; } } Console.ReadKey(); Console.Clear(); do // 2. Profesja { message.nowaPostac(2); odpowiedz = Console.ReadLine(); Console.Clear(); text = wyliczenia.nazwyProfesji(odpowiedz); } while (text == "ERROR"); gracz.newProfesjaBohatera = text; Console.Write("Twoja profesja to "); Console.WriteLine(gracz.newProfesjaBohatera); Console.ReadKey(); Console.Clear(); do // 3. Cechy { message.nowaPostac(3); odpowiedz = Console.ReadLine(); Console.Clear(); } while ((odpowiedz != "1") && (odpowiedz != "2")); if (odpowiedz == "1") //Losowanie wartości cech { Random los = new Random(); double srednia = 0; double suma = 0; double czesci = 0; int calosc = 0; int[] wyniki = {0, 0, 0, 0, 0, 0}; for (int i = 0; i < 6; i++) { suma = 0; czesci = (los.Next(20) + 1); suma += czesci; czesci = (los.Next(20) + 1); suma += czesci; czesci = (los.Next(20) + 1); suma += czesci; srednia = suma / 3; calosc = (int)srednia; if (calosc < srednia) { calosc++; } if ((calosc < 7) || (calosc > 19)) { if (calosc < 7) { wyniki[i] = 6; } else { wyniki[i] = 19; } } else { wyniki[i] = calosc; } } Array.Sort(wyniki); Console.WriteLine("Wyniki: "); Console.Write(wyniki[0]); Console.Write(" "); Console.Write(wyniki[1]); Console.Write(" "); Console.Write(wyniki[2]); Console.Write(" "); Console.Write(wyniki[3]); Console.Write(" "); Console.Write(wyniki[4]); Console.Write(" "); Console.WriteLine(wyniki[5]); do { calosc = 0; Console.WriteLine(""); Console.WriteLine("Punkty na zręczność"); text = Console.ReadLine(); calosc = wyliczenia.przedzial(text); if(calosc != 0) { int i = 0; bool b = false; do { calosc = wyliczenia.przedzial(text); if (calosc == wyniki[i]) { b = true; gracz.newCechaZrecznosc += wyniki[i]; wyniki[i] = 0; } else { i++; calosc = 0; } }while( (b == false) && (i < 6)); } } while(calosc == 0); do { calosc = 0; Console.WriteLine(""); Console.WriteLine("Punkty na percepcja"); text = Console.ReadLine(); calosc = wyliczenia.przedzial(text); if (calosc != 0) { int i = 0; bool b = false; do { calosc = wyliczenia.przedzial(text); if (calosc == wyniki[i]) { b = true; gracz.newCechaPercepcja += wyniki[i]; wyniki[i] = 0; } else { i++; calosc = 0; } } while ((b == false) && (i < 6)); } } while (calosc == 0); do { calosc = 0; Console.WriteLine(""); Console.WriteLine("Punkty na charakter"); text = Console.ReadLine(); calosc = wyliczenia.przedzial(text); if (calosc != 0) { int i = 0; bool b = false; do { calosc = wyliczenia.przedzial(text); if (calosc == wyniki[i]) { b = true; gracz.newCechaCharakter += wyniki[i]; wyniki[i] = 0; } else { i++; calosc = 0; } } while ((b == false) && (i < 6)); } } while (calosc == 0); do { calosc = 0; Console.WriteLine(""); Console.WriteLine("Punkty na spryt"); text = Console.ReadLine(); calosc = wyliczenia.przedzial(text); if (calosc != 0) { int i = 0; bool b = false; do { calosc = wyliczenia.przedzial(text); if (calosc == wyniki[i]) { b = true; gracz.newCechaSpryt += wyniki[i]; wyniki[i] = 0; } else { i++; calosc = 0; } } while ((b == false) && (i < 6)); } } while (calosc == 0); do { calosc = 0; Console.WriteLine(""); Console.WriteLine("Punkty na budowa"); text = Console.ReadLine(); calosc = wyliczenia.przedzial(text); if (calosc != 0) { int i = 0; bool b = false; do { calosc = wyliczenia.przedzial(text); if (calosc == wyniki[i]) { b = true; gracz.newCechaBudowa += wyniki[i]; wyniki[i] = 0; } else { i++; calosc = 0; } } while ((b == false) && (i < 6)); } } while (calosc == 0); Console.ReadKey(); Console.Clear(); } if (odpowiedz == "2") //przydział użytkownika { bool kasa = true; int wyplata = 100; do { int last = 60; if (kasa == false) { Console.WriteLine("Pozostało Ci za mało gambli"); Console.WriteLine("Musisz przydzielić punkty jeszcze raz"); kasa = true; wyplata = 100; Console.ReadKey(); Console.Clear(); } do { Console.Write("Masz do przydziału "); Console.WriteLine(last); Console.WriteLine("Ile punktów chcesz przeznaczyć na zręczność?"); text = Console.ReadLine(); Console.Clear(); } while (wyliczenia.przedzial(text) == 0); last = last - wyliczenia.przedzial(text); gracz.newCechaZrecznosc += wyliczenia.przedzial(text); do { Console.Write("Masz do przydziału "); Console.WriteLine(last); Console.WriteLine("Ile punktów chcesz przeznaczyć na percepcię?"); text = Console.ReadLine(); Console.Clear(); } while (wyliczenia.przedzial(text) == 0); last = last - wyliczenia.przedzial(text); gracz.newCechaPercepcja += wyliczenia.przedzial(text); do { Console.Write("Masz do przydziału "); Console.WriteLine(last); Console.WriteLine("Ile punktów chcesz przeznaczyć na Charakter?"); text = Console.ReadLine(); Console.Clear(); } while (wyliczenia.przedzial(text) == 0); last = last - wyliczenia.przedzial(text); gracz.newCechaCharakter += wyliczenia.przedzial(text); do { Console.Write("Masz do przydziału "); Console.WriteLine(last); Console.WriteLine("Ile punktów chcesz przeznaczyć na spryt?"); text = Console.ReadLine(); Console.Clear(); } while (wyliczenia.przedzial(text) == 0); last = last - wyliczenia.przedzial(text); gracz.newCechaSpryt += wyliczenia.przedzial(text); do { Console.Write("Masz do przydziału "); Console.WriteLine(last); Console.WriteLine("Ile punktów chcesz przeznaczyć na budowę?"); text = Console.ReadLine(); Console.Clear(); } while (wyliczenia.przedzial(text) == 0); last = last - wyliczenia.przedzial(text); gracz.newCechaBudowa += wyliczenia.przedzial(text); if (last < 0) { wyplata += (last * 10); } else { wyplata += (last * 30); } gracz.newGambleUser = wyplata; if (wyplata <= 30) { kasa = false; } }while(wyplata<=30); } do // 4. Specjalizacje { message.nowaPostac(4); odpowiedz = Console.ReadLine(); Console.Clear(); text = wyliczenia.nazwySpecjalizacji(odpowiedz); } while (text == "ERROR"); gracz.newSpecjalizacjaBohatera = text; Console.Write("Twoja specjalizacja to "); Console.WriteLine(gracz.newSpecjalizacjaBohatera); Console.ReadKey(); Console.Clear(); // 5. Umiejętności message.nowaPostac(5); message.spisUmiejetnosci(gracz.newSpecjalizacjaBohatera); Console.ReadKey(); Console.Clear(); Console.WriteLine("Karta postaci"); Console.Write("Twoje imię: "); Console.WriteLine(gracz.newName); Console.Write("Pochodzenie: "); Console.WriteLine(gracz.newPochodzenie); Console.Write("Profesja: "); Console.WriteLine(gracz.newProfesjaBohatera); Console.Write("Specjalizacja: "); Console.WriteLine(gracz.newSpecjalizacjaBohatera); Console.Write("Zręczność: "); Console.WriteLine(gracz.newCechaZrecznosc); Console.Write("Percepcja: "); Console.WriteLine(gracz.newCechaPercepcja); Console.Write("Charakter: "); Console.WriteLine(gracz.newCechaCharakter); Console.Write("Spryt: "); Console.WriteLine(gracz.newCechaSpryt); Console.Write("Budowa: "); Console.WriteLine(gracz.newCechaBudowa); Console.Write("Kasa: "); Console.WriteLine(gracz.newGambleUser); /*Console.ReadKey(); Console.Clear(); gracz.setUmiejetnosci(12, 0, 0, 0); Console.WriteLine(gracz.getUmiejetnosci(0, 0, 0)); Console.WriteLine(); Console.WriteLine(); Console.WriteLine(); Console.WriteLine(); Console.WriteLine();*/ }//Koniec tworzenia nowej postaci if (anser == "K") { //Kod wczytywania postępów w grze } if ((anser == "K") || (anser == "N")) { //Gra } } while(anser == "Z"); message.byebye(); Console.ReadKey(); Console.Clear(); }
base.RegisterStartupScript(msg.StartsWith("window") ? "PAGE" : "", msg);
base.WndProc(ref msg);