コード例 #1
0
ファイル: RfqsController.cs プロジェクト: josean14/axis
        // GET: Rfqs/Create
        public ActionResult Create(string typefarm)
        {
            switch (typefarm)
            {
            case "WIND":
                ViewBag.FarmId   = new SelectList(db.Farms.Where(f => f.TypeFarm == TypeFarm.WIND), "FarmId", "FarmName");
                ViewBag.ClientId = new SelectList(db.Clients, "ClientId", "FullName");

                //Otra manera de hacer la lista
                List <Client> ClientList = db.Clients.ToList();
                ViewBag.ClientList = new SelectList(ClientList, "ClientId", "Fullname");
                break;

            case "SOLAR":
                ViewBag.FarmId = new SelectList(db.Farms.Where(f => f.TypeFarm == TypeFarm.SOLAR), "FarmId", "FarmName");
                break;

            case "OTHER":
                ViewBag.FarmId = new SelectList(db.Farms.Where(f => f.TypeFarm == TypeFarm.OTHER), "FarmId", "FarmName");
                break;
            }
            var model = new Rfq
            {
                Status = "Open"
            };

            return(View(model));
        }
コード例 #2
0
        public bool UpdateInfo(int rfqId)
        {
            Rfq rfq = new Rfq();

            GetValuesFromGui(rfq);
            rfq.rfqNo   = rfqId;
            rfq.salesId = mySubs[cbSales.SelectedIndex];

            if ((rfq.rfqStates != (int)RfqStatesEnum.Closed) && (rfq.closeReason.HasValue))
            {
                rfq.closeReason = null;
            }


            bool suc;

            try
            {
                suc = RfqMgr.UpdateRfq(rfq);
            }
            catch (Exception ex)
            {
                suc = false;
                Logger.Error(ex.StackTrace);
            }
            return(suc);
        }
コード例 #3
0
ファイル: RfqItems.cs プロジェクト: windygu/ERP-1
 public virtual void FillTheTable(Rfq rfq)
 {
     tbProject.Text           = rfq.project;
     tbContact.Text           = rfq.contact;
     tbPhone.Text             = rfq.phone;
     tbFax.Text               = rfq.fax;
     tbEmail.Text             = rfq.email;
     cbPriority.SelectedIndex = (rfq.priority.HasValue ? rfq.priority.Value : -1);
     cbRohs.Checked           = (rfq.rohs == 1 ? true : false);
     tbRfqDate.Text           = rfq.rfqdate.ToShortDateString();
     dateTimePicker1.Value    = rfq.dockdate;
     tbPartNo.Text            = rfq.partNo;
     tbMfg.Text               = rfq.mfg;
     tbDc.Text          = rfq.dc;
     tbCustPartNo.Text  = rfq.custPartNo;
     tbGenPartNo.Text   = rfq.genPartNo;
     tbAlt.Text         = rfq.alt;
     tbQuantity.Text    = rfq.qty.ToString();
     tbPackaging.Text   = rfq.packaging.ToString();
     tbTargetPrice.Text = rfq.targetPrice.ToString();
     tbResale.Text      = rfq.resale.ToString();
     tbCost.Text        = rfq.cost.ToString();
     // tbPrimaryPA.Text = rfq.firstPA.ToString();
     //tbAltPA.Text = rfq.secondPA.ToString();
     cbCloseReason.SelectedIndex = (rfq.closeReason.HasValue ? rfq.closeReason.Value : -1);
     tbToCustomer.Text           = rfq.infoToCustomer;
     tbToInternal.Text           = rfq.infoToInternal;
     tbRoutingHistory.Text       = rfq.routingHistory;
 }
