protected void gridDetails_CustomUnboundColumnData(object sender, ASPxGridViewColumnDataEventArgs e) { if (e.Column.FieldName == "CurrentPrice") { int id = e.ListSourceRowIndex; int channelId = Convert.ToInt32(e.GetListSourceFieldValue("ChannelId")); string monitoredName = e.GetListSourceFieldValue("MonitoredName").ToString(); string monitoredUrl = e.GetListSourceFieldValue("MonitoredUrl").ToString(); e.Value = CanonMapping.GetCurrentMapPrice(channelId, monitoredName, monitoredUrl); } }
protected void gridPMapping_CustomButtonCallback(object sender, ASPxGridViewCustomButtonCallbackEventArgs e) { int relId = (int)gridPMapping.GetRowValues(e.VisibleIndex, new String[] { "RelId" }); switch (e.ButtonID) { case "btnCustomChooseAndSave": //save new mapping into DB CanonMapping.AddMapping(relId); ASPxWebControl.RedirectOnCallback(string.Format("~/ChannelMapping.aspx?channel={0}", this.CurrentChannel)); break; } }
/// <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); } }