/// <summary> /// Called when [outstanding picklist selected]. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="DevExpress.XtraGrid.Views.Grid.RowClickEventArgs" /> instance containing the event data.</param> private void OnOutstandingPicklistSelected(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e) { var dr = gridOutstandingPickListView.GetFocusedDataRow(); _orderID = Convert.ToInt32(dr["ID"]); var order = new BLL.Order(); order.LoadByPrimaryKey(_orderID); // load payment type options int?requestedBy = null; var usr = new User(); lblIssueStatus.Text = (string)dr["OrderStatus"]; lblIssueTypes.Text = (string)dr["Description"]; if (!order.IsColumnNull("RequestedBy")) { var ins = new Institution(); requestedBy = order.RequestedBy; lkPaymentType.Properties.DataSource = PaymentType.GetAllowedTypes(order.FromStore, requestedBy); ins.LoadByPrimaryKey(order.RequestedBy); try { lblWoreda.Text = ins.WoredaName ?? "-"; lblRegion.Text = ins.RegionName ?? "-"; lblZone.Text = ins.ZoneName ?? "-"; lblInstitutionType.Text = ins.InstitutionTypeName ?? "-"; var ownership = new BLL.OwnershipType(); if (!ins.IsColumnNull("Ownership")) { ownership.LoadByPrimaryKey(ins.Ownership); lblOwnership.Text = ownership.Name; } } catch (NullReferenceException ex) { //when transfer, institution has no woreda, zone or region, ignore the error } } else { lblWoreda.Text = lblRegion.Text = lblZone.Text = lblInstitutionType.Text = lblOwnership.Text = "NA"; } //usr.LoadByPrimaryKey(NewMainWindow.UserId); usr = CurrentContext.LoggedInUser; txtIssuedBy.Text = usr.FullName ?? "-"; PickList pl = new PickList(); _dvOutstandingPickList = pl.GetPickListDetailsForOrder(_orderID, CurrentContext.LoggedInUserName); gridOutstandingPicklistDetail.DataSource = _dvOutstandingPickList; if (order.FromStore != Mode.Constants.HEALTH_PROGRAM) { colSKUPicked.Visible = false; } else { colSKUPicked.Visible = true; } txtConfirmFromStore.Text = order.GetFromStore(); txtConfirmRequestedBy.Text = order.GetRequestedBy(); int length = order.GetRequestedBy().Length; string s = ""; HeaderSection.Text = order.GetRequestedBy() + s.PadRight(150 - length) + "Order Number: " + order.RefNo; txtConfirmOrderNumber.Text = order.RefNo; //txtConfirmApprovedBy.Text = order.GetApprovedBy() ?? "-"; lblApprovedBy.Text = order.GetApprovedBy() ?? "-"; lkPaymentType.EditValue = order.PaymentTypeID; // Temporarily copy the STV txtIssueRefNo.Text = order.RefNo; //""; lblRefNo.Text = order.RefNo ?? "-"; var paymentType = new BLL.PaymentType(); paymentType.LoadByPrimaryKey(order.PaymentTypeID); lblPaymentType.Text = paymentType.Name ?? "-"; lblMode.Text = order.GetFromStore() ?? "-"; lblissuedDate.Text = order.Date.ToShortDateString(); lblIssuedBy.Text = order.GetFilledBy(); lblPicklistPrintedDate.Text = pl.PickedDate.ToShortDateString() != "" ? pl.PickedDate.ToShortDateString() : "-"; var us = new User(); pl.LoadByOrderID(_orderID); if (!pl.IsColumnNull("PickedBy")) { us.LoadByPrimaryKey(pl.PickedBy); lblPicklistConfirmedBy.Text = us.FullName; } else { lblPicklistConfirmedBy.Text = "-"; } }