コード例 #4
0
ファイル: QuotesController.cs プロジェクト: josean14/axis
        // GET: Quotes/Create
        public ActionResult Create(int rversionid)
        {
            Rversion rversion = db.Rversions.Find(rversionid);
            Rfq      rfq      = db.Rfqs.Find(rversion.RfqId);


            ViewBag.RfqId              = rfq.RfqId;
            ViewBag.VersionDate        = rversion.Date;
            ViewBag.NumberVersion      = rversion.NumberVersion;
            ViewBag.SiteFarm           = rfq.Farm.FarmName;
            ViewBag.FullName           = rfq.Farm.Client.FullName;
            ViewBag.Street             = rfq.Farm.StreetAddress;
            ViewBag.City               = rfq.Farm.City;
            ViewBag.State              = rfq.Farm.State;
            ViewBag.Country            = rfq.Farm.Country;
            ViewBag.ProjectDescription = rversion.ProjectDescription;
            ViewBag.ProjectName        = rfq.ProjectName;
            ViewBag.RversionId         = rversion.RversionId;

            ViewBag.TypeWork  = rversion.TypeWork;
            ViewBag.ScopeWork = rversion.ScopeWork.Work;

            ViewBag.Notes       = rversion.NotesAndInstructions;
            ViewBag.Description = "";

            //ViewBag.Description = new SelectList(db.QuotesLists, "Description", "Description");

            return(View());
        }
コード例 #5
0
        /// <summary>
        /// convert rfq to list model
        /// </summary>
        /// <param name="rfq"></param>
        /// <returns></returns>
        public RfqViewModel ConvertToListView(Rfq rfq)
        {
            RfqViewModel model = new RfqViewModel();

            var _projectRepository = new ProjectRepository();

            var project = _projectRepository.GetProject(rfq.ProjectId);

            model.RfqId              = rfq.RfqId;
            model.ProjectName        = (project != null && !string.IsNullOrEmpty(project.Name)) ? project.Name : "N/A";
            model.RfqNumber          = (!string.IsNullOrEmpty(rfq.Number)) ? rfq.Number : "N/A";
            model.RfqDate            = rfq.RfqDate;
            model.HoldNotes          = rfq.HoldNotes;
            model.HoldExpirationDate = rfq.HoldExpirationDate;
            model.RfqDateStr         = rfq.RfqDate.ToShortDateString();
            model.IsOpen             = rfq.IsOpen;
            model.IsHold             = rfq.IsHold;
            model.IsCanceled         = rfq.IsCanceled;
            model.Status             = rfq.IsOpen ? "Open" : rfq.IsCanceled ? "Canceled" : rfq.IsHold ? "On Hold" : "N/A";
            model.CreatedDate        = rfq.CreatedDate;

            if (_projectRepository != null)
            {
                _projectRepository.Dispose();
                _projectRepository = null;
            }

            return(model);
        }
コード例 #6
0
ファイル: SoViewControl.cs プロジェクト: hnjm/AmbleSystem
        public void NewSOFill()
        {
            FillTheSalesComboBox();
            cbSp.SelectedIndex = 0;
            this.isNewCreateSo = true;

            foreach (int id in rfqList)
            {
                Rfq     rfq    = RfqGui.RfqManager.RfqMgr.GetRfqAccordingToRfqId(id);
                SoItems soItem = new SoItems();
                soItem.currencyType = (int)AmbleClient.Currency.USD;
                soItem.unitPrice    = rfq.targetPrice ?? 0;
                soItem.mfg          = rfq.mfg;
                soItem.partNo       = rfq.partNo;
                soItem.rohs         = rfq.rohs;
                soItem.qty          = rfq.qty ?? 0;
                soItem.intPartNo    = rfq.custPartNo;
                soItem.dc           = rfq.dc;
                soItem.dockDate     = rfq.dockdate;
                soItem.rfqId        = id;
                soItem.soItemState  = new SoItemNew().GetStateValue();

                this.soItemsStateList.Add(
                    new SoItemsContentAndState
                {
                    soitem = soItem,
                    state  = OrderItemsState.New
                }
                    );
            }

            ShowDataInDataGridView();
        }
コード例 #7
0
        private void RFQView_Load(object sender, EventArgs e)
        {
            Rfq rfq = rfqMgr.GetRfqAccordingToRfqId(rfqId);

            rfqItems1.FillTheTable(rfq);
            GuiOpAccordingToRfqState((RfqStatesEnum)rfq.rfqStates);
        }
