//public void openExe() //{ // Process p = new Process(); // //p.StartInfo.FileName = "D:\\yourapplication.exe"; // //p.StartInfo.FileName = "D:\\Git\\ConsoleSendMessage\\ConsoleSendMessage\\bin\\Debug\\ConsoleSendMessage.exe 0909399615 สวัสดีครับ"; // string FileName = "D:\\Git\\ConsoleSendMessage\\ConsoleSendMessage\\bin\\Debug\\ConsoleSendMessage.exe"; // var startInfo = new System.Diagnostics.ProcessStartInfo(FileName, "0909399615 สวัสดีครับ"); // p.StartInfo = startInfo; // p.Start(); //} public MessageResult GetNewsTop() { MessageResult result = new MessageResult(); try { using (CallITEntities db = new CallITEntities()) { var query = (from q in db.news where q.newsType == "" select q).FirstOrDefault(); result.status = "success"; } } catch (DbEntityValidationException exp) { foreach (var entityValidationErrors in exp.EntityValidationErrors) { foreach (var validationError in entityValidationErrors.ValidationErrors) { Console.WriteLine("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage); } } result.status = "error"; } return(result); }
public MessageResult Save(callModel model) { MessageResult result = new MessageResult(); try { using (CallITEntities db = new CallITEntities()) { call md = new call(); md.machineName = model.machineName; md.machineIP = model.machineIP; md.sendDatetime = model.sendDatetime; md.sendName = model.sendName; md.sendText = model.sendText; md.sendTel = model.sendTel; db.call.Add(md); db.SaveChanges(); result.status = "success"; } } catch (DbEntityValidationException exp) { foreach (var entityValidationErrors in exp.EntityValidationErrors) { foreach (var validationError in entityValidationErrors.ValidationErrors) { Console.WriteLine("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage); } } result.status = "error"; } return(result); }