public ActionResult UpdateItemPriceDetails(CoData Model, int?ViewID, int?CostCodeID, bool?SalesTax, bool?PurchasedTaxed, int?ContactID, decimal?UnitCost, decimal?UnitPrice, decimal?Margin, decimal?Markup, bool?ExcludePor, bool?WarranteePart, bool?OneOffItem, int?SaleUomID, int?OrderUomID, int?LeadTime, int?OrderQty, decimal?OrderPrice) { var errorList = new List <string>(); Model.MasterItemID = (int)ViewID; int MasteritemID = (int?)Model.MasterItemID ?? 0; var item = db.CoData.Where(p => p.MasterItemID == MasteritemID).FirstOrDefault(); var itemPrice = db.CoDataPricing.Where(p => p.MasterItemID == item.MasterItemID).FirstOrDefault(); if (item != null && itemPrice != null) { db.UpdateItemPrice(ViewID, ContactID, item.Discontinued, DateTime.Now.Date, CostCodeID, SaleUomID, OrderUomID, LeadTime, OrderQty, item.OrderingName, item.UseOrderingName, OrderPrice, ExcludePor, item.ExcludeSO, OrderQty, SalesTax, PurchasedTaxed, WarranteePart, OneOffItem, UnitCost, UnitPrice); db.SaveChanges(); itemPrice.Cost = UnitCost; itemPrice.Price = UnitPrice; db.SaveChanges(); return(Json(new { status = "success" })); } else { errorList.Add("Item couldn't be updated. Please retry."); } return(Json(new { status = "error", errors = errorList })); }
private void SearchQueryInput_KeyUp(object sender, KeyEventArgs e) { if (!SearchQueryInput.Text.Equals(string.Empty) && e.Key.Equals(Key.Enter)) { coList.Clear(); ResultListView.Items.Clear(); string result = Network.Request("https://work.mma.go.kr/caisBYIS/search/byjjecgeomsaek.do?eopjong_gbcd=" + (PositionSelector.SelectedIndex + 1) + "&eopche_nm=" + SearchQueryInput.Text); Document doc = NSoup.Parse.Parser.Parse(result, "https://work.mma.go.kr"); Elements elms = doc.Select("th.title.t-alignLt.pl20px"); if (elms.Count.Equals(0)) { ResultListView.Items.Add("조회된 기업 없음"); LoadImageReady(); } foreach (var item in elms) { CoData coData = new CoData(); coData.SetName(item.Text()); coData.SetId(GetMiddleString(item.Select("a").Attr("href"), "byjjeopche_cd=", "&")); coList.Add(coData); ResultListView.Items.Add(coData.GetName() + Environment.NewLine + "기업코드: " + coData.GetId()); } } }
public ActionResult DeleteConfirmed(int id) { CoData coData = db.CoData.Find(id); db.CoData.Remove(coData); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CoData coData = db.CoData.Find(id); if (coData == null) { return(HttpNotFound()); } return(View(coData)); }
public ActionResult Edit(CoData coData, int?ViewID) { if (ModelState.IsValid) { var q = db.CoData.Where(p => p.MasterItemID == ViewID).FirstOrDefault(); q.MasterItemID = (int)ViewID; q.SiteCoID = base.siteusercompanyid; q.GroupID = coData.GroupID; q.ManufacturerID = coData.ManufacturerID; q.Model = coData.Model; q.SKU = coData.SKU; db.SaveChanges(); return(Json(new { status = "success", ViewID = coData.MasterItemID })); } return(View(coData)); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CoData coData = db.CoData.Find(id); ViewBag.Group = new SelectList(db.GetGroupsBySiteCoID(base.siteusercompanyid).ToList(), nameof(GetGroupsBySiteCoID_Result.ViewID), nameof(GetGroupsBySiteCoID_Result.Group), coData.GroupID); ViewBag.Manufacturer = new SelectList(db.GetManufacturersBySiteCoID(base.siteusercompanyid).ToList(), nameof(GetManufacturersBySiteCoID_Result.ViewID), nameof(GetManufacturersBySiteCoID_Result.Name), coData.ManufacturerID); var model = db.GetItemInfoByMasterItemID(coData.MasterItemID).FirstOrDefault(); if (coData == null) { return(HttpNotFound()); } return(PartialView("_Edit", model)); }
private void PositionSelector_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { try { if (!SearchQueryInput.Text.Equals(string.Empty)) { coList.Clear(); ResultListView.Items.Clear(); string result = Network.Request("https://work.mma.go.kr/caisBYIS/search/byjjecgeomsaek.do?eopjong_gbcd=" + (PositionSelector.SelectedIndex + 1) + "&eopche_nm=" + SearchQueryInput.Text); Document doc = NSoup.Parse.Parser.Parse(result, "https://work.mma.go.kr"); Elements elms = doc.Select("th.title.t-alignLt.pl20px"); foreach (var item in elms) { CoData coData = new CoData(); coData.SetName(item.Text()); coData.SetId(GetMiddleString(item.Select("a").Attr("href"), "byjjeopche_cd=", "&")); coList.Add(coData); ResultListView.Items.Add(coData.GetName() + Environment.NewLine + "기업코드: " + coData.GetId()); } } } catch { } }
public ActionResult Create(CoData coData) { if (ModelState.IsValid) { // db.InsertMasterItem(base.siteusercompanyid, coData.GroupID, coData.ManufacturerID, coData.Model, coData.SKU); CoData cdata = new CoData(); cdata.GroupID = coData.GroupID; cdata.ManufacturerID = coData.ManufacturerID; cdata.Model = coData.Model; cdata.SKU = coData.SKU; cdata.SiteCoID = base.siteusercompanyid; cdata.UseOrderingName = coData.UseOrderingName; cdata.Discontinued = coData.Discontinued; db.CoData.Add(cdata); db.SaveChanges(); CoDataPricing coDataPricing = new CoDataPricing(); coDataPricing.MasterItemID = cdata.MasterItemID; db.CoDataPricing.Add(coDataPricing); db.SaveChanges(); return(Json(new { status = "success", ViewID = cdata.MasterItemID })); } return(View(coData)); }