コード例 #8
0
        private void BuyerManagerRfqView_Load(object sender, EventArgs e)
        {
            Rfq rfq = rfqMgr.GetRfqAccordingToRfqId(rfqId);

            buyerManagerRfqItems1.FillTheTable(rfq);
            SetMenuStateAccordingToRfqState((RfqStatesEnum)rfq.rfqStates);
        }
コード例 #9
0
        /// <summary>
        /// update rfq
        /// </summary>
        /// <param name="rfq"></param>
        /// <returns></returns>
        public OperationResult UpdateRfq(Rfq rfq)
        {
            var operationResult = new OperationResult();

            var existingRfq = GetRfq(rfq.RfqId);

            if (existingRfq != null)
            {
                try
                {
                    _db.Rfq.Attach(existingRfq);

                    _db.Entry(existingRfq).CurrentValues.SetValues(rfq);

                    _db.SaveChanges();

                    operationResult.Success = true;
                    operationResult.Message = "Edit this RFQ success!";
                }
                catch (Exception ex)
                {
                    operationResult.Success = false;
                    operationResult.Message = "can not edit this RFQ!";
                    logger.ErrorFormat("Error updating rfq: {0} ", ex.ToString());
                }
            }
            else
            {
                operationResult.Success = false;
                operationResult.Message = "can not find this RFQ!";
            }

            return(operationResult);
        }
コード例 #10
0
        /// <summary>
        /// save rfq
        /// </summary>
        /// <param name="rfq"></param>
        /// <returns></returns>
        public OperationResult SaveRfq(Rfq rfq)
        {
            var operationResult = new OperationResult();

            try
            {
                var existingRfq = _db.Rfq.FirstOrDefault(x => x.Number.ToLower() == rfq.Number.ToLower());

                if (existingRfq == null)
                {
                    var insertedRfq = _db.Rfq.Add(rfq);

                    _db.SaveChanges();

                    operationResult.Success     = true;
                    operationResult.Message     = "Success";
                    operationResult.ReferenceId = insertedRfq.RfqId;
                }
                else
                {
                    operationResult.Success = false;
                    operationResult.Message = "Duplicate Entry";
                }
            }
            catch (Exception ex)
            {
                operationResult.Success = false;
                operationResult.Message = "Can not create this RFQ";
                logger.ErrorFormat("Error saving new rfq: {0} ", ex.ToString());
            }

            return(operationResult);
        }
コード例 #11
0
        private void tsbOffer_Click(object sender, EventArgs e)
        {
            AmbleClient.OfferGui.NewOffer newOffer = new OfferGui.NewOffer(rfqId);
            newOffer.NewOfferAutoFill(this.buyerManagerRfqItems1.tbPartNo.Text, this.buyerManagerRfqItems1.tbMfg.Text);
            newOffer.ShowDialog();
            Rfq rfq = RfqMgr.GetRfqAccordingToRfqId(rfqId);
            SetMenuStateAccordingToRfqState((RfqStatesEnum)rfq.rfqStates);

        }
