protected void btnDelete_Click(object sender, EventArgs e) { purchaseManager = new PurchaseManager(this); var purchaseOrderManager = new PurchaseOrderManager(this); if (!String.IsNullOrEmpty(Request["request"])) { foreach (string requestId in Request["request"].Split(',')) { var purchaseReq = purchaseOrderManager.GetPurchaseRequest(Convert.ToInt32(requestId)); foreach (var item in purchaseReq.PurchaseRequestItems) { if (item.PurchaseOrderItemId.HasValue) { ShowError("Não pode excluir uma requisição que há processo de compra associado!"); return; } } purchaseManager.DeletePurchaseRequest(Convert.ToInt32(requestId)); } } if (!String.IsNullOrEmpty(Request["requestItems"])) { foreach (string requestItem in Request["requestItems"].Split(',')) { string[] item = requestItem.Trim().Split('|'); purchaseManager.DeletePurchaseRequestItem(Convert.ToInt32("0" + item[6])); } } grdPurchaseReq.DataBind(); }
protected override void DoCommand(IOrderGroup order, CommandParameters cp) { Mediachase.Ibn.Web.UI.CHelper.RequireDataBind(); PurchaseOrder purchaseOrder = order as PurchaseOrder; WorkflowResults workflowResults = OrderGroupWorkflowManager.RunWorkflow(purchaseOrder, "SaveChangesWorkflow", false, false, new Dictionary <string, object> { { "PreventProcessPayment", !string.IsNullOrEmpty(order.Properties["QuoteStatus"] as string) && (order.Properties["QuoteStatus"].ToString() == Constants.Quote.RequestQuotation || order.Properties["QuoteStatus"].ToString() == Constants.Quote.RequestQuotationFinished) } }); if (workflowResults.Status != WorkflowStatus.Completed) { string msg = "Unknow error"; if (workflowResults.Exception != null) { msg = workflowResults.Exception.Message; } ErrorManager.GenerateError(msg); } else { WritePurchaseOrderChangeNotes(purchaseOrder); SavePurchaseOrderChanges(purchaseOrder); PurchaseOrderManager.UpdatePromotionUsage(purchaseOrder, purchaseOrder); OrderHelper.ExitPurchaseOrderFromEditMode(purchaseOrder.OrderGroupId); } }
protected void btnDownloadRequestBudget_Click(object sender, EventArgs e) { if (Page.SavePurchaseOrder() == null) { return; } var purchaseOrderManager = new PurchaseOrderManager(this); // //Este pedaço de código, verifica se tem modelo de ordem de compra cadastrado no sistema // DocumentTemplate documentTemplate = purchaseOrderManager.GetSupplyAuthorizationDocumentTemplate(Page.Company.CompanyId); foreach (var item in Page.PurchaseOrder.PurchaseOrderItems) { if (item.ProductPackage.RequiresQuotationInPurchasing) { documentTemplate = purchaseOrderManager.GetBudgetRequestDocumentTemplate(Page.Company.CompanyId); if (documentTemplate == null) { Page.ShowError(Exception.BudgetDocumentTemplateIsNull); return; } } } if (documentTemplate == null) { Page.ShowError(Exception.SupplyAuthorizationTemplateIsNull); return; } ExportDocumentTemplate("SolicitacaoOrcamento" + Page.PurchaseOrder.PurchaseOrderCode, documentTemplate); }
private void ConvertPurchaseRequestItemsInPurchaseOrder() { txtPurchaseOrderCode.Text = Page.PurchaseOrder.PurchaseOrderCode; var productManager = new ProductManager(this); var purchaseOrderManager = new PurchaseOrderManager(this); foreach (string requestItem in Request["requestItems"].Split(',')) { string[] item = requestItem.Trim().Split('|'); int productId = Convert.ToInt32(item[0]); int productPackageId = Convert.ToInt32("0" + item[1]); int? productManufacturerId = String.IsNullOrEmpty(item[2]) ? (int?)null : Convert.ToInt32("0" + item[2]); int requestAmount = Convert.ToInt32("0" + item[3]); //string centerCost = item[4]; int cityId = Convert.ToInt32("0" + item[5]); int purchaseRequestItemId = Convert.ToInt32("0" + item[6]); int purchaseRequestId = Convert.ToInt32("0" + item[7]); if (purchaseRequestItemId > 0) { ProductList.Add( new PurchaseOrderQuotedItem( item[item.Length - 1], requestAmount, requestAmount, "", 0m, productId, productPackageId, productManufacturerId, purchaseRequestItemId, null, 0)); } else { foreach (var prItem in purchaseOrderManager.GetPurchaseRequestItems(purchaseRequestId)) { ProductList.Add( new PurchaseOrderQuotedItem( prItem.Product.Name, Convert.ToInt32(prItem.Amount.Value), Convert.ToInt32(prItem.Amount.Value), "", 0m, prItem.ProductId, prItem.ProductPackageId.Value, prItem.ProductManufacturerId, prItem.PurchaseRequestItemId, null, 0)); } } } Page.SavePurchaseOrder(); BindGrid(); }
/// <summary> /// Places the order. /// </summary> protected void PlaceOrder() { MergeShipment(); // Make sure to execute within transaction using (var scope = new Mediachase.Data.Provider.TransactionScope()) { try { OrderGroupWorkflowManager.RunWorkflow(Cart, OrderGroupWorkflowManager.CartCheckOutWorkflowName); } catch (Exception ex) { if (ex is PaymentException) { throw ex; } else if (ex.InnerException != null && ex.InnerException is PaymentException) { throw ex.InnerException; } } Cart.CustomerId = SecurityContext.Current.CurrentUserId; var po = Cart.SaveAsPurchaseOrder(); if (_currentContact != null) { _currentContact.LastOrder = po.Created; _currentContact.SaveChanges(); Cart.CustomerName = _currentContact.FullName; } // Add note to purchaseOrder AddNoteToPurchaseOrder("New order placed by {0} in {1}", po, SecurityContext.Current.CurrentUserName, "Public site"); po.AcceptChanges(); PurchaseOrderManager.UpdatePromotionUsage(Cart, po); // Save latest order id Session[SessionLatestOrderIdKey] = po.OrderGroupId; Session[SessionLatestOrderNumberKey] = po.TrackingNumber; Session[SessionLatestOrderTotalKey] = new Money(po.Total, po.BillingCurrency).ToString(); // Increase the coressponding KPI in CMO. IncreaseKpi(); // Remove old cart Cart.Delete(); Cart.AcceptChanges(); // Commit changes scope.Complete(); } }
public void RemoveLineItem(string code) { var lineItem = CartHelper.Cart.GetLineItem(code); if (lineItem != null) { PurchaseOrderManager.RemoveLineItemFromOrder(CartHelper.Cart, lineItem.LineItemId); ValidateCart(); CartHelper.Cart.AcceptChanges(); } }
private static void LoadOrderContext() { if (orderContext == null) { var siteName = Configuration.CSSiteName; ordersAgent = new OrderSiteAgent(siteName); context = OrderManagementContext.Create(ordersAgent); manager = context.PurchaseOrderManager; orderContext = CommerceServer.Core.Runtime.Orders.OrderContext.Create(siteName); } }
static void Main(string[] args) { //================================================================================== // instances of costumer accounts CostList = new CustomerAccount("sam", "89012345", "*****@*****.**"); CostList.addNewCostumerAccount("john", "56789012", "*****@*****.**"); CostList.addNewCostumerAccount("Jane", "45678901", "*****@*****.**"); CostList.addNewCostumerAccount("alex", "23456789", "*****@*****.**"); CostList.addNewCostumerAccount("steve", "12345678", "*****@*****.**"); CostList.printcostumerTable(); //================================================================================== // instances of orders Console.WriteLine(); DeliverOrderList = new DeliveryOrder("pencil", 20, 10.00, "sam", 7777); DeliverOrderList.createOrder("book", 1, 50.00, "john", 5555); DeliverOrderList.createOrder("note", 3, 20.00, "alex", 3333); DeliverOrderList.printOrdersTable(); bool run = true; int yes; //program starts makeOrders = new PurchaseOrderManager(); Console.WriteLine(); while (run) { Console.WriteLine("Please enter the accountID:"); string accountID = Console.ReadLine(); Console.WriteLine("Please enter the item:"); string item = Console.ReadLine(); Console.WriteLine("Please enter quantity (only numbers):"); int quantity = int.Parse(Console.ReadLine()); //if (quantity < 0) quantity = -quantity; Console.WriteLine("Please enter the totalPrice(only numbers, integers or decimals):"); string newPrice = Console.ReadLine(); double totalPrice = double.Parse(newPrice); CustomerInterface.request(item, quantity, totalPrice, accountID); Console.WriteLine("Do you want to start a new order? Enter 1 for yes or 0 for no"); yes = int.Parse(Console.ReadLine()); run = (yes == 1) ? true : false; Console.WriteLine(); } makeOrders.DeliverOrderTable.printOrdersTable(); Console.WriteLine(); Console.WriteLine("You've reached the end of the program."); }
public static bool DeletePurchaseOrder(int purchaseOrderId, int companyId) { bool result = true; using (var purchaseOrderManager = new PurchaseOrderManager(null)) { try { purchaseOrderManager.DeletePurchaseOrder(purchaseOrderId); } catch (Exception e) { result = false; } } return result; }
public static bool DeletePurchaseOrder(int purchaseOrderId, int companyId) { bool result = true; using (var purchaseOrderManager = new PurchaseOrderManager(null)) { try { purchaseOrderManager.DeletePurchaseOrder(purchaseOrderId); } catch (Exception e) { result = false; } } return(result); }
protected void btnSave_Click(object sender, EventArgs e) { if (Page.ViewState["SupplierId"] != null) { PurchaseOrder original_PurchaseOrder; var modified_PurchaseOrder = new PurchaseOrder(); purchaseOrderManager = new PurchaseOrderManager(this); original_PurchaseOrder = purchaseOrderManager.GetPurchaseOrder(Convert.ToInt32(Page.ViewState["PurchaseOrderId"]), Company.CompanyId); modified_PurchaseOrder.CopyPropertiesFrom(original_PurchaseOrder); modified_PurchaseOrder.SupplierId = Convert.ToInt32(Page.ViewState["SupplierId"]); purchaseOrderManager.Update(original_PurchaseOrder, modified_PurchaseOrder); } Response.Redirect("PurchaseOrders.aspx"); }
protected void Page_Load(object sender, EventArgs e) { if (Session["PurchaseOrderCode"] == null) return; String purchaseOrderCode = Convert.ToString(Session["PurchaseOrderCode"]); var purchaseOrderManager = new PurchaseOrderManager(this); PurchaseOrder purchaseOrder = purchaseOrderManager.GetPurchaseOrderByPurchaseOrderCode(purchaseOrderCode); Response.Clear(); Response.ContentType = "text/rtf"; Response.AddHeader("content-disposition", "attachment;filename=OrdemDeCompra.rtf"); Response.ContentEncoding = Encoding.Default; Response.Write(purchaseOrderManager.ApplyPurchaseOrderInDocumentTemplate(purchaseOrder, Company.CompanyConfiguration. PurchaseOrderTemplate)); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["PurchaseOrderCode"] == null) { return; } String purchaseOrderCode = Convert.ToString(Session["PurchaseOrderCode"]); var purchaseOrderManager = new PurchaseOrderManager(this); PurchaseOrder purchaseOrder = purchaseOrderManager.GetPurchaseOrderByPurchaseOrderCode(purchaseOrderCode); Response.Clear(); Response.ContentType = "text/rtf"; Response.AddHeader("content-disposition", "attachment;filename=OrdemDeCompra.rtf"); Response.ContentEncoding = Encoding.Default; Response.Write(purchaseOrderManager.ApplyPurchaseOrderInDocumentTemplate(purchaseOrder, Company.CompanyConfiguration. PurchaseOrderTemplate)); Response.End(); }
protected void btnSendPurchaseOrderByMail_Click(object sender, EventArgs e) { Page.ViewState["SupplierId"] = cboSupplierWinner.SelectedValue; if (Page.SavePurchaseOrder(PurchaseOrderStatus.Bought) == null) { return; } // //Este pedaço de código, verifica se tem modelo de ordem de compra cadastrado no sistema // DocumentTemplate documentTemplate = new PurchaseOrderManager(this).GetPurchaseOrderDocumentTemplate(Page.Company.CompanyId); if (documentTemplate == null) { Page.ShowError(Exception.PurchaseDocumentTemplateIsNull); return; } Contact contact = new ContactManager(this).GetContact(Convert.ToInt32(cboContactWinner.SelectedValue)); if (contact == null || String.IsNullOrEmpty(contact.Email)) { Page.ShowError("O contato selecionado não possui e-mail!"); return; } var message = new MailMessage(Page.Company.LegalEntityProfile.Email, contact.Email, "Ordem de Compra", ApplyDocumentTemplate(Page.PurchaseOrder, documentTemplate)); message.IsBodyHtml = true; message.ReplyTo = new MailAddress(Page.User.Identity.UserName); message.BodyEncoding = System.Text.Encoding.Default; Postman.Send(message); Page.ShowAlert("E-mail enviado!"); }
private void RequestInventory(OrderForm orderForm, Shipment shipment, LineItem lineItem) { var lineItemIndex = orderForm.LineItems.IndexOf(lineItem); InventoryRequest request; InventoryResponse response = null; // If item is out of stock then delete item. if (GetNewLineItemQty(lineItem, new List <string>(), shipment) <= 0) { Warnings.Add("LineItemRemoved-" + lineItem.LineItemId.ToString(), string.Format("Item \"{0}\" has been removed from the cart because there is not enough available quantity.", lineItem.DisplayName)); PurchaseOrderManager.RemoveLineItemFromShipment(orderForm.Parent, lineItem.LineItemId, shipment); ValidateShipment(orderForm, shipment); return; } // Else try to allocate quantity request = AdjustStockItemQuantity(shipment, lineItem); if (request != null) { response = _inventoryService.Service.Request(request); } if (response != null && response.IsSuccess) { lineItem.IsInventoryAllocated = true; // Store operation keys to Shipment for each line item, to use later for complete request var existedIndex = shipment.OperationKeysMap.ContainsKey(lineItemIndex); var operationKeys = response.Items.Select(c => c.OperationKey); if (!existedIndex) { shipment.AddInventoryOperationKey(lineItemIndex, operationKeys); } else { shipment.InsertOperationKeys(lineItemIndex, operationKeys); } } }
protected void btnDownloadPurchaseOrder_Click(object sender, EventArgs e) { // //verifica se tem modelo de ordem de compra cadastrado no sistema // DocumentTemplate documentTemplate = new PurchaseOrderManager(this).GetPurchaseOrderDocumentTemplate(Page.Company.CompanyId); if (documentTemplate == null) { Page.ShowError(Exception.PurchaseDocumentTemplateIsNull); return; } Page.ViewState["SupplierId"] = cboSupplierWinner.SelectedValue; if (Page.SavePurchaseOrder(PurchaseOrderStatus.Bought) == null) { return; } ExportDocumentTemplate("OrdemDeCompra-" + Page.PurchaseOrder.PurchaseOrderCode, documentTemplate); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Context.Items["PurchaseOrderId"] != null) { Page.ViewState["PurchaseOrderId"] = Context.Items["PurchaseOrderId"]; purchaseOrderManager = new PurchaseOrderManager(this); purchaseOrder = purchaseOrderManager.GetPurchaseOrder( Convert.ToInt32(Page.ViewState["PurchaseOrderId"]), Company.CompanyId); lblPurchaseOrderCode.Text = "Código: " + purchaseOrder.PurchaseOrderCode; if (purchaseOrder.SupplierId != null) { var supplierManager = new SupplierManager(this); Supplier supplier = supplierManager.GetSupplier(Convert.ToInt32(purchaseOrder.SupplierId), Company.CompanyId); selSupplier.ShowSupplier(supplier); } } } }
//[SwaggerResponse(HttpStatusCode.OK, Type = typeof(LeaveVoucher))] public HttpResponseMessage AddPO(string token, string jsonStr) { ReturnMessage msg = new ReturnMessage(); vouMag = (VoucherManager)HttpContext.Current.Application.Get(token); if (vouMag == null) { msg.Success = false; msg.Msg = "参数token无效或已过期"; msg.Code = 500; } else { PurchaseOrderManager poMag = new PurchaseOrderManager(vouMag); PurchaseOrder po = new PurchaseOrder(); string mes = ""; bool reult = poMag.AddPO(po, ref mes); if (reult) { msg.Success = true; msg.Msg = "成功"; msg.Code = 200; } else { msg.Success = false; msg.Msg = mes; msg.Code = 500; } } HttpContext.Current.Application.Remove(vouMag.GetGUID); string str = msg.ToJson(); return(new HttpResponseMessage { Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json") }); }
private void ExportDocumentTemplate(string fileName, DocumentTemplate documentTemplate) { var purchaseOrderManager = new PurchaseOrderManager(this); // // Limpa os buffers de resposta, para não enviar os cabeçalhos da página ASPX // Response.Clear(); Response.ContentType = "text/doc"; // // Seta o cabeçalho que irá dizer ao navegador que é para fazer download, ao invés de apresentar na tela. // Response.AddHeader("content-disposition", "attachment;filename=" + fileName + ".htm"); // // Indica que o formato do arquivo será o mesmo do modelo // Response.ContentEncoding = Encoding.Default; // // Busca a localização do modelo no servidor e retorna seu conteúdo // string contentFile = File.ReadAllText(Server.MapPath(documentTemplate.FileUrl)); // // Aplica as trocas das máscaras no modelo, ou seja, substitui os []'s pelo conteúdo e retorna // contentFile = purchaseOrderManager.ApplyPurchaseOrderInDocumentTemplate(Page.PurchaseOrder, contentFile); // // Envia o arquivo para o cliente // Response.Write(contentFile); // // Interrompe o processamento da página para que o conteúdo do modelo não se misture // ao HTML da página PurchaseOrder.aspx // Response.End(); }
/// <summary> /// Removes the discounts. /// </summary> private void RemoveDiscounts() { //preserve the coupons in the promotion context so that they can be reapplied duringthe calculate discounts activity List <string> coupons = new List <string>(); // Process line item discounts first foreach (OrderForm form in OrderGroup.OrderForms) { foreach (LineItem lineItem in form.LineItems) { // First remove items foreach (LineItemDiscount discount in lineItem.Discounts) { if (!discount.DiscountName.StartsWith("@") /*&& discount.DiscountId == -1*/) // ignore custom entries { if (!string.IsNullOrEmpty(discount.DiscountCode)) { coupons.Add(discount.DiscountCode); } discount.Delete(); } } } } // Process shipment discounts foreach (OrderForm form in OrderGroup.OrderForms) { foreach (Shipment shipment in form.Shipments) { foreach (ShipmentDiscount discount in shipment.Discounts) { if (!discount.DiscountName.StartsWith("@") /*&& discount.DiscountId == -1*/) // ignore custom entries { if (!string.IsNullOrEmpty(discount.DiscountCode)) { coupons.Add(discount.DiscountCode); } shipment.ShippingDiscountAmount -= discount.DiscountValue; // Pending testing, this might need to be changed to summing ShippingDiscountAmount before removing them, // and then adding that sum back to form.ShippingTotal (since CalculateTotalsActivity simply does // shipment.ShipmentTotal - shipment.ShippingDiscountAmount without checking for custom discounts) form.ShippingTotal += discount.DiscountValue; discount.Delete(); } } } } foreach (OrderForm form in OrderGroup.OrderForms) { foreach (LineItem lineItem in form.LineItems) { if (IsGiftLineItem(lineItem)) { PurchaseOrderManager.RemoveLineItemFromOrder(OrderGroup, lineItem.LineItemId); } else { lineItem.OrderLevelDiscountAmount = GetCustomOrderDiscountAmount(form); lineItem.LineItemDiscountAmount = GetCustomLineItemDiscountAmount(lineItem); lineItem.ExtendedPrice = lineItem.ListPrice * lineItem.Quantity; } } foreach (OrderFormDiscount discount in form.Discounts) { if (!discount.DiscountName.StartsWith("@") /*&& discount.DiscountId == -1*/) // ignore custom entries { if (!string.IsNullOrEmpty(discount.DiscountCode)) { coupons.Add(discount.DiscountCode); } discount.Delete(); } } } //add the coupons back to the promotion context if (coupons.Count > 0) { foreach (string coupon in coupons) { MarketingContext.Current.AddCouponToMarketingContext(coupon); } } }
protected void BtnSendQuotationRequest_Click(object sender, EventArgs e) { if (Page.SavePurchaseOrder(PurchaseOrderStatus.SentToSupplier) == null) { return; } var purchaseOrderManager = new PurchaseOrderManager(this); // //Este pedaço de código, verifica se tem modelo de ordem de compra cadastrado no sistema // DocumentTemplate documentTemplate = purchaseOrderManager.GetSupplyAuthorizationDocumentTemplate(Page.Company.CompanyId); foreach (var item in Page.PurchaseOrder.PurchaseOrderItems) { if (item.ProductPackage.RequiresQuotationInPurchasing) { documentTemplate = purchaseOrderManager.GetBudgetRequestDocumentTemplate(Page.Company.CompanyId); } } if (documentTemplate == null) { Page.ShowError(Exception.PurchaseDocumentTemplateIsNull); return; } if (selSupplier.Supplier == null) { Page.ShowError("Selecione um fornecedor!"); return; } if (String.IsNullOrEmpty(cboSupplierContacts.SelectedValue)) { Page.ShowError("O contato selecionado não possui e-mail!"); return; } Contact contact = new ContactManager(this).GetContact(Convert.ToInt32(cboSupplierContacts.SelectedValue)); if (contact == null || String.IsNullOrEmpty(contact.Email)) { Page.ShowError("O contato selecionado não possui e-mail!"); return; } var message = new MailMessage(Page.Company.LegalEntityProfile.Email, contact.Email, "Solicitação de Orçamento", ApplyDocumentTemplate(Page.PurchaseOrder, documentTemplate)); message.IsBodyHtml = true; message.ReplyTo = new MailAddress(Page.User.Identity.UserName); message.BodyEncoding = System.Text.Encoding.UTF8; Postman.Send(message); selSupplier.ShowSupplier(null); Page.ShowAlert("E-mail enviado!"); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { var cManager = new CompanyManager(this); CompanyConfiguration cSettings = Company.CompanyConfiguration; if (cSettings != null) { lblHeader.Text = cSettings.ReportHeader; lblFooter.Text = cSettings.ReportFooter; } } var purchaseOrder = new PurchaseOrder(); var purchaseOrderManager = new PurchaseOrderManager(this); var supplierManager = new SupplierManager(this); rptProduct.DataSource = Session["_productList"]; rptProduct.DataBind(); // // Este bloco formata os dados de endereço do cliente // #region Endereço lblLocalDate.Text = "Rio de Janeiro " + DateTime.Now.ToLongDateString(); if (Session["SupplierId"] != null) { Supplier supplier = supplierManager.GetSupplier((int)Session["SupplierId"], (int)Company.MatrixId); if (supplier != null) { if (supplier.LegalEntityProfile != null) { lblSupplierAddress.Text = supplier.LegalEntityProfile.Address.Name + " " + supplier.LegalEntityProfile.AddressNumber + " " + supplier.LegalEntityProfile.AddressComp; lblSupplierLocalization.Text = supplier.LegalEntityProfile.Address.City + " - " + supplier.LegalEntityProfile.Address.Neighborhood + ", " + supplier.LegalEntityProfile.Address.StateId; lblPostalCode.Text = "CEP: " + supplier.LegalEntityProfile.Address.PostalCode; lblSupplierPhone.Text = "Tel: " + supplier.LegalEntityProfile.Phone.Replace("(__)____-____", "") ?? supplier.LegalEntityProfile.Phone.Replace("(__)____-____", ""); lblCNPJ_CPF.Text = supplier.LegalEntityProfile.CNPJ ?? supplier.LegalEntityProfile.CNPJ; lblSupplierName.Text = supplier.LegalEntityProfile.CompanyName + "/"; } else { lblSupplierAddress.Text = supplier.Profile.Address.Name + " " + supplier.Profile.AddressNumber + " " + supplier.Profile.AddressComp; lblSupplierLocalization.Text = supplier.Profile.Address.City + " - " + supplier.Profile.Address.Neighborhood + ", " + supplier.Profile.Address.StateId; lblPostalCode.Text = "CEP: " + supplier.Profile.Address.PostalCode; lblSupplierPhone.Text = "Tel: " + supplier.Profile.Phone.Replace("(__)____-____", "") ?? supplier.Profile.Phone.Replace("(__)____-____", ""); lblCNPJ_CPF.Text = supplier.Profile.CPF ?? supplier.Profile.CPF; lblSupplierName.Text = supplier.Profile.Name + "/"; } #endregion lblFooter.Text = @"<p align=center>Sem mais para o momento e no aguardo de um contato, antecipamos agradecimentos<br><br>Atenciosamente,<br><br>____________________________________ <br>" + Company.LegalEntityProfile.CompanyName + @"<br><br><br><strong>DE ACORDO COM AS CONDIÇÕES DA PROPOSTA, <br><br></strong>" + "Rio de Janeiro, " + DateTime.Now.ToLongDateString() + @"<br><br>____________________________________<br>"; if (supplier != null) { if (supplier.Profile != null) { lblFooter.Text += supplier.Profile.Name + "</p>"; } } else { lblFooter.Text += supplier.LegalEntityProfile.CompanyName + "</p>"; } } } }
protected void btnDelete_Click(object sender, EventArgs e) { purchaseManager = new PurchaseManager(this); var purchaseOrderManager = new PurchaseOrderManager(this); if (!String.IsNullOrEmpty(Request["request"])) foreach (string requestId in Request["request"].Split(',')) { var purchaseReq = purchaseOrderManager.GetPurchaseRequest(Convert.ToInt32(requestId)); foreach (var item in purchaseReq.PurchaseRequestItems) if (item.PurchaseOrderItemId.HasValue) { ShowError("Não pode excluir uma requisição que há processo de compra associado!"); return; } purchaseManager.DeletePurchaseRequest(Convert.ToInt32(requestId)); } if (!String.IsNullOrEmpty(Request["requestItems"])) foreach (string requestItem in Request["requestItems"].Split(',')) { string[] item = requestItem.Trim().Split('|'); purchaseManager.DeletePurchaseRequestItem(Convert.ToInt32("0" + item[6])); } grdPurchaseReq.DataBind(); }