【028】CallBack事件注册
侧边栏壁纸
  • 累计撰写 60 篇文章
  • 累计收到 2 条评论

【028】CallBack事件注册

秋驰雪隙
2025-04-08 / 0 评论 / 10 阅读 / 正在检测是否收录...
/// <summary>
/// 注册列表本次发运数量值变化事件
/// </summary>
private void SchemaCallBack()
{
    AssociationControl assocControl = new AssociationControl();//交互关联控件实例
    assocControl.SourceServerControl = this.DataGrid8;//触发源控件
    assocControl.SourceControl.EventName = "OnCellDataValueChanged"; // 触发事件
    ((IUFClientAssoGrid)assocControl.SourceControl).FireEventCols.Add("ShipQty");
    ClientCallBackFrm cbf = new ClientCallBackFrm();
    cbf.DoCustomerAction += new ClientCallBackFrm.ActionCustomer(DoCellDataValueChanged);//定义服务器端的处理方法
    cbf.ParameterControls.Add(this.DataGrid8); //添加传送到服务器端的控件值
    cbf.Add(assocControl);
    this.Controls.Add(cbf);
}

/// <summary>
/// 本次发运数量值发生变化
/// </summary>
/// <param name="args"></param>
/// <returns>计算本行总体积,总重量</returns>
private object DoCellDataValueChanged(CustomerActionEventArgs args)
{
    UFWebClientGridAdapter grid = new UFWebClientGridAdapter(this.DataGrid8); // 列表
    ArrayList list = (ArrayList)args.ArgsHash[this.DataGrid8.ClientID];
    int curIndex = Convert.ToInt32(args.ArgsHash[UFWebClientGridAdapter.FocusRow]);
    Hashtable hashT = (Hashtable)list[curIndex];
    decimal volume = 0m;
    decimal weight = 0m;
    decimal shipQty = 0m;
    decimal.TryParse(hashT["Volume"].ToString(), out volume);
    decimal.TryParse(hashT["Weight"].ToString(), out weight);
    decimal.TryParse(hashT["ShipQty"].ToString(), out shipQty);
    decimal totalVolume = volume * shipQty;
    decimal totalWeight = weight * shipQty;
    grid.CellValue.Add(new object[] { curIndex, "TotalVolume", new string[] { totalVolume.ToString(), totalVolume.ToString(), totalVolume.ToString() } });
    grid.CellValue.Add(new object[] { curIndex, "TotalWeight", new string[] { totalWeight.ToString(), totalWeight.ToString(), totalWeight.ToString() } });
    args.ArgsResult.Add(grid.ClientInstanceWithValue);
    return args;
}
0

评论 (0)

取消