コード例 #12
0
        /// <summary>
        /// convert rfq to quote view model
        /// </summary>
        /// <param name="rfq"></param>
        /// <returns></returns>
        public QuoteViewModel ConvertToView(Rfq rfq)
        {
            QuoteViewModel model = new QuoteViewModel();

            var _priceSheetRepository       = new PriceSheetRepository();
            var _projectPartRepository      = new ProjectPartRepository();
            var _customerDynamicsRepository = new CustomerDynamicsRepository();

            var dynamicsCustomer = _customerDynamicsRepository.GetCustomer(rfq.CustomerId);
            var priceSheet       = _priceSheetRepository.GetPriceSheets().FirstOrDefault(x => x.RfqId == rfq.RfqId && x.IsQuote);
            var projectParts     = _projectPartRepository.GetProjectParts().Where(x => x.PriceSheetId == ((priceSheet != null) ? priceSheet.PriceSheetId : Guid.Empty));

            model.ProjectId     = rfq.ProjectId;
            model.RfqId         = rfq.RfqId;
            model.RfqNumber     = rfq.Number;
            model.ContactName   = rfq.ContactName;
            model.CustomerId    = rfq.CustomerId;
            model.CustomerName  = (dynamicsCustomer != null) ? dynamicsCustomer.SHRTNAME : "N/A";
            model.MaterialId    = rfq.MaterialId;
            model.CoatingTypeId = rfq.CoatingTypeId;
            model.IsMachined    = rfq.IsMachined;
            model.Machining     = rfq.IsMachined ? "Included" : "Not Included";
            model.PriceSheetId  = (priceSheet != null) ? priceSheet.PriceSheetId : Guid.Empty;
            model.Date          = DateTime.Now.ToShortDateString();
            model.QuoteDateStr  = DateTime.Now.ToShortDateString();

            if (projectParts != null && projectParts.Count() > 0)
            {
                model.MaterialId = projectParts.FirstOrDefault().MaterialId;

                model.QuoteParts = new List <QuotePartViewModel>();
                foreach (var projectPart in projectParts)
                {
                    var quotePartModel = new QuotePartConverter().ConvertToView(projectPart);
                    model.QuoteParts.Add(quotePartModel);
                }
            }

            if (_priceSheetRepository != null)
            {
                _priceSheetRepository.Dispose();
                _priceSheetRepository = null;
            }
            if (_projectPartRepository != null)
            {
                _projectPartRepository.Dispose();
                _projectPartRepository = null;
            }

            if (_customerDynamicsRepository != null)
            {
                _customerDynamicsRepository.Dispose();
                _customerDynamicsRepository = null;
            }

            return(model);
        }
コード例 #13
0
ファイル: NewRfq.cs プロジェクト: hnjm/AmbleSystem
        private void tsbPaste_Click(object sender, EventArgs e)
        {
            int rfqId = RfqMgr.GetRfqIdOfTheCopiedRecord(UserInfo.UserId);
            Rfq rfq   = RfqMgr.GetRfqAccordingToRfqId(rfqId);

            rfqItems1.FillTheTable(rfq);
            rfqItems1.tbRoutingHistory.Clear();
            rfqItems1.tbCost.Clear();
            rfqItems1.cbCloseReason.SelectedIndex = -1;
        }
コード例 #14
0
        private void tsbSo_Click(object sender, EventArgs e)
        {
            SO.NewSo newSo = new SO.NewSo(rfqId);
            newSo.FillCustomerAndContact(this.rfqItems1.tbCustomer.Text, this.rfqItems1.tbContact.Text);
            newSo.ShowDialog();

            Rfq rfq = rfqMgr.GetRfqAccordingToRfqId(rfqId);

            GuiOpAccordingToRfqState((RfqStatesEnum)rfq.rfqStates);
        }
