public static string CreateSiebelQuoteWithOpty(string eQuoteID, string optyid, ref string WSParameters, ref string ErrorMSG) { if (string.IsNullOrEmpty(eQuoteID)) { ErrorMSG = "eQuotation Quote ID is string.IsNullOrEmpty"; return(string.Empty); } try { QuotationMaster QM = QuoteBusinessLogic.GetQuotationMaster(eQuoteID); if (QM == null) { ErrorMSG = "Quote master cannot be found in eQuotation"; return(string.Empty); } List <QuotationDetail> QD = QuoteBusinessLogic.GetQuotationDetail(eQuoteID); //ICC 2015/11/3 Use new Siebel web service to add quote return(SiebelDAL.CreateSiebelQuoteV2(QM, QD, optyid, ref WSParameters, ref ErrorMSG)); //return SiebelDAL.CreateSiebelQuote(QM, QD, optyid, ref WSParameters, ref ErrorMSG); //return SiebelDAL.CreateSiebelQuote(QM, QD, optyid, WS_ID, WS_PASSWORD); } catch (Exception ex) { ErrorMSG = ex.Message; } return(string.Empty); }
public ActionResult SavePMComments(List <OpportunityCoverModel> pm) { DL_OpportunityModel cls = new DL_OpportunityModel(); QuoteBusinessLogic BL = new QuoteBusinessLogic(); cls = PopulatePMDL(pm); string Saved = BL.BL_UpdateOpportunityPMComments(cls); return(Json(Saved, JsonRequestBehavior.AllowGet)); }
public ActionResult SaveTerritorySplit(List <OpportunityCoverModel> Territory) { DL_OpportunityModel cls = new DL_OpportunityModel(); QuoteBusinessLogic BL = new QuoteBusinessLogic(); cls = PopulateTerritorySplitDL(Territory); string Saved = BL.BL_UpdateOpportunityTerritorySplit(cls); return(Json(Saved, JsonRequestBehavior.AllowGet)); }
public ActionResult SaveAssembly(List <OpportunityCoverModel> Assembly) { DL_OpportunityModel Cust = new DL_OpportunityModel(); QuoteBusinessLogic BL = new QuoteBusinessLogic(); Cust = PopulateAssemblyDL(Assembly); string Saved = BL.BL_UpdateOpportunityAssemblyDetails(Cust); return(Json(Saved, JsonRequestBehavior.AllowGet)); }
public ActionResult SaveConsumables(List <OpportunityCoverModel> Consumables) { DL_OpportunityModel cls = new DL_OpportunityModel(); QuoteBusinessLogic BL = new QuoteBusinessLogic(); cls = PopulateConsumableDL(Consumables); string Saved = BL.BL_UpdateOpportunityConsumableDetails(cls); return(Json(Saved, JsonRequestBehavior.AllowGet)); }
public ActionResult ProjectFinancials(int OpportunityID, int BOMID) { BOMFinancialReviewModel FM = new BOMFinancialReviewModel(); DL_BOMFinancialReiewModel DFM = new DL_BOMFinancialReiewModel(); QuoteBusinessLogic BL = new QuoteBusinessLogic(); DFM = BL.GetAssemblyForBOMByOpportunityID(OpportunityID, BOMID); FM = PopulateFinanceReviewViewModel(DFM); return(PartialView(FM)); }
// GET: Customer/Edit/5 public ActionResult Edit(string QuoteNo) { DL_QuoteViewModel view = new DL_QuoteViewModel(); QuoteBusinessLogic CBL = new QuoteBusinessLogic(); QuoteViewModel CustomerView = new QuoteViewModel(); view = CBL.BL_GetOpportunityByQuoteNo(QuoteNo); QuoteViewModel ViewModel = PopulateBOMViewModel(view); ViewBag.Territorylist = ViewModel.TerritoryListModel; return(View("Edit", ViewModel)); }
public JsonResult CreateLead(QuoteViewModel c) { var result = false; try { QuoteBusinessLogic BL = new QuoteBusinessLogic(); //result = BL.BL_CreateLead(c.CustomerName, c.QuotedDate, c.QuotedBy, c.ReferenceNo, c.NoOfWeeks, c.DeliveryDate, c.PONumber, c.DispatchAddress, c.DispatchAddress, c.Title, c.PhoneNo, c.Email, c.ReferenceNo); } catch (Exception ex) { throw ex; } return(Json(result, JsonRequestBehavior.AllowGet)); }
public byte[] DownloadPickingSlip(int OpportunityID, int BOMID, int State) { _documet = new Document(); _documet.SetPageSize(PageSize.A4); _documet.SetMargins(5f, 5f, 20f, 5f); _pdfTable.WidthPercentage = 100; _pdfTable.HorizontalAlignment = Element.ALIGN_LEFT; _fontStyle = FontFactory.GetFont("Tahoma", 8f, 1); PdfWriter docWrite = PdfWriter.GetInstance(_documet, _memoryStream); _documet.Open(); float[] sizes = new float[_maxColumns]; sizes[0] = 40; sizes[1] = 40; sizes[2] = 80; sizes[3] = 20; //for (var i = 0; i < _maxColumns; i++) //{ // if (i == 2) sizes[i] = 20; // else sizes[i] = 100; //} //--Get the BOM details' PDFDownloadBusinessLogic BL = new PDFDownloadBusinessLogic(); QuoteBusinessLogic QBL = new QuoteBusinessLogic(); DLVM = BL.GetOpportunityPickingList_BOMDownload(OpportunityID, BOMID, State); this.ReportHeader(); this.EmptyRow(2, _maxColumns); this.DownloadBOM_ReportBody(); _pdfTable.SetWidths(sizes); _pdfTable.HeaderRows = 2; _documet.Add(_pdfTable); _documet.Close(); return(_memoryStream.ToArray()); }
public ActionResult SaveProjectFinancials(List <BOMFinancialReviewModel> Financials) { decimal DepositPerc = Convert.ToDecimal(Financials[0].DepositPerc); decimal PreDPerc = Convert.ToDecimal(Financials[0].PreDeliveryPerc); decimal TotalPerc = DepositPerc + PreDPerc; string Saved = ""; if (TotalPerc > 100) { Saved = "Project Milestones Exceeding 100%"; } else { DL_BOMFinancialReiewModel cls = new DL_BOMFinancialReiewModel(); QuoteBusinessLogic BL = new QuoteBusinessLogic(); cls = PopulateFinancialReviewDL(Financials); Saved = BL.BL_SaveProjectFinancials(cls); } return(Json(Saved, JsonRequestBehavior.AllowGet)); }
public ViewDownloadForwardQuoteViewModel(string quoteId, string quoteNo, string org) { this.QuoteId = quoteId; this.QuoteNo = quoteNo; this.Org = org; this.CanClickPdfAndEmail = true; if (org.StartsWith("CN")) { List <SelectListItem> AdvantechCompanyTitleOptions = new List <SelectListItem>(); AdvantechCompanyTitleOptions.Add(new SelectListItem() { Text = "北京", Value = "CN10", Selected = org == "CN10" }); AdvantechCompanyTitleOptions.Add(new SelectListItem() { Text = "上海(CN30)", Value = "CN30", Selected = org == "CN30" }); AdvantechCompanyTitleOptions.Add(new SelectListItem() { Text = "上海(CN70)", Value = "CN70", Selected = org == "CN70" }); this.AdvantechCompanyOptions = AdvantechCompanyTitleOptions; } else { this.AdvantechCompanyOptions = new List <SelectListItem>(); } var defaultQuoteTitleOptions = QuoteBusinessLogic.GetQuoteTitleOptions(AppContext.AppRegion); if (defaultQuoteTitleOptions.Any()) { this.QuoteTitleOptions = defaultQuoteTitleOptions .Select(x => new SelectListItem() { Text = x, Value = x }) .ToList(); } }
public ActionResult Index(string QuoteNo = "") { if (QuoteNo == "") { DL_QuoteViewModel QuoteLst = new DL_QuoteViewModel(); QuoteViewModel QuoteVM = new QuoteViewModel(); QuoteBusinessLogic BL = new QuoteBusinessLogic(); QuoteLst = BL.GetCustomersList(); QuoteViewModel CustLst = PopulateQuoteViewModel(QuoteLst); return(View(CustLst)); } else { DL_QuoteViewModel view = new DL_QuoteViewModel(); QuoteBusinessLogic CBL = new QuoteBusinessLogic(); QuoteViewModel CustomerView = new QuoteViewModel(); view = CBL.BL_GetOpportunityByQuoteNo(QuoteNo); QuoteViewModel ViewModel = PopulateBOMViewModel(view); return(View("Edit", ViewModel)); } }
public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) { var values = bindingContext.ValueProvider.GetValue(bindingContext.ModelName); if (values != null) { // We have specified asterisk (*) as a token delimiter. So // the ids will be separated by *. For example "2*3*5" var ids = values.AttemptedValue.Split('*'); // Now that we have the selected ids we could fetch the corresponding // salesRepresentative from our datasource var sales = QuoteBusinessLogic.GetSalesRepresentatives("", AppContext.AppRegion).Where(x => ids.Contains(x.SalesCode)).Select(x => new SalesRepresentative { SalesCode = x.SalesCode, Email = x.Email }).ToList(); return(sales); } return(Enumerable.Empty <SalesRepresentative>()); //var valueProviderResult = bindingContext.ValueProvider.GetValue(bindingContext.ModelName); //if (!string.IsNullOrEmpty(valueProviderResult.AttemptedValue)) //{ // var items = valueProviderResult.AttemptedValue.Split(','); // var result = new List<SalesRepresentative>(); // for (var counter = 0; counter < items.Length; counter++) // { // result[counter] = items[counter]; // } // return result; //} //return base.BindModel(controllerContext, bindingContext); }
/// <summary> /// Use eStore B+B function to calcaulate freight(simple version for ajax) /// </summary> /// <returns></returns> public static ShippingResult CalculateBBFreight(string shipToCountry, string shipToZipCode, string shipToState, string cartId, WebSource source = WebSource.Myadvantech) { ShippingResult shippingResult = new ShippingResult(); List <ShippingMethod> shippingmethods = new List <ShippingMethod>(); Response response; try { List <FreightOption> freightOptions = Advantech.Myadvantech.DataAccess.MyAdvantechDAL.GetAllFreightOptions(); foreach (var option in freightOptions) { ShippingMethod method = new ShippingMethod(); method.MethodName = option.SAPCode + ": " + option.Description; method.MethodValue = option.CarrierCode + ": " + option.Description; method.DisplayShippingCost = "N/A"; method.ErrorMessage = ""; if (option.EStoreServiceName != null) { method.EstoreServiceName = option.EStoreServiceName; } shippingmethods.Add(method); } try { shippingrate target = new shippingrate(); target.Timeout = 30000; //target.Url = "http://buy.advantech.com/services/shippingrate.asmx"; AUS eStore URL DataAccess.bbeStoreFreightAPI.Order order = new DataAccess.bbeStoreFreightAPI.Order(); order.StoreId = "ABB"; // Shipto settings Address shipto = new Address(); shipto.Countrycode = shipToCountry; shipto.Zipcode = shipToZipCode; shipto.StateCode = shipToState; order.Shipto = shipto; order.Billto = shipto; if (source == WebSource.Myadvantech) { List <Advantech.Myadvantech.DataAccess.cart_DETAIL_V2> cartItems = Advantech.Myadvantech.DataAccess.CartDetailHelper.GetCartDetailByID(cartId); // Loose Items settings List <Item> items = new List <Item>(); List <cart_DETAIL_V2> LooseItems = cartItems.Where(d => d.otype == 0).ToList(); if (LooseItems.Count > 0) { foreach (cart_DETAIL_V2 LooseItem in LooseItems) { items.Add(new Item() { ProductID = LooseItem.Part_No, Qty = (int)LooseItem.Qty }); } } // System Items settings List <ConfigSystem> systems = new List <ConfigSystem>(); List <cart_DETAIL_V2> ParentItems = cartItems.Where(d => d.otype == -1).ToList(); foreach (cart_DETAIL_V2 ParentItem in ParentItems) { int _sys1Qty = 1; ConfigSystem _sys1 = new ConfigSystem(); _sys1.Qty = (int)ParentItem.Qty; _sys1.ProductID = ParentItem.Part_No; _sys1Qty = _sys1.Qty; List <cart_DETAIL_V2> ChildItems = cartItems.Where(d => d.otype == 1 && d.higherLevel == ParentItem.Line_No).ToList(); List <Item> _ds = new List <Item>(); foreach (cart_DETAIL_V2 ChildItem in ChildItems) { _ds.Add(new Item() { ProductID = ChildItem.Part_No, Qty = (Int32)Math.Ceiling((double)(Convert.ToDouble(ChildItem.Qty / (double)_sys1Qty))) }); } _sys1.Details = _ds.ToArray(); systems.Add(_sys1); } order.Items = items.ToArray(); order.Systems = systems.ToArray(); } else if (source == WebSource.eQuotation) { var quotationMaster = QuoteBusinessLogic.GetQuotationMaster(cartId); if (quotationMaster != null) { List <QuotationDetail> _QuoteDetails = quotationMaster.QuotationDetail; // Loose Items settings List <Item> items = new List <Item>(); List <QuotationDetail> LooseItems = _QuoteDetails.Where(q => q.ItemType == (int)LineItemType.LooseItem).ToList(); if (LooseItems.Count > 0) { foreach (QuotationDetail LooseItem in LooseItems) { items.Add(new Item() { ProductID = LooseItem.partNo, Qty = (int)LooseItem.qty }); } } // System Items settings List <ConfigSystem> systems = new List <ConfigSystem>(); List <QuotationDetail> ParentItems = _QuoteDetails.Where(q => q.ItemType == (int)LineItemType.BTOSParent).ToList(); foreach (QuotationDetail ParentItem in ParentItems) { int _sys1Qty = 1; ConfigSystem _sys1 = new ConfigSystem(); _sys1.Qty = (int)ParentItem.qty; _sys1.ProductID = ParentItem.partNo; _sys1Qty = _sys1.Qty; List <QuotationDetail> ChildItems = _QuoteDetails.Where(q => q.ItemType == (int)LineItemType.BTOSChild && q.HigherLevel == ParentItem.line_No).ToList(); List <Item> _ds = new List <Item>(); foreach (QuotationDetail ChildItem in ChildItems) { _ds.Add(new Item() { ProductID = ChildItem.partNo, Qty = (Int32)Math.Ceiling((double)(Convert.ToDouble(ChildItem.qty / (double)_sys1Qty))) }); } _sys1.Details = _ds.ToArray(); systems.Add(_sys1); } order.Items = items.ToArray(); order.Systems = systems.ToArray(); } } response = target.getShippingRate(order); } catch (Exception ex) { throw ex; } if (response != null) { if (response.ShippingRates != null) { var normalShippingRatesList = new List <ShippingRate>(); foreach (var item in response.ShippingRates) { foreach (var method in shippingmethods) { if (method.EstoreServiceName == item.Nmae) { method.ShippingCost = item.Rate; method.DisplayShippingCost = item.Rate.ToString(); method.ErrorMessage = string.IsNullOrEmpty(item.ErrorMessage)? "" : item.ErrorMessage; //配對成功的就移除 normalShippingRatesList.Add(item); } } } var unnormalShippingRatesList = response.ShippingRates.Where(p => !normalShippingRatesList.Any(p2 => p2.Nmae == p.Nmae)); if (unnormalShippingRatesList.Any()) { shippingResult.Message = string.Join("<br/>", unnormalShippingRatesList.Select(s => s.Nmae).ToList()); } } if (response.Boxex[0] != null) { shippingResult.Weight = (double)Decimal.Round(response.Boxex[0].Weight, 2); } shippingResult.Status = response.Status; //if (response.DetailMessages != null) // shippingResult.DetailMessage += string.Join(",", response.DetailMessages); } else { shippingResult.Message = "No Response. Please select one freight option and manually enter cost."; shippingResult.Status = "0"; } } catch (Exception ex) { shippingResult.Message = "Exception occurs. Please contact Myadvantech team."; shippingResult.DetailMessage = ex.Message; shippingResult.Status = "0"; } shippingResult.ShippingMethods = shippingmethods; return(shippingResult); }