public void CompleteCraft() { if (RandomUtilities.IsLuck(LuckChance) && IsActive) //todo Craft chance { if (RandomUtilities.IsLuck(Recipe.CriticalChancePercent) && Recipe.CriticalChancePercent != 0) { SystemMessages.CraftedItem("@item:" + Recipe.CriticalResultItem.Key).Send(Player.Connection); Communication.Global.StorageService.AddItem(Player, Player.Inventory, Recipe.CriticalResultItem.Key, Recipe.CriticalResultItem.Value); } else { SystemMessages.CraftedItem("@item:" + Recipe.ResultItem.Key).Send(Player.Connection); Communication.Global.StorageService.AddItem(Player, Player.Inventory, Recipe.ResultItem.Key, Recipe.ResultItem.Value); } if (RandomUtilities.IsLuck(ProgressStatChance)) { Communication.Global.CraftLearnService.ProcessCraftStat(Player, Recipe.CraftStat); } new SpCraftProgress(100).Send(Player.Connection); new SpCharacterEmotions(Player, PlayerEmotion.CraftSuccess).Send(Player.Connection); } else { new SpCraftProgress(100).Send(Player.Connection); SystemMessages.FailedToCraftItem("@item:" + Recipe.ResultItem.Key).Send(Player.Connection); } }
public ActionResult Setup(int?id) { ComponentSetupViewModel vm = null; if (!id.HasValue) { ViewBag.Title = ComponentStrings.Component_Create_Title; vm = new ComponentSetupViewModel() { IsActive = true }; } else { ViewBag.Title = ComponentStrings.Component_Edit_Title; vm = _componentService.GetComponentById(id.Value); } if (vm == null) { SystemMessages.Add(CommonStrings.No_Record, true, true); return(RedirectToAction("Index")); } ViewBag.ComponentTypeDropDown = new SelectList(_componentTypeService.GetComponentTypeDropDown(), "Value", "Text"); ViewBag.DonorDropDown = new SelectList(_donorService.GetDonorDropDown(), "Value", "Text"); return(View("Setup", vm)); }
public ActionResult Setup(int?id) { ComponentTypeSetupViewModel vm = null; if (!id.HasValue) { ViewBag.Title = ComponentStrings.ComponentType_Create_Title; vm = new ComponentTypeSetupViewModel() { IsActive = true }; } else { ViewBag.Title = ComponentStrings.ComponentType_Edit_Title; vm = _componentTypeService.GetComponentTypeById(id.Value); } if (vm == null) { SystemMessages.Add(CommonStrings.No_Record, true, true); return(RedirectToAction("Index")); } return(PartialView("_Setup", vm)); }
public ActionResult Setup(ComponentTypeSetupViewModel vm) { if (ModelState.IsValid) { try { if (vm.Id > 0) { if (_componentTypeService.UpdateComponentType(vm)) { SystemMessages.Add(ComponentStrings.ComponentType_Edit_Update_Success_Msg, false, true); } else { SystemMessages.Add(CommonStrings.No_Record, true, true); } } else { _componentTypeService.CreateComponentType(vm); SystemMessages.Add(ComponentStrings.ComponentType_Edit_Create_Success_Msg, false, true); } return(new XHR_JSON_Redirect()); } catch (Exception ex) { SystemMessages.Add(CommonStrings.Server_Error, true, true); } } return(PartialView("_Setup", vm)); }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { return; } ProcessSessionParameters(); if (KpiIdHiddenField.Value == "0") { SystemMessages.DisplaySystemErrorMessage(Resources.KpiDetails.ErrorLoadingKpi); Response.Redirect("~/Kpi/KpiList.aspx"); return; } try { LoadKpiData(); return; } catch (Exception ex) { SystemMessages.DisplaySystemErrorMessage(Resources.KpiDetails.ErrorLoadingKpi); log.Error("Error loading KPI", ex); } Response.Redirect("~/Kpi/KpiList.aspx"); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { List <KPIMeasurements> theList = new List <KPIMeasurements>(); try { if (Unit.Equals("TIME")) { theList = KpiMeasurementBLL.GetKPIMeasurementCategoriesTimeByKpiId(KpiId, CategoryId, CategoryItemId); } else { theList = KpiMeasurementBLL.GetKPIMeasurementCategoriesByKpiId(KpiId, CategoryId, CategoryItemId); } } catch (Exception exc) { SystemMessages.DisplaySystemErrorMessage(exc.Message); } MeasurementsGridView.DataSource = theList; MeasurementsGridView.DataBind(); if (theList.FindAll(i => !string.IsNullOrEmpty(i.Detalle)).Count > 0 && string.IsNullOrEmpty(CategoryItemId)) { MeasurementsGridView.Columns[1].Visible = true; } else { MeasurementsGridView.Columns[1].Visible = false; } } }
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) { //// If the app is running outside of the debugger then report the exception using //// the browser's exception mechanism. On IE this will display it a yellow alert //// icon in the status bar and Firefox will display a script error. //if (!System.Diagnostics.Debugger.IsAttached) //{ // // NOTE: This will allow the application to continue running after an exception has been thrown // // but not handled. // // For production applications this error handling should be replaced with something that will // // report the error to the website and stop the application. // e.Handled = true; // Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); }); //} StringBuilder sb = new StringBuilder(); sb.AppendLine("Exception Type: " + e.GetType().ToString()); sb.AppendLine("Error Message: " + e.ExceptionObject.Message); sb.AppendLine("Stack Trace: " + e.ExceptionObject.StackTrace); SystemMessages sm = new SystemMessages(new Message() { UserMessage = "Application Error Occured", SystemMessage = sb.ToString(), UserMessageType = MessageType.Error }, ButtonType.OkOnly); sm.ShowPopup(); }
public ActionResult Delete(int id, FormCollection fc) { if (id > 0) { try { if (_employeeTypeService.DeleteEmployeeType(id)) { SystemMessages.Add(EmployeeTypeStrings.Employee_Type_Delete_Success_Msg, SystemMessageType.Success, true); } else { SystemMessages.Add(CommonStrings.No_Record, SystemMessageType.Error, true); } } catch (Exception ex) { SystemMessages.Add(CommonStrings.Server_Error, SystemMessageType.Error, true); } } else { SystemMessages.Add(CommonStrings.POST_NoID, SystemMessageType.Error, true); } return(new XHR_JSON_Redirect()); }
public void RemoveMoney(Player arrivedFrom, long money) { lock (TradeLock) { if (IsTradeFinished()) { return; } if (arrivedFrom != Player1 && arrivedFrom != Player2) { return; } Storage storage = arrivedFrom.Equals(Player1) ? Storage1 : Storage2; if (storage.Locked) { SystemMessages.TradeListLocked.Send(arrivedFrom); return; } if (!Communication.Global.StorageService.RemoveMoney(arrivedFrom, storage, money)) { return; } Communication.Global.StorageService.AddMoneys(arrivedFrom, arrivedFrom.Inventory, money); CheckLock(arrivedFrom.Equals(Player1) ? Storage2 : Storage1); SystemMessages.YouOfferedMoney(storage.Money).Send(arrivedFrom); SystemMessages.OpponentOfferedMoney(arrivedFrom.PlayerData.Name, storage.Money).Send( arrivedFrom.Equals(Player1) ? Player2 : Player1); UpdateWindow(); } }
private void LoadArea() { if (AreaId > 0) { Area theData = null; try { theData = AreaBLL.GetAreaById(AreaId); } catch (Exception exc) { SystemMessages.DisplaySystemErrorMessage(exc.Message); } if (theData != null) { if (DataTypeHiddenField.Value.Equals("KPI")) { pnlAddArea.Style["display"] = "none"; pnlKPIArea.Style["display"] = "inline"; KPIAreaText.Text = theData.Name; AreaTextBox.Enabled = !ReadOnly; RemoveAreaButton.Visible = !ReadOnly; } else { AreaTextBox.Text = theData.Name; } } } KPIActivityText.Enabled = !ReadOnly; }
void client_GetNodesCompleted(object sender, GetNodesCompletedEventArgs e) { if (e.Error == null) { ComboboxNode.ItemsSource = e.Result; } else { SystemMessages sm; if (e.Error is FaultException <CustomServiceFault> ) { FaultException <CustomServiceFault> fault = e.Error as FaultException <CustomServiceFault>; sm = new SystemMessages(new Message() { UserMessage = fault.Detail.UserMessage, SystemMessage = fault.Detail.SystemMessage, UserMessageType = MessageType.Error }, ButtonType.OkOnly); } else { sm = new SystemMessages(new Message() { UserMessage = "Failed to Retrieve Nodes", SystemMessage = e.Error.Message, UserMessageType = MessageType.Error }, ButtonType.OkOnly); } sm.ShowPopup(); } if (ComboboxNode.Items.Count > 0) { ComboboxNode.SelectedIndex = 0; } }
void client_GetAdapterListCompleted(object sender, GetAdapterListCompletedEventArgs e) { if (e.Error == null) { ListBoxAdapterList.ItemsSource = e.Result; } else { SystemMessages sm; if (e.Error is FaultException <CustomServiceFault> ) { FaultException <CustomServiceFault> fault = e.Error as FaultException <CustomServiceFault>; sm = new SystemMessages(new Message() { UserMessage = fault.Detail.UserMessage, SystemMessage = fault.Detail.SystemMessage, UserMessageType = MessageType.Error }, ButtonType.OkOnly); } else { sm = new SystemMessages(new Message() { UserMessage = "Failed to Retrieve Adapter List", SystemMessage = e.Error.Message, UserMessageType = MessageType.Error }, ButtonType.OkOnly); } sm.ShowPopup(); } }
void m_client_GetNodeListCompleted(object sender, GetNodeListCompletedEventArgs e) { if (e.Error == null) { ComboboxNode.ItemsSource = e.Result; SetGlobalVariables(); } else { SystemMessages sm; if (e.Error is FaultException <CustomServiceFault> ) { FaultException <CustomServiceFault> fault = e.Error as FaultException <CustomServiceFault>; sm = new SystemMessages(new Message() { UserMessage = fault.Detail.UserMessage, SystemMessage = fault.Detail.SystemMessage, UserMessageType = MessageType.Error }, ButtonType.OkOnly); } else { sm = new SystemMessages(new Message() { UserMessage = "Failed to Retrieve Nodes", SystemMessage = e.Error.Message, UserMessageType = MessageType.Error }, ButtonType.OkOnly); } sm.ShowPopup(); } m_raiseNodesCollectionChanged = false; }
public ActionResult Edit(MediaGroupsEditModel model) { if (ModelState.IsValid) { short sysMessageId = 0; byte sysMessageTypeId = 0; model.SystemStatus = SystemStatus.Error; var mediaGroup = new MediaGroups { SiteId = model.SiteId, MediaGroupId = model.MediaGroupId, MediaGroupName = model.MediaGroupName, MediaGroupDesc = model.MediaGroupDesc, ParentGroupId = model.ParentGroupId, CrUserId = model.CrUserId, CrDateTime = model.CrDateTime }; sysMessageTypeId = model.MediaGroupId > 0 ? mediaGroup.Update(0, _userId, ref sysMessageId) : mediaGroup.Insert(0, _userId, ref sysMessageId); if (sysMessageId > 0) { var sysMessage = new SystemMessages().Get(sysMessageId); if (sysMessageTypeId == CmsConstants.SystemMessageIdSuccess) { model.SystemStatus = SystemStatus.Success; } ModelState.AddModelError("SystemMessages", sysMessage.SystemMessageDesc); } else { ModelState.AddModelError("SystemMessages", "Bạn vui lòng thử lại sau."); } } return(View(model)); }
protected void BitacoraDataSource_Selected(object sender, ObjectDataSourceStatusEventArgs e) { if (e.Exception != null) { log.Error("Ocurrio un error al tratar de obtener la lista de eventos", e.Exception); SystemMessages.DisplaySystemErrorMessage("Ocurrio un error al obtener la lista de Eventos"); e.ExceptionHandled = true; } int totalRows = 0; try { totalRows = Convert.ToInt32(e.OutputParameters["totalRows"]); } catch (Exception ex) { log.Error("Failed to get OuputParameter 'totalRows'", ex); } Pager.TotalRows = totalRows; if (totalRows == 0) { Pager.Visible = false; return; } Pager.Visible = true; Pager.BuildPagination(); }
void SendInitialize() { SystemMessages sm; try { if (serviceClient != null && serviceClient.Helper.RemotingClient.CurrentState == TVA.Communication.ClientState.Connected) { string result = CommonFunctions.SendCommandToWindowsService(serviceClient, "Initialize " + TextBlockRuntimeID.Text); sm = new SystemMessages(new Message() { UserMessage = result, SystemMessage = "", UserMessageType = MessageType.Success }, ButtonType.OkOnly); } else { sm = new SystemMessages(new Message() { UserMessage = "Application is disconnected", SystemMessage = "Connection String: " + ((App)Application.Current).RemoteStatusServiceUrl, UserMessageType = MessageType.Error }, ButtonType.OkOnly); } } catch (Exception ex) { CommonFunctions.LogException(null, "WPF.SendInitialize", ex); sm = new SystemMessages(new Message() { UserMessage = "Failed to Send Initialize Command", SystemMessage = ex.Message, UserMessageType = MessageType.Error }, ButtonType.OkOnly); } sm.Owner = Window.GetWindow(this); sm.WindowStartupLocation = WindowStartupLocation.CenterOwner; sm.ShowPopup(); }
void AddDevices() { SystemMessages sm; try { string result = CommonFunctions.AddDevices(null, m_sourceOutputStreamID, m_devicesToBeAdded, (bool)CheckAddDigitals.IsChecked, (bool)CheckAddAnalog.IsChecked); sm = new SystemMessages(new Message() { UserMessage = result, SystemMessage = string.Empty, UserMessageType = MessageType.Success }, ButtonType.OkOnly); sm.Owner = Window.GetWindow(this); sm.WindowStartupLocation = WindowStartupLocation.CenterOwner; sm.ShowPopup(); GetDevicesForOutputStream(); } catch (Exception ex) { CommonFunctions.LogException(null, "WPF.AddDevices", ex); sm = new SystemMessages(new Message() { UserMessage = "Failed to Add Output Stream Device(s)", SystemMessage = ex.Message, UserMessageType = MessageType.Error }, ButtonType.OkOnly); sm.Owner = Window.GetWindow(this); sm.WindowStartupLocation = WindowStartupLocation.CenterOwner; sm.ShowPopup(); } }
private void LoadFormEnterData() { DateTextBox.Text = DateTime.Now.ToString(); //-- get CategoriesItems combinated List <KPICategoyCombination> theCombinatedList = new List <KPICategoyCombination>(); try { theCombinatedList = KPICategoryCombinationBLL.GetCategoryItemsCombinatedByKpiId(Convert.ToInt32(KPIIdHiddenField.Value)); } catch (Exception exc) { log.Error("Error en GetCategoryItemsCombinatedByKpiId para kpiId: " + KPIIdHiddenField.Value, exc); SystemMessages.DisplaySystemErrorMessage(exc.Message); return; } if (theCombinatedList.Count <= 0) { theCombinatedList.Add(new KPICategoyCombination()); } EnterDataRepeater.DataSource = theCombinatedList; EnterDataRepeater.DataBind(); }
public override void Process() { if (GuildName == "") { return; } if (Connection.Player.PlayerLastPraise != -1 && Funcs.GetRoundedUtc() - Connection.Player.PlayerLastPraise > 86400) { Connection.Player.PlayerLastPraise = -1; Connection.Player.PlayerPraiseGiven = 0; } if (Connection.Player.PlayerPraiseGiven >= 3) { new SpSystemNotice("Sorry, but you've exceeded the limit of 3 praises per day.").Send(Connection); return; } Connection.Player.PlayerPraiseGiven++; Connection.Player.PlayerLastPraise = Funcs.GetRoundedUtc(); Communication.Global.GuildService.PraiseGuild(GuildName); Communication.Global.GuildService.SendServerGuilds(Connection.Player, 1); SystemMessages.YouPraiseGuildNowYouHavePraisesLeft(GuildName, 3 - Connection.Player.PlayerPraiseGiven).Send(Connection.Player); }
void GetOutputStreamList() { try { ListBoxOutputStreamList.ItemsSource = CommonFunctions.GetOutputStreamList(null, false, m_nodeValue); if (ListBoxOutputStreamList.Items.Count > 0) { ListBoxOutputStreamList.SelectedIndex = 0; } else { ClearForm(); } } catch (Exception ex) { CommonFunctions.LogException(null, "WPF.GetOutputStreamList", ex); SystemMessages sm = new SystemMessages(new Message() { UserMessage = "Failed to Retrieve Output Stream List", SystemMessage = ex.Message, UserMessageType = MessageType.Error }, ButtonType.OkOnly); sm.Owner = Window.GetWindow(this); sm.WindowStartupLocation = WindowStartupLocation.CenterOwner; sm.ShowPopup(); } }
void m_client_GetFilteredMeasurementsByDeviceCompleted(object sender, GetFilteredMeasurementsByDeviceCompletedEventArgs e) { if (e.Error == null) { ComboBoxMeasurements.ItemsSource = e.Result; } else { SystemMessages sm; if (e.Error is FaultException <CustomServiceFault> ) { FaultException <CustomServiceFault> fault = e.Error as FaultException <CustomServiceFault>; sm = new SystemMessages(new openPDCManager.Utilities.Message() { UserMessage = fault.Detail.UserMessage, SystemMessage = fault.Detail.SystemMessage, UserMessageType = MessageType.Error }, ButtonType.OkOnly); } else { sm = new SystemMessages(new openPDCManager.Utilities.Message() { UserMessage = "Failed to Retrieve Measurements for Device", SystemMessage = e.Error.Message, UserMessageType = MessageType.Error }, ButtonType.OkOnly); } sm.ShowPopup(); } if (ComboBoxMeasurements.Items.Count > 0) { ComboBoxMeasurements.SelectedIndex = 0; } ReconnectToService(); }
bool IsValid() { bool isValid = true; if (string.IsNullOrEmpty(TextBoxName.Text.CleanText())) { isValid = false; SystemMessages sm = new SystemMessages(new Message() { UserMessage = "Invalid Name", SystemMessage = "Please provide valid Name.", UserMessageType = MessageType.Error }, ButtonType.OkOnly); sm.Closed += new EventHandler(delegate(object sender, EventArgs e) { TextBoxName.Focus(); }); #if !SILVERLIGHT sm.Owner = Window.GetWindow(this); #endif sm.ShowPopup(); return(isValid); } return(isValid); }
void client_GetOutputStreamDeviceAnalogListCompleted(object sender, GetOutputStreamDeviceAnalogListCompletedEventArgs e) { if (e.Error == null) { ListBoxOutputStreamDeviceAnalogList.ItemsSource = e.Result; if (ListBoxOutputStreamDeviceAnalogList.Items.Count > 0 && m_selectFirst) { ListBoxOutputStreamDeviceAnalogList.SelectedIndex = 0; m_selectFirst = false; } } else { SystemMessages sm; if (e.Error is FaultException <CustomServiceFault> ) { FaultException <CustomServiceFault> fault = e.Error as FaultException <CustomServiceFault>; sm = new SystemMessages(new Message() { UserMessage = fault.Detail.UserMessage, SystemMessage = fault.Detail.SystemMessage, UserMessageType = MessageType.Error }, ButtonType.OkOnly); } else { sm = new SystemMessages(new Message() { UserMessage = "Failed to Retrieve Ouptu Stream Device Analog List", SystemMessage = e.Error.Message, UserMessageType = MessageType.Error }, ButtonType.OkOnly); } sm.ShowPopup(); } }
void ButtonInitialize_Click(object sender, RoutedEventArgs e) { try { SystemMessages sm = new SystemMessages(new Message() { UserMessage = "Do you want to send Initialize command?", SystemMessage = "Adapter Acronym: " + ((Button)sender).Tag.ToString(), UserMessageType = MessageType.Confirmation }, ButtonType.YesNo); sm.Closed += new EventHandler(delegate(object popupWindow, EventArgs eargs) { if ((bool)sm.DialogResult) SendInitialize(); }); #if !SILVERLIGHT sm.Owner = Window.GetWindow(this); sm.WindowStartupLocation = WindowStartupLocation.CenterOwner; #endif sm.ShowPopup(); } catch (Exception ex) { SystemMessages sm = new SystemMessages(new Message() { UserMessage = "Failed to send Initialize command.", SystemMessage = ex.Message, UserMessageType = MessageType.Error }, ButtonType.OkOnly); #if !SILVERLIGHT sm.Owner = Window.GetWindow(this); sm.WindowStartupLocation = WindowStartupLocation.CenterOwner; #endif sm.ShowPopup(); } }
void SaveOutputStreamDeviceDigital(OutputStreamDeviceDigital outputStreamDeviceDigital, bool isNew) { SystemMessages sm; try { string result = CommonFunctions.SaveOutputStreamDeviceDigital(null, outputStreamDeviceDigital, isNew); sm = new SystemMessages(new Message() { UserMessage = result, SystemMessage = string.Empty, UserMessageType = MessageType.Success }, ButtonType.OkOnly); GetOutputStreamDeviceDigitalList(); //ClearForm(); ListBoxOutputStreamDeviceDigitalList.SelectedItem = ((List <OutputStreamDeviceDigital>)ListBoxOutputStreamDeviceDigitalList.ItemsSource).Find(c => c.Label == outputStreamDeviceDigital.Label); } catch (Exception ex) { CommonFunctions.LogException(null, "WPF.SaveOutputStreamDeviceDigital", ex); sm = new SystemMessages(new Message() { UserMessage = "Failed to Save Output Stream Device Digital Information", SystemMessage = ex.Message, UserMessageType = MessageType.Error }, ButtonType.OkOnly); } sm.Owner = Window.GetWindow(this); sm.WindowStartupLocation = WindowStartupLocation.CenterOwner; sm.ShowPopup(); }
void ButtonDelete_Click(object sender, RoutedEventArgs e) { #if SILVERLIGHT Storyboard sb = new Storyboard(); sb = Application.Current.Resources["ButtonPressAnimation"] as Storyboard; sb.Completed += new EventHandler(delegate(object obj, EventArgs es) { sb.Stop(); }); Storyboard.SetTarget(sb, ButtonDeleteTransform); sb.Begin(); #endif if (m_devicesToBeDeleted.Count > 0) { DeleteOutputStreamDevice(); if ((bool)CheckAll.IsChecked) { CheckAll.IsChecked = false; } } else { SystemMessages sm = new SystemMessages(new Message() { UserMessage = "Please select device(s) to delete", SystemMessage = string.Empty, UserMessageType = MessageType.Information }, ButtonType.OkOnly); #if !SILVERLIGHT sm.Owner = Window.GetWindow(this); sm.WindowStartupLocation = WindowStartupLocation.CenterOwner; #endif sm.ShowPopup(); } }
private void BindGridView() { List <KPIMeasurements> theList = new List <KPIMeasurements>(); try { if (UnitIdHiddenField.Value.Equals("TIME")) { theList = KpiMeasurementBLL.GetKPIMeasurementCategoriesTimeByKpiId(Convert.ToInt32(KPIIdHiddenField.Value), "", ""); } else { theList = KpiMeasurementBLL.GetKPIMeasurementCategoriesByKpiId(Convert.ToInt32(KPIIdHiddenField.Value), "", ""); } } catch (Exception exc) { SystemMessages.DisplaySystemErrorMessage(exc.Message); } KpiMeasurementGridView.DataSource = theList; KpiMeasurementGridView.DataBind(); if (theList.FindAll(i => !string.IsNullOrEmpty(i.Detalle)).Count > 0) { KpiMeasurementGridView.Columns[2].Visible = true; } else { KpiMeasurementGridView.Columns[2].Visible = false; } }
void DeleteOutputStreamDeviceDigital(int outputStreamDeviceDigitalID) { SystemMessages sm; try { string result = CommonFunctions.DeleteOutputStreamDeviceDigital(null, outputStreamDeviceDigitalID); sm = new SystemMessages(new Message() { UserMessage = result, SystemMessage = string.Empty, UserMessageType = MessageType.Success }, ButtonType.OkOnly); GetOutputStreamDeviceDigitalList(); } catch (Exception ex) { CommonFunctions.LogException(null, "WPF.DeleteOutputStreamDeviceDigital", ex); sm = new SystemMessages(new Message() { UserMessage = "Failed to Delete Output Stream Device Digital", SystemMessage = ex.Message, UserMessageType = MessageType.Error }, ButtonType.OkOnly); } sm.Owner = Window.GetWindow(this); sm.WindowStartupLocation = WindowStartupLocation.CenterOwner; sm.ShowPopup(); }
protected void UserGridView_SelectedIndexChanged(object sender, EventArgs e) { string[] RolesForUser = null; try { MembershipUser theUser; EmployeeRolePanel.Visible = true; RolesForUser = Roles.GetRolesForUser(UserGridView.SelectedValue.ToString()); FillCheckBoxesForRoles(RolesForUser); theUser = Membership.GetUser(UserGridView.SelectedValue.ToString()); UserLabel.Text = theUser.UserName.ToString(); UserEmailLabel.Text = theUser.Email.ToString(); if (theUser.UserName.Equals(HttpContext.Current.User.Identity.Name)) { foreach (ListItem item in UserRoleCheckBoxList.Items) { item.Enabled = false; } SaveRolesButton.Visible = false; ResetRolesButton.Visible = false; } else { SaveRolesButton.Visible = true; ResetRolesButton.Visible = (!LoginSecurity.IsUserAuthorizedPermission("RESET_USER_ACCOUNT")); } } catch (Exception exc) { log.Error("Function InRoleListBox_SelectedIndexChanged from AssingRolesByUser page", exc); SystemMessages.DisplaySystemMessage(Resources.SecurityData.MessageErrorGetRoles); } }
public ActionResult Edit(BranchEditViewModel vm) { if (ModelState.IsValid) { try { if (vm.Id > 0) { _branchService.UpdateBranch(vm); SystemMessages.Add(BranchStrings.Branch_Update_Success_Msg, false, true); } else { _branchService.SaveBranch(vm); SystemMessages.Add(BranchStrings.Branch_Add_Success_Msg, false, true); } return(RedirectToAction("Index")); } catch (Exception ex) { SystemMessages.Add(CommonStrings.Server_Error, true, true); } } return(View(vm)); }
public void CheckDataType(SystemMessages sysMsg) { CheckDataType(sysMsg, CommonCategory); CheckDataType(sysMsg, BasicInfoCategory); CheckDataType(sysMsg, ProcessFlowCategory); CheckDataType(sysMsg, BOMCategory); CheckDataType(sysMsg, EDMCategories.ToArray()); CheckDataType(sysMsg, SpecialCategory.ToArray()); }
private void CheckSpecRequired(SystemMessages sysMsg) { if (CostBase.GetPCBType(Convert.ToString(CommonCategory.Fields["CostingBasedOn"].DataValue)) == CostBase.PCBTYPE_FPC) { foreach (FieldCategory fc in SpecialCategory) { if (fc.CategoryName == "SMCM") { ArrayList arrMWC = fc.Fields["MainWorkCenter"].DataValue as ArrayList; if (arrMWC != null) { for (int i = 0; i < arrMWC.Count; i++) { if (Convert.ToString(arrMWC[i]) == "COM") { fc.Fields["SidePanel"].CheckRequired(sysMsg, i); } else { fc.Fields["Thickness"].CheckRequired(sysMsg, i); fc.Fields["Area"].CheckRequired(sysMsg, i); } } } } } } }
private void CheckRequired(SystemMessages sysMsg, params FieldCategory[] fcs) { foreach (FieldCategory fc in fcs) { foreach (FieldInfo fi in fc.Fields) { fi.CheckRequired(sysMsg); } } }
private void CheckProcessFlow(SystemMessages sysMsg) { ArrayList arrVal = ProcessFlowCategory.Fields["WorkCenter"].DataValue as ArrayList; if (arrVal == null || arrVal.Count == 0) { sysMsg.isPass = false; sysMsg.Messages.Add("Process Flow Check", "\"Process Flow\" is required."); } }
private void LoadLanguage() { if (Language == SystemLanguage.Undefined) Language = (SystemLanguage)Enum.Parse(typeof(SystemLanguage), GridConfig.Get("WGLanguage", SystemLanguage.English.ToString()), true); string cacheobjectSystemMessages = string.Format("{0}_{1}_{2}_SystemMessages_{3}", ClientID, Trace.ClientID, DataSourceId,Language); if (m_GridSystemMessages != null) return; if (DesignMode == false && HttpRuntime.Cache != null && Equals(CacheGridStructure, true) && HttpRuntime.Cache.Get(cacheobjectSystemMessages) != null) { m_GridSystemMessages = HttpRuntime.Cache.Get(cacheobjectSystemMessages) as SystemMessages; if (Debug) m_DebugString.AppendFormat("<b>Cache</b> - Loading system messages from cache object: {0}<br/>", cacheobjectSystemMessages); return; } if (Trace.IsTracing) Trace.Trace("{0} : Started LoadLanguage()", ID); // What language should we load? string systemmessagefile = SystemMessageDataFile; try { if (systemmessagefile != null && systemmessagefile.StartsWith("http://", StringComparison.OrdinalIgnoreCase) == false) { if (Equals(DesignMode, true) && Site != null) systemmessagefile = GridConfig.LoadSystemLanguages(systemmessagefile, Site); else systemmessagefile = GridConfig.LoadSystemLanguages(systemmessagefile); } if (systemmessagefile != null && System.IO.File.Exists(systemmessagefile) == false) { throw new GridException( string.Format("The system message file '{0}' does not exists.", systemmessagefile)); } if (string.IsNullOrEmpty(systemmessagefile)) // Load from resources if not available. { m_GridSystemMessages = new SystemMessages(); Assembly a = Assembly.GetExecutingAssembly(); //Assembly.Load(GetType().Assembly.GetName().Name); Stream str = a.GetManifestResourceStream("WebGrid.Resources.WebGridMessages.xml"); if (str == null) throw new GridException("WebGrid messages is not found in resources."); XmlTextReader tr = new XmlTextReader(str); XmlDocument xml = new XmlDocument(); xml.Load(tr); XPathNavigator nav = xml.CreateNavigator(); if (nav == null) throw new GridException("Unable to get a XpathNavigator for WebGrid Messages (in resources)."); XPathNodeIterator it = nav.Select(string.Format(@"//{0}/*", Language)); while (it.MoveNext()) { if (string.IsNullOrEmpty(it.Current.Name) || string.IsNullOrEmpty(it.Current.Value)) continue; m_GridSystemMessages.SetSystemMessage(it.Current.Name, it.Current.Value, null); } } else m_GridSystemMessages = new SystemMessages(Language, systemmessagefile, this); } catch (Exception ee) { throw new GridException( string.Format("Error loading WebGrid system message file '{0}'.", systemmessagefile), ee); } if (HttpRuntime.Cache != null && Equals(CacheGridStructure, true)) HttpRuntime.Cache[cacheobjectSystemMessages] = m_GridSystemMessages; if (Trace.IsTracing) Trace.Trace(string.Format("{0} : Stopped LoadLanguage()", ID)); }
public void CheckRequired(SystemMessages sysMsg) { CheckRequired(sysMsg, CommonCategory); CheckRequired(sysMsg, BasicInfoCategory); CheckProcessFlow(sysMsg); CheckRequired(sysMsg, ProcessFlowCategory); CheckRequired(sysMsg, BOMCategory); CheckRequired(sysMsg, EDMCategories.ToArray()); CheckRequired(sysMsg, SpecialCategory.ToArray()); CheckCategoryWorkCenter(sysMsg); CheckSpecRequired(sysMsg); }
public static int SubmitToRFQ(int dataID, SystemMessages sysMsg) { int rfqId = 0; string strSql = "SELECT * FROM SCI_ProductionInformation WHERE ID=@DataID"; DataTable dt = DbHelperSQL.Query(strSql, new SqlParameter("@DataID", dataID)).Tables[0]; if (dt.Rows.Count > 0) { DataRow drData = dt.Rows[0]; strSql = "SELECT ID FROM SGP_RFQ WHERE Number=@Number"; rfqId = DbHelperSQL.GetSingle<int>(strSql, new SqlParameter("@Number", drData["RFQNumber"])); if (rfqId > 0) { strSql = "UPDATE SGP_RFQ SET InternalRevisionNumber=@InternalRevisionNumber WHERE ID=@RFQID"; DbHelperSQL.Query(strSql, new SqlParameter("@InternalRevisionNumber", drData["InternalRevision"]), new SqlParameter("@RFQID", rfqId)); Dictionary<string, string> dicProd = new Dictionary<string, string>(); dicProd.Add("LayerCount", "LayerCount"); dicProd.Add("ViaStructure", "ViaStructure"); dicProd.Add("MaterialCategory", "MaterialType"); dicProd.Add("BoardThickness", "BoardThickness"); dicProd.Add("UnitType", "Measure"); dicProd.Add("UnitSizeWidth", "UnitSizeWidth"); dicProd.Add("UnitSizeLength", "UnitSizeLength"); dicProd.Add("UnitOrArray", "UnitOrArray"); dicProd.Add("UnitPerArray", "UnitPerArray"); dicProd.Add("ArraySizeWidth", "ArraySizeWidth"); dicProd.Add("ArraySizeLength", "ArraySizeLength"); dicProd.Add("UnitPerWorkingPanel", "UnitPerWorkingPanel"); dicProd.Add("PanelUtilization", "PanelUtilization"); dicProd.Add("Outline", "OutLine"); dicProd.Add("LnO", "LNO"); dicProd.Add("LnI", "LNI"); dicProd.Add("TechnicalRemarks", "TechnicalRemarks"); dicProd.Add("BoardConstruction", "Construction"); dicProd.Add("MicroViaSize", "MicroViaSize"); UpdateRFQKeyValue("SGP_RFQProduction", rfqId, dicProd, drData); dicProd = new Dictionary<string, string>(); dicProd.Add("MaterialCost", "MaterialCost"); dicProd.Add("VariableCost", "VariableCost"); dicProd.Add("FixedCost", "FixedCost"); dicProd.Add("TotalCost", "TotalCost"); dicProd.Add("Yield", "TargetYield"); UpdateRFQKeyValue("SGP_RFQCostingProfitability", rfqId, dicProd, drData); } } return rfqId; }
public void CheckData(SystemMessages sysMsg) { foreach (FieldInfo field in Category.Fields) { if (field.Options.UpdateKey && field.Options.Required) { if (FieldIsEmpty(field)) { sysMsg.isPass = false; sysMsg.Messages.Add(field.DisplayName, String.Format("\"{0}\" is required.", field.DisplayName)); } } } }
private void CheckCategoryWorkCenter(SystemMessages sysMsg) { }
/// <summary> /// Returns translation for sepcified SystemMessage /// </summary> /// <param name="key"></param> /// <returns></returns> public static string Translate(SystemMessages key) { _logger.Debug("Translate(SystemMessages.{0})", key); return Translate(SystemMessagePrefix + key.ToString()); }
private void CheckDataType(SystemMessages sysMsg, params FieldCategory[] fcs) { foreach (FieldCategory fc in fcs) { if (Data.ContainsKey(fc.ID)) { fc.CheckDataType(Data[fc.ID] as Dictionary<string, object>, sysMsg); } } }