コード例 #15
0
ファイル: RfqsController.cs プロジェクト: josean14/axis
 public ActionResult Edit([Bind(Include = "RfqId,Status,ProjectName,FarmId")] Rfq rfq)
 {
     if (ModelState.IsValid)
     {
         db.Entry(rfq).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.FarmId = new SelectList(db.Farms, "FarmId", "FarmName", rfq.FarmId);
     return(View(rfq));
 }
コード例 #16
0
ファイル: RfqsController.cs プロジェクト: josean14/axis
        public ActionResult DeleteConfirmed(int id)
        {
            Rfq rfq = db.Rfqs.Find(id);

            db.Rfqs.Remove(rfq);
            db.SaveChanges();
            return(new JsonResult()
            {
                Data = "RFQ Deleted successfully"
            });
        }
コード例 #17
0
ファイル: RfqsController.cs プロジェクト: josean14/axis
        public ActionResult PrintRfqViewer(int?RversionId, int?RfqId, string typefarm)
        {
            if ((RversionId == null) & (RfqId == null))
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Rfq rfq = db.Rfqs.Find(RfqId);

            if (rfq == null)
            {
                return(HttpNotFound());
            }
            Rversion rversion = db.Rversions.Find(RversionId);

            if (rfq == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Typefarm       = typefarm;
            ViewBag.RversionId     = rversion.RversionId;
            ViewBag.VersionDate    = rversion.Date;
            ViewBag.NumberVersion  = rversion.NumberVersion;
            ViewBag.TypeWork       = rversion.TypeWork;
            ViewBag.Status         = rversion.Status;
            ViewBag.ScopeWork      = rversion.ScopeWork.Work;
            ViewBag.MIPricePerTech = rversion.MIPricePerTech;
            ViewBag.MITechnicians  = rversion.MITechnicians;
            ViewBag.MITotal        = rversion.MITotal;
            ViewBag.MOPricePerTech = rversion.MOPricePerTech;
            ViewBag.MOTechnicians  = rversion.MOTechnicians;
            ViewBag.MOTotal        = rversion.MOTotal;

            ViewBag.Notes = rversion.NotesAndInstructions;
            ViewBag.ProjectDescription = rversion.ProjectDescription;
            ViewBag.ProjectName        = rfq.ProjectName;
            ViewBag.SiteFarm           = rfq.Farm.FarmName;
            ViewBag.FullName           = rfq.Farm.Client.FullName;
            ViewBag.Street             = rfq.Farm.StreetAddress;
            ViewBag.City               = rfq.Farm.City;
            ViewBag.State              = rfq.Farm.State;
            ViewBag.Country            = rfq.Farm.Country;
            ViewBag.TermsandConditions = rversion.TermsandConditions;

            var quotes1 = db.Quotes.Where(q => q.RversionId == rversion.RversionId).Where(r => r.TypeR == 1).ToList();
            var quotes2 = db.Quotes.Where(q => q.RversionId == rversion.RversionId).Where(r => r.TypeR == 2).ToList();

            ViewBag.Quotes1 = quotes1;
            ViewBag.Quotes2 = quotes2;
            return(new Rotativa.ViewAsPdf("RfqViewer", rfq)
            {
                FileName = "RFQ " + RfqId + " Ver " + ViewBag.NumberVersion + ".pdf"
            });
        }
コード例 #18
0
ファイル: RfqItemPicker.cs プロジェクト: hnjm/AmbleSystem
        private void RfqItemPicker_Load(object sender, EventArgs e)
        {
            if (rfqState == RfqStatesEnum.Quoted)
            {
                DataTable dt = AmbleClient.RfqGui.RfqManager.RfqMgr.GetRfqForSo(customerName, UserInfo.UserId);

                foreach (DataRow dr in dt.Rows)
                {
                    if (Convert.ToInt32(dr["rfqNo"]) == this.rfqId)
                    {
                        dataGridView1.Rows.Insert(0,
                                                  true,
                                                  Tool.Get6DigitalNumberAccordingToId(Convert.ToInt32(dr["rfqNo"])),
                                                  dr["partNo"].ToString(),
                                                  dr["mfg"].ToString(),
                                                  dr["dc"].ToString(),
                                                  dr["targetPrice"].ToString(),
                                                  dr["resale"].ToString(),
                                                  dr["cost"].ToString());
                    }
                    else
                    {
                        dataGridView1.Rows.Add(true,
                                               Tool.Get6DigitalNumberAccordingToId(Convert.ToInt32(dr["rfqNo"])),
                                               dr["partNo"].ToString(),
                                               dr["mfg"].ToString(),
                                               dr["dc"].ToString(),
                                               dr["targetPrice"].ToString(),
                                               dr["resale"].ToString(),
                                               dr["cost"].ToString());
                    }
                }
            }
            else
            {
                Rfq rfq = AmbleClient.RfqGui.RfqManager.RfqMgr.GetRfqAccordingToRfqId(this.rfqId);
                dataGridView1.Rows.Add(true,
                                       Tool.Get6DigitalNumberAccordingToId(this.rfqId),
                                       rfq.partNo,
                                       rfq.mfg,
                                       rfq.dc,
                                       rfq.targetPrice,
                                       rfq.resale,
                                       rfq.cost);
            }



            if (dataGridView1.Rows.Count > 0)
            {
                dataGridView1.Rows[0].Cells[0].ReadOnly = true;
            }
        }
コード例 #19
0
ファイル: QuotesController.cs プロジェクト: josean14/axis
        // GET: Quotes/Edit/5
        public ActionResult PartialVersionEdit(int?rversionId, int rfqId)
        {
            if (rversionId == null)
            {
                return(RedirectToAction("Details", "Rfqs", new { id = rfqId }));
            }
            Rversion rversion = db.Rversions.Find(rversionId);
            Rfq      rfq      = db.Rfqs.Find(rfqId);


            ViewBag.VersionDate   = rversion.Date;
            ViewBag.NumberVersion = rversion.NumberVersion;
            ViewBag.RfqId         = rfqId;

            ViewBag.SiteFarm           = rfq.Farm.FarmName;
            ViewBag.FullName           = rfq.Farm.Client.FullName;
            ViewBag.Street             = rfq.Farm.StreetAddress;
            ViewBag.City               = rfq.Farm.City;
            ViewBag.State              = rfq.Farm.State;
            ViewBag.Country            = rfq.Farm.Country;
            ViewBag.ProjectDescription = rversion.ProjectDescription;
            ViewBag.ProjectName        = rfq.ProjectName;
            ViewBag.RversionId         = rversion.RversionId;

            ViewBag.TypeWork    = rversion.TypeWork;
            ViewBag.Notes       = rversion.NotesAndInstructions;
            ViewBag.ScopeWork   = rversion.ScopeWork.Work;
            ViewBag.Typefarm    = rfq.Farm.TypeFarm;
            ViewBag.Description = "";

            ViewBag.MIPricePerTech = rversion.MIPricePerTech;
            ViewBag.MITechnicians  = rversion.MITechnicians;
            ViewBag.MITotal        = rversion.MITotal;

            ViewBag.MOPricePerTech = rversion.MOPricePerTech;
            ViewBag.MOTechnicians  = rversion.MOTechnicians;
            ViewBag.MOTotal        = rversion.MOTotal;


            var quotes1 = db.Quotes.Where(q => q.RversionId == rversion.RversionId).Where(r => r.TypeR == 1).ToList();
            var quotes2 = db.Quotes.Where(q => q.RversionId == rversion.RversionId).Where(r => r.TypeR == 2).ToList();

            ViewBag.Quotes1 = quotes1;
            ViewBag.Quotes2 = quotes2;


            //ViewBag.Description = new SelectList(db.QuotesLists, "Description", "Description");


            ViewBag.Quotes = db.Quotes.Where(r => r.RversionId == rversionId).ToList();
            return(PartialView());
        }
コード例 #20
0
        public async Task <ActionResult> Put(string rfqid, [FromBody] Rfq obj)
        {
            var target = await _context.Rfq.SingleOrDefaultAsync(nobj => nobj.Rfqid == rfqid);

            if (target != null && ModelState.IsValid)
            {
                _context.Entry(target).CurrentValues.SetValues(obj);
                await _context.SaveChangesAsync();

                return(Ok());
            }
            return(BadRequest());
        }
コード例 #21
0
ファイル: RfqsController.cs プロジェクト: josean14/axis
        public ActionResult Create([Bind(Include = "RfqId,Status,ProjectName,FarmId")] Rfq rfq)
        {
            if (ModelState.IsValid)
            {
                db.Rfqs.Add(rfq);
                db.SaveChanges();


                return(RedirectToAction("Create", "Rversions", new { rfqid = rfq.RfqId, projectname = rfq.ProjectName }));
            }

            ViewBag.FarmId = new SelectList(db.Farms, "FarmId", "FarmName", rfq.FarmId);
            return(View(rfq));
        }
コード例 #22
0
        /// <summary>
        /// get rfq by number
        /// </summary>
        /// <param name="rfqNumber"></param>
        /// <returns></returns>
        public Rfq GetRfq(string rfqNumber)
        {
            var rfq = new Rfq();

            try
            {
                rfq = _db.Rfq.Where(b => b.Number.Replace(" ", string.Empty).ToLower() == rfqNumber.Replace(" ", string.Empty).ToLower()).FirstOrDefault();
            }
            catch (Exception ex)
            {
                logger.ErrorFormat("Error getting rfq: {0} ", ex.ToString());
            }

            return(rfq);
        }
コード例 #23
0
        /// <summary>
        /// get rfq by nullable id
        /// </summary>
        /// <param name="rfqId"></param>
        /// <returns></returns>
        public Rfq GetRfq(Guid?rfqId)
        {
            var rfq = new Rfq();

            try
            {
                rfq = _db.Rfq.FirstOrDefault(x => x.RfqId == rfqId);
            }
            catch (Exception ex)
            {
                logger.ErrorFormat("Error getting rfq: {0} ", ex.ToString());
            }

            return(rfq);
        }
コード例 #24
0
ファイル: RfqsController.cs プロジェクト: josean14/axis
        // GET: Rfqs/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Rfq rfq = db.Rfqs.Find(id);

            if (rfq == null)
            {
                return(HttpNotFound());
            }
            ViewBag.FarmId = new SelectList(db.Farms, "FarmId", "FarmName", rfq.FarmId);
            return(View(rfq));
        }
コード例 #25
0
ファイル: RfqsController.cs プロジェクト: josean14/axis
        // GET: Rfqs/Details/5
        public ActionResult Details(int?id, string typefarm)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Rfq rfq = db.Rfqs.Find(id);

            if (rfq == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Rversion = db.Rversions.Where(f => f.RfqId == id).ToList();
            ViewBag.Typefarm = typefarm;
            return(View(rfq));
        }
コード例 #26
0
        //TODO: FIX TO WORK ON LINUX CONTAINER. DO INTEROPERABLE
        public async Task <IActionResult> ExecuteAsync(string requestForQuotation, CancellationToken cancellationToken)
        {
            Rfq rfq         = Rfq.FromJson(requestForQuotation);
            var httpContext = this.actionContextAccessor.ActionContext.HttpContext;

            if (httpContext.Request.Headers.TryGetValue(HeaderNames.IfModifiedSince, out StringValues stringValues))
            {
                //TODO: ADD WHEN SYSTEM WAS LAST UPDATED

                /*         if (DateTimeOffset.TryParse(stringValues, out var modifiedSince) &&
                 *           (modifiedSince >= car.Modified))
                 *       {
                 *           return new StatusCodeResult(StatusCodes.Status304NotModified);
                 *       } */
            }
            //Perform matching here:
            string filepath            = Path.Combine(this._hostingEnvironment.WebRootPath, "Matchmaking.jar");
            string args                = "/C java -jar " + filepath;
            string standaloneArguments = "java -jar Matchmaking.jar" + " " + HttpUtility.JavaScriptStringEncode(parameter.ToJson());
            string complete_args       = args + " " + HttpUtility.JavaScriptStringEncode(parameter.ToJson());

            System.Diagnostics.Process clientProcess = new Process
            {
                StartInfo = { FileName  = "java",
                              Arguments = @"-jar " + filepath + " " + HttpUtility.JavaScriptStringEncode(parameter.ToJson()),
                              RedirectStandardOutput = true,
                              RedirectStandardError  = true }
            };
            clientProcess.Start();
//            clientProcess.WaitForExit();
            var result  = clientProcess.StandardOutput.ReadToEnd();
            var isError = clientProcess.StandardError.ReadToEnd();
            int code    = clientProcess.ExitCode;

            Console.WriteLine(code);
            Console.WriteLine();

            bool isErr = result.Split('\n').Length > 5;

            return(isErr ? new OkObjectResult(isError) : new OkObjectResult(result));


            //lalalala
            return(new OkObjectResult("ok"));
        }
コード例 #27
0
        private void tsbQuote_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Set The RFQ Status to Quoted?", "", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK)
            {
                if (rfqMgr.ChangeRfqState(RfqStatesEnum.Quoted, rfqId))
                {
                    rfqMgr.AddRfqHistory(rfqId, UserInfo.UserId, "Quoted the RFQ");
                    GuiOpAccordingToRfqState(RfqStatesEnum.Quoted);
                }
                else
                {
                    MessageBox.Show("Quote the RFQ Fail");
                }
            }
            Rfq rfq = rfqMgr.GetRfqAccordingToRfqId(rfqId);

            GuiOpAccordingToRfqState((RfqStatesEnum)rfq.rfqStates);
        }
