I had write some code try to change some fields on Inventory allocation details.
Below is my code, the value I wanna change is the field 'On Hand'. And I was always use 'setValue' or 'setValueExt' to do this on other pages. But on this inquire page, it doesn't work.
I had check the cache after I used 'setValue' method, the value of 'On hand' is actually changed in cache, but it didn't refresh the UI.
Anyone know why? Thanks.
public PXAction<PX.Objects.IN.InventoryAllocDetEnqFilter> changeIt;
[PXButton(CommitChanges = true)]
[PXUIField(DisplayName = "Change it")]
protected void changeit()
{
var current = Base.Filter.Current;
var cache = Base.Filter.Cache;
var BaseUnit = current.BaseUnit;
var onHand = current.QtyOnHand;
var totalAddition = current.QtyTotalAddition;
var cgt = Convert.ToDecimal(current.QtyOnHand * 100);
cache.SetValue<InventoryAllocDetEnqFilter.qtyOnHand>(current, cgt);
}
The 'QtyOnHand' value is computed in the 'Filter' delegate.
Delegate are called on server callback to refresh values. Your action changes the 'QtyOnHand' value but the delegate overwrite it's value on next server callback:
public PXFilter<InventoryAllocDetEnqFilter> Filter;
protected virtual IEnumerable filter()
{
PXCache cache = this.Caches[typeof(InventoryAllocDetEnqFilter)];
if (cache != null)
{
InventoryAllocDetEnqFilter filter = cache.Current as InventoryAllocDetEnqFilter;
if (filter != null)
{
filter.QtyOnHand = 0m;
filter.QtyTotalAddition = 0m;
filter.QtyPOPrepared = 0m;
filter.QtyPOOrders = 0m;
filter.QtyPOReceipts = 0m;
filter.QtyINReceipts = 0m;
filter.QtyInTransit = 0m;
filter.QtyInTransitToSO = 0m;
filter.QtyINAssemblySupply = 0m;
filter.QtyInTransitToProduction = 0m;
filter.QtyProductionSupplyPrepared = 0m;
filter.QtyProductionSupply = 0m;
filter.QtyPOFixedProductionPrepared = 0m;
filter.QtyPOFixedProductionOrders = 0m;
filter.QtyTotalDeduction = 0m;
filter.QtyHardAvail = 0m;
filter.QtyActual = 0m;
filter.QtyNotAvail = 0m;
filter.QtyExpired = 0m;
filter.QtySOPrepared = 0m;
filter.QtySOBooked = 0m;
filter.QtySOShipping = 0m;
filter.QtySOShippingReverse = 0m;
filter.QtySOShipped = 0m;
filter.QtySOShippedReverse = 0m;
filter.QtyINIssues = 0m;
filter.QtyINAssemblyDemand = 0m;
filter.QtyProductionDemandPrepared = 0m;
filter.QtyProductionDemand = 0m;
filter.QtyProductionAllocated = 0m;
filter.QtySOFixedProduction = 0m;
filter.QtySOBackOrdered = 0m;
filter.QtySOFixed = 0m;
filter.QtyPOFixedOrders = 0m;
filter.QtyPOFixedPrepared = 0m;
filter.QtyPOFixedReceipts = 0m;
filter.QtySODropShip = 0m;
filter.QtyPODropShipOrders = 0m;
filter.QtyPODropShipPrepared = 0m;
filter.QtyPODropShipReceipts = 0m;
filter.QtyAvail = 0m;
// InventoryId is required field
if (filter.InventoryID != null)
{
// 'included' checkboxes
InventoryItem inventoryItemRec = PXSelect<InventoryItem, Where<InventoryItem.inventoryID, Equal<Current<InventoryAllocDetEnqFilter.inventoryID>>>>.Select(this);
INAvailabilityScheme availSchemeRec = PXSelectJoin<INAvailabilityScheme,
InnerJoin<INItemClass, On<INAvailabilityScheme.availabilitySchemeID, Equal<INItemClass.availabilitySchemeID>>>,
Where<INItemClass.itemClassID, Equal<Required<INItemClass.itemClassID>>>>
.Select(this, inventoryItemRec.ItemClassID);
filter.InclQtyPOPrepared = availSchemeRec.InclQtyPOPrepared;
filter.InclQtyPOOrders = availSchemeRec.InclQtyPOOrders;
filter.InclQtyPOReceipts = availSchemeRec.InclQtyPOReceipts;
filter.InclQtyINReceipts = availSchemeRec.InclQtyINReceipts;
filter.InclQtyInTransit = availSchemeRec.InclQtyInTransit;
filter.InclQtySOPrepared = availSchemeRec.InclQtySOPrepared;
filter.InclQtySOBooked = availSchemeRec.InclQtySOBooked;
filter.InclQtySOShipping = availSchemeRec.InclQtySOShipping;
filter.InclQtySOShipped = availSchemeRec.InclQtySOShipped;
filter.InclQtyINIssues = availSchemeRec.InclQtyINIssues;
filter.InclQtyINAssemblyDemand = availSchemeRec.InclQtyINAssemblyDemand;
filter.InclQtyINAssemblySupply = availSchemeRec.InclQtyINAssemblySupply;
filter.InclQtyProductionDemandPrepared = availSchemeRec.InclQtyProductionDemandPrepared;
filter.InclQtyProductionDemand = availSchemeRec.InclQtyProductionDemand;
filter.InclQtyProductionAllocated = availSchemeRec.InclQtyProductionAllocated;
filter.InclQtyProductionSupplyPrepared = availSchemeRec.InclQtyProductionSupplyPrepared;
filter.InclQtyProductionSupply = availSchemeRec.InclQtyProductionSupply;
filter.InclQtySOBackOrdered = availSchemeRec.InclQtySOBackOrdered;
filter.InclQtySOReverse = availSchemeRec.InclQtySOReverse;
filter.BaseUnit = inventoryItemRec.BaseUnit;
// QtyOnHand , QtyExpired , QtyLocNotAvail calculation :
// simplified (without cost) version of code from IN401000
PXSelectBase<INLocationStatus> calcStatusCmd =
new PXSelectReadonly2<INLocationStatus,
//InnerJoin<INSiteStatus,
// On<INSiteStatus.inventoryID, Equal<INLocationStatus.inventoryID>,
// And<INSiteStatus.subItemID, Equal<INLocationStatus.subItemID>,
// And<INSiteStatus.siteID, Equal<INLocationStatus.siteID>>>>>,
InnerJoin<InventoryItem,
On<InventoryItem.inventoryID, Equal<INLocationStatus.inventoryID>>,
InnerJoin<INLocation,
On<INLocation.siteID, Equal<INLocationStatus.siteID>,
And<INLocation.locationID, Equal<INLocationStatus.locationID>>>,
InnerJoin<INSubItem,
On<INSubItem.subItemID, Equal<INLocationStatus.subItemID>>,
LeftJoin<INLotSerClass,
On<INLotSerClass.lotSerClassID, Equal<InventoryItem.lotSerClassID>>,
LeftJoin<INLotSerialStatus,
On<INLotSerialStatus.inventoryID, Equal<INLocationStatus.inventoryID>,
And<INLotSerClass.lotSerAssign, Equal<INLotSerAssign.whenReceived>,
And<INLotSerialStatus.subItemID, Equal<INLocationStatus.subItemID>,
And<INLotSerialStatus.siteID, Equal<INLocationStatus.siteID>,
And<INLotSerialStatus.locationID, Equal<INLocationStatus.locationID>,
And<INLotSerClass.lotSerClassID, IsNotNull,
And<INLotSerClass.lotSerTrack, NotEqual<INLotSerTrack.notNumbered>>>>>>>>,
InnerJoin<INSite,
On<INSite.siteID, Equal<INLocationStatus.siteID>,
And<Match<IN.INSite, Current<AccessInfo.userName>>>>
>>>>>>,
Where<INLocationStatus.inventoryID, Equal<Current<InventoryAllocDetEnqFilter.inventoryID>>>,
OrderBy<Asc<InventoryItem.inventoryCD,
Asc<INLocationStatus.siteID,
Asc<INSubItem.subItemCD,
Asc<INLocationStatus.locationID,
Asc<INLotSerialStatus.lotSerialNbr>>>>>>>(this);
if (!SubCDUtils.IsSubCDEmpty(filter.SubItemCD))
calcStatusCmd.WhereAnd<Where<INSubItem.subItemCD, Like<Current<InventoryAllocDetEnqFilter.subItemCDWildcard>>>>();
if (filter.SiteID != null)
calcStatusCmd.WhereAnd<Where<INLocationStatus.siteID, Equal<Current<InventoryAllocDetEnqFilter.siteID>>>>();
if (filter.LocationID != null)
calcStatusCmd.WhereAnd<Where<INLocationStatus.locationID, Equal<Current<InventoryAllocDetEnqFilter.locationID>>>>();
if (!string.IsNullOrEmpty(filter.LotSerialNbr))
calcStatusCmd.WhereAnd<Where<INLotSerialStatus.lotSerialNbr, Like<Current<InventoryAllocDetEnqFilter.lotSerialNbrWildcard>>>>();
PXResultset<INLocationStatus> calcStatusRecs = calcStatusCmd.Select();
// only 3 values here : QtyOnHand, QtyOnLocNotAvail, QtyExpired
foreach (PXResult<INLocationStatus, /*INSiteStatus,*/ InventoryItem, INLocation, INSubItem, INLotSerClass, INLotSerialStatus> it in calcStatusRecs)
{
INLocationStatus ls_rec = it;
//INSiteStatus ss_rec = it;
InventoryItem ii_rec = it;
//INSubItem si_rec = it;
INLocation l_rec = it;
INLotSerialStatus lss_rec = it;
filter.QtyOnHand += (lss_rec.QtyOnHand ?? ls_rec.QtyOnHand);
if (!(l_rec.InclQtyAvail ?? true))
{
filter.QtyNotAvail += lss_rec.QtyAvail ?? ls_rec.QtyAvail;
}
else
{
if ((lss_rec.ExpireDate != null) && (DateTime.Compare((DateTime)this.Accessinfo.BusinessDate, (DateTime)lss_rec.ExpireDate) > 0))
{
filter.QtyExpired += lss_rec.QtyOnHand;
}
}
}
foreach (InventoryAllocDetEnqResult it in this.ResultRecords.Select()) //???
{
Aggregate(filter, it);
}
filter.QtyTotalAddition =
((filter.InclQtyPOPrepared ?? false) ? filter.QtyPOPrepared : 0m)
+ ((filter.InclQtyPOOrders ?? false) ? filter.QtyPOOrders : 0m)
+ ((filter.InclQtyPOReceipts ?? false) ? filter.QtyPOReceipts : 0m)
+ ((filter.InclQtyINReceipts ?? false) ? filter.QtyINReceipts : 0m)
+ ((filter.InclQtyInTransit ?? false) ? filter.QtyInTransit : 0m)
+ ((filter.InclQtyINAssemblySupply ?? false) ? filter.QtyINAssemblySupply : 0m)
+ ((filter.InclQtyProductionSupplyPrepared ?? false) ? filter.QtyProductionSupplyPrepared : 0m)
+ ((filter.InclQtyProductionSupply ?? false) ? filter.QtyProductionSupply : 0m);
filter.QtyTotalDeduction =
filter.QtyExpired
+ ((filter.InclQtySOPrepared ?? false) ? filter.QtySOPrepared : 0m)
+ ((filter.InclQtySOBooked ?? false) ? filter.QtySOBooked : 0m)
+ ((filter.InclQtySOShipping ?? false) ? filter.QtySOShipping : 0m)
+ ((filter.InclQtySOShipped ?? false) ? filter.QtySOShipped : 0m)
+ ((filter.InclQtyINIssues ?? false) ? filter.QtyINIssues : 0m)
+ ((filter.InclQtyINAssemblyDemand ?? false) ? filter.QtyINAssemblyDemand : 0m)
+ ((filter.InclQtyProductionDemandPrepared ?? false) ? filter.QtyProductionDemandPrepared : 0m)
+ ((filter.InclQtyProductionDemand ?? false) ? filter.QtyProductionDemand : 0m)
+ ((filter.InclQtyProductionAllocated ?? false) ? filter.QtyProductionAllocated : 0m)
+ ((filter.InclQtySOBackOrdered ?? false) ? filter.QtySOBackOrdered : 0m);
filter.QtyAvail = filter.QtyOnHand + filter.QtyTotalAddition - (filter.QtyTotalDeduction + filter.QtyNotAvail);
filter.QtyHardAvail = filter.QtyOnHand - filter.QtyNotAvail - filter.QtyINIssues
- (filter.QtySOShipping - filter.QtySOShippingReverse) - (filter.QtySOShipped - filter.QtySOShippedReverse);
filter.QtyActual = filter.QtyOnHand - filter.QtyNotAvail - (filter.QtySOShipped - filter.QtySOShippedReverse);
}
}
}
yield return cache.Current;
cache.IsDirty = false;
}
Related
When I put pagination(50); it shows WhereNull does not exist. and then I go make the whereNull into ctrl + /
and it show the next line which is OrderBy not exist. I seriously dont know where the problem is.. because I want to make pagination without using datatable from a DB::raw query.....
public function searchParticipation(Request $request){
ini_set('memory_limit','2G');
if ($request->method() != 'POST') {
return redirect()->route('ticketparticipation.view');
}
$replaceStartDate = $this->remove_string($request['start_date']);
$replaceEndDate = $this->remove_string($request['end_date']);
$valStartDate = strtotime($replaceStartDate) + (60*60*8);
$valEndDate = strtotime($replaceEndDate) + (60*60*24) + (60*60*8) - 1;
$event_id = $request['event_id'];
$category_id = $request['category_id'];
$ticket_number = $request['ticket_number'];
$full_name = $request['full_name'];
$dataEvent = array(
'event_id' => $event_id,
'category_id' => $category_id,
'ticket_number' => $ticket_number
);
$superadmins = User::UserOrganizer()->get();
$user_id = Session::get('user_id');
$roles = Session::get('roles');
if(empty(Session::get('roles'))){
auth()->logout();
return redirect('/admin/logout2');
}
$eventx = Event::query();
$eventx = $eventx->select('id', 'name');
if ($roles == 'Organizer-Admin') {
$eventx->Where('admin_id','=',$user_id);
$event = $eventx->Where('is_deleted','=','0')->get(); //->Where('is_active','=','1')
}elseif($roles == 'Organizer-Project'){
$eventx->Where('project_manager_id','=',$user_id);
$event = $eventx->Where('is_deleted','=','0')->get(); //->Where('is_active','=','1')
}elseif($roles == 'Organizer-Super-Admin'){
$eventx->Where('superadmin_id','=',$user_id);
$event = $eventx->Where('is_deleted','=','0')->get(); //->Where('is_active','=','1')
}elseif($roles == 'Superadmin-Organizer'){
$event = $eventx->Where('is_deleted','=','0')->get(); //->Where('is_active','=','1')
}
$data = array(
'user_id' => $user_id,
'roles' => $roles,
'date_start' => $request['start_date'],
'date_end' => $request['end_date']
);
if($data['roles'] == 'Organizer-Admin'){
$field = "event.admin_id";
}elseif($data['roles'] == 'Organizer-Project'){
$field = "event.project_manager_id";
}else{
$field = "event.superadmin_id";
}
$tCount = EventParticipation::Select('event_participation.id')
->join('event', 'event.id', '=', 'event_participation.event_id')
->join('categories', 'categories.id', 'event_participation.run_id');
if($event_id != ''){
$tCount = $tCount->Where("event_participation.event_id", "=", $event_id);
}
if($category_id != ''){
$tCount = $tCount->Where("event_participation.run_id", "=", $category_id);
}
if($ticket_number != ''){
$tCount = $tCount->Where(DB::raw('concat(event.ticket_number_prepend,"",event_participation.queue_id)') , '=' , $ticket_number);
}
if($full_name != ''){
$tCount = $tCount->Where("event_participation.full_name", 'LIKE' , '%'.$full_name.'%');
}
$tCount = $tCount->Where("event_participation.acceptance_date", "<>", 0)
->Where("event_participation.is_participating", "=", 1)
->Where("event_participation.is_deleted", "=", 0)
->OrderBy('event_participation.creation_date','ASC')
->get();
$eventDetail = Event::Select('name', 'registration_end', 'type','primary_currency')->Where('id', '=', $event_id)->first();
if($tCount->count() < 10000) {
$ticketParticipation = EventParticipation::Select(
DB::raw("if(epu.full_name is not null, epu.full_name, event_participation.full_name) as full_name"),
DB::raw("if(epu.address is not null, epu.address, event_participation.address) as address"),
DB::raw("if(epu.city is not null, epu.city, event_participation.city) as city"),
DB::raw("if(epu.postcode is not null, epu.postcode, event_participation.postcode) as postcode"),
DB::raw("if(epu.state is not null, epu.state, event_participation.state) as state"),
DB::raw("if(epu.country is not null, epu.country, event_participation.country) as country"),
DB::raw("if(epu.additional_info is not null, epu.additional_info, event_participation.additional_info) as additional_info"),
'event_participation.id', 'event_participation.delivery_company', 'event_participation.tracking_number', 'event_participation.run_id','event_participation.event_id', 'event_participation.local_transaction_number', 'event_participation.user_id',
'event_participation.nric_passport', 'event_participation.gender', 'event_participation.tshirt_size', 'event_participation.nationality',
'event_participation.email', 'event_participation.contact_number', 'event_participation.emergency_contact_name', 'event_participation.emergency_contact_number', 'event_participation.medical_conditions', 'event_participation.amount',
'event_participation.after_discount', 'event_participation.discount_id', 'event_participation.payment_type', 'event_participation.remarks',
'event.name AS eventname', 'event.ticket_number_prepend', 'categories.title AS run_title', 'event_participation.date_of_birth', 'event_participation.creation_date', 'event_participation.acceptance_date',
DB::raw("FROM_UNIXTIME(`event_participation`.`creation_date`,\"%d-%m-%Y %h:%i:%s %p\") AS `register_date`"),
DB::raw("CONCAT(event.`ticket_number_prepend`, '', event_participation.`queue_id`) AS `ticket_number`"),
'virtual_parcel_shipping_order.awb_id','virtual_parcel_shipping_order.awb_url','virtual_parcel_shipping_order.tracking_url','virtual_parcel_shipping_order.shipping_status',
'virtual_parcel_shipping_order.pick_up_date','virtual_parcel_shipping_order.parcel_content',
'virtual_parcel_shipping_order.status','virtual_parcel_shipping_order.response')//DB::raw("FROM_UNIXTIME(`event_participation`.`date_of_birth`,\"%d-%m-%Y\") AS `dob`"),
->join('event', 'event.id', '=', 'event_participation.event_id')
->join('categories', 'categories.id', 'event_participation.run_id')
->leftjoin('event_participation_report_status','participation_id','event_participation.id')
->leftjoin('virtual_parcel_shipping_order','participant_id','event_participation.id')
->leftjoin('event_participation_utf8 as epu', 'event_participation.id', 'epu.participation_id')->paginate(50); <<<<<<<< got problem when I add in paginate(50)
if($event_id != ''){
$ticketParticipation = $ticketParticipation->Where("event_participation.event_id", "=", $event_id);
}
if($category_id != ''){
$ticketParticipation = $ticketParticipation->Where("event_participation.run_id", "=", $category_id);
}
if($ticket_number != ''){
$ticketParticipation = $ticketParticipation->Where(DB::raw('concat(event.ticket_number_prepend,"",event_participation.queue_id)') , '=' , $ticket_number);
}
if($full_name != ''){
$ticketParticipation = $ticketParticipation->Where("event_participation.full_name", 'LIKE' , '%'.$full_name.'%');
}
$ticketParticipation = $ticketParticipation->Where("event_participation.acceptance_date", "<>", 0)
->Where("event_participation.is_participating", "=", 1)
->Where("event_participation.is_deleted", "=", 0)
->WhereNull("event_participation_report_status.participation_id")
->OrderBy('event_participation.queue_id', 'DESC')
->get()->chunk(1000);
$eventDiscount = EventDiscountCode::Select('id', 'event_id', 'amount', 'code')->Where('event_id', $event_id)->get();
return view('admin.organizer.participant_summary',['ticketParticipation'=>$ticketParticipation], compact('event', 'ticketParticipation', 'eventDiscount', 'dataEvent', 'eventDetail'));
}else{
return view('admin.organizer.participant_summaryv2', compact('event','data', 'dataEvent', 'eventDetail'));
}
}
I am seriously not sure where is the problem.....
I found a small detail on the sales order screen, which when adding two custom fields generates a new price as shown in the image.
but at the moment of generating the new value at the unit price I am surprised that the ext price will not be updated and the other fields which are marked with green.
I am attaching my code and I would like them to tell me what I am failing or what I need to do, so that when updating the unit price the other fields are automatically updated since I am only modifying the unitprice.
besides that I have also used the commit change = true, but it is not working for me.
I thank you for your support,
namespace PX.Objects.SO
{
public class PESKSOOrderEntry6_Extension : PXGraphExtension<SOOrderEntry>
{
#region Event Handlers
public const string PMBudgetType = "I";
//STATE
public const string eNY = "NY";
public const string ePA = "PA";
//UOM
public const string uTN = "TN";
public const string uGL = "GL";
protected virtual void SOLine_CuryUnitPrice_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
{
sender.SetValuePending<SOLine.curyDiscPrice>(e.Row, PXCache.NotSetValue);
}
protected void _(Events.RowUpdated<SOLine> e)
{
var row = (SOLine)e.Row;
var row1 = (SOLine)e.OldRow;
SOOrder soOrder = Base.Document.Current;
if (row == null) return;
var rowExt = row.GetExtension<SOLineExt>();
var rowExt1 = row1.GetExtension<SOLineExt>();
PMRevenueBudget pmBudget = GetPMRevenueBudget(row.ProjectID, row.TaskID, row.InventoryID, PMBudgetType, row.UOM);
var pmBudgetExt = pmBudget.GetExtension<PMBudgetExt>();
if (row.InventoryID != null && row.OrderQty != 0 && row.TaskID != null && pmBudget != null && (rowExt.UsrSPriceIndex == false || rowExt.UsrSPriceIndex == null))
{
rowExt.UsrSPriceIndex = pmBudgetExt.UsrSPriceIndex;
rowExt.UsrQuoteUnitPrice = pmBudget.Rate;
row.CuryUnitPrice = pmBudget.Rate;
//row.CuryExtPrice = row.OrderQty * row.CuryUnitPrice;
//row.CuryDiscPrice = row.CuryExtPrice;
//row.CuryLineAmt = row.CuryExtPrice;
//row.CuryUnbilledAmt = row.CuryExtPrice;
}
else
{
rowExt.UsrSPriceIndex = false;
}
if (row.InventoryID != null && row.OrderQty != 0 && row.TaskID != null && pmBudget != null && rowExt.UsrSPriceIndex == true)
{
rowExt.UsrQuoteUnitPrice = pmBudget.Rate;
PESKPriceIndexCat pricecat = GetPESKPriceIndexCat(row.InventoryID);
decimal? nempriceIndex = 0, baseIndex = 0, aPercent = 0;
nempriceIndex = NewEfecctiveMPriceIndex(soOrder, pricecat, nempriceIndex);
baseIndex = BaseIndex(pmBudgetExt, baseIndex);
aPercent = AsphaltPercent(row, pricecat, aPercent);
if (pricecat != null && pricecat.State == eNY)
{
if (row.UOM == uTN)
{
//((New Effective Monthly Price Index) – (Base Index)) x Asphalt Percent
rowExt.UsrIndexAdj = (((nempriceIndex) - (baseIndex)) * (aPercent / 100));
row.CuryUnitPrice = rowExt.UsrQuoteUnitPrice + rowExt.UsrIndexAdj;
//row.CuryExtPrice = row.OrderQty * row.CuryUnitPrice;
//row.CuryDiscPrice = row.CuryExtPrice;
//row.CuryLineAmt = row.CuryExtPrice;
//row.CuryUnbilledAmt = row.CuryExtPrice;
}
if (row.UOM == uGL)
{
//(((New Effective Monthly Index Price) – (Base Index))/ 235) x Asphalt Percent
decimal? num = 235;
rowExt.UsrIndexAdj = ((((nempriceIndex) - (baseIndex)) / num) * (aPercent / 100));
row.CuryUnitPrice = rowExt.UsrQuoteUnitPrice + rowExt.UsrIndexAdj;
//row.CuryExtPrice = row.OrderQty * row.CuryUnitPrice;
//row.CuryDiscPrice = row.CuryExtPrice;
//row.CuryLineAmt = row.CuryExtPrice;
//row.CuryUnbilledAmt = row.CuryExtPrice;
}
}
if (pricecat != null && pricecat.State == ePA)
{
if (row.UOM == uTN)
{
var resul = (((nempriceIndex) - (baseIndex)) * (aPercent / 100));
var diff = resul - baseIndex;
decimal? diff1 = baseIndex * Convert.ToDecimal(0.1);
if (diff == diff1)
{
//((New Effective Monthly Price Index) – (Base Index)) x Asphalt Percent
rowExt.UsrIndexAdj = resul;
row.CuryUnitPrice = rowExt.UsrQuoteUnitPrice + rowExt.UsrIndexAdj;
//row.CuryExtPrice = row.OrderQty * row.CuryUnitPrice;
//row.CuryDiscPrice = row.CuryExtPrice;
//row.CuryLineAmt = row.CuryExtPrice;
//row.CuryUnbilledAmt = row.CuryExtPrice;
}
}
if (row.UOM == uGL)
{
decimal? num = 235;
var resul = ((((nempriceIndex) - (baseIndex)) / num) * (aPercent / 100));
var diff = resul - baseIndex;
decimal? diff1 = baseIndex * Convert.ToDecimal(0.1);
if (diff == diff1)
{
//(((New Effective Monthly Index Price) – (Base Index))/ 235) x Asphalt Percent
rowExt.UsrIndexAdj = resul;
row.CuryUnitPrice = rowExt.UsrQuoteUnitPrice + rowExt.UsrIndexAdj;
//row.CuryExtPrice = row.OrderQty * row.CuryUnitPrice;
//row.CuryDiscPrice = row.CuryExtPrice;
//row.CuryLineAmt = row.CuryExtPrice;
//row.CuryUnbilledAmt = row.CuryExtPrice;
}
}
}
}
}
//how to calculate field Index Adj
protected void _(Events.RowSelected<SOLine> e)
{
var row = (SOLine)e.Row;
SOOrder soOrder = Base.Document.Current;
if (row == null) return;
var rowExt = row.GetExtension<SOLineExt>();
#region Enabled and Disable
PMRevenueBudget pmBudget = GetPMRevenueBudget(row.ProjectID, row.TaskID, row.InventoryID, PMBudgetType, row.UOM);
if (row.InventoryID != null && row.OrderQty != 0 && row.TaskID != null && pmBudget != null)
{
PXUIFieldAttribute.SetEnabled<SOLineExt.usrQuoteUnitPrice>(e.Cache, e.Row, true);
PXUIFieldAttribute.SetEnabled<SOLineExt.usrIndexAdj>(e.Cache, e.Row, true);
rowExt.UsrQuoteUnitPrice = 0;
rowExt.UsrIndexAdj = 0;
}
else
{
PXUIFieldAttribute.SetEnabled<SOLineExt.usrQuoteUnitPrice>(e.Cache, e.Row, false);
PXUIFieldAttribute.SetEnabled<SOLineExt.usrIndexAdj>(e.Cache, e.Row, false);
}
if (rowExt.UsrSPriceIndex == true)
{
PXUIFieldAttribute.SetEnabled<SOLineExt.usrIndexAdj>(e.Cache, e.Row, true);
}
else
{
PXUIFieldAttribute.SetEnabled<SOLineExt.usrIndexAdj>(e.Cache, e.Row, false);
rowExt.UsrQuoteUnitPrice = 0;
rowExt.UsrIndexAdj = 0;
}
#endregion
}
#region Method
private decimal? AsphaltPercent(SOLine row, PESKPriceIndexCat pricecat, decimal? aPercent)
{
foreach (PESKStockItem res3 in PXSelect<PESKStockItem,
Where<PESKStockItem.inventoryID, Equal<Required<PESKStockItem.inventoryID>>,
And<PESKStockItem.categoryID, Equal<Required<PESKStockItem.categoryID>>>
>>.Select(Base, row.InventoryID, pricecat.CategoryCD))
{
if (res3 != null)
{
//Asphalt Percent
aPercent = res3.AsphaltPct;
}
}
return aPercent;
}
private decimal? BaseIndex(PMBudgetExt contraExt, decimal? baseIndex)
{
PESKPriceIndexDetail res2 = PXSelectJoin<PESKPriceIndexDetail,
InnerJoin<PESKPRC,
On<PESKPRC.priceIndexID, Equal<PESKPriceIndexDetail.priceIndexID>>>,
Where<PESKPRC.recordID, Equal<Required<PESKPRC.recordID>>>>
.Select(Base, contraExt.UsrPRCNumber);
if (res2 != null)
{
//Base Index
baseIndex = res2.BaseIndex;
}
return baseIndex;
}
private decimal? NewEfecctiveMPriceIndex(SOOrder soOrder, PESKPriceIndexCat pricecat, decimal? nempriceIndex)
{
Dictionary<int?, object> Mydict1 = new Dictionary<int?, object>();
Dictionary<int?, object> Mydict2 = new Dictionary<int?, object>();
foreach (PESKPriceIndexDetail res in PXSelect<PESKPriceIndexDetail,
Where<PESKPriceIndexDetail.categoryID, Equal<Required<PESKPriceIndexDetail.categoryID>>>>
.Select(Base, pricecat.CategoryID))
{
if (res != null)
{
if (res.EffDate <= soOrder.OrderDate)
{
if (!Mydict1.ContainsKey(res.PriceIndexID))
{
Mydict1.Add(res.PriceIndexID, res.EffDate);
}
}
}
}
var maxfecha = (from mydic in Mydict1 select mydic.Value).Max();
nempriceIndex = 0;
PESKPriceIndexDetail res1 = PXSelect<PESKPriceIndexDetail,
Where<PESKPriceIndexDetail.categoryID, Equal<Required<PESKPriceIndexDetail.categoryID>>,
And<PESKPriceIndexDetail.effDate, Equal<Required<PESKPriceIndexDetail.effDate>>>>>
.Select(Base, pricecat.CategoryID, maxfecha);
if (res1 != null)
{
//New Effective Monthly Price Index
nempriceIndex = res1.BaseIndex;
}
return nempriceIndex;
}
#endregion
#endregion
#region Metodos Realizados
public static PXGraph GetGraph(PXGraph graph = null)
{
if (graph == null)
{
graph = new PXGraph();
}
return graph;
}
public static List<TDac> PXResultSetToList<TDac>(PXResultset<TDac> resultSet) where TDac : class, IBqlTable, new()
{
List<TDac> list = new List<TDac>();
foreach (PXResult<TDac> item2 in resultSet)
{
TDac item = item2;
list.Add(item);
}
return list;
}
public static PMRevenueBudget GetPMRevenueBudget(int? ProjectID, int? TaskID, int? InventoryID, string PMBudgetType, string UOM, PXGraph graph = null)
{
graph = GetGraph(graph);
PXResultset<PMRevenueBudget> l = PXSelectBase<
PMRevenueBudget, PXSelect<
PMRevenueBudget,
Where<PMRevenueBudget.projectID, Equal<Required<PMRevenueBudget.projectID>>,
And<PMRevenueBudget.projectTaskID, Equal<Required<PMRevenueBudget.projectTaskID>>,
And<PMRevenueBudget.inventoryID, Equal<Required<PMRevenueBudget.inventoryID>>,
And<PMRevenueBudget.type, Equal<Required<PMRevenueBudget.type>>,
And<PMRevenueBudget.uOM, Equal<Required<PMRevenueBudget.uOM>>>>
>>>>.Config>
.Select(graph, ProjectID, TaskID, InventoryID, PMBudgetType, UOM);
return l;
}
public static PESKPriceIndexCat GetPESKPriceIndexCat(int? InventoryID, PXGraph graph = null)
{
graph = GetGraph(graph);
return PXSelectBase<
PESKPriceIndexCat, PXSelectJoin<
PESKPriceIndexCat,
InnerJoin<PESKStockItem,
On<PESKStockItem.categoryID,
Equal<PESKPriceIndexCat.categoryCD>>>,
Where<PESKStockItem.inventoryID,
Equal<Required<PESKStockItem.inventoryID>>>>.Config>
.Select(graph, InventoryID);
}
#endregion
}
}
By using graph.View.SetValueExt<>(), you can take advantage of field events, which is what updates those fields automatically.
It will take a bit of re-coding, but it would look something like this: (notice the first line and last two lines)
protected void _(Events.RowUpdated<SOLine> e)
{
var orderGraph = (SOOrderEntry)e.Cache.Graph; // ***NEW***
var row = (SOLine)e.Row;
var row1 = (SOLine)e.OldRow;
SOOrder soOrder = Base.Document.Current;
if (row == null) return;
var rowExt = row.GetExtension<SOLineExt>();
var rowExt1 = row1.GetExtension<SOLineExt>();
PMRevenueBudget pmBudget = GetPMRevenueBudget(row.ProjectID, row.TaskID, row.InventoryID, PMBudgetType, row.UOM);
var pmBudgetExt = pmBudget.GetExtension<PMBudgetExt>();
if (row.InventoryID != null && row.OrderQty != 0 && row.TaskID != null && pmBudget != null && (rowExt.UsrSPriceIndex == false || rowExt.UsrSPriceIndex == null))
{
rowExt.UsrSPriceIndex = pmBudgetExt.UsrSPriceIndex;
rowExt.UsrQuoteUnitPrice = pmBudget.Rate;
orderGraph.Transactions.SetValueExt<SOLine.curyUnitPrice>(row, pmBudget.Rate); // ***NEW***
//row.CuryUnitPrice = pmBudget.Rate; ***OLD***
//.... other code
}
}
I think this may resolve your issue.
Can anyone help me find where in the code Acumatica writes to the CRRelation table when createing a Sales Order from an Opportunity? I've done a search for all instances of "CRRelation" but none of them seem to be doing the actual writing to the table.
It is done in the DoCreateSalesOrder(CreateSalesOrderFilter param) method which is called in the CreateSalesOrder action:
public PXAction<CROpportunity> createSalesOrder;
[PXUIField(DisplayName = Messages.CreateSalesOrder, MapEnableRights = PXCacheRights.Update, MapViewRights = PXCacheRights.Select)]
[PXButton(ImageKey = PX.Web.UI.Sprite.Main.DataEntry)]
public virtual IEnumerable CreateSalesOrder(PXAdapter adapter)
{
foreach (CROpportunity opportunity in adapter.Get())
{
Customer customer = (Customer)PXSelect<Customer, Where<Customer.bAccountID, Equal<Current<CROpportunity.bAccountID>>>>
.SelectSingleBound(this, new object[] { opportunity });
if (customer == null)
{
throw new PXException(Messages.ProspectNotCustomer);
}
var products = Products.View.SelectMultiBound(new object[] { opportunity }).RowCast<CROpportunityProducts>();
if (products.Any(_ => _.InventoryID == null) && !products.Any(_ => _.InventoryID != null))
{
throw new PXException(Messages.SalesOrderHasOnlyNonInventoryLines);
}
if (CreateOrderParams.AskExtFullyValid((graph, viewName) => { }, DialogAnswerType.Positive))
{
Save.Press();
PXLongOperation.StartOperation(this, delegate()
{
var grapph = PXGraph.CreateInstance<OpportunityMaint>();
grapph.Opportunity.Current = opportunity;
grapph.CreateOrderParams.Current = CreateOrderParams.Current;
grapph.DoCreateSalesOrder(CreateOrderParams.Current);
});
}
yield return opportunity;
}
}
if we look in that method we can find the following lines which are creating the relation:
var campaignRelation = docgraph.RelationsLink.Insert();
campaignRelation.RefNoteID = doc.NoteID;
campaignRelation.Role = CRRoleTypeList.Source;
campaignRelation.TargetType = CRTargetEntityType.CROpportunity;
campaignRelation.TargetNoteID = opportunity.NoteID;
campaignRelation.DocNoteID = opportunity.NoteID;
campaignRelation.EntityID = opportunity.BAccountID;
campaignRelation.ContactID = opportunity.ContactID;
docgraph.RelationsLink.Update(campaignRelation);
You can find the full code of that method below:
protected virtual void DoCreateSalesOrder(CreateSalesOrderFilter param)
{
bool recalcAny = param.RecalculatePrices == true ||
param.RecalculateDiscounts == true ||
param.OverrideManualDiscounts == true ||
param.OverrideManualDocGroupDiscounts == true ||
param.OverrideManualPrices == true;
var opportunity = this.Opportunity.Current;
Customer customer = (Customer)PXSelect<Customer, Where<Customer.bAccountID, Equal<Current<CROpportunity.bAccountID>>>>.Select(this);
SOOrderEntry docgraph = PXGraph.CreateInstance<SOOrderEntry>();
CurrencyInfo info = PXSelect<CurrencyInfo, Where<CurrencyInfo.curyInfoID, Equal<Current<CROpportunity.curyInfoID>>>>.Select(this);
info.CuryInfoID = null;
info = CurrencyInfo.GetEX(docgraph.currencyinfo.Insert(info.GetCM()));
SOOrder doc = new SOOrder();
doc.OrderType = CreateOrderParams.Current.OrderType ?? SOOrderTypeConstants.SalesOrder;
doc = docgraph.Document.Insert(doc);
doc = PXCache<SOOrder>.CreateCopy(docgraph.Document.Search<SOOrder.orderNbr>(doc.OrderNbr));
doc.CuryInfoID = info.CuryInfoID;
doc = PXCache<SOOrder>.CreateCopy(docgraph.Document.Update(doc));
doc.CuryID = info.CuryID;
doc.OrderDate = Accessinfo.BusinessDate;
doc.OrderDesc = opportunity.Subject;
doc.TermsID = customer.TermsID;
doc.CustomerID = opportunity.BAccountID;
doc.CustomerLocationID = opportunity.LocationID ?? customer.DefLocationID;
if (opportunity.TaxZoneID != null)
{
doc.TaxZoneID = opportunity.TaxZoneID;
if (!recalcAny)
{
SOTaxAttribute.SetTaxCalc<SOLine.taxCategoryID>(docgraph.Transactions.Cache, null, TaxCalc.ManualCalc);
SOTaxAttribute.SetTaxCalc<SOOrder.freightTaxCategoryID>(docgraph.Document.Cache, null,
TaxCalc.ManualCalc);
}
}
doc.ProjectID = opportunity.ProjectID;
doc.BranchID = opportunity.BranchID;
doc = docgraph.Document.Update(doc);
var campaignRelation = docgraph.RelationsLink.Insert();
campaignRelation.RefNoteID = doc.NoteID;
campaignRelation.Role = CRRoleTypeList.Source;
campaignRelation.TargetType = CRTargetEntityType.CROpportunity;
campaignRelation.TargetNoteID = opportunity.NoteID;
campaignRelation.DocNoteID = opportunity.NoteID;
campaignRelation.EntityID = opportunity.BAccountID;
campaignRelation.ContactID = opportunity.ContactID;
docgraph.RelationsLink.Update(campaignRelation);
bool failed = false;
foreach (CROpportunityProducts product in SelectProducts(opportunity.QuoteNoteID))
{
if (product.SiteID == null)
{
InventoryItem item = (InventoryItem)PXSelectorAttribute.Select<CROpportunityProducts.inventoryID>(Products.Cache, product);
if (item != null && item.NonStockShip == true)
{
Products.Cache.RaiseExceptionHandling<CROpportunityProducts.siteID>(product, null,
new PXSetPropertyException(ErrorMessages.FieldIsEmpty, typeof(CROpportunityProducts.siteID).Name));
failed = true;
}
}
SOLine tran = new SOLine();
tran = docgraph.Transactions.Insert(tran);
if (tran != null)
{
tran.InventoryID = product.InventoryID;
tran.SubItemID = product.SubItemID;
tran.TranDesc = product.Descr;
tran.OrderQty = product.Quantity;
tran.UOM = product.UOM;
tran.CuryUnitPrice = product.CuryUnitPrice;
tran.TaxCategoryID = product.TaxCategoryID;
tran.SiteID = product.SiteID;
tran.IsFree = product.IsFree;
tran.ProjectID = product.ProjectID;
tran.TaskID = product.TaskID;
tran.CostCodeID = product.CostCodeID;
tran.ManualPrice = true;
tran.ManualDisc = true;
tran.CuryDiscAmt = product.CuryDiscAmt;
tran.DiscAmt = product.DiscAmt;
tran.DiscPct = product.DiscPct;
tran.POCreate = product.POCreate;
tran.VendorID = product.VendorID;
if (param.RecalculatePrices != true)
{
tran.ManualPrice = true;
}
else
{
if (param.OverrideManualPrices != true)
tran.ManualPrice = product.ManualPrice;
else
tran.ManualPrice = false;
}
if (param.RecalculateDiscounts != true)
{
tran.ManualDisc = true;
}
else
{
if (param.OverrideManualDiscounts != true)
tran.ManualDisc = product.ManualDisc;
else
tran.ManualDisc = false;
}
tran.CuryDiscAmt = product.CuryDiscAmt;
tran.DiscAmt = product.DiscAmt;
tran.DiscPct = product.DiscPct;
}
tran = docgraph.Transactions.Update(tran);
PXNoteAttribute.CopyNoteAndFiles(Products.Cache, product, docgraph.Transactions.Cache, tran,
Setup.Current);
}
PXNoteAttribute.CopyNoteAndFiles(Opportunity.Cache, opportunity, docgraph.Document.Cache, doc, Setup.Current);
if (failed)
throw new PXException(Messages.SiteNotDefined);
//Skip all customer dicounts
if (param.RecalculateDiscounts != true && param.OverrideManualDiscounts != true)
{
var discounts = new Dictionary<string, SOOrderDiscountDetail>();
foreach (SOOrderDiscountDetail discountDetail in docgraph.DiscountDetails.Select())
{
docgraph.DiscountDetails.SetValueExt<SOOrderDiscountDetail.skipDiscount>(discountDetail, true);
string key = discountDetail.Type + ':' + discountDetail.DiscountID + ':' + discountDetail.DiscountSequenceID;
discounts.Add(key, discountDetail);
}
Discount ext = this.GetExtension<Discount>();
foreach (CROpportunityDiscountDetail discountDetail in ext.DiscountDetails.Select())
{
SOOrderDiscountDetail detail;
string key = discountDetail.Type + ':' + discountDetail.DiscountID + ':' + discountDetail.DiscountSequenceID;
if (discounts.TryGetValue(key, out detail))
{
docgraph.DiscountDetails.SetValueExt<SOOrderDiscountDetail.skipDiscount>(detail, false);
if (discountDetail.IsManual == true && discountDetail.Type == DiscountType.Document)
{
docgraph.DiscountDetails.SetValueExt<SOOrderDiscountDetail.extDiscCode>(detail, discountDetail.ExtDiscCode);
docgraph.DiscountDetails.SetValueExt<SOOrderDiscountDetail.description>(detail, discountDetail.Description);
docgraph.DiscountDetails.SetValueExt<SOOrderDiscountDetail.isManual>(detail, discountDetail.IsManual);
docgraph.DiscountDetails.SetValueExt<SOOrderDiscountDetail.curyDiscountAmt>(detail, discountDetail.CuryDiscountAmt);
}
}
else
{
detail = (SOOrderDiscountDetail)docgraph.DiscountDetails.Cache.CreateInstance();
detail.Type = discountDetail.Type;
detail.DiscountID = discountDetail.DiscountID;
detail.DiscountSequenceID = discountDetail.DiscountSequenceID;
detail.ExtDiscCode = discountDetail.ExtDiscCode;
detail.Description = discountDetail.Description;
detail = (SOOrderDiscountDetail)docgraph.DiscountDetails.Cache.Insert(detail);
if (discountDetail.IsManual == true && (discountDetail.Type == DiscountType.Document || discountDetail.Type == DiscountType.ExternalDocument))
{
detail.CuryDiscountAmt = discountDetail.CuryDiscountAmt;
detail.IsManual = discountDetail.IsManual;
docgraph.DiscountDetails.Cache.Update(detail);
}
}
}
SOOrder old_row = PXCache<SOOrder>.CreateCopy(docgraph.Document.Current);
docgraph.Document.Cache.SetValueExt<SOOrder.curyDiscTot>(docgraph.Document.Current, DiscountEngineProvider.GetEngineFor<SOLine, SOOrderDiscountDetail>().GetTotalGroupAndDocumentDiscount(docgraph.DiscountDetails));
docgraph.Document.Cache.RaiseRowUpdated(docgraph.Document.Current, old_row);
}
doc = docgraph.Document.Update(doc);
if (opportunity.TaxZoneID != null && !recalcAny)
{
foreach (CRTaxTran tax in PXSelect<CRTaxTran, Where<CRTaxTran.quoteID, Equal<Current<CROpportunity.quoteNoteID>>>>.Select(this))
{
SOTaxTran newtax = new SOTaxTran();
newtax.LineNbr = int.MaxValue;
newtax.TaxID = tax.TaxID;
newtax = docgraph.Taxes.Insert(newtax);
if (newtax != null)
{
newtax = PXCache<SOTaxTran>.CreateCopy(newtax);
newtax.TaxRate = tax.TaxRate;
newtax.CuryTaxableAmt = tax.CuryTaxableAmt;
newtax.CuryTaxAmt = tax.CuryTaxAmt;
newtax.CuryUnshippedTaxableAmt = tax.CuryTaxableAmt;
newtax.CuryUnshippedTaxAmt = tax.CuryTaxAmt;
newtax.CuryUnbilledTaxableAmt = tax.CuryTaxableAmt;
newtax.CuryUnbilledTaxAmt = tax.CuryTaxAmt;
newtax = docgraph.Taxes.Update(newtax);
}
}
}
if (opportunity.AllowOverrideContactAddress == true)
{
CRContact _CRContact = Opportunity_Contact.SelectSingle();
CRAddress _CRAddress = Opportunity_Address.SelectSingle();
// Insert
if (_CRContact != null)
{
SOBillingContact _billingContact = docgraph.Billing_Contact.Select();
if (_billingContact != null)
{
_billingContact.FullName = _CRContact.FullName;
_billingContact.Salutation = _CRContact.Salutation;
_billingContact.Phone1 = _CRContact.Phone1;
_billingContact.Email = _CRContact.Email;
_billingContact = docgraph.Billing_Contact.Update(_billingContact);
_billingContact.IsDefaultContact = false;
_billingContact = docgraph.Billing_Contact.Update(_billingContact);
}
}
if (_CRAddress != null)
{
SOBillingAddress _billingAddress = docgraph.Billing_Address.Select();
if (_billingAddress != null)
{
_billingAddress.AddressLine1 = _CRAddress.AddressLine1;
_billingAddress.AddressLine2 = _CRAddress.AddressLine2;
_billingAddress.City = _CRAddress.City;
_billingAddress.CountryID = _CRAddress.CountryID;
_billingAddress.State = _CRAddress.State;
_billingAddress.PostalCode = _CRAddress.PostalCode;
_billingAddress = docgraph.Billing_Address.Update(_billingAddress);
_billingAddress.IsDefaultAddress = false;
_billingAddress = docgraph.Billing_Address.Update(_billingAddress);
}
}
}
if (recalcAny)
{
docgraph.recalcdiscountsfilter.Current.OverrideManualPrices = param.OverrideManualPrices == true;
docgraph.recalcdiscountsfilter.Current.RecalcDiscounts = param.RecalculateDiscounts == true;
docgraph.recalcdiscountsfilter.Current.RecalcUnitPrices = param.RecalculatePrices == true;
docgraph.recalcdiscountsfilter.Current.OverrideManualDiscounts = param.OverrideManualDiscounts == true;
docgraph.recalcdiscountsfilter.Current.OverrideManualDocGroupDiscounts = param.OverrideManualDocGroupDiscounts == true;
docgraph.Actions[nameof(Discount.RecalculateDiscountsAction)].Press();
}
if (!this.IsContractBasedAPI)
throw new PXRedirectRequiredException(docgraph, "");
docgraph.Save.Press();
}
NOTE: you can find most part of the sources by the following path in the Acumatica's server folder App_Data\CodeRepository\PX.Objects,App_Data\CodeRepository\PX.Data,App_Data\CodeRepository\PX.Objects.FS
Currently we are displaying the container that contains the table layout with 7 columns in center of the screen in the 1280x800 pixels resolution.
But we need the same container displaying in the 1920x1200 pixels resolution in center of the screen.
Actually the container is displayed but the row data is missing. Is anything wrong in my code? Please help me how to resolve this one.
FlowLayout centerLayout = new FlowLayout();
centerLayout.setAlign(Component.CENTER);
centerLayout.setValign(Component.TOP);
Container centerContainer = new Container(centerLayout);
topTabelcontainer = new Container(new TableLayout(7, 1));
commonComponentsForm = new CommonComponentsForm();
eventPostSchedulesForm = commonComponentsForm.setEventPostSchedulesFormHeader(eventPostSchedulesForm, res, workerBreaksPreferences);
topTabelcontainer = commonComponentsForm.getEventInfoHeader(eventPostSchedulesForm, res, topTabelcontainer, "showroster");
filterLayoutContainer = this.getFilterBody();
postScheduleTableContainer = this.getEventPostScheduleTable();
TableLayout.Constraint postScheduleTableConstraint = new TableLayout.Constraint();
postScheduleTableConstraint.setHorizontalAlign(BorderLayout.CENTER_BEHAVIOR_SCALE);
postScheduleTableConstraint.setVerticalAlign(BorderLayout.CENTER_BEHAVIOR_SCALE);
topTabelcontainer.add(filterLayoutContainer);
headerContainer);
topTabelcontainer.add(postScheduleTableConstraint, postScheduleTableContainer);
centerContainer.add(topTabelcontainer);
centerContainer.setScrollableY(Boolean.TRUE);
centerContainer.setTactileTouch(Boolean.TRUE);
centerContainer.addPointerDraggedListener(new ActionListener() {
#Override
public void actionPerformed(ActionEvent evt) {
float val = Display.getInstance().getDragSpeed(false);
boolean upperFlag = false;
if (Display.getInstance().isPortrait()) {
if (portRaitUpperBound < toralRecourdsCount)
upperFlag = true;
} else if (landScapeUpperBound < toralRecourdsCount)
upperFlag = true;
boolean lowerFlag = false;
if (Display.getInstance().isPortrait()) {
if ((portRaitLowerBound > 0 && portRaitLowerBound <= toralRecourdsCount))
lowerFlag = true;
} else if (landScapeLowerBound > 0 && landScapeLowerBound < toralRecourdsCount)
lowerFlag = true;
if (val >= 0.5 && scrollFlag) {
dragFlag = true;
if (upperFlag) {
scrollFlag = false;
setPageUpperAndLowerBound(Constants.NEXTFLAG);
postScheduleTableContainer.removeAll();
setEventPostScheduleTable(postScheduleTableContainer);
eventPostSchedulesForm.revalidate();
}
} else if (val <= -0.5 && scrollFlag) {
dragFlag = true;
if (lowerFlag) {
scrollFlag = false;
setPageUpperAndLowerBound(Constants.PREVIOUSFLAG);
postScheduleTableContainer.removeAll();
setEventPostScheduleTable(postScheduleTableContainer);
eventPostSchedulesForm.revalidate();
}
}
}
});
eventPostSchedulesForm.setUIID("workersListForm");
eventPostSchedulesForm.add(BorderLayout.CENTER, centerContainer);
commonComponentsForm.getFooterTag(eventPostSchedulesForm);
eventPostSchedulesForm.show();
}
public Container getEventPostSchedulesTableHeader(Container postSchedulesTableHeaderContainer) {
Label position = new Label(Constants.POSITION, searchingButtonImage);
Label name = new Label(Constants.NAME, searchingButtonImage);
Label callInOutLabel = new Label(Constants.CALLINOUT);
position.setTextPosition(LEFT);
name.setTextPosition(LEFT);
TextArea actualCallIn1 = null;
Label actualCallIn = null;
TextArea actualCallOut1 = null;
Label actualCallOut = null;
TextArea agencyWorker1 = null;
Label agencyWorker = null;
if (Display.getInstance().isPortrait()) {
actualCallIn1 = new TextArea(Constants.ACTUALCALLIN);
actualCallIn1.setEditable(false);
actualCallIn1.setFocusable(false);
actualCallIn1.setColumns(3);
actualCallIn1.setVerticalAlignment(Component.CENTER);
actualCallOut1 = new TextArea(Constants.ACTUALCALLOUT);
actualCallOut1.setEditable(false);
actualCallOut1.setFocusable(false);
actualCallOut1.setColumns(3);
actualCallOut1.setVerticalAlignment(Component.CENTER);
agencyWorker1 = new TextArea(Constants.AGENCYWORKER);
agencyWorker1.setEditable(false);
agencyWorker1.setFocusable(false);
agencyWorker1.setColumns(3);
agencyWorker1.setVerticalAlignment(Component.CENTER);
} else {
agencyWorker = new Label(Constants.AGENCYWORKER);
actualCallIn = new Label(Constants.ACTUALCALLIN);
actualCallOut = new Label(Constants.ACTUALCALLOUT);
}
Label workerBreak = new Label(" ");
position.setUIID("workerTableHeader");
name.setUIID("workerTableHeader");
callInOutLabel.setUIID("workerTableHeader");
if (Display.getInstance().isPortrait()) {
agencyWorker1.setUIID("workerTableHeader");
actualCallIn1.setUIID("workerTableHeader");
actualCallOut1.setUIID("workerTableHeader");
} else {
agencyWorker.setUIID("workerTableHeader");
actualCallIn.setUIID("workerTableHeader");
actualCallOut.setUIID("workerTableHeader");
}
workerBreak.setUIID("workerTableHeader");
if (Display.getInstance().isPortrait()) {
postSchedulesTableHeaderContainer.addComponent(getTableConstraint(16, 8), position);
postSchedulesTableHeaderContainer.addComponent(getTableConstraint(15, 8), name);
postSchedulesTableHeaderContainer.addComponent(getTableConstraint(24, 8), callInOutLabel);
postSchedulesTableHeaderContainer.addComponent(getTableConstraint(13, 8), actualCallIn1);
postSchedulesTableHeaderContainer.addComponent(getTableConstraint(13, 8), actualCallOut1);
postSchedulesTableHeaderContainer.add(getTableConstraint(13, 8), agencyWorker1);
if (workerBreaksPreferences.getAllowbreaks() != null && !"".equals(workerBreaksPreferences.getAllowbreaks()) && "1".equals(workerBreaksPreferences.getAllowbreaks()))
postSchedulesTableHeaderContainer.addComponent(getTableConstraint(6, 8), workerBreak);
} else {
postSchedulesTableHeaderContainer.addComponent(getTableConstraint(13, 10), position);
postSchedulesTableHeaderContainer.addComponent(getTableConstraint(18, 10), name);
postSchedulesTableHeaderContainer.addComponent(getTableConstraint(20, 10), callInOutLabel);
postSchedulesTableHeaderContainer.addComponent(getTableConstraint(13, 10), actualCallIn);
postSchedulesTableHeaderContainer.addComponent(getTableConstraint(13, 10), actualCallOut);
postSchedulesTableHeaderContainer.addComponent(getTableConstraint(16, 10), agencyWorker);
if (workerBreaksPreferences.getAllowbreaks() != null && !"".equals(workerBreaksPreferences.getAllowbreaks()) && "1".equals(workerBreaksPreferences.getAllowbreaks()))
postSchedulesTableHeaderContainer.addComponent(getTableConstraint(7, 10), workerBreak);
}
return postSchedulesTableHeaderContainer;
}
public Container getEventPostScheduleTable() {
List < WorkerBean > eventPostSchedulesList = null;
roasterDao = RoasterDao.getInstance();
if (Display.getInstance().isPortrait()) {
eventPostSchedulesList = roasterDao.getEventPostSchedulesDetails(positionFilterValue, nameFilterValue, portRaitLowerBound, portRaitPageSize);
} else {
eventPostSchedulesList = roasterDao.getEventPostSchedulesDetails(positionFilterValue, nameFilterValue, landScapeLowerBound, landScapePageSize);
}
int tableRowCount = Constants.INITIALTABLEROWS;
boolean pagingFlag = false;
int eventPostScheduleCount = roasterDao.getEventPostSchedulesCount(positionFilterValue, nameFilterValue);
this.toralRecourdsCount = eventPostScheduleCount;
FlowLayout centerLayout = new FlowLayout();
centerLayout.setAlign(Component.CENTER);
postScheduleTableContainer = new Container(centerLayout);
postScheduleTableContainer.setUIID("tableBodyContainer");
if (eventPostSchedulesList.size() > landScapePageSize) {
tableRowCount = landScapePageSize + 1;
} else {
tableRowCount = eventPostSchedulesList.size() + 1;
}
Container borderTopPagingContainer = new Container(new BorderLayout());
if (eventPostScheduleCount > landScapePageSize) {
pagingFlag = true;
if (Display.getInstance().isPortrait()) {
borderTopPagingContainer = this.setHeaderPaging(eventPostScheduleCount, portRaitLowerBound, portRaitUpperBound, res);
} else {
borderTopPagingContainer = this.setHeaderPaging(eventPostScheduleCount, landScapeLowerBound, landScapeUpperBound, res);
}
}
if (pagingFlag) {
tableRowCount = tableRowCount + 1;
}
int columnCount = 6;
if (workerBreaksPreferences.getAllowbreaks() != null && !"".equals(workerBreaksPreferences.getAllowbreaks()) && "1".equals(workerBreaksPreferences.getAllowbreaks()))
columnCount++;
Container postSchedulesListContainer = new Container(new TableLayout(tableRowCount, columnCount));
if (pagingFlag) {
TableLayout.Constraint postSchedulesListConstraint1 = new TableLayout.Constraint();
postSchedulesListConstraint1.setHorizontalSpan(columnCount);
postSchedulesListContainer.add(postSchedulesListConstraint1, borderTopPagingContainer);
}
postSchedulesListContainer = this.getEventPostSchedulesTableHeader(postSchedulesListContainer);
String callInDBValue = "";
String callOutDBValue = "";
String actCallInDBValue = "";
String actCallOutDBValue = "";
Label position = null;
Label name = null;
Label callInOutLabel = null;
Label actualCallIn = null;
Label actualCallOut = null;
TextField agencyWorker = null;
Label workerBreak = null;
for (WorkerBean eventPostSchedules: eventPostSchedulesList) {
callInDBValue = "";
if (eventPostSchedules != null) {
if (eventPostSchedules.getCallIn().length() > 10)
callInDBValue = eventPostSchedules.getCallIn().substring(10).trim();
else {
if (Constants.PLATFORMNAME.equals(Display.getInstance().getPlatformName()))
callInDBValue = " ";
else
callInDBValue = " ";
}
}
callOutDBValue = "";
if (eventPostSchedules != null) {
if (eventPostSchedules.getCallOut().length() > 10)
callOutDBValue = eventPostSchedules.getCallOut().substring(10).trim();
else {
if (Constants.PLATFORMNAME.equals(Display.getInstance().getPlatformName()))
callOutDBValue = " ";
else
callOutDBValue = " ";
}
}
actCallInDBValue = "";
if (eventPostSchedules != null) {
if (eventPostSchedules.getActCallIn().length() > 10)
actCallInDBValue = eventPostSchedules.getActCallIn().substring(10).trim();
else
actCallInDBValue = eventPostSchedules.getActCallIn().trim();
}
actCallOutDBValue = "";
if (null != eventPostSchedules) {
if (eventPostSchedules.getActCallOut().length() > 10)
actCallOutDBValue = eventPostSchedules.getActCallOut().substring(10).trim();
else
actCallOutDBValue = eventPostSchedules.getActCallOut().trim();
}
callInDBValue = ((callInDBValue.trim().length() < 8) ? " ".concat(callInDBValue) : callInDBValue) + ((callOutDBValue.trim().equals("")) ? callOutDBValue : " - " + callOutDBValue);
position = new Label(eventPostSchedules.getPersonnelType());
name = new Label(eventPostSchedules.getName());
callInOutLabel = new Label(callInDBValue);
actualCallIn = new Label(actCallInDBValue);
actualCallIn.setFocusable(Boolean.TRUE);
actualCallIn.addPointerPressedListener(createActualCallChangeListener(actualCallIn, eventPostSchedules.getSerialId(), Constants.ACTUALCALLINFLAG, eventPostSchedules.getName(), eventPostSchedules.getActCallIn(), eventPostSchedules.getActCallOut(), eventPostSchedules.getActCallIn()));
actualCallOut = new Label(actCallOutDBValue);
actualCallOut.setFocusable(Boolean.TRUE);
actualCallOut.addPointerPressedListener(createActualCallChangeListener(actualCallOut, eventPostSchedules.getSerialId(), Constants.ACTUALCALLOUTFLAG, eventPostSchedules.getName(), eventPostSchedules.getActCallIn(), eventPostSchedules.getActCallOut(), eventPostSchedules.getActCallOut()));
agencyWorker = new TextField(eventPostSchedules.getAgencyWorker(), null, 5, TextArea.ANY);
position.setUIID("workersList");
name.setUIID("workersList");
callInOutLabel.setUIID("workersList");
actualCallIn.setUIID("workersListEditable");
actualCallOut.setUIID("workersListEditable");
agencyWorker.setUIID("workersListEditable");
workerBreak.setUIID("workersList");
if (Display.getInstance().isPortrait()) {
postSchedulesListContainer.addComponent(getTableConstraint(16, 8), position);
postSchedulesListContainer.addComponent(getTableConstraint(15, 8), name);
postSchedulesListContainer.addComponent(getTableConstraint(24, 8), callInOutLabel);
postSchedulesListContainer.addComponent(getTableConstraint(13, 8), actualCallIn);
postSchedulesListContainer.addComponent(getTableConstraint(13, 8), actualCallOut);
postSchedulesListContainer.addComponent(getTableConstraint(13, 8), agencyWorker);
if (workerBreaksPreferences.getAllowbreaks() != null && !"".equals(workerBreaksPreferences.getAllowbreaks()) && "1".equals(workerBreaksPreferences.getAllowbreaks()))
postSchedulesListContainer.addComponent(getTableConstraint(6, 8), workerBreak);
} else {
postSchedulesListContainer.addComponent(getTableConstraint(13, 10), position);
postSchedulesListContainer.addComponent(getTableConstraint(18, 10), name);
postSchedulesListContainer.addComponent(getTableConstraint(20, 10), callInOutLabel);
postSchedulesListContainer.addComponent(getTableConstraint(13, 10), actualCallIn);
postSchedulesListContainer.addComponent(getTableConstraint(13, 10), actualCallOut);
postSchedulesListContainer.addComponent(getTableConstraint(16, 10), agencyWorker);
if (workerBreaksPreferences.getAllowbreaks() != null && !"".equals(workerBreaksPreferences.getAllowbreaks()) && "1".equals(workerBreaksPreferences.getAllowbreaks()))
postSchedulesListContainer.addComponent(getTableConstraint(7, 10), workerBreak);
}
}
postScheduleTableContainer.add(postSchedulesListContainer);
return postScheduleTableContainer;
}
}
}
public TableLayout.Constraint getTableConstraint(int widthPercent, int heightPercent) {
TableLayout.Constraint tableConstraint = new TableLayout.Constraint();
tableConstraint.setWidthPercentage(widthPercent);
tableConstraint.setHeightPercentage(heightPercent);
return tableConstraint;
}
}
Don't use flow layout for large dynamic data. You border layout with center constraint or absolute center.
Flow layout is overly simplistic and shouldn't be used for complex structures since Codename One doesn't reflow. There is a big discussion of that in the developer guide.
i have done code to fill up grid view with data set.
just look at :
public void FillGrid(string StartAlpha, string CommandName, string ColumnName, string SearchText)
{
using (DataClassesDataContext db = new DataClassesDataContext())
{
int userid = db.Users.Where(u => u.EmailAddress.Equals((String)Session["EmailID"])).Select(u => u.Id).SingleOrDefault();
var sms = Enumerable.Repeat(new
{
Id = default(int),
Title = string.Empty,
Body = string.Empty,
FromUser = string.Empty,
ToUser = string.Empty,
SentDateTime = default(DateTime?),
IsMedia = default(bool),
CreatedDate = default(DateTime),
}, 1).ToList();
DataSet myDataSet = new DataSet();
DataTable dt = new DataTable();
dt.Columns.Add(new DataColumn("Id", typeof(string)));
dt.Columns.Add(new DataColumn("Title", typeof(string)));
dt.Columns.Add(new DataColumn("Body", typeof(string)));
dt.Columns.Add(new DataColumn("FromUser", typeof(string)));
dt.Columns.Add(new DataColumn("ToUser", typeof(string)));
dt.Columns.Add(new DataColumn("SentDateTime", typeof(DateTime)));
dt.Columns.Add(new DataColumn("IsMedia", typeof(bool)));
dt.Columns.Add(new DataColumn("CreatedDate", typeof(DateTime)));
if (StartAlpha.Equals("All"))
{
switch (CommandName)
{
case "Inbox":
break;
case "Outbox":
lbl_countall.Text = db.SMS.Where(s => s.SentDateTime != null).Count().ToString();
lbut_showinbox.Font.Bold = false;
lbut_showoutbox.Font.Bold = true;
lbut_showdraffs.Font.Bold = false;
sms = db.SMS.OrderByDescending(s => s.SentDateTime).Where(s => (s.SentDateTime != null || s.IsDraft.Equals(false)) & s.user_id.Equals(userid)).Select(s => new
{
Id = s.Id,
Title = s.Title,
Body = s.Body,
FromUser = db.SMSAccounts.Where(a=>a.user_id.Equals(userid)).Select(a=>a.FromMobileNo).FirstOrDefault(),
ToUser = s.To_MobileNo,
SentDateTime = s.SentDateTime,
IsMedia = false,
CreatedDate = s.CreatedDate
}).FilterForColumn(ColumnName, SearchText).ToList();
foreach (var item in sms)
{
if (item != null)
{
DataRow dr = dt.NewRow();
dr["Id"] = item.Id.ToString();
dr["Title"] = item.Title.ToString();
dr["Body"] = Regex.Replace(item.Body.ToString().Trim(), #"<(.|\n)*?>", string.Empty);
dr["FromUser"] = item.FromUser.ToString();
if (item.ToUser != null)
{
dr["ToUser"] = item.ToUser.ToString();
}
else
{
dr["ToUser"] = "NoN";
}
if (item.SentDateTime != null)
{
dr["SentDatetTime"] = item.SentDateTime;
}
else
{
dr["SentDatetTime"] = DBNull.Value;
}
dr["IsMedia"] = item.IsMedia;
dr["CreatedDate"] = item.CreatedDate;
dt.Rows.Add(dr);
}
}
break;
case "Drafts":
lbl_countall.Text = db.SMS.Where(s => s.SentDateTime != null || s.IsDraft.Equals(true)).Count().ToString();
lbut_showinbox.Font.Bold = false;
lbut_showoutbox.Font.Bold = false;
lbut_showdraffs.Font.Bold = true;
sms = db.SMS.OrderByDescending(s => s.SentDateTime).Where(s => (s.SentDateTime == null || s.IsDraft.Equals(true)) & s.user_id.Equals(userid)).Select(s => new
{
Id = s.Id,
Title = s.Title,
Body = s.Body,
FromUser = db.SMSAccounts.Where(a => a.user_id.Equals(userid)).Select(a => a.FromMobileNo).FirstOrDefault(),
ToUser = s.To_MobileNo,
SentDateTime = s.SentDateTime,
IsMedia = false,
CreatedDate = s.CreatedDate
}).FilterForColumn(ColumnName, SearchText).ToList();
foreach (var item in sms)
{
if (item != null)
{
DataRow dr = dt.NewRow();
dr["Id"] = item.Id.ToString();
dr["Title"] = item.Title.ToString();
dr["Body"] = Regex.Replace(item.Body.ToString().Trim(), #"<(.|\n)*?>", string.Empty);
dr["FromUser"] = item.FromUser.ToString();
if (item.ToUser != null)
{
dr["ToUser"] = item.ToUser.ToString();
}
else
{
dr["ToUser"] = "NoN";
}
if (item.SentDateTime != null)
{
dr["SentDatetTime"] = item.SentDateTime;
}
else
{
dr["SentDatetTime"] = DBNull.Value;
}
dr["IsMedia"] = item.IsMedia;
dr["CreatedDate"] = item.CreatedDate;
dt.Rows.Add(dr);
}
}
break;
}
}
else
{
switch (CommandName)
{
//case "Inbox":
.............
// break;
case "Outbox":
lbl_countall.Text = db.SMS.Where(s => s.SentDateTime != null).Count().ToString();
lbut_showinbox.Font.Bold = false;
lbut_showoutbox.Font.Bold = true;
lbut_showdraffs.Font.Bold = false;
sms = db.SMS.OrderByDescending(s => s.SentDateTime).Where(s => (s.SentDateTime != null || s.IsDraft.Equals(false)) & s.user_id.Equals(userid)).Select(s => new
{
Id = s.Id,
Title = s.Title,
Body = s.Body,
FromUser = db.SMSAccounts.Where(a => a.user_id.Equals(userid)).Select(a => a.FromMobileNo).FirstOrDefault(),
ToUser = s.To_MobileNo,
SentDateTime = s.SentDateTime,
IsMedia = false,
CreatedDate = s.CreatedDate
}).FilterForColumn(ColumnName, SearchText).ToList().Where(x => x.Title.StartsWith(StartAlpha, StringComparison.CurrentCultureIgnoreCase)).ToList();
foreach (var item in sms)
{
if (item != null)
{
DataRow dr = dt.NewRow();
dr["Id"] = item.Id.ToString();
dr["Title"] = item.Title.ToString();
dr["Body"] = Regex.Replace(item.Body.ToString().Trim(), #"<(.|\n)*?>", string.Empty);
dr["FromUser"] = item.FromUser.ToString();
if (item.ToUser != null)
{
dr["ToUser"] = item.ToUser.ToString();
}
else
{
dr["ToUser"] = "NoN";
}
if (item.SentDateTime != null)
{
dr["SentDatetTime"] = item.SentDateTime;
}
else
{
dr["SentDatetTime"] = DBNull.Value;
}
dr["IsMedia"] = item.IsMedia;
dr["CreatedDate"] = item.CreatedDate;
dt.Rows.Add(dr);
}
}
break;
case "Drafts":
lbl_countall.Text = db.SMS.Where(s => s.SentDateTime != null).Count().ToString();
lbut_showinbox.Font.Bold = false;
lbut_showoutbox.Font.Bold = false;
lbut_showdraffs.Font.Bold = true;
sms = db.SMS.OrderByDescending(s => s.SentDateTime).Where(s => (s.SentDateTime == null || s.IsDraft.Equals(true)) & s.user_id.Equals(userid)).Select(s => new
{
Id = s.Id,
Title = s.Title,
Body = s.Body,
FromUser = db.SMSAccounts.Where(a => a.user_id.Equals(userid)).Select(a => a.FromMobileNo).FirstOrDefault(),
ToUser = s.To_MobileNo,
SentDateTime = s.SentDateTime,
IsMedia = false,
CreatedDate = s.CreatedDate
}).FilterForColumn(ColumnName, SearchText).ToList().Where(x => x.Title.StartsWith(StartAlpha, StringComparison.CurrentCultureIgnoreCase)).ToList();
foreach (var item in sms)
{
if (item != null)
{
DataRow dr = dt.NewRow();
dr["Id"] = item.Id.ToString();
dr["Title"] = item.Title.ToString();
dr["Body"] = Regex.Replace(item.Body.ToString().Trim(), #"<(.|\n)*?>", string.Empty);
dr["FromUser"] = item.FromUser.ToString();
if (item.ToUser != null)
{
dr["ToUser"] = item.ToUser.ToString();
}
else
{
dr["ToUser"] = "NoN";
}
if (item.SentDateTime != null)
{
dr["SentDatetTime"] = item.SentDateTime;
}
else
{
dr["SentDatetTime"] = DBNull.Value;
}
dr["IsMedia"] = item.IsMedia;
dr["CreatedDate"] = item.CreatedDate;
dt.Rows.Add(dr);
}
}
break;
}
}
myDataSet.Tables.Add(dt);
if (myDataSet.Tables[0].Rows.Count > 0)
{
DataView myDataView = new DataView();
myDataView = myDataSet.Tables[0].DefaultView;
if (this.ViewState["SortExp"] != null)
{
myDataView.Sort = this.ViewState["SortExp"].ToString()
+ " " + this.ViewState["SortOrder"].ToString();
}
GV_ViewSMS.DataSource = myDataView;
}
if (GV_ViewSMS.Rows.Count != 0)
{
SetPageNumbers();
}
GV_ViewSMS.DataBind();
}
}
and this error occurs :
Server Error in '/' Application.
Column 'SentDatetTime' does not belong to table .
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: Column 'SentDatetTime' does not belong to table .
Source Error:
Line 439: else
Line 440: {
Line 441: dr["SentDatetTime"] = DBNull.Value;
Line 442: }
Line 443: dr["IsMedia"] = item.IsMedia;
Source File: e:\EASYMAIL_off\EASYMAIL\BulkSMS.aspx.cs Line: 441
Stack Trace:
[ArgumentException: Column 'SentDatetTime' does not belong to table .]
System.Data.DataRow.GetDataColumn(String columnName) +5731291
System.Data.DataRow.set_Item(String columnName, Object value) +13
BulkSMS.FillGrid(String StartAlpha, String CommandName, String ColumnName, String SearchText) in e:\EASYMAIL_off\EASYMAIL\BulkSMS.aspx.cs:441
BulkSMS.Page_Load(Object sender, EventArgs e) in e:\EASYMAIL_off\EASYMAIL\BulkSMS.aspx.cs:40
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
System.Web.UI.Control.OnLoad(EventArgs e) +95
System.Web.UI.Control.LoadRecursive() +59
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +678
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1055.0
What wrong with my Code?????
please help me to throughout this problem.....
Looks like you have a spelling error SentDatetTime -> SentDateTime:
if (item.SentDateTime != null)
{
dr["SentDateTime"] = item.SentDateTime;
}
else
{
dr["SentDateTime"] = DBNull.Value;
}