void Grid_RowsChanging(object sender, GridViewCollectionChangingEventArgs e) { if (e.Action == Telerik.WinControls.Data.NotifyCollectionChangedAction.Remove) { objMaster = new InvoiceBO(); try { objMaster.GetByPrimaryKey(grdLister.CurrentRow.Cells["Id"].Value.ToInt()); objMaster.Delete(objMaster.Current); } catch (Exception ex) { if (objMaster.Errors.Count > 0) { ENUtils.ShowMessage(objMaster.ShowErrors()); } else { ENUtils.ShowMessage(ex.Message); } e.Cancel = true; } } }
private void populateInvoiceOrders(int invoice = 0, int distributorclientaddress = 0, bool isNew = true, int shipmentid = 0, bool isPopulate = true) { if (isPopulate) { this.RadInvoice.Visible = false; } else { List <ReturnInvoiceOrderDetailViewBO> lstInvoiceOrderDetails = new List <ReturnInvoiceOrderDetailViewBO>(); lstInvoiceOrderDetails = InvoiceBO.InvoiceOrderDetailView(invoice, distributorclientaddress, isNew, DateTime.Parse(this.ddlShipmentDates.SelectedValue), shipmentid); if (lstInvoiceOrderDetails.Count > 0) { this.RadInvoice.DataSource = lstInvoiceOrderDetails; this.RadInvoice.DataBind(); this.dvEmptyContentInvoiceOrders.Visible = false; this.RadInvoice.Visible = true; Session["InvoiceOrderDetails"] = lstInvoiceOrderDetails; } else { this.RadInvoice.Visible = false; this.dvEmptyContentInvoiceOrders.Visible = true; } } }
private void InitializeConstructor() { ComboFunctions.FillCompanyCombo(ddlCompany); ComboFunctions.FillBookingTypeCombo(ddlBookingType); ddlBookingType.SelectedValue = Enums.BOOKING_TYPES.LOCAL; dtpInvoiceDate.Value = DateTime.Now.ToDate(); dtpDueDate.Value = DateTime.Now.ToDate().AddMonths(1); FormatChargesGrid(); grdLister.ShowGroupPanel = false; grdLister.AutoCellFormatting = true; grdLister.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; grdLister.ShowRowHeaderColumn = false; objMaster = new InvoiceBO(); this.SetProperties((INavigation)objMaster); grdLister.AllowAddNewRow = false; dtpFromDate.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1); dtpTillDate.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.LastDayOfMonthValue()); grdLister.CommandCellClick += new CommandCellClickEventHandler(grdLister_CommandCellClick); }
public frmCompanyInvoicePaymentList(int Id) { InitializeComponent(); // grdLister.CellDoubleClick += new GridViewCellEventHandler(grdLister_CellDoubleClick); grdLister.RowsChanging += new Telerik.WinControls.UI.GridViewCollectionChangingEventHandler(Grid_RowsChanging); objMaster = new InvoiceBO(); CompanyId = Id; this.SetProperties((INavigation)objMaster); grdLister.ShowRowHeaderColumn = false; this.Shown += new EventHandler(frmCompanyPendingInvoice_Shown); grdLister.EnableHotTracking = false; grdLister.AllowAddNewRow = false; grdLister.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill; //grdLister.ShowRowHeaderColumn = false; grdLister.ShowGroupPanel = false; grdLister.CommandCellClick += new CommandCellClickEventHandler(grid_CommandCellClick); grdLister.RowsChanged += new GridViewCollectionChangedEventHandler(GridJobs_RowsChanged); grdLister.ViewCellFormatting += new CellFormattingEventHandler(grdLister_ViewCellFormatting); grdLister.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill; // grdLister.ScreenTipNeeded += new ScreenTipNeededEventHandler(grdLister_ScreenTipNeeded); this.grdLister.FilterChanged += new GridViewCollectionChangedEventHandler(grdLister_FilterChanged); }
//void grdLister_CellDoubleClick(object sender, GridViewCellEventArgs e) //{ // ViewDetailForm(e.Row); //} //private void ViewDetailForm(GridViewRowInfo row) //{ // try // { // int? val = row.Cells[COLS.Payment_ID].Value.ToInt(); // if (row != null && row is GridViewDataRowInfo && val == 4) // { // ShowPaymetForm(row.Cells["InvoiceId"].Value.ToInt(), row.Cells["InvoiceNo"].Value.ToStr(), row.Cells["InvoiceTotal"].Value.ToStr()); ; // } // } // catch (Exception ex) // { // } //} //public static void ShowPaymetForm(int id, string InvoiceNo, string Total) //{ // try // { // //frmInvoicePayment frm = new frmInvoicePayment(id, InvoiceNo, Total); // frmPayment frm = new frmPayment(id, InvoiceNo, Total); // frm.MaximizeBox = false; // frm.ShowDialog(); // frm.Dispose(); // } // catch (Exception ex) // { // ENUtils.ShowMessage(ex.Message); // } //} void Grid_RowsChanging(object sender, GridViewCollectionChangingEventArgs e) { if (e.Action == Telerik.WinControls.Data.NotifyCollectionChangedAction.Remove) { objMaster = new InvoiceBO(); try { long id = grdLister.CurrentRow.Cells["Id"].Value.ToLong(); objMaster.GetByPrimaryKey(id); if (objMaster.Current != null) { objMaster.Current.InvoicePaymentTypeID = Enums.INVOICE_PAYMENTTYPES.UNPAID; objMaster.Save(); } } catch (Exception ex) { if (objMaster.Errors.Count > 0) { ENUtils.ShowMessage(objMaster.ShowErrors()); } else { ENUtils.ShowMessage(ex.Message); } e.Cancel = true; } } }
protected void RadGridWeeklySummary_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) { if (e.Item is GridDataItem) { var item = e.Item as GridDataItem; if (item.ItemIndex > -1 && item.DataItem is ReturnWeeklySummaryViewBO) { ReturnWeeklySummaryViewBO objWeekSummary = (ReturnWeeklySummaryViewBO)item.DataItem; Literal litWeekEnDate = (Literal)item.FindControl("litWeekEnDate"); litWeekEnDate.Text = this.WeekEndDate.ToString("dd MMMM yyyy"); HyperLink linkTotal = (HyperLink)item.FindControl("linkTotal"); linkTotal.Text = objWeekSummary.Qty.ToString(); linkTotal.NavigateUrl = "ViewWeekDetails.aspx?WeekendDate=" + this.WeekEndDate.ToString("dd/MM/yyyy") + "&CompanyName=" + objWeekSummary.CompanyName + "&sm=" + objWeekSummary.ShipmentModeID; TextBox txtInvoiceNo = (TextBox)item.FindControl("txtInvoiceNo"); Literal litStatus = (Literal)item.FindControl("litStatus"); litStatus.Text = "<span class=\"label label-" + objWeekSummary.InvoiceStatus.ToLower().Replace(" ", string.Empty).Trim() + "\">" + objWeekSummary.InvoiceStatus + "</span>"; HyperLink linkInvoice = (HyperLink)item.FindControl("linkInvoice"); linkInvoice.NavigateUrl = "AddEditInvoice.aspx?id=" + objWeekSummary.Invoice.ToString(); linkInvoice.Visible = (objWeekSummary.Invoice > 0) ? true : false; LinkButton btnCreateInvoice = (LinkButton)item.FindControl("btnCreateInvoice"); btnCreateInvoice.Attributes.Add("widdate", this.WeekEndDate.ToString("dd MMMM yyyy")); btnCreateInvoice.Attributes.Add("sdate", Convert.ToDateTime(objWeekSummary.ShipmentDate.ToString()).ToString("dd MMMM yyyy")); btnCreateInvoice.Attributes.Add("smkey", objWeekSummary.DistributorClientAddress.ToString()); btnCreateInvoice.Attributes.Add("smid", objWeekSummary.ShipmentModeID.ToString()); if (objWeekSummary.Invoice > 0) { InvoiceBO objInvoice = new InvoiceBO(); objInvoice.ID = (int)objWeekSummary.Invoice; objInvoice.GetObject(); txtInvoiceNo.Text = objInvoice.InvoiceNo; txtInvoiceNo.Enabled = false; btnCreateInvoice.Visible = false; } total = total + (int)objWeekSummary.Qty; } } else if (e.Item is GridFooterItem) { var item = e.Item as GridFooterItem; Literal litQty = (Literal)item.FindControl("litQty"); litQty.Text = total.ToString(); } }
public IHttpActionResult GetInvoice(string bookingno) { try { var invoiceObj = new InvoiceBO().GetInvoiceByBookingNo(bookingno); return(Ok(invoiceObj)); } catch (Exception ex) { return(InternalServerError(ex)); } }
public frmCompanyInvoiceCourierList() { InitializeComponent(); grdLister.CellDoubleClick += new GridViewCellEventHandler(grdLister_CellDoubleClick); grdLister.RowsChanging += new Telerik.WinControls.UI.GridViewCollectionChangingEventHandler(Grid_RowsChanging); objMaster = new InvoiceBO(); this.SetProperties((INavigation)objMaster); grdLister.ShowRowHeaderColumn = false; this.Shown += new EventHandler(frmCompanyInvoiceList_Shown); grdLister.CommandCellClick += new CommandCellClickEventHandler(grid_CommandCellClick); }
private void PopulateShipmentDates(DateTime WeekendDate, int id = 0) { ViewState["WeekEndDate"] = this.GetWeeklyProductionCapacityDetails(id).WeekendDate; ViewState["weekNo"] = this.GetWeeklyProductionCapacityDetails(id).WeekNo + "/" + this.GetWeeklyProductionCapacityDetails(id).WeekendDate.Year; ViewState["weekid"] = id; List <ReturnShipmentDatesViewBO> lstShipmentDates = new List <ReturnShipmentDatesViewBO>(); lstShipmentDates = InvoiceBO.GetShipmentDates(WeekendDate); this.ddlShipmentDates.Items.Clear(); this.ddlShipmentDates.Items.Add(new ListItem("Select a Shipment Date")); foreach (ReturnShipmentDatesViewBO shipdates in lstShipmentDates) { this.ddlShipmentDates.Items.Add(new ListItem(Convert.ToDateTime(shipdates.ShipmentDate.ToString()).ToString("dd MMMM yyyy"))); } }
public frmPreCustomerInvoiceList() { InitializeComponent(); // this.Load +=new EventHandler(frmCompanyInvoiceList_Load); grdLister.CellDoubleClick += new GridViewCellEventHandler(grdLister_CellDoubleClick); grdLister.RowsChanging += new Telerik.WinControls.UI.GridViewCollectionChangingEventHandler(Grid_RowsChanging); objMaster = new InvoiceBO(); this.SetProperties((INavigation)objMaster); // grdLister.CellFormatting+=new CellFormattingEventHandler(grdLister_CellFormatting); grdLister.ShowRowHeaderColumn = false; this.Shown += new EventHandler(frmCompanyInvoiceList_Shown); grdLister.CommandCellClick += new CommandCellClickEventHandler(grid_CommandCellClick); // grdLister.EnableFastScrolling = true; }
private void InitializeConstructor() { try { ComboFunctions.FillMultiColumnCustomerCombo(ddlCustomer); ddlCustomer.MultiColumnComboBoxElement.Sorted = Telerik.WinControls.Enumerations.SortStyle.Ascending; // ddlCustomer.MultiColumnComboBoxElement.Columns["Name"].Sort(RadSortOrder.Ascending, true); ddlCustomer.MultiColumnComboBoxElement.DropDownWidth = 500; ddlCustomer.EditorControl.AutoSizeRows = false; ddlCustomer.EditorControl.BestFitColumns(); ddlCustomer.EditorControl.ColumnWidthChanged += new ColumnWidthChangedEventHandler(EditorControl_ColumnWidthChanged); ddlCustomer.SelectedValue = null; dtpInvoiceDate.Value = DateTime.Now.ToDate(); FormatChargesGrid(); grdLister.ShowGroupPanel = false; grdLister.AutoCellFormatting = true; grdLister.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; grdLister.ShowRowHeaderColumn = false; objMaster = new InvoiceBO(); this.SetProperties((INavigation)objMaster); grdLister.AllowAddNewRow = false; dtpFromDate.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1); dtpTillDate.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.LastDayOfMonthValue()); grdLister.CommandCellClick += new CommandCellClickEventHandler(grdLister_CommandCellClick); } catch (Exception ex) { ENUtils.ShowMessage(ex.Message); } }
public static InvoiceBO InvoiceDOtoInvoiceBO(InvoiceDO from) { //maps to and from do to po InvoiceBO to = new InvoiceBO(); to.InvoiceID = from.InvoiceID; to.LastName = from.LastName; to.FirstName = from.FirstName; to.Address = from.Address; to.City = from.City; to.StateProvidence = from.StateProvidence; to.Country = from.Country; to.PostalCode = from.PostalCode; to.DateChartered = from.DateChartered; to.DateReturned = from.DateReturned; to.CostperDay = from.CostperDay; to.AmountDue = from.AmountDue; to.BoatID = from.BoatID; to.UserID = from.UserID; return(to); }
private void InitializeConstructor() { var obj = General.GetObject <Gen_SysPolicy_DocumentNumberSetup>(c => c.DocumentId == Enums.GEN_DOCUMENTS.INVOICENO && (c.AutoIncrement == null || c.AutoIncrement == false)); if (obj != null) { txtInvoiceNo.ReadOnly = false; txtInvoiceNo.Enabled = true; this.AutoInc = false; } ComboFunctions.FillCompanyCombo(ddlCompany); ComboFunctions.FillBookingTypeCombo(ddlBookingType); ddlBookingType.SelectedValue = Enums.BOOKING_TYPES.LOCAL; dtpInvoiceDate.Value = DateTime.Now.ToDate(); dtpDueDate.Value = DateTime.Now.ToDate().AddMonths(1); FormatChargesGrid(); grdLister.ShowGroupPanel = false; // grdLister.AutoCellFormatting = true; grdLister.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; grdLister.ShowRowHeaderColumn = false; objMaster = new InvoiceBO(); this.SetProperties((INavigation)objMaster); grdLister.AllowAddNewRow = false; dtpFromDate.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1); dtpTillDate.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.LastDayOfMonthValue()); grdLister.CommandCellClick += new CommandCellClickEventHandler(grdLister_CommandCellClick); grdLister.ContextMenuOpening += new ContextMenuOpeningEventHandler(grdLister_ContextMenuOpening); }
public HttpResponseMessage getOrderDatabyKey(string orderkey) { InvoiceBO invoiceBO = new InvoiceBO(); var orderdata = bl.getOrderDatabyKey(orderkey); invoiceBO.order = orderdata; var containerdata = dl.GetContainers(orderkey); if (containerdata != null) { invoiceBO.containers = containerdata; } if (invoiceBO != null) { return(Request.CreateResponse(HttpStatusCode.OK, invoiceBO, Configuration.Formatters.JsonFormatter)); } else { return(Request.CreateResponse(HttpStatusCode.InternalServerError)); } }
void Grid_RowsChanging(object sender, GridViewCollectionChangingEventArgs e) { if (e.Action == Telerik.WinControls.Data.NotifyCollectionChangedAction.Remove) { objMaster = new InvoiceBO(); try { objMaster.GetByPrimaryKey(grdLister.CurrentRow.Cells["Id"].Value.ToInt()); int InvoiceId = grdLister.CurrentRow.Cells["Id"].Value.ToInt(); invoice_Payment obj = General.GetObject <invoice_Payment>(c => c.invoiceId == InvoiceId); if (obj == null) { objMaster.Delete(objMaster.Current); } else { ENUtils.ShowMessage("You Can not delete a record.."); return; } } catch (Exception ex) { if (objMaster.Errors.Count > 0) { ENUtils.ShowMessage(objMaster.ShowErrors()); } else { ENUtils.ShowMessage(ex.Message); } e.Cancel = true; } } }
protected void btnDelete_Click(object sender, EventArgs e) { int invoiceID = int.Parse(hdnSelectedID.Value.Trim()); if (invoiceID > 0) { try { using (TransactionScope ts = new TransactionScope()) { InvoiceBO objInvoice = new InvoiceBO(this.ObjContext); objInvoice.ID = invoiceID; objInvoice.GetObject(); List <InvoiceOrderBO> lstInvoiceOrder = (new InvoiceOrderBO()).GetAllObject().Where(o => o.Invoice == objInvoice.ID).ToList(); foreach (InvoiceOrderBO objDelInvoiceOrder in lstInvoiceOrder) { InvoiceOrderBO objInvoiceOrder = new InvoiceOrderBO(this.ObjContext); objInvoiceOrder.ID = objDelInvoiceOrder.ID; objInvoiceOrder.GetObject(); objInvoiceOrder.Delete(); } objInvoice.Delete(); this.ObjContext.SaveChanges(); ts.Complete(); } } catch (Exception ex) { throw ex; } this.PopulateDataGrid(); } }
private void ProcessForm() { //NNM try { using (TransactionScope ts = new TransactionScope()) { #region Create InvoiceHeader InvoiceBO objInvoice = new InvoiceBO(this.ObjContext); if (QueryID > 0) { objInvoice.ID = this.QueryID; objInvoice.GetObject(); } else { objInvoice.Creator = this.LoggedUser.ID; objInvoice.CreatedDate = DateTime.Now; } objInvoice.InvoiceNo = this.txtInvoiceNo.Text; objInvoice.InvoiceDate = Convert.ToDateTime(this.txtInvoiceDate.Text); objInvoice.ShipTo = this.DistributorClientAddress; objInvoice.AWBNo = this.txtAwbNo.Text; objInvoice.WeeklyProductionCapacity = int.Parse(this.RadComboWeek.SelectedValue); objInvoice.ShipmentMode = this.ShipmentModeID; objInvoice.IndimanInvoiceNo = (this.LoggedUserRoleName == UserRole.IndimanAdministrator) ? this.txtIndimanInvoiceNo.Text : string.Empty; objInvoice.IsBillTo = this.chkIsBillTo.Checked; objInvoice.BillTo = (this.chkIsBillTo.Checked) ? int.Parse(this.ddlBillTo.SelectedValue) : 22; objInvoice.Bank = int.Parse(this.ddlBank.SelectedValue); if (this.LoggedUserRoleName == UserRole.IndimanAdministrator) { objInvoice.IndimanInvoiceDate = Convert.ToDateTime(this.txtIndimanInvoiceDate.Text); } objInvoice.Modifier = this.LoggedUser.ID; objInvoice.ModifiedDate = DateTime.Now; this.ObjContext.SaveChanges(); ViewState["InvoiceId"] = objInvoice.ID; #endregion #region InvoiceOrderDetail foreach (GridDataItem item in RadInvoice.Items) { TextBox txtRate = (TextBox)item.FindControl("txtRate"); int id = int.Parse(((System.Web.UI.WebControls.WebControl)(txtRate)).Attributes["invoiceorder"].ToString()); int orderdetail = int.Parse(((System.Web.UI.WebControls.WebControl)(txtRate)).Attributes["orderdetail"].ToString()); TextBox txtIndimanRate = (TextBox)item.FindControl("txtIndimanRate"); InvoiceOrderBO objInvoiceOrder = new InvoiceOrderBO(this.ObjContext); if (id > 0) { objInvoiceOrder.ID = id; objInvoiceOrder.GetObject(); } objInvoiceOrder.Invoice = int.Parse(ViewState["InvoiceId"].ToString()); objInvoiceOrder.OrderDetail = orderdetail; objInvoiceOrder.FactoryPrice = Convert.ToDecimal(txtRate.Text); objInvoiceOrder.IndimanPrice = (this.LoggedUserRoleName == UserRole.IndimanAdministrator) ? Convert.ToDecimal(txtIndimanRate.Text) : Convert.ToDecimal("0"); } this.ObjContext.SaveChanges(); #endregion #region Change Order Detail Status List <int> lstOrders = new List <int>(); int orderid = 0; if (this.ddlStatus.SelectedItem.Text == "Shipped") { foreach (GridDataItem item in RadInvoice.Items) { TextBox txtRate = (TextBox)item.FindControl("txtRate"); int orderdetail = int.Parse(((System.Web.UI.WebControls.WebControl)(txtRate)).Attributes["orderdetail"].ToString()); OrderDetailBO objOrderDetail = new OrderDetailBO(this.ObjContext); objOrderDetail.ID = orderdetail; objOrderDetail.GetObject(); if (objOrderDetail.Order != orderid) { lstOrders.Add(objOrderDetail.Order); orderid = objOrderDetail.Order; } objOrderDetail.Status = 16; } this.ObjContext.SaveChanges(); } #endregion #region Change Order Status if (lstOrders.Count > 0) { foreach (int order in lstOrders) { OrderBO objOrder = new OrderBO(this.ObjContext); objOrder.ID = order; objOrder.GetObject(); objOrder.Status = 21; } this.ObjContext.SaveChanges(); } #endregion ts.Complete(); } } catch (Exception ex) { // Log the error IndicoLogging.log.Error("Error occured while Adding or Updating Invoicing", ex); } }
public HttpResponseMessage GetOrderstoGenerateInvoice() { var invoiceDtlList = dl.GetOrderstoGenerateInvoice(); var orders = new List <InvoiceBO>(); foreach (var list in invoiceDtlList) { InvoiceBO bo = new InvoiceBO(); bo.order = new DeliveryOrderBO(); bo.orderDetails = new DeliveryOrderDetailBO(); bo.order.OrderKey = list.OrderKey; bo.order.OrderNo = list.OrderNo; bo.order.OrderDate = list.OrderDate; bo.order.OrderType = list.OrderType; bo.order.BrokerRefNo = list.BrokerRefNo; bo.order.CustKey = list.CustKey; bo.order.BillToAddress = list.BillToAddress; bo.order.SourceAddress = list.SourceAddress; bo.order.DestinationAddress = list.DestinationAddress; bo.order.VesselName = list.VesselName; bo.order.BillofLading = list.BillofLading; bo.order.BookingNo = list.BookingNo; // bo.order.CutOffDate = list.CutOffDate; bo.orderDetails.OrderDetailKey = list.OrderDetails.OrderDetailKey; bo.orderDetails.ContainerNo = list.OrderDetails.ContainerNo; bo.orderDetails.ContainerSizeDesc = list.OrderDetails.ContainerSizeDesc; bo.orderDetails.ContainerSize = list.OrderDetails.ContainerSize; bo.orderDetails.Chassis = list.OrderDetails.Chassis; bo.orderDetails.SealNo = list.OrderDetails.SealNo; if (list.CustKey != null) { var addr = new AddressRepository().GetbyId(list.CustKey); if (addr != null) { bo.BillFrom = new AddressBO() { AddrKey = addr.addrkey, Address1 = addr.address1, Address2 = addr.address2, City = addr.city, State = addr.state, Zip = addr.zipcode, Email = addr.email, Phone = addr.phone, Fax = addr.fax, Name = addr.addrname }; } } if (list.CustKey != null) { var addrBillTo = new AddressRepository().GetbyId(list.BillToAddress); if (addrBillTo != null) { bo.BillTo = new AddressBO() { AddrKey = addrBillTo.addrkey, Address1 = addrBillTo.address1, Address2 = addrBillTo.address2, City = addrBillTo.city, State = addrBillTo.state, Zip = addrBillTo.zipcode, Email = addrBillTo.email, Phone = addrBillTo.phone, Fax = addrBillTo.fax, Name = addrBillTo.addrname }; } } if (list.SourceAddress != null) { var addrBillTo = new AddressRepository().GetbyId(list.SourceAddress); if (addrBillTo != null) { bo.Pickup = new AddressBO() { AddrKey = addrBillTo.addrkey, Address1 = addrBillTo.address1, Address2 = addrBillTo.address2, City = addrBillTo.city, State = addrBillTo.state, Zip = addrBillTo.zipcode, Email = addrBillTo.email, Phone = addrBillTo.phone, Fax = addrBillTo.fax, Name = addrBillTo.addrname }; } } if (list.DestinationAddress != null) { var addrBillTo = new AddressRepository().GetbyId(list.DestinationAddress); if (addrBillTo != null) { bo.Delivery = new AddressBO() { AddrKey = addrBillTo.addrkey, Address1 = addrBillTo.address1, Address2 = addrBillTo.address2, City = addrBillTo.city, State = addrBillTo.state, Zip = addrBillTo.zipcode, Email = addrBillTo.email, Phone = addrBillTo.phone, Fax = addrBillTo.fax, Name = addrBillTo.addrname }; } } orders.Add(bo); } return(Request.CreateResponse(HttpStatusCode.OK, orders, Configuration.Formatters.JsonFormatter)); }
/// <summary> /// Populate the controls. /// </summary> private void PopulateControls() { this.litHeaderText.Text = ((this.QueryID > 0) ? "Edit " : "New ") + this.ActivePage.Heading; this.spanShipmentError.Visible = false; this.lblShipmentKeyAddress.Text = string.Empty; this.btnIndimanInvoice.Visible = (this.QueryID > 0) ? true : false; var daysTillMonday = (int)DateTime.Today.DayOfWeek - (int)DayOfWeek.Monday; var monday = DateTime.Today.AddDays(-daysTillMonday); // populate RadComboWeek this.RadComboWeek.Items.Clear(); List <WeeklyProductionCapacityBO> lstWeeklyCapacities; if (this.QueryID > 0) { lstWeeklyCapacities = (new WeeklyProductionCapacityBO()).SearchObjects().ToList(); } else { lstWeeklyCapacities = (new WeeklyProductionCapacityBO()).SearchObjects().Where(o => o.WeekendDate >= DateTime.Now.AddMonths(-1) && o.WeekendDate.Year >= DateTime.Now.Year).ToList(); } //List<WeeklyProductionCapacityBO> this.RadComboWeek.DataSource = lstWeeklyCapacities; this.RadComboWeek.DataBind(); // populate Invoice Status this.ddlStatus.Items.Clear(); this.ddlStatus.Items.Add(new ListItem("Select a Status", "0")); List <InvoiceStatusBO> lstStatus = (new InvoiceStatusBO()).GetAllObject().OrderBy(o => o.Name).ToList(); foreach (InvoiceStatusBO ins in lstStatus) { this.ddlStatus.Items.Add(new ListItem(ins.Name, ins.ID.ToString())); } //populate Bank this.ddlBank.Items.Clear(); this.ddlBank.Items.Add(new ListItem("Select a Bank", "0")); List <BankBO> lstBanks = (new BankBO()).GetAllObject(); foreach (BankBO bank in lstBanks) { this.ddlBank.Items.Add(new ListItem(bank.Name + " - " + bank.AccountNo, bank.ID.ToString())); } //populate bill to this.PopulateBillTo(); // populate Destination Port this.ddlShipToPort.Items.Clear(); this.ddlShipToPort.Items.Add(new ListItem("Select Destination Port", "0")); List <DestinationPortBO> lstDestinationPort = (new DestinationPortBO()).GetAllObject(); foreach (DestinationPortBO ds in lstDestinationPort) { this.ddlShipToPort.Items.Add(new ListItem(ds.Name, ds.ID.ToString())); } // Populate Country this.ddlShipToCountry.Items.Clear(); this.ddlShipToCountry.Items.Add(new ListItem("Select Country", "0")); List <CountryBO> lstCountries = (new CountryBO()).GetAllObject().OrderBy(o => o.ShortName).ToList(); foreach (CountryBO country in lstCountries) { this.ddlShipToCountry.Items.Add(new ListItem(country.ShortName, country.ID.ToString())); } Session["InvoiceOrderDetails"] = null; this.populateInvoiceOrders(); if (this.QueryID > 0) { InvoiceBO objInvoice = new InvoiceBO(); objInvoice.ID = this.QueryID; objInvoice.GetObject(); this.RadComboWeek.Items.FindItemByValue(objInvoice.WeeklyProductionCapacity.ToString()).Selected = true; //this.PopulateShipmentDates(this.GetWeeklyProductionCapacityDetails(objInvoice.WeeklyProductionCapacity).WeekendDate, (int)objInvoice.WeeklyProductionCapacity); //this.PopulateShipmentDates(objInvoice.ShipmentDate, (int)objInvoice.WeeklyProductionCapacity); this.PopulateInvoiceShipmentDates(objInvoice.objWeeklyProductionCapacity.WeekendDate, (int)objInvoice.WeeklyProductionCapacity); this.ddlShipmentDates.Items.FindByText(objInvoice.ShipmentDate.ToString("dd MMMM yyyy")).Selected = true; this.PopulateShipmentKey(objInvoice.ShipmentDate); this.txtInvoiceDate.Text = objInvoice.InvoiceDate.ToString("dd MMMM yyyy"); this.txtAwbNo.Text = objInvoice.AWBNo; this.txtShipTo.Text = objInvoice.objShipTo.CompanyName; this.txtShipmentMode.Text = objInvoice.objShipmentMode.Name; this.RadComboShipmentKey.Enabled = false; this.txtInvoiceNo.Text = objInvoice.InvoiceNo; this.txtIndimanInvoiceNo.Text = objInvoice.IndimanInvoiceNo; this.ddlStatus.Items.FindByValue(objInvoice.Status.ToString()).Selected = true; this.chkIsBillTo.Checked = (bool)objInvoice.IsBillTo; this.ddlBillTo.Items.FindByValue(objInvoice.BillTo.ToString()).Selected = true; this.ddlBank.Items.FindByValue(objInvoice.Bank.ToString()).Selected = true; ViewState["DistributorClientAddress"] = objInvoice.ShipTo; ViewState["ShipmentID"] = objInvoice.ShipmentMode; DistributorClientAddressBO objDistributorClientAddress = new DistributorClientAddressBO(); objDistributorClientAddress.ID = objInvoice.ShipTo; objDistributorClientAddress.GetObject(); string state = (objDistributorClientAddress.State != null) ? objDistributorClientAddress.Suburb : string.Empty; this.lblShipmentKeyAddress.Text = objDistributorClientAddress.CompanyName + " , " + objDistributorClientAddress.Address + " , " + objDistributorClientAddress.Suburb + " " + state + " , " + objDistributorClientAddress.objCountry.ShortName + " , " + objDistributorClientAddress.PostCode; //is logged user role Factory Admin or Coordinator RadInvoice.Columns[13].Visible = false; this.populateInvoiceOrders(this.QueryID, objInvoice.ShipTo, false, objInvoice.ShipmentMode, false); } // if Redirect From WeeklySummary Page if (this.WeeklyCapacityDate != new DateTime(1100, 1, 1)) { this.RadComboWeek.Items.FindItemByValue(this.WeeklyCapacityID.ToString()).Selected = true; // this.PopulateShipmentKey(this.WeeklyCapacityID); this.PopulateShipmentDates(this.WeeklyCapacityDate, this.WeeklyCapacityID); } }