コード例 #28
0
ファイル: SalesRfqItems.cs プロジェクト: hnjm/ShenZhenSystem
        public bool UpdateInfo(int rfqId)
        {
            Rfq rfq = new Rfq();

            GetValuesFromGui(rfq);
            rfq.rfqNo   = rfqId;
            rfq.salesId = mySubs[cbSales.SelectedIndex];
            bool suc;

            try
            {
                suc = rfqMgr.UpdateRfq(rfq);
            }
            catch (Exception ex)
            {
                suc = false;
                Logger.Error(ex.StackTrace);
            }
            return(suc);
        }
コード例 #29
0
        public async Task <ActionResult <Rfq> > Post([FromBody] Rfq obj)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest("Invalid model state"));
            }
            else
            {
                var product = await _context.Product.SingleOrDefaultAsync(p => p.Productid == obj.Productid);

                if (product == null)
                {
                    return(BadRequest("Invalid product"));
                }
                if (obj.Qty < product.Moq)
                {
                    return(BadRequest("Order quantity less than product's MOQ."));
                }

                var cusrfqs   = _context.Rfq.Where(rf => rf.Customer == obj.Customer).Select(rf => rf.Rfqid);
                var cusorders = _context.Orderrequest.Where(co => cusrfqs.Contains(co.Rfqid) && co.Status == "Success");
                //       if (cusorders.Count() >= 3)
                //       {
                //           //choose rep by quality
                //       }
                //       else
                //       {
                //           //select count(rfqid),salesrep from rfqchatlog group by salesrep
                //           // _context.Rfq.GroupBy(rf => rf.Salesrep).Count();
                //           userInfos.GroupBy(userInfo => userInfo.metric)
                //.OrderBy(group => group.Key)
                //.Select(group => Tuple.Create(group.Key, group.Count()));
                //       }
                //       _context.Rfq.GroupBy();
                //       _context.Rfq.Add(obj);
                await _context.SaveChangesAsync();

                return(Created("api/Rfq", obj));
            }
        }
