protected void lvCMMeasurementBookDetail_ItemCommand(object sender, ListViewCommandEventArgs e) { Int64 MeasurementBookDetailID; Int64.TryParse(e.CommandArgument.ToString(), out MeasurementBookDetailID); if (MeasurementBookDetailID > 0) { if (string.Equals(e.CommandName, "EditItem")) { _MeasurementBookDetailID = MeasurementBookDetailID; PrepareEditView(); } else if (string.Equals(e.CommandName, "DeleteItem")) { try { Int64 result = -1; String fe = SqlExpressionBuilder.PrepareFilterExpression(CMMeasurementBookDetailEntity.FLD_NAME_MeasurementBookDetailID, MeasurementBookDetailID.ToString(), SQLMatchType.Equal); CMMeasurementBookDetailEntity cMMeasurementBookDetailEntity = new CMMeasurementBookDetailEntity(); result = FCCCMMeasurementBookDetail.GetFacadeCreate().Delete(cMMeasurementBookDetailEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No); if (result == 0) { _MeasurementBookDetailID = 0; _CMMeasurementBookDetailEntity = new CMMeasurementBookDetailEntity(); PrepareInitialView(); BindCMMeasurementBookDetailList(); MiscUtil.ShowMessage(lblMessage, "Measurement Book Detail has been successfully deleted.", true); } else { MiscUtil.ShowMessage(lblMessage, "Failed to delete Measurement Book Detail.", true); } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } } }
protected void lvCMMeasurementBookDetail_ItemCommand(object sender, ListViewCommandEventArgs e) { Int64 MeasurementBookDetailID; Int64.TryParse(e.CommandArgument.ToString(), out MeasurementBookDetailID); if (MeasurementBookDetailID > 0) { LinkButton lnkBtnEdit = (LinkButton)e.Item.FindControl("lnkBtnEdit"); TextBox txtlstDescription = (TextBox)e.Item.FindControl("txtlstDescription"); TextBox txtlstLengthft = (TextBox)e.Item.FindControl("txtlstLengthft"); TextBox txtlstWidthft = (TextBox)e.Item.FindControl("txtlstWidthft"); TextBox txtlstLengthin = (TextBox)e.Item.FindControl("txtlstLengthin"); TextBox txtlstWidthin = (TextBox)e.Item.FindControl("txtlstWidthin"); TextBox txtlstHeightft = (TextBox)e.Item.FindControl("txtlstHeightft"); TextBox txtlstHeightin = (TextBox)e.Item.FindControl("txtlstHeightin"); TextBox txtlstNos = (TextBox)e.Item.FindControl("txtlstNos"); TextBox txtlstQty = (TextBox)e.Item.FindControl("txtlstQty"); DropDownList ddlUnitIDLV = (DropDownList)e.Item.FindControl("ddlUnitIDLV"); if (string.Equals(e.CommandName, "EditItem") && lnkBtnEdit.Text == "Cancel") { txtlstDescription.Enabled = false; txtlstLengthft.Enabled = false; txtlstWidthft.Enabled = false; txtlstLengthin.Enabled = false; txtlstWidthin.Enabled = false; txtlstHeightft.Enabled = false; txtlstHeightin.Enabled = false; txtlstNos.Enabled = false; ddlUnitIDLV.Enabled = false; lnkBtnEdit.Text = "Edit"; } else if (string.Equals(e.CommandName, "EditItem") && lnkBtnEdit.Text == "Edit") { _MeasurementBookDetailID = MeasurementBookDetailID; txtlstDescription.Enabled = true; txtlstLengthft.Enabled = true; txtlstWidthft.Enabled = true; txtlstLengthin.Enabled = true; txtlstWidthin.Enabled = true; txtlstHeightft.Enabled = true; txtlstHeightin.Enabled = true; txtlstNos.Enabled = true; ddlUnitIDLV.Enabled = true; lnkBtnEdit.Text = "Cancel"; } else if (string.Equals(e.CommandName, "DeleteItem")) { try { Int64 result = -1; String fe = SqlExpressionBuilder.PrepareFilterExpression(CMMeasurementBookDetailEntity.FLD_NAME_MeasurementBookDetailID, MeasurementBookDetailID.ToString(), SQLMatchType.Equal); CMMeasurementBookDetailEntity cMMeasurementBookDetailEntity = new CMMeasurementBookDetailEntity(); result = FCCCMMeasurementBookDetail.GetFacadeCreate().Delete(cMMeasurementBookDetailEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No); if (result == 0) { _MeasurementBookDetailID = 0; _CMMeasurementBookDetailEntity = new CMMeasurementBookDetailEntity(); PrepareInitialView(); BindCMMeasurementBookDetailList(); MiscUtil.ShowMessage(lblMessage, "Measurement Book Detail has been successfully deleted.", true); } else { MiscUtil.ShowMessage(lblMessage, "Failed to delete Measurement Book Detail.", true); } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } } if (string.Equals(e.CommandName, "InsertItem")) { SaveCMMeasurementBookDetailEntityLV(); } }