protected void Page_Load(object sender, EventArgs e) { //bind states if ((!Page.IsCallback) && (!Page.IsPostBack)) { BindStates(); } if (this.CurrentChannel == null) { Response.Redirect("~/Administration.aspx"); } base.PageLoadEvent(sender, e); //set actualization label lblLastActualizationValue.Text = CanonChannelMonitor.GetLastActualizationByChannel((int)this.CurrentChannel).ToString("dd.MM.yyyy HH:mm"); //if channel in progress - disable Actualize button ManualImportStatusEnum currentStatus = CanonManualImport.GetChannelImportStatus((int)this.CurrentChannel); if ((currentStatus == ManualImportStatusEnum.InProgress) || (currentStatus == ManualImportStatusEnum.WaitingInQueue)) { btnActualize.Enabled = false; } if (this.ManualImportReference != null) { CanonManualImport.RemoveSubscriber(SessionManager.LoggedUser.UserId, (int)this.ManualImportReference); } }
/// <summary> /// Handler for general callback event (filtering, bulk mapping) /// </summary> /// <param name="source"></param> /// <param name="e"></param> protected void clbPanelMapping_Callback(object source, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e) { try { if (e.Parameter == "UnMapSelected") { List <object> keyValues = gridMapping.GetSelectedFieldValues("ProductId"); foreach (object key in keyValues) { CanonMapping.DeleteMapping((int)this.CurrentChannel, int.Parse(key.ToString())); } } else if (e.Parameter == "MapSelected") { List <object> keyValues = gridMapping.GetSelectedFieldValues("ProductId"); foreach (object key in keyValues) { CanonMapping.AddRecommendedMapping((int)this.CurrentChannel, int.Parse(key.ToString())); } } else if (e.Parameter == "Search") { if (!string.IsNullOrEmpty(txtSearchParam.Text.Trim())) { this.FilterText = txtSearchParam.Text; } this.IsFilterMode = true; } else if (e.Parameter == "ShowAll") { this.IsFilterMode = false; this.FilterText = string.Empty; } else if (e.Parameter == "StateChanged") { } else if (e.Parameter == "DoActualization") { //Actualize button click btnActualize.Enabled = false; ManualImportStatusEnum status = CanonManualImport.GetChannelImportStatus((int)this.CurrentChannel); if ((status == ManualImportStatusEnum.NotInQueue) || (status == ManualImportStatusEnum.ImportComplete)) { CanonManualImport.AddChannelToQueue(SessionManager.LoggedUser.UserId, (int)this.CurrentChannel); lblActualizeMessage.Text = Utilities.GetResourceString("Common", "ActualizeMessagePostedIntoQueue"); } else { ManualImportQueue elem = CanonManualImport.GetLatestQueueElement((int)this.CurrentChannel); int queueElemId = elem.RecordId; CanonManualImport.AddNewSubscriber(SessionManager.LoggedUser.UserId, queueElemId); lblActualizeMessage.Text = string.Format(Utilities.GetResourceString("Common", "ActualizeMessageAlreadyInQueue"), elem.User.FullName, (SessionManager.CurrentShortLanguage == "En") ? elem.Enum.NameEn : elem.Enum.NameCz); } clbPanelMapping.JSProperties["cpResult"] = "OK"; } else if (e.Parameter == "ExcludeSelected") { List <object> keyValues = gridMapping.GetSelectedFieldValues("ProductId"); foreach (object key in keyValues) { CanonMapping.AddToExceptions((int)this.CurrentChannel, int.Parse(key.ToString())); } } else if (e.Parameter == "IncludeSelected") { List <object> keyValues = gridMapping.GetSelectedFieldValues("ProductId"); foreach (object key in keyValues) { CanonMapping.RemoveFromExceptions((int)this.CurrentChannel, int.Parse(key.ToString())); } } else if (e.Parameter.StartsWith("LogHistory")) { string idValue = e.Parameter.Replace("LogHistory", ""); int productId = int.Parse(idValue); Product product = Cdb.Instance.Products.FirstOrDefault(p => p.ProductId == productId); if (product != null) { string productName = product.ProductName; popupImport.HeaderText = string.Format(Utilities.GetResourceString("Headers", "MappingHistoryPopupForm"), productName); } MapHistoryCtrl.Parameters = new int[] { (int)this.CurrentChannel, productId }; MapHistoryCtrl.Bind(); } this.BindData(); } catch (Exception ex) { Logger.Log(string.Format("exception {0}", ex.ToString()), LogLevel.Error); } }