protected void FpSpread1_UpdateCommand(object sender, FarPoint.Web.Spread.SpreadCommandEventArgs e)
{
List<JiaJu.Model.ProductType> list = FpSpread1.Sheets[0].DataSource as List<JiaJu.Model.ProductType>;
e.Handled = true;
if (e.SheetView.ActiveColumn == 0)
{
string path = list[e.SheetView.ActiveRow].path;
int level = list[e.SheetView.ActiveRow].Level;
string code = e.EditValues[0].ToString().ToUpper();
if (code.Trim() ==list[e.SheetView.ActiveRow].Code.ToUpper().Trim() )
{
return;
}
if (list.SingleOrDefault(n => n.Code.ToUpper().Trim() == code.ToUpper().Trim() && n.ParentID == list[e.SheetView.ActiveRow].ParentID) != null)
{
WcScript.Show(this, "同级存在" + code.ToUpper());
return;
}
list[e.SheetView.ActiveRow].Code = code;
list[e.SheetView.ActiveRow].path = path.Substring(0, (level - 1) * 4) + code.PadLeft(4, '0');
UpdateChildrenPath(list, list[e.SheetView.ActiveRow]);
}
}
public void Show(Page page, string msg)
{
ScriptManager.RegisterStartupScript(page, page.GetType(), "js_alert", "alert(\"" + msg + "\");", true);
} |
|