コード例 #30
0
ファイル: SoViewControl.cs プロジェクト: hnjm/AmbleSystem
        private void btAdd_Click(object sender, EventArgs e)
        {
            NewAddItem nai = new NewAddItem(true);

            if (DialogResult.Yes == nai.ShowDialog())
            {
                Rfq rfq = RfqGui.RfqManager.RfqMgr.GetRfqAccordingToRfqId(nai.rfqId);

                SoItems soItem = new SoItems();
                soItem.currencyType = (int)AmbleClient.Currency.USD;
                soItem.unitPrice    = rfq.targetPrice ?? 0;
                soItem.mfg          = rfq.mfg;
                soItem.partNo       = rfq.partNo;
                soItem.rohs         = rfq.rohs;
                soItem.qty          = rfq.qty ?? 0;
                soItem.intPartNo    = rfq.custPartNo;
                soItem.dc           = rfq.dc;
                soItem.dockDate     = rfq.dockdate;
                soItem.rfqId        = nai.rfqId;


                if (isNewCreateSo)
                {
                    soItemsStateList.Add(new SoItemsContentAndState
                    {
                        soitem = soItem,
                        state  = OrderItemsState.New
                    }
                                         );
                }
                else
                {
                    SoMgr.SaveSoItems(this.soId, soItem);
                    GetSoItems();
                }
                ShowDataInDataGridView();
                this.HasItemChange = true;
            }
        }