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); }
// If your activity returns a value, derive from CodeActivity<TResult> // and return the value from the Execute method. protected override void Execute(CodeActivityContext context) { // Obtain the runtime value of the Text input argument QuotationMaster quoteMaster = context.GetValue(this.QuoteMaster); string ERPId = context.GetValue(this.ERPId); string org = context.GetValue(this.Org); string errMsg = context.GetValue(this.ErrorMessage); quoteMaster.SimulateITPByOrgAndERPId(org, ERPId, ref errMsg); this.ErrorMessage.Set(context, errMsg); //Order order = quoteMaster.ConvertQuoteToOrder(org, ERPId); //Advantech.Myadvantech.DataAccess.SAPDAL.SimulateOrder(ref order, ref errMsg); //if (String.IsNullOrEmpty(errMsg)) //{ // foreach (Product p in order.LineItems) // { // if (p.UnitPrice > 0) // { // quoteMaster.QuotationDetail.Where(d => d.partNo.Equals(p.PartNumber) && // d.line_No == p.LineNumber) // .ToList() // .ForEach(c => // { // c.itp = p.UnitPrice; // c.newItp = p.UnitPrice; // }); // } // } // quoteMaster.InitializeQuotationDetail(); //} }
public int Update(QuotationModel model) { Mapper.CreateMap <QuotationModel, QuotationMaster>(); QuotationMaster objUser = Dbcontext.QuotationMasters.SingleOrDefault(m => m.QID == model.QID); objUser = Mapper.Map(model, objUser); return(Dbcontext.SaveChanges()); }
public async Task <ActionResult> DeleteConfirmed(int id) { QuotationMaster quotationMaster = await db.QuotationMasters.FindAsync(id); db.QuotationMasters.Remove(quotationMaster); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
// If your activity returns a value, derive from CodeActivity<TResult> // and return the value from the Execute method. protected override void Execute(CodeActivityContext context) { // Obtain the runtime value of the Text input argument QuotationMaster quoteMaster = context.GetValue(this.QuoteMaster); string errMsg = context.GetValue(this.ErrorMessage); quoteMaster.SimulateITPBySAPGPBlockRFC(ref errMsg); this.ErrorMessage.Set(context, errMsg); }
// If your activity returns a value, derive from CodeActivity<TResult> // and return the value from the Execute method. protected override void Execute(CodeActivityContext context) { // Obtain the runtime value of the Text input argument QuotationMaster quoteMaster = context.GetValue(this.QuoteMaster); string currency = context.GetValue(this.Currency); string errMsg = context.GetValue(this.ErrorMessage); quoteMaster.GetProductBOMCost(currency, ref errMsg); this.ErrorMessage.Set(context, errMsg); }
public Object SaveQuotation(dynamic data) { QuotationMaster quotationMaster = JsonConvert.DeserializeObject <QuotationMaster>(data.ToString()); _quotationLogic.AddorUpdate(quotationMaster); return(new { success = true, QuotationMaster = new { Record = quotationMaster, TotalRecords = 1 }, QuotationDetails = new { Record = quotationMaster.QuotationDetails, TotalRecords = quotationMaster.QuotationDetails.Count } }); }
public QuotationModel getByID(int id) { try { Mapper.CreateMap <QuotationMaster, QuotationModel>(); QuotationMaster objCityMaster = Dbcontext.QuotationMasters.Where(m => m.QID == id).SingleOrDefault(); QuotationModel objCityItem = Mapper.Map <QuotationModel>(objCityMaster); return(objCityItem); } catch (Exception ex) { throw ex; } }
// GET: POS/QuotationMasters/Delete/5 public async Task <ActionResult> Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } QuotationMaster quotationMaster = await db.QuotationMasters.FindAsync(id); if (quotationMaster == null) { return(HttpNotFound()); } return(View(quotationMaster)); }
private static WorkflowApplication GetWorkFlowApplication(Dictionary <string, object> inputs, AutoResetEvent syncEvent) { InstanceStore store = new SqlWorkflowInstanceStore(ConfigurationManager.ConnectionStrings["WFDB"].ConnectionString); var accountFlowIdentity = new WorkflowIdentity { Name = "test", Version = new Version(1, 0, 0, 1) }; WorkflowApplication.DeleteDefaultInstanceOwner(store); WorkflowApplication.CreateDefaultInstanceOwner(store, null, WorkflowIdentityFilter.Any, new TimeSpan(0, 0, 0, 10)); WorkflowApplication wfApp = new WorkflowApplication(new FindApproverFlow(), inputs, accountFlowIdentity); wfApp.InstanceStore = store; wfApp.PersistableIdle = (e) => { //a thread becomes in signaled state by calling Set on AutoResetEvent return(PersistableIdleAction.Unload); }; wfApp.Unloaded = (workflowApplicationEventArgs) => { syncEvent.Set(); //InstanceUnloaded.Set(); }; wfApp.Completed = (e) => { FindApproverResult = (FindApproverResult)e.Outputs["Result"]; WaitingApprovals = (List <WorkFlowApproval>)e.Outputs["ApprovalList"]; QuoteMasterWithGPStatus = (QuotationMaster)e.Outputs["QuotationMaster"]; //syncEvent.Set(); }; wfApp.Aborted = (e) => { string test = Convert.ToString(e.Reason.Message); }; wfApp.OnUnhandledException = (e) => { return(UnhandledExceptionAction.Terminate); }; return(wfApp); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } QuotationMaster quotmaster = db.QuotationMasters.Find(id); if (quotmaster == null) { return(HttpNotFound()); } ViewBag.CategoryID = new SelectList(db.Categories, "Id", "CategoryName"); ViewBag.ItemNameID = new SelectList(db.ItemNames, "Id", "ItemDesc"); ViewBag.CustomerID = new SelectList(db.Customers, "CustomerID", "CustomerName", quotmaster.CustomerID); ViewBag.StoreID = new SelectList(db.Stores, "StoreID", "StoreName", quotmaster.StoreID); return(View(quotmaster)); }
public static void StartFlow(QuotationMaster quote, string url, string region) { //AutoResetEvent allows threads that need access to a resource to communicate with each other by signaling. //A thread waits for a signal by calling WaitOne on the AutoResetEvent. //If the AutoResetEvent is the non-signaled state (a thread becomes in signaled state by calling Set on AutoResetEvent), //the thread blocks waiting for the thread that currently controls the resource to signal that the resource is available by calling Set. AutoResetEvent syncEvent = new AutoResetEvent(false); Dictionary <string, object> inputs = new Dictionary <string, object>(); inputs.Add("Region", region); inputs.Add("Url", url); inputs.Add("QuotationMaster", quote); WorkflowApplication wfApp = GetWorkFlowApplication(inputs, syncEvent); wfApp.Run(); syncEvent.WaitOne(); }
// If your activity returns a value, derive from CodeActivity<TResult> // and return the value from the Execute method. protected override void Execute(CodeActivityContext context) { // Obtain the runtime value of the Text input argument QuotationMaster quoteMaster = context.GetValue(this.QuoteMaster); string errMsg = context.GetValue(this.ErrorMessage); quoteMaster.SimulateListUnitPriceVPRS(ref errMsg); this.ErrorMessage.Set(context, errMsg); //Order order = quoteMaster.ConvertQuoteToOrder(); //Advantech.Myadvantech.DataAccess.SAPDAL.SimulateOrder(ref order, ref errMsg); //// Process Simulate Result //if (String.IsNullOrEmpty(errMsg)) //{ // foreach (Product p in order.LineItems) // { // // Write price back to quotationdetail's unitprice and ITP // quoteMaster.QuotationDetail.Where(d => d.partNo.Equals(p.PartNumber) && // d.unitPrice == d.newUnitPrice && // d.line_No == p.LineNumber) // .ToList() // .ForEach(c => // { // c.listPrice = p.ListPrice; // c.unitPrice = p.UnitPrice; // c.newUnitPrice = p.UnitPrice; // }); // quoteMaster.QuotationDetail.Where(d => d.partNo.Equals(p.PartNumber) && // d.unitPrice != d.newUnitPrice && // d.line_No == p.LineNumber) // .ToList() // .ForEach(c => // { // c.listPrice = p.ListPrice; // c.unitPrice = p.UnitPrice; // }); // } // quoteMaster.InitializeQuotationDetail(); //} }
public QuotationMasterViewModel AddQuotationMaster(QuotationMasterViewModel str) { QuotationMaster pur = new QuotationMaster(); pur.CustomerID = str.CustomerID; pur.QuoteNumber = str.QuoteNumber; pur.QuoteDate = str.QuoteDate; pur.QuoteRevDate = str.QuoteRevDate; pur.StoreID = int.Parse(System.Web.HttpContext.Current.Session["storeid"].ToString()); pur.UserID = int.Parse(System.Web.HttpContext.Current.Session["userid"].ToString()); pur.AddedUser = System.Web.HttpContext.Current.Session["username"].ToString(); cntxt.QuotationMasters.Add(pur); cntxt.SaveChanges(); foreach (QuotationDetailsViewModel strdet in str.QuotationDetailsViewModels) { QuotationDetail quotationDetail = new QuotationDetail(); quotationDetail.QuotationMasterId = pur.QuotationMasterid; quotationDetail.CategoryID = strdet.CategoryID; quotationDetail.ItemNameID = strdet.ItemNameID; quotationDetail.Specification = strdet.Specification; quotationDetail.Qty = strdet.Qty; quotationDetail.TotalPrice = strdet.TotalPrice; quotationDetail.UnitPrice = strdet.UnitPrice ?? 00; quotationDetail.CGSTPercent = strdet.CGSTPercent; quotationDetail.SGSTPercent = strdet.SGSTPercent; quotationDetail.AddedUser = System.Web.HttpContext.Current.Session["username"].ToString(); quotationDetail.AddedDate = DateTime.Now; quotationDetail.IsDeleted = false; cntxt.QuotationDetails.Add(quotationDetail); } cntxt.SaveChanges(); return(str); }
public int Insert(QuotationModel model, TicketModel model1) { try { Mapper.CreateMap <TicketModel, TicketMaster>(); TicketMaster objTicket = Mapper.Map <TicketMaster>(model1); Dbcontext.TicketMasters.Add(objTicket); Dbcontext.SaveChanges(); int tid = Dbcontext.TicketMasters.Max(m => m.TicketID); Mapper.CreateMap <QuotationModel, QuotationMaster>(); QuotationMaster objUser = Mapper.Map <QuotationMaster>(model); objUser.TicketID = tid; Dbcontext.QuotationMasters.Add(objUser); Dbcontext.SaveChanges(); return(tid); } catch (Exception ex) { throw ex; } }
public static void StartFlow(ref QuotationMaster quote, ref string errorMsg) { //AutoResetEvent allows threads that need access to a resource to communicate with each other by signaling. //A thread waits for a signal by calling WaitOne on the AutoResetEvent. //If the AutoResetEvent is the non-signaled state (a thread becomes in signaled state by calling Set on AutoResetEvent), //the thread blocks waiting for the thread that currently controls the resource to signal that the resource is available by calling Set. ErrorMessage = ""; AutoResetEvent syncEvent = new AutoResetEvent(false); Dictionary <string, object> inputs = new Dictionary <string, object>(); inputs.Add("QuotationMaster", quote); //inputs.Add("ErrorMessage", errorMsg); WorkflowApplication wfApp = GetWorkFlowApplication(inputs, syncEvent); wfApp.Run(); syncEvent.WaitOne(); // move to outside? errorMsg = ErrorMessage; quote.ReorderQuotationDetail(); quote.InitializeQuotationDetail(); }
public static bool AddQuotation(QuotationModel model) { try { using (HJStudioEntities context = new HJStudioEntities()) { ClientMaster clt = new ClientMaster(); var Clienttemp = context.ClientMasters.Find(model.ClientID); clt = Clienttemp == null ? new ClientMaster() : Clienttemp; clt.Name = model.Name; clt.MobileNo = model.MobileNo; clt.EmailId = model.EmailId; clt.Address1 = model.Address1; clt.Address2 = model.Address2; clt.City = model.City; clt.State = model.State; clt.Refrence = model.Refrence; if (Clienttemp == null) { clt.CreatedBy = "Admin"; clt.CreatedDate = DateTime.Now; context.ClientMasters.Add(clt); } else { clt.ModifiedBy = "Admin"; clt.ModifiedDate = DateTime.Now; } context.SaveChanges(); int ClientID = clt.ClientID; QuotationMaster _Quotation = new QuotationMaster(); var temp = context.QuotationMasters.Find(model.QuotationID); _Quotation = temp == null ? new QuotationMaster() : temp; if (temp != null) { } _Quotation.QuotationDate = model.QuotationDate; _Quotation.EventStartDate = model.EventStartDate; _Quotation.EventDays = model.EventDays; _Quotation.Remark = model.Remark; _Quotation.QuotationAmount = model.QuotationAmount; _Quotation.Discount = model.Discount; _Quotation.FinalAmount = model.FinalAmount; _Quotation.ClientID = ClientID; _Quotation.Name = model.Name; _Quotation.MobileNo = model.MobileNo; _Quotation.EmailId = model.EmailId; _Quotation.Address1 = model.Address1; _Quotation.Address2 = model.Address2; _Quotation.City = model.City; _Quotation.State = model.State; _Quotation.Refrence = model.Refrence; _Quotation.Status = model.Status; List <QuotationDay> _QuotationDay = new List <Data.QuotationDay>(); if (model.QuotationDayList != null) { foreach (var d in model.QuotationDayList) { List <EmployeeQuotationDay> _EmployeeQuotationDay = new List <EmployeeQuotationDay>(); if (d.EmployeeQuotationDayList != null) { foreach (var e in d.EmployeeQuotationDayList) { if (e.IsDelete == false && e.EmployeeID > 0) { _EmployeeQuotationDay.Add(new EmployeeQuotationDay { EmployeeID = e.EmployeeID, Wages = e.Wages, EmployeeRole = e.EmployeeRole, }); } } } _QuotationDay.Add(new QuotationDay { EventName = d.EventName, EventDate = d.EventDate, StartTime = d.StartTime, EndTime = d.EndTime, Remarks = d.Remarks, Address1 = d.Address1, Address2 = d.Address2, City = d.City, State = d.State, ClientMobileNo = d.ClientMobileNo, EmployeeQuotationDays = _EmployeeQuotationDay }); } } _Quotation.QuotationDays = _QuotationDay; List <ProductQuotation> _ProductQuotation = new List <ProductQuotation>(); if (model.ProductQuotationList != null) { foreach (var p in model.ProductQuotationList) { if (p.ProductID > 0) { _ProductQuotation.Add(new ProductQuotation { ProductID = p.ProductID, Quantity = p.Quantity, Amount = p.Amount, TotalAmount = p.TotalAmount, Remark = p.Remark, }); } } } _Quotation.ProductQuotations = _ProductQuotation; if (temp == null) { _Quotation.CreatedBy = CommanModel.LoginUserDetails.EmployeeID; _Quotation.CreatedDate = DateTime.Now; context.QuotationMasters.Add(_Quotation); } else { _Quotation.ModifiedBy = CommanModel.LoginUserDetails.EmployeeID; _Quotation.ModifiedDate = DateTime.Now; } context.SaveChanges(); return(true); } } catch (Exception) { return(false); } }
public override void Init() { var QuotationMaster = new QuotationMaster(); HttpContext.Current.Session["QuotationMaster"] = QuotationMaster; }
public QuotationMaster AddorUpdate(QuotationMaster master) { _quotationMasterRepository.AddOrUpdate(master); _quotationMasterRepository.SaveChanges(); return(master); }
public QuotationMaster ConverToQuote() { QuotationMaster quote = new QuotationMaster(); quote.quoteNo = this.QuoteNo; quote.quoteId = this.QuoteId; quote.quoteToErpId = this.QuoteToErpId != null? this.QuoteToErpId: ""; quote.quoteToRowId = this.QuoteToRowId; quote.siebelRBU = this.SiebelRBU; quote.quoteDate = this.QuoteDate; quote.expiredDate = TimeHelper.ConvertToSystemTime(this.ExpiredDate, this.Region); quote.createdBy = this.CreatedBy; quote.createdDate = this.CreatedDate; quote.LastUpdatedBy = this.LastUpdatedBy; quote.LastUpdatedDate = this.LastUpdatedDate; quote.deliveryDate = this.DeliveryDate; quote.reqDate = this.ReqDate; quote.DOCSTATUS = this.DOCSTATUS; quote.PODate = this.PoDate; quote.Revision_Number = this.RevisionNumber; quote.Active = this.Active = true; quote.tax = this.Tax; quote.isRepeatedOrder = this.IsRepeatedOrder; quote.PO_NO = string.IsNullOrEmpty(this.PoNo) ? "" : this.PoNo.Trim().Replace("'", "''"); quote.DIST_CHAN = this.DistChan; quote.DIVISION = this.Division; quote.currency = this.Currency; quote.org = this.Org; quote.SALESOFFICE = this.SalesOffice; quote.SALESGROUP = this.SalesGroup; quote.customId = string.IsNullOrEmpty(this.Description) ? "" : this.Description.Trim().Replace("'", "''"); quote.salesRowId = string.IsNullOrEmpty(this.SalesRowId) ? "" : this.SalesRowId.Trim().Replace("'", "''"); quote.salesEmail = this.InSideSales; quote.quoteToName = string.IsNullOrEmpty(this.QuoteToName) ? "" : this.QuoteToName.Trim().Replace("'", "''"); quote.relatedInfo = string.IsNullOrEmpty(this.ApprovalReason) ? "" : this.ApprovalReason.Trim().Replace("'", "''"); quote.quoteNote = string.IsNullOrEmpty(this.QuoteNote) ? "" : this.QuoteNote.Trim().Replace("'", "''"); //quote.QuotationExtensionNew.Warranty = string.IsNullOrEmpty(this.Warranty) ? "" : this.Warranty.Trim().Replace("'", "''"); quote.freight = this.Freight; quote.INCO1 = this.Inco1; quote.INCO2 = this.Inco2; quote.OriginalQuoteID = this.OriginalQuoteID; quote.paymentTerm = this.PaymentTerm; //quote.INCO1 = Advantech.Myadvantech.DataAccess.DataCore.MyAdvantech.SAPCompanyHelper.GetSAPDIMCompanyByID(this.QuoteToErpId).FirstOrDefault(); quote.Remark = string.IsNullOrEmpty(this.Remark) ? "" : this.Remark.Trim().Replace("'", "''"); var quoteExten = new QuotationExtensionNew(); quoteExten.QuoteID = this.QuoteId; quoteExten.GeneralRate = 0.24m; quoteExten.Warranty = this.Warranty; quoteExten.BelowGP = false; quote.QuotationExtensionNew = quoteExten; var quotePartners = new List <EQPARTNER>(); if (this.SoldToPartner != null) { quotePartners.Add(this.SoldToPartner); } if (this.ShipToPartner != null) { quotePartners.Add(this.ShipToPartner); } if (this.BillToPartner != null) { quotePartners.Add(this.BillToPartner); } if (this.EndCustomer != null && !string.IsNullOrEmpty(this.EndCustomer.ERPID)) //Alex 20180712: For ACN, only endcutomer with epr id will be added to eqparters. { quotePartners.Add(this.EndCustomer); } foreach (var item in this.ExtraTermsAndConditionOptions) { EQPARTNER e = new EQPARTNER(); if (item.Selected == true) { e.QUOTEID = this.QuoteId; e.NAME = item.Name; e.TYPE = item.Type; quotePartners.Add(e); } } if (this.SalesRepresentatives != null) { int count = 1; foreach (var sales in this.SalesRepresentatives) { EQPARTNER partner_sales = new EQPARTNER(); partner_sales.QUOTEID = this.QuoteId; partner_sales.ERPID = sales.SalesCode; partner_sales.NAME = sales.Email; if (count == 1) { partner_sales.TYPE = "E"; } if (count == 2) { partner_sales.TYPE = "E2"; } if (count == 3) { partner_sales.TYPE = "E3"; } quotePartners.Add(partner_sales); count += 1; } } quote.QuotationPartner = quotePartners; quote.QuotationDetail = this.QuoteItems .Select(x => new QuotationDetail() { quoteId = x.QuoteId, line_No = x.LineNo, partNo = x.PartNo, description = x.Description, listPrice = x.ListPrice, unitPrice = x.UnitPrice, newUnitPrice = x.QuotingPrice, itp = x.Itp, newItp = x.NewItp, qty = x.Qty, sprNo = x.SprNo, HigherLevel = x.HigherLevel, DMF_Flag = x.DMF_Flag, ItemType = x.ItemType, deliveryPlant = x.DeliveryPlant, NCNR = Convert.ToInt32(x.NCNR), RecyclingFee = x.RecyclingFee, category = string.IsNullOrEmpty(x.Category) ? "" : x.Category.Trim().Replace("'", "''"), classABC = string.IsNullOrEmpty(x.ClassABC) ? "" : x.ClassABC.Trim().Replace("'", "''"), rohs = x.Rohs, ewFlag = x.EWFlag, reqDate = x.RequiredDate, dueDate = x.DueDate, satisfyFlag = x.SatisfyFlag, canBeConfirmed = x.CanBeConfirmed, custMaterial = x.CusMaterial == null?"": x.CusMaterial, inventory = x.Inventory, modelNo = string.IsNullOrEmpty(x.ModelNo) ? "" : x.ModelNo.Trim().Replace("'", "''"), VirtualPartNo = x.VirtualPartNo, RECFIGID = string.IsNullOrEmpty(x.Recfigid) ? "" : x.Recfigid.Trim().Replace("'", "''"), SequenceNo = x.SequenceNo, OriginalSalesDiscountRate = x.SalesDiscountRate, }) .ToList(); if (!string.IsNullOrEmpty(this.OptyId)) { optyQuote oppty = new optyQuote(); oppty.optyId = this.OptyId; oppty.quoteId = this.QuoteId; oppty.optyName = this.OptyName ?? ""; oppty.optyStage = this.OptyStage ?? ""; oppty.Opty_Owner_Email = AppContext.UserEmail ?? ""; quote.QuotationOpty = new optyQuote(); quote.QuotationOpty = oppty; } if (this.QuoteApproval.QuoteApprovalList != null) { quote.WaitingApprovals = this.QuoteApproval.QuoteApprovalList.ToList(); } return(quote); }