protected void btnMove_Click(object sender, System.EventArgs e) { string strMessage; string strFromUnitID, strToUnitID; int intFromUnitID, intToUnitID; //1. Get Data strFromUnitID = this.trvFromUnit.GetSelectedValue(); strToUnitID = this.trvToUnit.GetSelectedValue(); strMessage = ""; intFromUnitID = 0; intToUnitID = 0; //2. Validation // Check From Unit if (strFromUnitID == "") { strMessage = ResourceManager.GetString("Message.From"); //"You must specify the From Unit to continue."; this.lblMessage.CssClass = "WarningMessage"; } else { intFromUnitID = int.Parse(strFromUnitID); } //Check To Unit if (strMessage == "") { if (this.chkTopLevel.Checked) { intToUnitID = 0; } else if (strToUnitID == "") { strMessage = ResourceManager.GetString("Message.To");//"You must specify the To Unit to continue."; this.lblMessage.CssClass = "WarningMessage"; } else { intToUnitID = int.Parse(strToUnitID); } } //3. Move Unit if (strMessage == "") { try { BusinessServices.Unit objUnit = new BusinessServices.Unit(); if (intToUnitID > 0) { objUnit.Move(intFromUnitID, intToUnitID, UserContext.UserID); } else { objUnit.MoveToTopLevel(intFromUnitID, UserContext.UserID); } strMessage = ResourceManager.GetString("Message.Moved"); //"The specified unit has been moved successfully"; this.lblMessage.CssClass = "SuccessMessage"; this.RenderUnitTreeData(intFromUnitID); } catch (ApplicationException ex) { strMessage = ex.Message; this.lblMessage.CssClass = "WarningMessage"; } } this.lblMessage.Text = strMessage; }