D365 new form is not populated with values - axapta

There is need to show all parts of one area. I created new form PMCContractAreasDialog. When I click on specific contract line into contract form it should open new form and show all parts of one area. In sum there should be same like on contract line. But every time when I click on button form is empty. Am I missing something ?
[Form]
public class PMCContractAreasDialog extends FormRun
{
[FormObservable]
date currWorkingDate;
[FormObservable]
boolean commonAreasRead;
PMERentalObjectAreaValueCl tmpRentalAreaCl;
PMETmpRentalObjectArea tmpArea;
public void init ()
{
super();
pmcContractLine_ds.linkActive();
}
public void activate(boolean _active)
{
PMCContractArea contractArea;
AmountMST sumContractArea;
pmcContractLine_ds.readCommonAreas(pmcContractLine);
h1_h2.realValue(pmcContractLine_ds.h1_h2(pmcContractLine));
efa.realValue(pmcContractLine_ds.efa(pmcContractLine));
bfa.realValue(pmcContractLine_ds.bfa(pmcContractLine));
mfa.realValue(pmcContractLine_ds.mfa(pmcContractLine));
sumArea.realValue(h1_h2.realValue() + efa.realValue() + bfa.realValue() + mfa.realValue());
}
[DataSource]
class PMCContract
{
public int active()
{
int ret;
ret = super();
return ret;
}
}
[DataSource]
class PMCContractLine
{
public int active()
{
int ret;
ret = super();
return ret;
}
display PMEAreaCommonBuildingSum BFA(PMCContractLine _contractLine)
{
if (commonAreasRead)
{
if (_contractLine.RentalObjectId)
{
return PMERentalObjectAreaCl::getRentalObjectCommonAreaBuildingSum(_contractLine.RentalObjectId, currWorkingDate, tmpArea, false);
}
else
{
return 0;
}
}
return 0;
}
void readCommonAreas(PMCContractLine _contractLine)
{
if (!commonAreasRead)
{
if (pmcContractLine.RentalObjectId)
{
tmpRentalAreaCl = new PMERentalObjectAreaValueCl();
tmpRentalAreaCl.clear();
tmpRentalAreaCl.getRentalObjectAreas(_contractLine.RentalObjectId, PMGUser::find().currDate());
tmpArea.setTmpData(tmpRentalAreaCl.getTempTable());
commonAreasRead = true;
}
}
}
//BP Deviation Documented
display PMEAreaCommonSectionSum EFA(PMCContractLine _contractLine)
{
if (commonAreasRead)
{
if (_contractLine.RentalObjectId)
{
return PMERentalObjectAreaCl::getRentalObjectCommonAreaSectionSum(_contractLine.RentalObjectId, currWorkingDate, tmpArea, false);
}
else
{
return 0;
}
}
return 0;
}
//BP Deviation Documented
display PMEAreaTotal H1_H2(PMCContractLine _contractLine)
{
if (commonAreasRead)
{
if (_contractLine.RentalObjectId)
{
return PMERentalObjectAreaCl::getRentalObjectMainAreaSectionSum(_contractLine.RentalObjectId, currWorkingDate, tmpArea, false);
}
else
{
return 0;
}
}
return 0;
}
//BP Deviation Documented
display PMEAreaTotal MFA(PMCContractLine _contractLine)
{
if (commonAreasRead)
{
if (_contractLine.RentalObjectId)
{
return PMERentalObjectAreaCl::getRentalObjectCommonAreaFixedSum(_contractLine.RentalObjectId, currWorkingDate, tmpArea, false);
}
else
{
return 0;
}
}
return 0;
}
}
[DataSource]
class PMCContractArea
{
public void delete()
{
super();
this.updateLines();
}
public void write()
{
super();
this.updateLines();
}
void updateLines()
{
;
PMCContractArea::updateLineAreas(pmcContractArea.ContractId, pmcContractArea.RentalObjectId);
}
}
}

Related

update parent child table [duplicate]

