public SystemMessage BS_CongSL_Chil_SP(int id_p, string groupcode) { SystemMessage systemMessage = new SystemMessage(); try { var db = new DB_CSEntities1(); var checkTon = db.sys_code_product.FirstOrDefault(m => m.id_product == id_p && m.group_code == groupcode && m.id_center == user.BranchId); if (checkTon == null) { systemMessage.IsSuccess = false; systemMessage.Message = SystemMessageConst.systemmessage.DataNotExisted; return(systemMessage); } float gtb = 0; float.TryParse(checkTon.giatrungbinh.ToString(), out gtb); int id_n = 0; int.TryParse(checkTon.id_nhap.ToString(), out id_n); sys_code_product item = new sys_code_product(); item.code = "12312312"; item.id_product = id_p; item.ngaynhap = DateTime.Now; item.trangthai = 0; item.id_nhap = id_n; item.id_center = user.BranchId; item.giatrungbinh = gtb; item.group_code = groupcode; item.isactive = true; item.note_code = "update tang"; db.sys_code_product.Add(item); var checkNhap = db.sys_Nhap.FirstOrDefault(m => m.id == id_n); if (checkNhap == null) { systemMessage.IsSuccess = false; systemMessage.Message = SystemMessageConst.systemmessage.DataNotExisted; return(systemMessage); } int sl = 0; int.TryParse(checkNhap.soluong.ToString(), out sl); checkNhap.soluong = sl + 1; db.SaveChanges(); systemMessage.IsSuccess = true; systemMessage.Message = SystemMessageConst.systemmessage.UpdateSuccess; return(systemMessage); } catch (Exception e) { systemMessage.IsSuccess = false; systemMessage.Message = e.ToString(); return(systemMessage); } }
public SystemMessage BS_NhapKho(sys_Nhap data) { SystemMessage systemMessage = new SystemMessage(); try { var db = new DB_CSEntities1(); var checkSP = db.sys_product.FirstOrDefault(m => m.id == data.id_product); if (checkSP == null) { systemMessage.IsSuccess = false; systemMessage.Message = SystemMessageConst.systemmessage.ProductNotExisted; return(systemMessage); } var checkNguon = db.sys_nguonnhap.FirstOrDefault(m => m.id == data.id_nguonnhap); if (checkNguon == null) { systemMessage.IsSuccess = false; systemMessage.Message = SystemMessageConst.systemmessage.NguonNotExit; return(systemMessage); } // cộng tồn kho var checkTonkho = db.sys_tonkho.FirstOrDefault(m => m.id_product == data.id_product && m.id_center == data.id_center); // chưa có if (checkTonkho == null) { sys_tonkho sys_ton = new sys_tonkho(); sys_ton.id_product = data.id_product; sys_ton.soluong = data.soluong; sys_ton.isactive = true; sys_ton.id_center = data.id_center; db.sys_tonkho.Add(sys_ton); } else // đã có thì cộng dồn { int sl_ton = 0; sl_ton = checkTonkho.soluong; checkTonkho.soluong = sl_ton + data.soluong; } // nhập nhóm hàng sys_Nhap nhap = new sys_Nhap(); nhap.ngaynhap = data.ngaynhap; nhap.soluong = data.soluong; nhap.nguoinhap = data.nguoinhap; nhap.id_product = data.id_product; nhap.tongtien = data.tongtien; nhap.giatrungbinh = data.giatrungbinh; nhap.trangthai = true; nhap.id_center = data.id_center; nhap.id_nguonnhap = data.id_nguonnhap; nhap.group_code_product = data.group_code_product; nhap.mota = data.mota; db.sys_Nhap.Add(nhap); db.SaveChanges(); int id_n = 0; id_n = nhap.id; // nhập chi tiết sinh code cho từng sp for (int i = 0; i < data.soluong; i++) { sys_code_product itemDetail = new sys_code_product(); itemDetail.code = data.group_code_product + "-" + GetBillNumer(); itemDetail.id_product = data.id_product; itemDetail.ngaynhap = DateTime.Now; itemDetail.trangthai = 0; // 0 chua ban, 1 da ban itemDetail.id_nhap = id_n; itemDetail.id_center = data.id_center; itemDetail.giatrungbinh = data.giatrungbinh; itemDetail.group_code = data.group_code_product; itemDetail.isactive = true; db.sys_code_product.Add(itemDetail); } db.SaveChanges(); systemMessage.IsSuccess = true; systemMessage.Message = SystemMessageConst.systemmessage.AddSuccess; return(systemMessage); } catch (Exception e) { systemMessage.IsSuccess = false; systemMessage.Message = e.ToString(); return(systemMessage); } }
public ActionResult _AddUser(string username, string password, string confirmPassword, string fullname, string email, int branch, string code, string birth, string phone, int roleId = 0, int parent = 0, bool isusingaccount = false) { var db = new ManagerListUserBussiness(); User itemuser = new User(); itemuser.FullName = fullname.Trim().ToUpper(); itemuser.Email = email.Trim().ToUpper(); itemuser.BranchId = branch; itemuser.UserCode = code.Trim().ToUpper(); itemuser.Phone = phone.Trim().ToUpper(); itemuser.isusingaccount = isusingaccount; if (itemuser.isusingaccount == true) { if (password != confirmPassword) { SystemMessage systemMessage = new SystemMessage(); systemMessage.IsSuccess = false; systemMessage.Message = SystemMessageConst.systemmessage.ConfirmPasswordNotCorrect; return(Json(new { result = systemMessage }, JsonRequestBehavior.AllowGet)); } itemuser.UserName = username.Trim().ToUpper(); itemuser.Password = password; } if (parent != 0) { itemuser.ParentId = parent; itemuser.parent_create_by = user.Id; itemuser.parent_create_time = DateTime.Now; } itemuser.DateCreated = DateTime.Now; itemuser.user_create_by = user.Id; DateTime _birth; if (!string.IsNullOrEmpty(birth)) { if (!DateTime.TryParseExact(birth, "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out _birth)) { SystemMessage systemMessage = new SystemMessage(); systemMessage.IsSuccess = false; systemMessage.Message = string.Format(SystemMessageConst.ValidateConst.DateIsNotValid, "Ngày sinh"); return(Json(new { result = systemMessage }, JsonRequestBehavior.AllowGet)); } itemuser.DateOfBirth = _birth; } var myRole = user.Roleid; if (myRole != SystemMessageConst.Role.Admin) { var userId = user.Id; var db2 = new CommonBusiness(); var myLevel = db2.GetLevelMaxByIdAcc(userId); var newUserLevel = db2.GetLevelByIdRole(roleId); if (myLevel >= newUserLevel) { SystemMessage systemMessage = new SystemMessage(); systemMessage.IsSuccess = false; systemMessage.Message = "Quyền không hợp lệ"; return(Json(new { result = systemMessage }, JsonRequestBehavior.AllowGet)); } } ; var result = db.AddUser(itemuser, roleId); return(Json(new { result }, JsonRequestBehavior.AllowGet)); }
public virtual void SendMessage(SystemMessage message) { if (ParentContext != null) ParentContext.SendMessage(message); }
internal void RaiseSystemMessage(string logmessage) { SystemMessage?.Invoke(this, logmessage); }
/// <summary> /// 更新游戏 /// </summary> /// <param name="gameGameItem"></param> public Message UpdateSystemMessage(SystemMessage systemMessage) { aidePlatformData.UpdateSystemMessage(systemMessage); return(new Message(true)); }
void _OnSystemMessageReceived(string arg) { Debug.Log ("OnSystemMessageReceived: " + arg); if (jiverResponder != null) { SystemMessage message = new SystemMessage(arg); jiverResponder.OnSystemMessageReceived(message); } }
/// <summary> /// Sends a message which announces a change in the player manager. The change doesn't concern a specific player /// slot. This method handles the "general messages which don't concern a special player" message types. /// </summary> /// <param name="type">Type of the message.</param> public static void SendPlayerManagerPlayerMessage(MessageType type) { SystemMessage msg = new SystemMessage(type); ServiceRegistration.Get <IMessageBroker>().Send(CHANNEL, msg); }
private SystemMessage CreateNewSystemMessage() { SystemMessage systemmessage = new SystemMessage(); systemmessage.SystemMessageID = 0; systemmessage.SystemMessageTitle = String.Empty; systemmessage.SystemMessageBody = String.Empty; systemmessage.DisplayDateStart = DateTime.Now; systemmessage.DisplayDateEnd = DateTime.Now; systemmessage.Priority = 1; return systemmessage; }
private string ValidateInput(SystemMessage systemmessage) { if (String.IsNullOrEmpty(systemmessage.SystemMessageTitle)) return "Title is required."; if (String.IsNullOrEmpty(systemmessage.SystemMessageBody)) return "Body is required."; if (systemmessage.DisplayDateStart > systemmessage.DisplayDateEnd) return "Start Date must be before End Date."; return String.Empty; }
public ActionResult Edit(SystemMessage systemmessage) { try { if (Session["UserAccountID"] == null) return RedirectToAction("Validate", "Login"); User user = (User)Session["User"]; ViewData["LoginInfo"] = Utility.BuildUserAccountString(user.Username, Convert.ToString(Session["UserAccountName"])); if (user.IsAdmin) ViewData["txtIsAdmin"] = "true"; else throw new Exception("You are not authorized to access this page."); if (ModelState.IsValid) { string validation = ValidateInput(systemmessage); if (!String.IsNullOrEmpty(validation)) { ViewData["ValidationMessage"] = validation; return View(systemmessage); } repository.UpdateSystemMessage(systemmessage); CommonMethods.CreateActivityLog((User)Session["User"], "System Message", "Edit", "Edited system message '" + systemmessage.SystemMessageTitle + "' - ID: " + systemmessage.SystemMessageID.ToString()); return RedirectToAction("Index"); } return View(systemmessage); } catch (Exception ex) { Helpers.SetupApplicationError("SystemMessage", "Edit POST", ex.Message); return RedirectToAction("Index", "ApplicationError"); } }
/// <summary> /// Initializes a new instance of the <see cref = "SystemMessageEventArgs" /> class. /// </summary> /// <param name = "message">The system message.</param> /// <param name = "data">The associated data.</param> public SystemMessageEventArgs(SystemMessage message, object data) { Message = message; Data = data; }
public void AddToSystemMessage(SystemMessage systemMessage) { base.AddObject("SystemMessage", systemMessage); }
public SystemMessageViewModel(string opc, SystemMessage msg) { Opcode = opc; SysMsg = msg; }
public abstract void OnSystemMessageReceived(SystemMessage message);
public override void SendMessage(SystemMessage message) { switch (message) { case SystemMessage.SHUTDOWN: ChildContext = null; Mode = Modes.OFF; break; case SystemMessage.RESTART: ChildContext = null; Boot(); break; default: base.SendMessage(message); break; } }
// // GET: /Manage/ChangePassword public ActionResult ChangePassword(SystemMessage? Message) { ViewBag.StatusMessage = new ViewSystemMessage(Message); return View(); }
/// <summary> /// Sends a <see cref="MessageType.ClientsOnlineStateChanged"/> message. /// </summary> public static void SendClientConnectionStateChangedMessage() { SystemMessage msg = new SystemMessage(MessageType.ClientsOnlineStateChanged); ServiceRegistration.Get <IMessageBroker>().Send(CHANNEL, msg); }
// GET: Edit public async Task<ActionResult> Edit(SystemMessage? Message) { ViewBag.StatusMessage = new ViewSystemMessage(Message); var userId = User.Identity.GetUserId(); var user = await UserManager.FindByIdAsync(userId); AccountInfoVm modelVm = new AccountInfoVm() { Username = user.UserName , FullName = user.Claims.Where(x => x.ClaimType == "FullName").Select(x => x.ClaimValue).FirstOrDefault() , Email = user.Email , PhoneNumber = user.PhoneNumber , Sex = user.Claims.Where(x => x.ClaimType == ClaimTypes.Gender).Select(x => x.ClaimValue).FirstOrDefault() }; DateTime BirthDate; if (DateTime.TryParse(user.Claims.Where(x => x.ClaimType == ClaimTypes.DateOfBirth).Select(x => x.ClaimValue).SingleOrDefault(), out BirthDate)) { modelVm.BirthDate = BirthDate; } return View("Edit", modelVm); }
private async Task <SystemMessageResponse> SendSystemMessageAsync(SystemMessage message) { byte[] data = { 0, (byte)message }; return(await SendMessageAsync <SystemMessageResponse>(Endpoint.SystemMessage, data)); }
private async void ChatXmppClientOnOnSystemMessage(object sender, SystemMessage message) { await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () => { var groupInfoMessage = message as GroupInfoMessage; if (groupInfoMessage != null) { await OnGroupInfoMessage(groupInfoMessage); } }); }
public static SystemMessage CreateSystemMessage(int id) { SystemMessage systemMessage = new SystemMessage(); systemMessage.ID = id; return systemMessage; }
private static void SendMessage(SystemMessage msg) { ServiceRegistration.Get <IMessageBroker>().Send(CHANNEL, msg); }
void OnMessageReceived(AsynchronousMessageQueue queue, SystemMessage message) { if (message.ChannelName == SharesMessaging.CHANNEL) { IContentDirectory cd = ContentDirectory; SharesMessaging.MessageType messageType = (SharesMessaging.MessageType) message.MessageType; IImporterWorker importerWorker = ServiceRegistration.Get<IImporterWorker>(); Share share; switch (messageType) { case SharesMessaging.MessageType.ShareAdded: share = (Share) message.MessageData[SharesMessaging.SHARE]; if (cd != null) cd.RegisterShareAsync(share); importerWorker.ScheduleImport(share.BaseResourcePath, share.MediaCategories, true); break; case SharesMessaging.MessageType.ShareRemoved: share = (Share) message.MessageData[SharesMessaging.SHARE]; importerWorker.CancelJobsForPath(share.BaseResourcePath); if (cd != null) cd.RemoveShareAsync(share.ShareId); break; case SharesMessaging.MessageType.ShareChanged: RelocationMode relocationMode = (RelocationMode) message.MessageData[SharesMessaging.RELOCATION_MODE]; share = (Share) message.MessageData[SharesMessaging.SHARE]; importerWorker.CancelJobsForPath(share.BaseResourcePath); if (cd == null) { ISettingsManager settingsManager = ServiceRegistration.Get<ISettingsManager>(); ServerConnectionSettings settings = settingsManager.Load<ServerConnectionSettings>(); RelocationMode oldMode; if (settings.CachedSharesUpdates.TryGetValue(share.ShareId, out oldMode) && oldMode == RelocationMode.ClearAndReImport) // ClearAndReimport is stronger than Relocate, use ClearAndReImport relocationMode = oldMode; settings.CachedSharesUpdates[share.ShareId] = relocationMode; settingsManager.Save(settings); } else { cd.UpdateShareAsync(share.ShareId, share.BaseResourcePath, share.Name, share.UseShareWatcher, share.MediaCategories, relocationMode); switch (relocationMode) { case RelocationMode.ClearAndReImport: importerWorker.ScheduleImport(share.BaseResourcePath, share.MediaCategories, true); break; case RelocationMode.Relocate: importerWorker.ScheduleRefresh(share.BaseResourcePath, share.MediaCategories, true); break; } } break; case SharesMessaging.MessageType.ReImportShare: share = (Share) message.MessageData[SharesMessaging.SHARE]; importerWorker.ScheduleRefresh(share.BaseResourcePath, share.MediaCategories, true); break; } } else if (message.ChannelName == ImporterWorkerMessaging.CHANNEL) { IContentDirectory cd = ContentDirectory; ImporterWorkerMessaging.MessageType messageType = (ImporterWorkerMessaging.MessageType) message.MessageType; switch (messageType) { case ImporterWorkerMessaging.MessageType.ImportStarted: case ImporterWorkerMessaging.MessageType.ImportCompleted: if (cd == null) break; ResourcePath path = (ResourcePath) message.MessageData[ImporterWorkerMessaging.RESOURCE_PATH]; ILocalSharesManagement lsm = ServiceRegistration.Get<ILocalSharesManagement>(); ICollection<Share> shares = lsm.Shares.Values; Share share = shares.BestContainingPath(path); if (share == null) break; if (messageType == ImporterWorkerMessaging.MessageType.ImportStarted) cd.ClientStartedShareImportAsync(share.ShareId); else cd.ClientCompletedShareImportAsync(share.ShareId); break; } } else if (message.ChannelName == ServerStateMessaging.CHANNEL) { //Check if Tv Server state has changed and update if necessary ServerStateMessaging.MessageType messageType = (ServerStateMessaging.MessageType)message.MessageType; if (messageType == ServerStateMessaging.MessageType.StatesChanged) { var states = message.MessageData[ServerStateMessaging.STATES] as IDictionary<Guid, object>; if (states != null && states.ContainsKey(ShareImportServerState.STATE_ID)) { ShareImportServerState importState = states[ShareImportServerState.STATE_ID] as ShareImportServerState; if (importState != null) { List<ShareImportState> shareStates = new List<ShareImportState>(importState.Shares); lock (_syncObj) { UpdateCurrentlyImportingShares(shareStates.Where(s => s.IsImporting).Select(s => s.ShareId).ToList()); UpdateCurrentlyImportingSharesProgresses(shareStates.Where(s => s.IsImporting).ToDictionary(s => s.ShareId, s => s.Progress)); } } } else if (states != null && states.ContainsKey(DatabaseUpgradeServerState.STATE_ID)) { DatabaseUpgradeServerState upgradeState = states[DatabaseUpgradeServerState.STATE_ID] as DatabaseUpgradeServerState; if (upgradeState != null && !upgradeState.IsUpgrading && upgradeState.Progress == 100) { ServerConnectionMessaging.SendServerConnectionStateChangedMessage(ServerConnectionMessaging.MessageType.HomeServerDisconnected); ServerConnectionMessaging.SendServerConnectionStateChangedMessage(ServerConnectionMessaging.MessageType.HomeServerConnected); } } } } }
public static void SendNavigationCompleteMessage() { SystemMessage msg = new SystemMessage(MessageType.NavigationComplete); ServiceRegistration.Get <IMessageBroker>().Send(CHANNEL, msg); }
public static void PrintDataGridView(DataGridView dgv1, int vp, int v5, int v4, int v3) { PrintPreviewDialog ppvw; _vp = vp; _v5 = v5; _v4 = v4; _v3 = v3; try { // Getting DataGridView object to print dgv = dgv1; // Getting all Coulmns Names in the DataGridView AvailableColumns.Clear(); foreach (DataGridViewColumn c in dgv.Columns) { if (!c.Visible) { continue; } AvailableColumns.Add(c.HeaderText); } // Showing the PrintOption Form PrintOptions dlg = new PrintOptions(AvailableColumns); if (dlg.ShowDialog() != DialogResult.OK) { return; } bool addColumns = false; string columnName = String.Empty; SelectedColumns = dlg.GetSelectedColumns(); switch (dlg.SelectedMode) { case 1: { columnName = "pass"; dgv.Columns.Add(columnName, "Зачёт?"); foreach (DataGridViewRow row in dgv.Rows) { double current = (double)row.Cells["Score"].Value; var cell = (row.Cells[columnName] as DataGridViewTextBoxCell); if ((_vp == 0 && current >= (double)row.Cells["PassingScore"].Value) || (_vp != 0 && current >= _vp)) { cell.Value = "зачёт"; } else { cell.Value = String.Empty; } } SelectedColumns.Add("Зачёт?"); addColumns = true; }; break; case 2: { columnName = "mark"; dgv.Columns.Add(columnName, "Оценка"); foreach (DataGridViewRow row in dgv.Rows) { double current = (double)row.Cells["Score"].Value; var cell = (row.Cells[columnName] as DataGridViewTextBoxCell); string mr = String.Empty; if (current >= _v3) { mr = "3"; } if (current >= _v4) { mr = "4"; } if (current >= _v5) { mr = "5"; } cell.Value = mr; } SelectedColumns.Add("Оценка"); addColumns = true; }; break; case 3: { columnName = "prs"; dgv.Columns.Add(columnName, "%"); foreach (DataGridViewRow row in dgv.Rows) { double current = (double)row.Cells["Score"].Value; double max = (double)row.Cells["MaxScore"].Value; double prs = 0; if (max != 0) { prs = ((double)current / max) * 100.0; } var cell = (row.Cells[columnName] as DataGridViewTextBoxCell); if (prs != 0) { cell.Value = prs.ToString("00.0") + "%"; } else { cell.Value = String.Empty; } } SelectedColumns.Add("%"); addColumns = true; }; break; } if (addColumns) { dgv.Columns[columnName].Width = 60; } PrintAllRows = dlg.PrintAllRows; FitToPageWidth = dlg.FitToPageWidth; RowsPerPage = 0; ppvw = new PrintPreviewDialog(); Form printForm = (ppvw as Form); printForm.Text = "Предварительный просмотр"; printForm.WindowState = FormWindowState.Maximized; printForm.FormBorderStyle = FormBorderStyle.FixedDialog; printForm.MaximizeBox = false; printForm.MinimizeBox = false; ppvw.Document = printDoc; // Showing the Print Preview Page printDoc.BeginPrint += new System.Drawing.Printing.PrintEventHandler(PrintDoc_BeginPrint); printDoc.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(PrintDoc_PrintPage); if (ppvw.ShowDialog() != DialogResult.OK) { printDoc.BeginPrint -= new System.Drawing.Printing.PrintEventHandler(PrintDoc_BeginPrint); printDoc.PrintPage -= new System.Drawing.Printing.PrintPageEventHandler(PrintDoc_PrintPage); } else { // Printing the Documnet try { printDoc.Print(); } catch (Exception ex) { SystemMessage.ShowErrorMessage(ex); } printDoc.BeginPrint -= new System.Drawing.Printing.PrintEventHandler(PrintDoc_BeginPrint); printDoc.PrintPage -= new System.Drawing.Printing.PrintPageEventHandler(PrintDoc_PrintPage); } if (addColumns) { dgv.Columns.Remove(columnName); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void Seed(IContext context) { var record = new SystemMessage { Code = SystemMessageConstant.NotEditable, Message = "Revision is not allowed.", CreatedBy = "medicardadmin", CreatedDate = DateTime.Now }; context.EntitySet <SystemMessage>().AddOrUpdate(c => new { c.Code }, record); record = new SystemMessage { Code = SystemMessageConstant.RecordAdded, Message = "Record successfully added.", CreatedBy = "medicardadmin", CreatedDate = DateTime.Now }; context.EntitySet <SystemMessage>().AddOrUpdate(c => new { c.Code }, record); record = new SystemMessage { Code = SystemMessageConstant.RecordUpdated, Message = "Record successfully updated.", CreatedBy = "medicardadmin", CreatedDate = DateTime.Now }; context.EntitySet <SystemMessage>().AddOrUpdate(c => new { c.Code }, record); record = new SystemMessage { Code = SystemMessageConstant.RecordAssigned, Message = "Record successfully assigned", CreatedBy = "medicardadmin", CreatedDate = DateTime.Now }; context.EntitySet <SystemMessage>().AddOrUpdate(c => new { c.Code }, record); record = new SystemMessage { Code = SystemMessageConstant.RecordSaved, Message = "Record successfully saved", CreatedBy = "medicardadmin", CreatedDate = DateTime.Now }; context.EntitySet <SystemMessage>().AddOrUpdate(c => new { c.Code }, record); #region Common Message record = new SystemMessage { Code = SystemMessageConstant.Toggle, Message = "Record(s) Successfully Updated", CreatedBy = "medicardadmin", CreatedDate = DateTime.Now }; context.EntitySet <SystemMessage>().AddOrUpdate(c => new { c.Code }, record); record = new SystemMessage { Code = SystemMessageConstant.Delete, Message = "Record(s) Successfully Deleted", CreatedBy = "medicardadmin", CreatedDate = DateTime.Now }; context.EntitySet <SystemMessage>().AddOrUpdate(c => new { c.Code }, record); record = new SystemMessage { Code = SystemMessageConstant.Rearrange, Message = "Records successfully rearranged.", CreatedBy = "medicardadmin", CreatedDate = DateTime.Now }; context.EntitySet <SystemMessage>().AddOrUpdate(c => new { c.Code }, record); record = new SystemMessage { Code = SystemMessageConstant.NoRecordAdded, Message = "No record added.", CreatedBy = "medicardadmin", CreatedDate = DateTime.Now }; context.EntitySet <SystemMessage>().AddOrUpdate(c => new { c.Code }, record); record = new SystemMessage { Code = SystemMessageConstant.NoRecordDeleted, Message = "No record deleted.", CreatedBy = "medicardadmin", CreatedDate = DateTime.Now }; context.EntitySet <SystemMessage>().AddOrUpdate(c => new { c.Code }, record); #endregion // Save ~ context.SaveChanges(); }
public SystemMessage BS_Tru_SL_Chil_SP(int id_p, string groupcode) { SystemMessage systemMessage = new SystemMessage(); try { var db = new DB_CSEntities1(); var checkTon = db.sys_code_product.FirstOrDefault(m => m.id_product == id_p && m.group_code == groupcode && m.id_center == user.BranchId && m.trangthai == 0 && m.isactive == true); if (checkTon == null) { systemMessage.IsSuccess = false; systemMessage.Message = SystemMessageConst.systemmessage.DataNotExisted; return(systemMessage); } float gtb = 0; float.TryParse(checkTon.giatrungbinh.ToString(), out gtb); int id_n = 0; int.TryParse(checkTon.id_nhap.ToString(), out id_n); checkTon.trangthai = 1; checkTon.note_code = "update giam"; var checkNhap = db.sys_Nhap.FirstOrDefault(m => m.id == id_n); if (checkNhap == null) { systemMessage.IsSuccess = false; systemMessage.Message = SystemMessageConst.systemmessage.DataNotExisted; return(systemMessage); } int sl = 0; int.TryParse(checkNhap.soluong.ToString(), out sl); if (sl == 0) { systemMessage.IsSuccess = false; systemMessage.Message = "Không thể trừ âm "; return(systemMessage); } checkNhap.soluong = checkNhap.soluong - 1; db.SaveChanges(); systemMessage.IsSuccess = true; systemMessage.Message = SystemMessageConst.systemmessage.UpdateSuccess; return(systemMessage); } catch (Exception e) { systemMessage.IsSuccess = false; systemMessage.Message = e.ToString(); return(systemMessage); } }
public SystemMessage SaveSocialInsuranceDetail(int roleId, int idTable, SocialInsuranceDetail obj, int staffID) { SystemMessage systemMessage = new SystemMessage(); try { var param1 = new DynamicParameters(); param1.Add("@FromMonth", obj.FromMonth); param1.Add("@StaffID", staffID); param1.Add("@AutoID", obj.AutoID); param1.Add("@ExistedResult", 0, DbType.Int32, ParameterDirection.InputOutput); param1.Add("@ExistedDate", "", DbType.String, ParameterDirection.InputOutput); UnitOfWork.ProcedureExecute("SocialInsuranceDetail_CheckFromMonth", param1); var existedResult = param1.GetDataOutput <int>("@ExistedResult"); var existedDate = param1.GetDataOutput <string>("@ExistedDate"); if (existedResult < 0) { systemMessage.IsSuccess = false; systemMessage.existedResult = existedResult; if (existedDate != "") { DateTime tempDate = Convert.ToDateTime(existedDate, CultureInfo.InvariantCulture); systemMessage.ExistedDate = tempDate.ToString().Substring(3, 8); } return(systemMessage); } else { var param = new DynamicParameters(); param.Add("@StaffID", staffID); param.Add("@InsuranceCode", obj.InsuranceCode); param.Add("@InsuranceNumber", obj.InsuranceNumber); param.Add("@HealthNumber", obj.HealthNumber); param.Add("@FamilyCode", obj.FamilyCode); param.Add("@MonthStart", obj.MonthStart); param.Add("@PlaceHold", obj.PlaceHold); param.Add("@InsuranceID", obj.InsuranceID); param.Add("@FromMonth", obj.FromMonth); param.Add("@ToMonth", obj.ToMonth); param.Add("@Status", obj.Status); param.Add("@BasicSalary", obj.BasicSalary); param.Add("@RateCompany", obj.RateCompany); param.Add("@RatePerson", obj.RatePerson); param.Add("@DateReturn", obj.DateReturn); param.Add("@PlaceHealthCare", obj.PlaceHealthCare); param.Add("@Regime", obj.Regime); param.Add("@ApproveStatus", obj.ApproveStatus); param.Add("@Note", obj.Note); param.Add("@InsuranceID", obj.InsuranceID, DbType.Int32, ParameterDirection.InputOutput); param.Add("@AutoID", obj.AutoID, DbType.Int32, ParameterDirection.InputOutput); UnitOfWork.ProcedureExecute("SocialInsuranceDetail_Save", param); systemMessage.IsSuccess = true; return(systemMessage); } } catch (Exception e) { systemMessage.IsSuccess = false; systemMessage.Message = e.ToString(); return(systemMessage); } }
public const string IMPORT_PROGRESS = "ImportProgress"; // Type: Dictionary<ImportJobInformation, Tuple<int, int>> internal static void SendImportMessage(MessageType messageType) { SystemMessage msg = new SystemMessage(messageType); ServiceRegistration.Get <IMessageBroker>().Send(CHANNEL, msg); }
protected Message getMessage() { byte[] b; int avail; try { //while we're here, look for data in the buffer avail = _sock.Available; if (avail > 0) { buffer.ReadFromSocket(_sock, avail); this.BytesReceived += avail; } //first see if we can actually decode something if (buffer.CanDecode()) { b = buffer.Decode(); } else { return(null); } } catch (Exception ex) { PhazeXLog.LogError(ex, GameLibraryVersion.VersionString, 104); _connected = false; return(null); } Message m = null; if (b.Length == 0) { return(m); } else if (b[0] == (byte)pxMessages.Heartbeat) { m = new HeartBeatMessage(b); } else if (b[0] == (byte)pxMessages.ChangeName) { m = new ChangeNameMessage(b, this.GetPlayerIDs()); } else if (b[0] == (byte)pxMessages.ChangeNameReject) { m = new ChangeNameRejectMessage(b); } else if (b[0] == (byte)pxMessages.Chat) { m = new ChatMessage(b, this.GetPlayerIDs()); } else if (b[0] == (byte)pxMessages.CompletedPhaze) { m = new CompletedPhazeMessage(b, this.GetPlayerIDs()); } else if (b[0] == (byte)pxMessages.CurrentPhaze) { m = new CurrentPhazeMessage(b, this.GameRules); } else if (b[0] == (byte)pxMessages.DiscardSkip) { m = new DiscardSkipMessage(b, this.GetPlayerIDs(), this.GameRules); } else if (b[0] == (byte)pxMessages.DialogMessage) { m = new DialogMessage(b); } else if (b[0] == (byte)pxMessages.ErrorMessage) { m = new ErrorMessage(b); } else if (b[0] == (byte)pxMessages.GameOver) { m = new GameOverMessage(b); } else if (b[0] == (byte)pxMessages.GameRules) { m = new GameRulesMessage(b); } else if (b[0] == (byte)pxMessages.GameStarting) { m = new GameStartingMessage(b); } else if (b[0] == (byte)pxMessages.Goodbye) { m = new GoodbyeMessage(b); } else if (b[0] == (byte)pxMessages.GotCards) { m = new GotCardsMessage(b, this.GameRules); } else if (b[0] == (byte)pxMessages.GotDeckCard) { m = new GotDeckCardMessage(b, this.GetPlayerIDs()); } else if (b[0] == (byte)pxMessages.GotDiscard) { m = new GotDiscardMessage(b, this.GetPlayerIDs(), this.GameRules); } else if (b[0] == (byte)pxMessages.Hand) { m = new HandMessage(b, this.GameRules); } else if (b[0] == (byte)pxMessages.Login) { m = new LoginMessage(b); } else if (b[0] == (byte)pxMessages.LoginAcknowledgment) { m = new LoginAckMessage(b); } else if (b[0] == (byte)pxMessages.LogOff) { m = new LogOffMessage(b, this.GetPlayerIDs()); } else if (b[0] == (byte)pxMessages.NewHand) { m = new NewHandMessage(b); } else if (b[0] == (byte)pxMessages.PlayedCardOnTable) { m = new PlayedCardOnTableMessage(b, this.GetPlayerIDs(), this.GameRules); } else if (b[0] == (byte)pxMessages.Ready) { m = new ReadyMessage(b, this.GetPlayerIDs()); } else if (b[0] == (byte)pxMessages.Scoreboard) { m = new ScoreboardMessage(b, this.GetPlayerIDs(), this.GameRules); } else if (b[0] == (byte)pxMessages.SkipNotification) { m = new SkipNotificationMessage(b, this.GetPlayerIDs()); } else if (b[0] == (byte)pxMessages.StartGameTimer) { m = new StartGameTimerMessage(b); } else if (b[0] == (byte)pxMessages.Status) { m = new StatusMessage(b, this.GetPlayerIDs(), this.GameRules); } else if (b[0] == (byte)pxMessages.SystemMessage) { m = new SystemMessage(b); } else if (b[0] == (byte)pxMessages.Table) { m = new TableMessage(b, this.GameRules); } else if (b[0] == (byte)pxMessages.TurnEnd) { m = new TurnEndMessage(b, this.GetPlayerIDs()); } else if (b[0] == (byte)pxMessages.TurnStart) { m = new TurnStartMessage(b, this.GetPlayerIDs()); } else if (b[0] == (byte)pxMessages.UpdateDiscard) { m = new UpdateDiscardMessage(b, this.GetPlayerIDs(), this.GameRules); } else if (b[0] == (byte)pxMessages.WentOut) { m = new WentOutMessage(b, this.GetPlayerIDs()); } else if (b[0] == (byte)pxMessages.Won) { m = new WonMessage(b, this.GetPlayerIDs()); } else { m = new UnknownMessage(b); } return(m); }
public override void run() { L2Player player = Client.CurrentPlayer; L2Player target = null; //if (name.Equals(player.Name)) //{ // player.sendActionFailed(); // return; //} foreach (L2Object obj in player.knownObjects.Values) { if (obj is L2Player) { if (((L2Player)obj).Name.Equals(name)) { target = (L2Player)obj; break; } } } if (target == null) { target = L2World.Instance.GetPlayer(name); } if (target == null) { player.sendSystemMessage(185);//You must first select a user to invite to your party. player.sendActionFailed(); return; } if (!target.Visible) { player.sendMessage("That player is invisible and cannot be invited."); player.sendActionFailed(); return; } if (target.Party != null) { SystemMessage sm = new SystemMessage(160); sm.addPlayerName(target.Name); player.sendPacket(sm);//$c1 is a member of another party and cannot be invited. player.sendActionFailed(); return; } if (player.IsCursed || target.IsCursed) { player.sendSystemMessage(152);//You have invited the wrong target. player.sendActionFailed(); return; } if (target.PartyState == 1) { player.sendSystemMessage(164);//Waiting for another reply. player.sendActionFailed(); return; } if (target.TradeState == 1 || target.TradeState == 2) { player.sendPacket(new SystemMessage(153).addPlayerName(target.Name));//$c1 is on another task. Please try again later. player.sendActionFailed(); return; } if (player.Party != null && player.Party.leader.ObjID != player.ObjID) { player.sendSystemMessage(154);//Only the leader can give out invitations. player.sendActionFailed(); return; } if (player.IsInOlympiad) { player.requester.sendSystemMessage(3094);//A user currently participating in the Olympiad cannot send party and friend invitations. player.sendActionFailed(); return; } if (player.Party != null && player.Party.Members.Count == 9) { player.requester.sendSystemMessage(155);//The party is full. player.sendActionFailed(); return; } player.sendPacket(new SystemMessage(105).addPlayerName(target.Name));//$c1 has been invited to the party. target.PendToJoinParty(player, itemDistribution); }
private void ProcessSystemMessage(string msg, string[] values) { var systemMessage = new SystemMessage(values[0], msg); System?.Invoke(systemMessage); }
public override void SendMessage(SystemMessage message) { switch (message) { case SystemMessage.CLEARSCREEN: ClearScreen(); break; default: base.SendMessage(message); break; } }
internal static void SendMessageReloadScreens() { SystemMessage msg = new SystemMessage(MessageType.ReloadScreens); ServiceRegistration.Get <IMessageBroker>().Send(CHANNEL, msg); }
public const string SERVERS_WERE_ADDED = "ServersWereAdded"; // Type: bool /// <summary> /// Sends a <see cref="MessageType.HomeServerConnected"/> or <see cref="MessageType.HomeServerDisconnected"/> message. /// </summary> /// <param name="messageType">One of the <see cref="MessageType.HomeServerConnected"/> or /// <see cref="MessageType.HomeServerDisconnected"/> messages.</param> public static void SendServerConnectionStateChangedMessage(MessageType messageType) { SystemMessage msg = new SystemMessage(messageType); ServiceRegistration.Get <IMessageBroker>().Send(CHANNEL, msg); }
private void dataGridView_DataError(object sender, DataGridViewDataErrorEventArgs e) { SystemMessage.ShowWarningMessage("Неверный формат данных."); }
public virtual void PreviewSystemMessage(SystemMessage message, Message msg) { }
public override void W() { InitTempValue(); OnMove(); HitEffectRPC("Alistar", "W"); GameObject obj = SkillObj["W"][0]; if (obj.activeInHierarchy) { Pooling(QSkillprefab, "W", 10); obj = SkillObj["W"][0]; } SkillObj["W"].RemoveAt(0); SkillObj["W"].Add(obj); obj.transform.position = transform.position; obj.SetActive(true); if (TempObject1.tag.Equals("Minion")) { MinionBehavior mB = TempObject1.GetComponent <MinionBehavior>(); if (!TempObject1.gameObject.name.Contains(TheChampionBehaviour.Team)) { MinionAtk mA = mB.minAtk; //mA.PushMe(Vector3.up * 3 + TempObject1.transform.position // + (((TempObject1.transform.position - TempVector1).normalized) * 5), 0.5f); Vector3 direction = (TempObject1.transform.position - TempVector1).normalized; Vector3 v = TempObject1.transform.position + (direction * 10);; RaycastHit hit; if (Physics.Raycast(mA.transform.position, direction, out hit, 12, 1 << LayerMask.NameToLayer("WallCollider"))) { float dis = Vector3.Distance(hit.point, TempObject1.transform.position); v = TempObject1.transform.position + (direction * (dis - 1f)); } v.y = 0; mA.PushMe(v, 0.5f); mA.PauseAtk(1f, true); float damage = skillData.wDamage[TheChampionData.skill_W - 1] + Acalculate(skillData.wAstat, skillData.wAvalue); if (mB != null) { int viewID = mB.GetComponent <PhotonView>().viewID; HitRPC(viewID, damage, "AP", "Push"); if (mB.HitMe(damage, "AP", gameObject)) { //여기에는 나중에 평타 만들면 플레이어의 현재 공격 타겟이 죽었을 시 초기화해주는 것을 넣자. TheChampionAtk.ResetTarget(); // 스킬쏜애 주인이 나면 킬올리자 if (GetComponent <PhotonView>().owner.Equals(PhotonNetwork.player)) { TheChampionData.Kill_CS_Gold_Exp(TempObject1.gameObject.name, 1, TempObject1.transform.position); } } } } } //else if (TempObject1.tag.Equals("Player")) else if (TempObject1.layer.Equals(LayerMask.NameToLayer("Champion"))) { ChampionBehavior cB = TempObject1.GetComponent <ChampionBehavior>(); if (cB.Team != TheChampionBehaviour.Team) { ChampionAtk cA = cB.myChampAtk; Vector3 direction = (TempObject1.transform.position - TempVector1).normalized; Vector3 v = TempObject1.transform.position + (direction * 5);; RaycastHit hit; if (Physics.Raycast(cA.transform.position, direction, out hit, 6, 1 << LayerMask.NameToLayer("WallCollider"))) { float dis = Vector3.Distance(hit.point, TempObject1.transform.position); v = TempObject1.transform.position + (direction * (dis - 1f)); } v.y = 0.5f; cA.PushMe(v, 0.5f); cA.PauseAtk(1f, true); float damage = skillData.wDamage[TheChampionData.skill_W - 1] + Acalculate(skillData.wAstat, skillData.wAvalue); if (cB != null) { int viewID = cB.GetComponent <PhotonView>().viewID; HitRPC(viewID, damage, "AP", "Push"); if (cB.HitMe(damage, "AP", gameObject, gameObject.name)) { TheChampionAtk.ResetTarget(); if (!sysmsg) { sysmsg = GameObject.FindGameObjectWithTag("SystemMsg").GetComponent <SystemMessage>(); } //sysmsg.sendKillmsg("alistar", TempObject1.GetComponent<ChampionData>().ChampionName, TheChampionBehaviour.Team.ToString()); // 스킬쏜애 주인이 나면 킬올리자 //if (GetComponent<PhotonView>().owner.Equals(PhotonNetwork.player)) //{ // TheChampionData.Kill_CS_Gold_Exp(TempObject1.gameObject.name, 0, TempObject1.transform.position); //} } } } } else if (TempObject1.layer.Equals(LayerMask.NameToLayer("Monster"))) { MonsterBehaviour mB = TempObject1.GetComponent <MonsterBehaviour>(); MonsterAtk mA = mB.monAtk; Vector3 direction = (TempObject1.transform.position - TempVector1).normalized; Vector3 v = TempObject1.transform.position + (direction * 5);; RaycastHit hit; if (Physics.Raycast(mA.transform.position, direction, out hit, 6, 1 << LayerMask.NameToLayer("WallCollider"))) { float dis = Vector3.Distance(hit.point, TempObject1.transform.position); v = TempObject1.transform.position + (direction * (dis - 1f)); } v.y = 0; mA.PushMe(v, 0.5f); mA.PauseAtk(1f, true); float damage = skillData.wDamage[TheChampionData.skill_W - 1] + Acalculate(skillData.wAstat, skillData.wAvalue); if (mB != null) { int viewID = mB.GetComponent <PhotonView>().viewID; HitRPC(viewID, damage, "AP", "Push"); if (mB.HitMe(damage, "AP", gameObject)) { TheChampionAtk.ResetTarget(); //// 스킬쏜애 주인이 나면 킬올리자 //if (GetComponent<PhotonView>().owner.Equals(PhotonNetwork.player)) //{ // TheChampionData.Kill_CS_Gold_Exp(TempObject1.gameObject.name, 3, TempObject1.transform.position); //} } } } skillselect = SSelect.none; }
public static void SendRegisteredSharesChangedMessage() { SystemMessage msg = new SystemMessage(MessageType.RegisteredSharesChanged); ServiceRegistration.Get <IMessageBroker>().Send(CHANNEL, msg); }
public const string PARAM = "Param"; // Parameter depends on the message type, see the docs in MessageType enum /// <summary> /// Sends a parameterless skin resource message. /// </summary> /// <param name="type">Type of the message.</param> public static void SendSkinResourcesMessage(MessageType type) { SystemMessage msg = new SystemMessage(type); ServiceRegistration.Get <IMessageBroker>().Send(CHANNEL, msg); }
/// <summary> /// 新增游戏 /// </summary> /// <param name="gameGameItem"></param> public Message InsertSystemMessage(SystemMessage systemMessage) { aidePlatformData.InsertSystemMessage(systemMessage); return(new Message(true)); }
private void OnMessageReceived(AsynchronousMessageQueue queue, SystemMessage message) { if (message.ChannelName == ServerConnectionMessaging.CHANNEL) { ServerConnectionMessaging.MessageType messageType = (ServerConnectionMessaging.MessageType)message.MessageType; switch (messageType) { case ServerConnectionMessaging.MessageType.AvailableServersChanged: ICollection <ServerDescriptor> availableServers = (ICollection <ServerDescriptor>) message.MessageData[ServerConnectionMessaging.AVAILABLE_SERVERS]; SynchronizeAvailableServers(); Mode mode; lock (_syncObj) mode = _mode; if (mode == Mode.AttachToServer) { if (_autoCloseOnNoServer && availableServers.Count == 0) { LeaveConfiguration(); return; } } break; } } else if (message.ChannelName == DialogManagerMessaging.CHANNEL) { DialogManagerMessaging.MessageType messageType = (DialogManagerMessaging.MessageType)message.MessageType; if (messageType == DialogManagerMessaging.MessageType.DialogClosed) { Guid dialogHandle = (Guid)message.MessageData[DialogManagerMessaging.DIALOG_HANDLE]; bool leaveConfiguration = false; bool doDetach = false; lock (_syncObj) if (_attachInfoDialogHandle == dialogHandle) { _attachInfoDialogHandle = null; leaveConfiguration = true; } else if (_detachConfirmDialogHandle == dialogHandle) { DialogResult dialogResult = (DialogResult)message.MessageData[DialogManagerMessaging.DIALOG_RESULT]; _detachConfirmDialogHandle = Guid.Empty; if (dialogResult == DialogResult.Yes) { doDetach = true; } leaveConfiguration = true; } // Do the next two statements outside our lock if (doDetach) { DoDetachFromHomeServer(); } if (leaveConfiguration) { LeaveConfiguration(); } } } }
void OnMessageReceived(AsynchronousMessageQueue queue, SystemMessage message) { if (message.ChannelName == WorkflowManagerMessaging.CHANNEL) { // Adjust our knowledge about the currently opened FSC/CP state if the user switches to one of them WorkflowManagerMessaging.MessageType messageType = (WorkflowManagerMessaging.MessageType)message.MessageType; switch (messageType) { case WorkflowManagerMessaging.MessageType.StatesPopped: ICollection <Guid> statesRemoved = new List <Guid>( ((IDictionary <Guid, NavigationContext>)message.MessageData[WorkflowManagerMessaging.CONTEXTS]).Keys); HandleStatesRemovedFromWorkflowStack(statesRemoved); break; case WorkflowManagerMessaging.MessageType.StatePushed: NavigationContext context = (NavigationContext)message.MessageData[WorkflowManagerMessaging.CONTEXT]; Guid stateId = context.WorkflowState.StateId; HandleWorkflowStatePushed(stateId); break; } } else if (message.ChannelName == PlayerManagerMessaging.CHANNEL) { // React to player changes PlayerManagerMessaging.MessageType messageType = (PlayerManagerMessaging.MessageType)message.MessageType; IPlayerSlotController psc; switch (messageType) { case PlayerManagerMessaging.MessageType.PlayerResumeState: psc = (IPlayerSlotController)message.MessageData[PlayerManagerMessaging.PLAYER_SLOT_CONTROLLER]; IResumeState resumeState = (IResumeState)message.MessageData[PlayerManagerMessaging.KEY_RESUME_STATE]; Guid mediaItemId = (Guid)message.MessageData[PlayerManagerMessaging.KEY_MEDIAITEM_ID]; HandleResumeInfo(psc, mediaItemId, resumeState); break; case PlayerManagerMessaging.MessageType.PlayerError: case PlayerManagerMessaging.MessageType.PlayerEnded: psc = (IPlayerSlotController)message.MessageData[PlayerManagerMessaging.PLAYER_SLOT_CONTROLLER]; HandlePlayerEnded(psc); break; case PlayerManagerMessaging.MessageType.PlayerStopped: psc = (IPlayerSlotController)message.MessageData[PlayerManagerMessaging.PLAYER_SLOT_CONTROLLER]; HandlePlayerStopped(psc); break; case PlayerManagerMessaging.MessageType.RequestNextItem: psc = (IPlayerSlotController)message.MessageData[PlayerManagerMessaging.PLAYER_SLOT_CONTROLLER]; HandleRequestNextItem(psc); break; } CleanupPlayerContexts(); CheckMediaWorkflowStates_NoLock(); // Primary player could have been changed or closed or CP player could have been closed } else if (message.ChannelName == PlayerContextManagerMessaging.CHANNEL) { // React to internal player context manager changes PlayerContextManagerMessaging.MessageType messageType = (PlayerContextManagerMessaging.MessageType)message.MessageType; switch (messageType) { case PlayerContextManagerMessaging.MessageType.UpdatePlayerRolesInternal: PlayerContext newCurrentPlayer = (PlayerContext)message.MessageData[PlayerContextManagerMessaging.NEW_CURRENT_PLAYER_CONTEXT]; PlayerContext newAudioPlayer = (PlayerContext)message.MessageData[PlayerContextManagerMessaging.NEW_AUDIO_PLAYER_CONTEXT]; HandleUpdatePlayerRoles(newCurrentPlayer, newAudioPlayer); break; // PlayerContextManagerMessaging.MessageType.CurrentPlayerChanged not handled here } } }
// Use this for initialization void Start() { Dialog = GetComponentInChildren<GUITextBox>(); System = GetComponentInChildren<SystemMessage>(); }