This question already has an answer here:
GridView's UpdateMethod not firing
(1 answer)
update linq related table
Closed 9 years ago.
I have two table, they are parent child. testtypes(Id,Name), testusers(Id,TypeId,Name)
i want update them in gridview. testusers (name filed) was updated but testTypes(testtype.Name field) doesn't update.
there is no exception. (i check the e.exception == null variable in GridviewUpdated handler.)
i'm really confuesd! it's so strange. i think vs 2012 has bug!
here's my markup and code:
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm4.aspx.cs" Inherits="Ahooratech.WebForm4" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView runat="server" ID="gv" AutoGenerateColumns="False" DataKeyNames="Id" DataSourceID="LinqDataSource1">
<Columns>
<asp:CommandField ShowEditButton="True" />
<asp:BoundField DataField="Id" HeaderText="Id" ReadOnly="True" SortExpression="Id" />
<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
<asp:BoundField DataField="testtype.Name" HeaderText="mytypid" />
</Columns>
</asp:GridView>
<asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="Ahooratech.DAL.DataClasses1DataContext" EnableUpdate="True" EntityTypeName="" TableName="testusers">
</asp:LinqDataSource>
</div>
</form>
</body>
</html>
and:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Ahooratech
{
public partial class WebForm4 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
gv.rowUpdated += handler;
}
void gv_RowUpdated(object sender, GridViewUpdatedEventArgs e)
{
if (e.exception == null)
{
resultlbl.text = "Update seccessfully";// i get this message and name update in db
}
}
}
}
and DAL:
[global::System.Data.Linq.Mapping.DatabaseAttribute(Name="AhooraTechdb")]
public partial class DataClasses1DataContext : System.Data.Linq.DataContext
{
private static System.Data.Linq.Mapping.MappingSource mappingSource = new AttributeMappingSource();
public DataClasses1DataContext() :
base(global::System.Configuration.ConfigurationManager.ConnectionStrings["AhooraTechdbConnectionString1"].ConnectionString, mappingSource)
{
OnCreated();
}
public DataClasses1DataContext(string connection) :
base(connection, mappingSource)
{
OnCreated();
}
public DataClasses1DataContext(System.Data.IDbConnection connection) :
base(connection, mappingSource)
{
OnCreated();
}
public DataClasses1DataContext(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) :
base(connection, mappingSource)
{
OnCreated();
}
public DataClasses1DataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) :
base(connection, mappingSource)
{
OnCreated();
}
public System.Data.Linq.Table<AdminUser> AdminUsers
{
get
{
return this.GetTable<AdminUser>();
}
}
public System.Data.Linq.Table<WishProduct> WishProducts
{
get
{
return this.GetTable<WishProduct>();
}
}
public System.Data.Linq.Table<Advertisement> Advertisements
{
get
{
return this.GetTable<Advertisement>();
}
}
public System.Data.Linq.Table<aspnet_Application> aspnet_Applications
{
get
{
return this.GetTable<aspnet_Application>();
}
}
public System.Data.Linq.Table<aspnet_Membership> aspnet_Memberships
{
get
{
return this.GetTable<aspnet_Membership>();
}
}
public System.Data.Linq.Table<aspnet_SchemaVersion> aspnet_SchemaVersions
{
get
{
return this.GetTable<aspnet_SchemaVersion>();
}
}
public System.Data.Linq.Table<aspnet_User> aspnet_Users
{
get
{
return this.GetTable<aspnet_User>();
}
}
public System.Data.Linq.Table<BillingType> BillingTypes
{
get
{
return this.GetTable<BillingType>();
}
}
public System.Data.Linq.Table<BoolValue> BoolValues
{
get
{
return this.GetTable<BoolValue>();
}
}
public System.Data.Linq.Table<ContainerItem> ContainerItems
{
get
{
return this.GetTable<ContainerItem>();
}
}
public System.Data.Linq.Table<Container> Containers
{
get
{
return this.GetTable<Container>();
}
}
public System.Data.Linq.Table<Country> Countries
{
get
{
return this.GetTable<Country>();
}
}
public System.Data.Linq.Table<DeliveryTimeType> DeliveryTimeTypes
{
get
{
return this.GetTable<DeliveryTimeType>();
}
}
public System.Data.Linq.Table<DeliveryType> DeliveryTypes
{
get
{
return this.GetTable<DeliveryType>();
}
}
public System.Data.Linq.Table<DescriptiveValue> DescriptiveValues
{
get
{
return this.GetTable<DescriptiveValue>();
}
}
public System.Data.Linq.Table<DiscountCode> DiscountCodes
{
get
{
return this.GetTable<DiscountCode>();
}
}
public System.Data.Linq.Table<DiscountCodesPrice> DiscountCodesPrices
{
get
{
return this.GetTable<DiscountCodesPrice>();
}
}
public System.Data.Linq.Table<DiscountcodesProduct> DiscountcodesProducts
{
get
{
return this.GetTable<DiscountcodesProduct>();
}
}
public System.Data.Linq.Table<DiscountCodesUser> DiscountCodesUsers
{
get
{
return this.GetTable<DiscountCodesUser>();
}
}
public System.Data.Linq.Table<DiscountType> DiscountTypes
{
get
{
return this.GetTable<DiscountType>();
}
}
public System.Data.Linq.Table<MeasurmentValue> MeasurmentValues
{
get
{
return this.GetTable<MeasurmentValue>();
}
}
public System.Data.Linq.Table<ProductImage> ProductImages
{
get
{
return this.GetTable<ProductImage>();
}
}
public System.Data.Linq.Table<ProductOption> ProductOptions
{
get
{
return this.GetTable<ProductOption>();
}
}
public System.Data.Linq.Table<ProductProductOption> ProductProductOptions
{
get
{
return this.GetTable<ProductProductOption>();
}
}
public System.Data.Linq.Table<Product> Products
{
get
{
return this.GetTable<Product>();
}
}
public System.Data.Linq.Table<ProductsCat> ProductsCats
{
get
{
return this.GetTable<ProductsCat>();
}
}
public System.Data.Linq.Table<ProductsDescriptionImage> ProductsDescriptionImages
{
get
{
return this.GetTable<ProductsDescriptionImage>();
}
}
public System.Data.Linq.Table<ProductsPeripheralProduct> ProductsPeripheralProducts
{
get
{
return this.GetTable<ProductsPeripheralProduct>();
}
}
public System.Data.Linq.Table<ProductsProperty> ProductsProperties
{
get
{
return this.GetTable<ProductsProperty>();
}
}
public System.Data.Linq.Table<ProductsRelatedProduct> ProductsRelatedProducts
{
get
{
return this.GetTable<ProductsRelatedProduct>();
}
}
public System.Data.Linq.Table<Property> Properties
{
get
{
return this.GetTable<Property>();
}
}
public System.Data.Linq.Table<PropertyCat> PropertyCats
{
get
{
return this.GetTable<PropertyCat>();
}
}
public System.Data.Linq.Table<RetrurnedOrder> RetrurnedOrders
{
get
{
return this.GetTable<RetrurnedOrder>();
}
}
public System.Data.Linq.Table<ReturnCause> ReturnCauses
{
get
{
return this.GetTable<ReturnCause>();
}
}
public System.Data.Linq.Table<ShippingType> ShippingTypes
{
get
{
return this.GetTable<ShippingType>();
}
}
public System.Data.Linq.Table<ShortDescriptiveValue> ShortDescriptiveValues
{
get
{
return this.GetTable<ShortDescriptiveValue>();
}
}
public System.Data.Linq.Table<SqlDataType> SqlDataTypes
{
get
{
return this.GetTable<SqlDataType>();
}
}
public System.Data.Linq.Table<State> States
{
get
{
return this.GetTable<State>();
}
}
public System.Data.Linq.Table<StatesShippingType> StatesShippingTypes
{
get
{
return this.GetTable<StatesShippingType>();
}
}
public System.Data.Linq.Table<StockStateType> StockStateTypes
{
get
{
return this.GetTable<StockStateType>();
}
}
public System.Data.Linq.Table<test> tests
{
get
{
return this.GetTable<test>();
}
}
public System.Data.Linq.Table<Unit> Units
{
get
{
return this.GetTable<Unit>();
}
}
public System.Data.Linq.Table<UserRequestProduct> UserRequestProducts
{
get
{
return this.GetTable<UserRequestProduct>();
}
}
public System.Data.Linq.Table<User> Users
{
get
{
return this.GetTable<User>();
}
}
public System.Data.Linq.Table<Warranty> Warranties
{
get
{
return this.GetTable<Warranty>();
}
}
public System.Data.Linq.Table<SideBarMenuItem> SideBarMenuItems
{
get
{
return this.GetTable<SideBarMenuItem>();
}
}
public System.Data.Linq.Table<OrderItem> OrderItems
{
get
{
return this.GetTable<OrderItem>();
}
}
public System.Data.Linq.Table<UserAddress> UserAddresses
{
get
{
return this.GetTable<UserAddress>();
}
}
public System.Data.Linq.Table<Basket> Baskets
{
get
{
return this.GetTable<Basket>();
}
}
public System.Data.Linq.Table<ElseCost> ElseCosts
{
get
{
return this.GetTable<ElseCost>();
}
}
public System.Data.Linq.Table<OrderStatuse> OrderStatuses
{
get
{
return this.GetTable<OrderStatuse>();
}
}
public System.Data.Linq.Table<ShipmentStatuse> ShipmentStatuses
{
get
{
return this.GetTable<ShipmentStatuse>();
}
}
public System.Data.Linq.Table<ConfirmStatuse> ConfirmStatuses
{
get
{
return this.GetTable<ConfirmStatuse>();
}
}
public System.Data.Linq.Table<PaymentStatuse> PaymentStatuses
{
get
{
return this.GetTable<PaymentStatuse>();
}
}
public System.Data.Linq.Table<Order> Orders
{
get
{
return this.GetTable<Order>();
}
}
public System.Data.Linq.Table<testtype> testtypes
{
get
{
return this.GetTable<testtype>();
}
}
public System.Data.Linq.Table<testuser> testusers
{
get
{
return this.GetTable<testuser>();
}
}
[global::System.Data.Linq.Mapping.FunctionAttribute(Name="dbo.FetchProperties")]
public ISingleResult<FetchPropertiesResult> FetchProperties([global::System.Data.Linq.Mapping.ParameterAttribute(Name="ProductId", DbType="Int")] System.Nullable<int> productId)
{
IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), productId);
return ((ISingleResult<FetchPropertiesResult>)(result.ReturnValue));
}
}
[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.testtypes")]
public partial class testtype : INotifyPropertyChanging, INotifyPropertyChanged
{
private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
private int _Id;
private string _Name;
private EntitySet<testuser> _testusers;
#region Extensibility Method Definitions
partial void OnLoaded();
partial void OnValidate(System.Data.Linq.ChangeAction action);
partial void OnCreated();
partial void OnIdChanging(int value);
partial void OnIdChanged();
partial void OnNameChanging(string value);
partial void OnNameChanged();
#endregion
public testtype()
{
this._testusers = new EntitySet<testuser>(new Action<testuser>(this.attach_testusers), new Action<testuser>(this.detach_testusers));
OnCreated();
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Id", DbType="Int NOT NULL", IsPrimaryKey=true)]
public int Id
{
get
{
return this._Id;
}
set
{
if ((this._Id != value))
{
this.OnIdChanging(value);
this.SendPropertyChanging();
this._Id = value;
this.SendPropertyChanged("Id");
this.OnIdChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Name", DbType="NVarChar(50)")]
public string Name
{
get
{
return this._Name;
}
set
{
if ((this._Name != value))
{
this.OnNameChanging(value);
this.SendPropertyChanging();
this._Name = value;
this.SendPropertyChanged("Name");
this.OnNameChanged();
}
}
}
[global::System.Data.Linq.Mapping.AssociationAttribute(Name="testtype_testuser", Storage="_testusers", ThisKey="Id", OtherKey="TypeId")]
public EntitySet<testuser> testusers
{
get
{
return this._testusers;
}
set
{
this._testusers.Assign(value);
}
}
public event PropertyChangingEventHandler PropertyChanging;
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void SendPropertyChanging()
{
if ((this.PropertyChanging != null))
{
this.PropertyChanging(this, emptyChangingEventArgs);
}
}
protected virtual void SendPropertyChanged(String propertyName)
{
if ((this.PropertyChanged != null))
{
this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
private void attach_testusers(testuser entity)
{
this.SendPropertyChanging();
entity.testtype = this;
}
private void detach_testusers(testuser entity)
{
this.SendPropertyChanging();
entity.testtype = null;
}
}
[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.testusers")]
public partial class testuser : INotifyPropertyChanging, INotifyPropertyChanged
{
private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
private int _Id;
private string _Name;
private System.Nullable<int> _TypeId;
private EntityRef<testtype> _testtype;
#region Extensibility Method Definitions
partial void OnLoaded();
partial void OnValidate(System.Data.Linq.ChangeAction action);
partial void OnCreated();
partial void OnIdChanging(int value);
partial void OnIdChanged();
partial void OnNameChanging(string value);
partial void OnNameChanged();
partial void OnTypeIdChanging(System.Nullable<int> value);
partial void OnTypeIdChanged();
#endregion
public testuser()
{
this._testtype = default(EntityRef<testtype>);
OnCreated();
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Id", DbType="Int NOT NULL", IsPrimaryKey=true)]
public int Id
{
get
{
return this._Id;
}
set
{
if ((this._Id != value))
{
this.OnIdChanging(value);
this.SendPropertyChanging();
this._Id = value;
this.SendPropertyChanged("Id");
this.OnIdChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Name", DbType="NVarChar(50)")]
public string Name
{
get
{
return this._Name;
}
set
{
if ((this._Name != value))
{
this.OnNameChanging(value);
this.SendPropertyChanging();
this._Name = value;
this.SendPropertyChanged("Name");
this.OnNameChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TypeId", DbType="Int")]
public System.Nullable<int> TypeId
{
get
{
return this._TypeId;
}
set
{
if ((this._TypeId != value))
{
if (this._testtype.HasLoadedOrAssignedValue)
{
throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
}
this.OnTypeIdChanging(value);
this.SendPropertyChanging();
this._TypeId = value;
this.SendPropertyChanged("TypeId");
this.OnTypeIdChanged();
}
}
}
[global::System.Data.Linq.Mapping.AssociationAttribute(Name="testtype_testuser", Storage="_testtype", ThisKey="TypeId", OtherKey="Id", IsForeignKey=true)]
public testtype testtype
{
get
{
return this._testtype.Entity;
}
set
{
testtype previousValue = this._testtype.Entity;
if (((previousValue != value)
|| (this._testtype.HasLoadedOrAssignedValue == false)))
{
this.SendPropertyChanging();
if ((previousValue != null))
{
this._testtype.Entity = null;
previousValue.testusers.Remove(this);
}
this._testtype.Entity = value;
if ((value != null))
{
value.testusers.Add(this);
this._TypeId = value.Id;
}
else
{
this._TypeId = default(Nullable<int>);
}
this.SendPropertyChanged("testtype");
}
}
}
public event PropertyChangingEventHandler PropertyChanging;
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void SendPropertyChanging()
{
if ((this.PropertyChanging != null))
{
this.PropertyChanging(this, emptyChangingEventArgs);
}
}
protected virtual void SendPropertyChanged(String propertyName)
{
if ((this.PropertyChanged != null))
{
this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
}
public partial class FetchPropertiesResult
{
private int _ProdPropId;
private string _propertyName;
private string _UnitName;
private string _propertyCatName;
private string _sqlType;
private string _stringVal;
private string _shortStringVal;
private System.Nullable<int> _measurmentVal;
private System.Nullable<bool> _boolVal;
private int _OrderId;
public FetchPropertiesResult()
{
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ProdPropId", DbType="Int NOT NULL")]
public int ProdPropId
{
get
{
return this._ProdPropId;
}
set
{
if ((this._ProdPropId != value))
{
this._ProdPropId = value;
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_propertyName", DbType="NVarChar(50) NOT NULL", CanBeNull=false)]
public string propertyName
{
get
{
return this._propertyName;
}
set
{
if ((this._propertyName != value))
{
this._propertyName = value;
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UnitName", DbType="NVarChar(50)")]
public string UnitName
{
get
{
return this._UnitName;
}
set
{
if ((this._UnitName != value))
{
this._UnitName = value;
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_propertyCatName", DbType="NVarChar(50) NOT NULL", CanBeNull=false)]
public string propertyCatName
{
get
{
return this._propertyCatName;
}
set
{
if ((this._propertyCatName != value))
{
this._propertyCatName = value;
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_sqlType", DbType="NVarChar(20) NOT NULL", CanBeNull=false)]
public string sqlType
{
get
{
return this._sqlType;
}
set
{
if ((this._sqlType != value))
{
this._sqlType = value;
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_stringVal", DbType="NVarChar(MAX)")]
public string stringVal
{
get
{
return this._stringVal;
}
set
{
if ((this._stringVal != value))
{
this._stringVal = value;
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_shortStringVal", DbType="NVarChar(100)")]
public string shortStringVal
{
get
{
return this._shortStringVal;
}
set
{
if ((this._shortStringVal != value))
{
this._shortStringVal = value;
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_measurmentVal", DbType="Int")]
public System.Nullable<int> measurmentVal
{
get
{
return this._measurmentVal;
}
set
{
if ((this._measurmentVal != value))
{
this._measurmentVal = value;
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_boolVal", DbType="Bit")]
public System.Nullable<bool> boolVal
{
get
{
return this._boolVal;
}
set
{
if ((this._boolVal != value))
{
this._boolVal = value;
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_OrderId", DbType="Int NOT NULL")]
public int OrderId
{
get
{
return this._OrderId;
}
set
{
if ((this._OrderId != value))
{
this._OrderId = value;
}
}
}
}

WPF listbox binding to listview

I have below classes:
public class BusinessFunction
{
private string str_Id;
public string id
{
get { return str_Id; }
set { str_Id = value; }
}
private List<Function> str_FunctionList;
public BusinessFunction() { }
public List<Function> functionList
{
get { return str_FunctionList; }
set { str_FunctionList = value; }
}
}
public class Function
{
private string str_FunctionType;
public string functionType
{
get { return str_FunctionType; }
set { str_FunctionType = value; }
}
private string str_FunctionName;
public string functionName
{
get { return str_FunctionName; }
set { str_FunctionName = value; }
}
private string str_Value;
public string value
{
get { return str_Value; }
set { str_Value = value; }
}
}
I have to bind the above data into Listbox and Listview. The "id" should display in listbox and the "functionList" in listview. When user changes the selection in listbox, it should bring the associated "functionList" into listview.
How to achieve this scenario?
Thanks
Listview Itemsource={Binding functionList} did the trick.

Flex AdvancedDataGrid with IHierarchical Objects

I have a problem with the model classes of my advancedDataGrid. Here are my model classes:
package module.testPlanModule
{
import flash.events.Event;
import flash.utils.IDataInput;
import flash.utils.IDataOutput;
import flash.utils.IExternalizable;
import mx.collections.IHierarchicalData;
import mx.utils.UIDUtil;
[Bindable]
[RemoteClass(alias="business.project.version.testPlan.TestSuite")]
public class TestSuite implements IExternalizable, IHierarchicalData
{
private var _uuid:String;
private var _ID:String;
private var _testCasesList:Array;
public function TestSuite()
{
_uuid = UIDUtil.createUID();
_ID = "TESTSUITE-"+Math.random();
_testCasesList = [];
}
public function get testCasesList():Array
{
return _testCasesList;
}
public function set testCasesList(value:Array):void
{
_testCasesList = value;
}
public function get ID():String
{
return _ID;
}
public function set ID(value:String):void
{
_ID = value;
}
public function get uuid():String
{
return _uuid;
}
public function set uuid(value:String):void
{
_uuid = value;
}
public function addEventListener(type:String, listener:Function, useCapture:Boolean=false, priority:int=0, useWeakReference:Boolean=false):void
{
// TODO Auto Generated method stub
}
public function dispatchEvent(event:Event):Boolean
{
// TODO Auto Generated method stub
return false;
}
public function hasEventListener(type:String):Boolean
{
// TODO Auto Generated method stub
return false;
}
public function removeEventListener(type:String, listener:Function, useCapture:Boolean=false):void
{
// TODO Auto Generated method stub
}
public function willTrigger(type:String):Boolean
{
// TODO Auto Generated method stub
return false;
}
public function canHaveChildren(node:Object):Boolean
{
if(node is TestSuite){
return true;
}
else if(node is TestCase){
return true;
}
else
return false;
}
public function hasChildren(node:Object):Boolean
{
if(node is TestSuite){
return !(node.testCasesList.length == 0);
}
else if(node is TestCase){
return !(node.allocatedTests.length == 0);
}
else
return false;
}
public function getChildren(node:Object):Object
{
if(node is TestSuite){
return node.testCasesList;
}
else if(node is TestCase){
return node.allocatedTests;
}
else
return null;
}
public function getData(node:Object):Object
{
return node;
}
public function getRoot():Object
{
// TODO Auto Generated method stub
return null;
}
public function writeExternal(output:IDataOutput):void
{
output.writeUTF(_uuid);
output.writeUTF(_ID);
output.writeObject(_testCasesList);
}
public function readExternal(input:IDataInput):void
{
_uuid = input.readUTF();
_ID = input.readUTF();
_testCasesList = input.readObject();
}
}
}
package module.testPlanModule
{
import flash.events.Event;
import flash.utils.IDataInput;
import flash.utils.IDataOutput;
import flash.utils.IExternalizable;
import mx.collections.IHierarchicalData;
import mx.utils.UIDUtil;
[Bindable]
[RemoteClass(alias="business.project.version.testPlan.TestCase")]
public class TestCase implements IExternalizable, IHierarchicalData
{
private var _uuid:String;
private var _ID:String;
private var _allocatedTests:Array;
public function TestCase()
{
_uuid = UIDUtil.createUID();
_ID = "TESTCASE-"+Math.random();
_allocatedTests = [];
}
public function get ID():String
{
return _ID;
}
public function set ID(value:String):void
{
_ID = value;
}
public function get allocatedTests():Array
{
return _allocatedTests;
}
public function set allocatedTests(value:Array):void
{
_allocatedTests = value;
}
public function get uuid():String
{
return _uuid;
}
public function set uuid(value:String):void
{
_uuid = value;
}
public function addEventListener(type:String, listener:Function, useCapture:Boolean=false, priority:int=0, useWeakReference:Boolean=false):void
{
// TODO Auto Generated method stub
}
public function dispatchEvent(event:Event):Boolean
{
// TODO Auto Generated method stub
return false;
}
public function hasEventListener(type:String):Boolean
{
// TODO Auto Generated method stub
return false;
}
public function removeEventListener(type:String, listener:Function, useCapture:Boolean=false):void
{
// TODO Auto Generated method stub
}
public function willTrigger(type:String):Boolean
{
// TODO Auto Generated method stub
return false;
}
public function canHaveChildren(node:Object):Boolean
{
if(node is TestSuite){
return true;
}
else if(node is TestCase){
return true;
}
else
return false;
}
public function hasChildren(node:Object):Boolean
{
if(node is TestSuite){
return !(node.testCasesList.length == 0);
}
else if(node is TestCase){
return !(node.allocatedTests.length == 0);
}
else
return false;
}
public function getChildren(node:Object):Object
{
if(node is TestSuite){
return node.testCasesList;
}
else if(node is TestCase){
return node.allocatedTests;
}
else
return null;
}
public function getData(node:Object):Object
{
return node;
}
public function getRoot():Object
{
// TODO Auto Generated method stub
return null;
}
public function writeExternal(output:IDataOutput):void
{
output.writeUTF(_uuid);
output.writeUTF(_ID);
output.writeObject(_allocatedTests);
}
public function readExternal(input:IDataInput):void
{
_uuid = input.readUTF();
_ID = input.readUTF();
_allocatedTests = input.readObject();
}
}
}
package module.testPlanModule
{
import flash.events.Event;
import flash.utils.IDataInput;
import flash.utils.IDataOutput;
import flash.utils.IExternalizable;
import mx.collections.IHierarchicalData;
import mx.utils.UIDUtil;
[Bindable]
[RemoteClass(alias="business.project.version.test.TestBase")]
public class TestBase implements IExternalizable, IHierarchicalData
{
private var _uuid:String;
private var _ID:String;
private var _state:String;
private var _result:String;
private var _allocatedUser:String;
private var _linkedRequirements:Array;
public function TestBase()
{
_uuid = UIDUtil.createUID();
_ID = "TEST-"+Math.random();
_state = "not passed";
_result = "na";
_allocatedUser = "";
_linkedRequirements = [];
}
public function get ID():String
{
return _ID;
}
public function set ID(value:String):void
{
_ID = value;
}
public function get state():String
{
return _state;
}
public function set state(value:String):void
{
_state = value;
}
public function get result():String
{
return _result;
}
public function set result(value:String):void
{
_result = value;
}
public function get allocatedUser():String
{
return _allocatedUser;
}
public function set allocatedUser(value:String):void
{
_allocatedUser = value;
}
public function get linkedRequirements():Array
{
return _linkedRequirements;
}
public function set linkedRequirements(value:Array):void
{
_linkedRequirements = value;
}
public function get uuid():String
{
return _uuid;
}
public function set uuid(value:String):void
{
_uuid = value;
}
public function addEventListener(type:String, listener:Function, useCapture:Boolean=false, priority:int=0, useWeakReference:Boolean=false):void
{
// TODO Auto Generated method stub
}
public function dispatchEvent(event:Event):Boolean
{
// TODO Auto Generated method stub
return false;
}
public function hasEventListener(type:String):Boolean
{
// TODO Auto Generated method stub
return false;
}
public function removeEventListener(type:String, listener:Function, useCapture:Boolean=false):void
{
// TODO Auto Generated method stub
}
public function willTrigger(type:String):Boolean
{
// TODO Auto Generated method stub
return false;
}
public function canHaveChildren(node:Object):Boolean
{
if(node is TestSuite){
return true;
}
else if(node is TestCase){
return true;
}
else
return false;
}
public function hasChildren(node:Object):Boolean
{
if(node is TestSuite){
return !(node.testCasesList.length == 0);
}
else if(node is TestCase){
return !(node.allocatedTests.length == 0);
}
else
return false;
}
public function getChildren(node:Object):Object
{
if(node is TestSuite){
return node.testCasesList;
}
else if(node is TestCase){
return node.allocatedTests;
}
else
return null;
}
public function getData(node:Object):Object
{
return node;
}
public function getRoot():Object
{
// TODO Auto Generated method stub
return null;
}
public function writeExternal(output:IDataOutput):void
{
output.writeUTF(_uuid);
output.writeUTF(_ID);
output.writeUTF(_state);
output.writeUTF(_result);
output.writeUTF(_allocatedUser);
output.writeObject(_linkedRequirements);
}
public function readExternal(input:IDataInput):void
{
_uuid = input.readUTF();
_ID = input.readUTF();
_state = input.readUTF();
_result = input.readUTF();
_allocatedUser = input.readUTF();
_linkedRequirements = input.readObject();
}
}
}
And here is my AdvancedDatagrid:
<mx:AdvancedDataGrid id="testPlanADG" displayItemsExpanded="true"
width="95%" height="95%"
contentBackgroundAlpha="0.0" chromeColor="0xdbeaff"
openDuration="500"
verticalScrollPolicy="on"
horizontalScrollPolicy="auto"
variableRowHeight="true">
<mx:columns>
<mx:AdvancedDataGridColumn id="IdCol" dataField="ID" headerText="ID"
/>
<mx:AdvancedDataGridColumn dataField="state" headerText="State"/>
<mx:AdvancedDataGridColumn dataField="result" headerText="Result"/>
<mx:AdvancedDataGridColumn dataField="allocatedUser" headerText="User affected"/>
</mx:columns>
</mx:AdvancedDataGrid>
The problem is that just the TestSuite's ID are displayed and nothing else.
To populate the ADG I did this:
_model = new ArrayCollection();
// here I populate the model
var testSuite1:TestSuite = new TestSuite();
testSuite1.ID = "testSuite1";
var testCase1:TestCase = new TestCase();
testCase1.ID = "testCase1";
var testBase1:TestBase = new TestBase();
testBase1.ID = "testBase1";
var testBase2:TestBase = new TestBase();
testBase2.ID = "testBase2";
testCase1.allocatedTests = [testBase1,testBase2];
// ...
_testPlanHierarchy = new HierarchicalData();
_testPlanHierarchy.source = _model;
testPlanADG.dataProvider = _testPlanHierarchy;
I can see the ID of my two test suites displayed like leaf nodes and nothing else. I really don't understand.
You can choose to show or hide the root node, and you need to tell the ADG what field to look at for children, since you don't have a field called children. That field needs to be of type ListCollectionViewnor one of its subclasses, such as ArrayCollection. Perhaps just adding a field called children that wraps the fields you already have of type Array will fix your issue.

Interface Implementation Issue

I Have a Base Interface Like this
public interface IHRMISBaseConnector
{
IHRMISEmployeeConnector EmployeeConnector { get ; set; }
}
And i have one more interface like this
public interface IHRMISEmployeeConnector
{
String Add(EmployeeDetails e);
Boolean Update(EmployeeDetails e);
Boolean Delete(int id);
}
I want implement IHRMISBaseConnector in this class DDWEDocumentOperations
How can i implement ? Please let me know if anybody knows it
Something like this should help you:
class FakeImplementationOfEmployeeConnector : IHRMISEmployeeConnector
{
public string Add(EmployeeDetails e)
{
//...
}
public bool Update(EmployeeDetails e)
{
//...
}
public bool Delete(int id)
{
//...
}
}
class DDWEDocumentOperations : IHRMISBaseConnector
{
IHRMISEmployeeConnector employeeConnector = new FakeImplementationOfEmployeeConnector();
public IHRMISEmployeeConnector EmployeeConnector
{
get
{
return employeeConnector;
}
set
{
employeeConnector = value;
}
}
}
Here is an example:
public class DDWEDocumentOperations : IHRMISBaseConnector
{
private IHRMISEmployeeConnector _employeeConnector;
public IHRMISEmployeeConnector EmployeeConnector
{
get { return _employeeConnector; }
set { _employeeConnector = value; }
}
}

help with image class implementation

i build that class
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI.WebControls;
namespace CDN
{
public class Image
{
#region Image parameters
private int _PG_ID;
private string _PG_FileName;
private int _PG_ItemId;
private int _TD_ID;
private Boolean _PG_Visible;
private string _PG_Caption;
public int PG_ID
{
get { return _PG_ID; }
set { _PG_ID = value; }
}
public string PG_FileName
{
get { return _PG_FileName; }
set { _PG_FileName = value; }
}
public int PG_ItemId
{
get { return _PG_ItemId; }
set { _PG_ItemId = value; }
}
public int TD_ID
{
get { return _TD_ID; }
set { _TD_ID = value; }
}
public Boolean PG_Visible
{
get { return _PG_Visible; }
set { _PG_Visible = value; }
}
public string PG_Caption
{
get { return _PG_Caption; }
set { _PG_Caption = value; }
}
#endregion
public Image(int PG_ID)
{
GetImage(PG_ID);
}
public Image()
{
}
private void GetImage(int PG_ID)
{
//TODO get image data from db and fill all parameters with the data
}
public int SaveImage(FileUpload fileUpload,string caption,Boolean visible,int toolId,int itemId)
{
try
{
SaveImageToTemporaryFolder(fileUpload);
return CreateImageOnDb(fileUpload.FileName, caption, visible, toolId, itemId);
}
catch (Exception)
{
throw;
}
}
private int CreateImageOnDb(string fileName, string caption, bool visible, int toolId, int itemId)
{
//TODO save image data on db return image id
return 0;
}
private void SaveImageToTemporaryFolder(FileUpload fileUpload)
{
try
{
string savePath = HttpContext.Current.Server.MapPath("~") + "\\upload\\pgallery\\";
fileUpload.SaveAs(savePath + fileUpload.FileName);
}
catch (Exception)
{
throw;
}
}
}
}
How to pass the file?
EDITED:
in the function SaveImage i pass a FileUpload control.
I want to use the class like this:
when uploading image to craete a new Image object and to pass him all data, but how can i transfer him the file.
Image img = new Image();
img.PG_Caption = "my file name";
img.PG_Visible = True;
img.SaveImage(file);
You can alter your SaveImage function to take a Stream and pass in like this:
using (MemoryStream stream = new MemoryStream(fileUpload.FileBytes))
{
img.SaveImage(stream);
}

Resources