public async Task <IActionResult> Edit([Bind("ProdTypeCode,ProdTypeName,ProdTypeDesc,ProdTypeSeq,CompanyCode,Id,Is_Active,Created_Date,Created_By,Updated_Date,Updated_By")] M_ProductionType m_ProductionType) { if (ModelState.IsValid) { m_ProductionType.Updated_By = await base.CurrentUserId(); ResultObject resultObj; try { using (var prodTypeBll = new ProductionTypeBLL()) { resultObj = await prodTypeBll.UpdateProductionType(m_ProductionType); _cache.Remove("CACHE_MASTER_PRODUCTIONTYPE"); } return(Json(new { success = true, data = (M_ProductionType)resultObj.ObjectValue, message = "Production Type Update." })); } catch (Exception ex) { return(Json(new { success = false, data = m_ProductionType, message = ex.Message })); } } var err = ModelState.Values.SelectMany(x => x.Errors).Select(x => x.ErrorMessage).ToList(); return(Json(new { success = false, errors = err, data = m_ProductionType, message = "Update Failed" })); }
public async Task <IActionResult> GetProductionType() { try { if (_cache.TryGetValue("CACHE_MASTER_PRODUCTIONTYPE", out List <M_ProductionType> c_lstProdType)) { return(Json(new { data = c_lstProdType })); } MemoryCacheEntryOptions options = new MemoryCacheEntryOptions { AbsoluteExpirationRelativeToNow = TimeSpan.FromSeconds(300), SlidingExpiration = TimeSpan.FromSeconds(60), Priority = CacheItemPriority.NeverRemove }; using (var prodTypeBll = new ProductionTypeBLL()) { var lstProdType = await prodTypeBll.GetProductionType(null); _cache.Set("CACHE_MASTER_PRODUCTIONTYPE", lstProdType, options); return(Json(new { data = lstProdType })); } } catch (Exception ex) { return(BadRequest(new { success = false, message = ex.Message })); } //using (var prodTypeBll = new ProductionTypeBLL()) //{ // return Json(new { data = await prodTypeBll.GetProductionType(null) }); //} }
public async Task <IActionResult> DeleteConfirmed(int?id) { if (id == null) { return(NotFound()); } ResultObject resultObj; try { if (_cache.TryGetValue("CACHE_MASTER_PRODUCTIONTYPE", out List <M_ProductionType> c_lstProdType)) { var m_ProductionType = c_lstProdType.Find(p => p.Id == id); if (m_ProductionType == null) { return(NotFound()); } m_ProductionType.Updated_By = await base.CurrentUserId(); using (var prodTypeBll = new ProductionTypeBLL()) { resultObj = await prodTypeBll.DeleteProductionType(m_ProductionType); _cache.Remove("CACHE_MASTER_PRODUCTIONTYPE"); } return(Json(new { success = true, data = (M_ProductionType)resultObj.ObjectValue, message = "Production Type Deleted." })); } using (var prodTypeBll = new ProductionTypeBLL()) { var lstProdType = await prodTypeBll.GetProductionType(id); var m_ProductionType = lstProdType.First(); if (m_ProductionType == null) { return(NotFound()); } m_ProductionType.Updated_By = await base.CurrentUserId(); await base.CurrentUserId(); resultObj = await prodTypeBll.DeleteProductionType(m_ProductionType); _cache.Remove("CACHE_MASTER_PRODUCTIONTYPE"); } return(Json(new { success = true, data = (M_ProductionType)resultObj.ObjectValue, message = "Production Type Deleted." })); } catch (Exception ex) { return(Json(new { success = false, message = ex.Message })); } }
private void InitializaLOVData() { this._emptyImage = base.Language.GetBitmap("EmptyImage"); try { using (ProductBLL pdBll = new ProductBLL()) { List <Unit> lstUnit = pdBll.GetUnitList(); if (lstUnit != null) { this.lueUNIT.Properties.DataSource = lstUnit; if (lstUnit.Count > 0) { Unit unitTemp = lstUnit.Find(delegate(Unit _unit) { return(_unit.SEQ_NO == "PCS"); }); if (unitTemp != null) { this.lueUNIT.EditValue = unitTemp.SEQ_NO; } else { //default this.lueUNIT.EditValue = lstUnit[0].SEQ_NO; } } } } using (MachineBLL mcBll = new MachineBLL()) { this.lstMachine = mcBll.GetMachineList(string.Empty); } using (ProductionTypeBLL pdtBll = new ProductionTypeBLL()) { this.lstProductionType = pdtBll.GetProductionTypeList(); } using (MaterialTypeBLL mtltypeBll = new MaterialTypeBLL()) { this.lstMtlType = mtltypeBll.GetMTLTypeList(string.Empty); } this.grvProduct_rps_lueMACHINE.DataSource = this.lstMachine; this.grvProduct_rps_lueMATERIAL_TYPE.DataSource = this.lstMtlType; this.grvProduct_rps_luePRODUCTION_TYPE.DataSource = this.lstProductionType; this.luePRODUCTION_TYPE.Properties.DataSource = this.lstProductionType; } catch (Exception ex) { XtraMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } }
private void InitializaLOVData() { try { //for warehouse using (QueryBLL queryBll = new QueryBLL()) { List <Warehouse> lstWH = queryBll.GetWarehouse(); if (lstWH != null) { lstWH.Insert(0, new Warehouse { SEQ_NO = string.Empty, NAME = "(All)" }); this.lueWarehouse.Properties.DataSource = lstWH; this.rps_lueWH.DataSource = lstWH; } } //for party using (PartyBLL partyBll = new PartyBLL()) { List <Party> lstParty = partyBll.LovPratyList("C", string.Empty); lstParty.Insert(0, new Party { PARTY_ID = string.Empty, PARTY_NAME = "(All)" }); this.lueCUSTOMER.Properties.DataSource = lstParty; } //for In Type using (ProductionTypeBLL pdtBll = new ProductionTypeBLL()) { List <UnplanInType> lstUnplanInType = pdtBll.GetUnplanInTypeList(); if (lstUnplanInType != null) { lstUnplanInType.Add(new UnplanInType() { SEQ_NO = "N", NAME = "PRODUCTION" }); lstUnplanInType.Add(new UnplanInType() { SEQ_NO = "R", NAME = "QC RETURN" }); } this.rps_lueInType.DataSource = lstUnplanInType; } } catch (Exception ex) { XtraMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } }
private void InitializaLOVData() { try { List <ProductionType> lstProductionType; using (ProductionTypeBLL pdtBll = new ProductionTypeBLL()) { lstProductionType = pdtBll.GetProductionTypeList(); } this.luePRODUCTION_TYPE.Properties.DataSource = lstProductionType; } catch (Exception ex) { XtraMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } }
private void InitializaLOVData() { try { using (ProductionTypeBLL pdtBll = new ProductionTypeBLL()) { List <ProductionType> lstProdType = pdtBll.GetProductionTypeList(); lstProdType.Insert(0, new ProductionType { SEQ_NO = string.Empty, NAME = "(All)" }); this.luePRODUCTION_TYPE.Properties.DataSource = lstProdType; } } catch (Exception ex) { XtraMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } }
// GET: Master/ProductionType/Edit/5 public async Task <IActionResult> Edit(int?id) { if (id == null) { return(NotFound()); } ViewBag.CompCode = await base.CurrentUserComp(); try { if (_cache.TryGetValue("CACHE_MASTER_PRODUCTIONTYPE", out List <M_ProductionType> c_lstProdType)) { var m_ProductionType = c_lstProdType.Find(p => p.Id == id); if (m_ProductionType == null) { return(NotFound()); } return(PartialView(m_ProductionType)); } using (var prodTypeBll = new ProductionTypeBLL()) { var lstProdType = await prodTypeBll.GetProductionType(id); var m_ProductionType = lstProdType.First(); if (m_ProductionType == null) { return(NotFound()); } return(PartialView(m_ProductionType)); } } catch (Exception ex) { return(BadRequest(new { success = false, message = ex.Message })); } }
private void InitializaLOVData() { try { //for post type using (InterfaceDataBLL inDataBll = new InterfaceDataBLL()) { List <PostType> lstPostType = inDataBll.PostTypeList(); if (lstPostType != null) { lstPostType.Insert(0, new PostType { SEQ_NO = string.Empty, NAME = "(All)" }); this.luePostType.Properties.DataSource = lstPostType; //set defautl this.luePostType.EditValue = "NEW"; } List <Warehouse> lstWH = inDataBll.GetWarehouse(); if (lstWH != null) { lstWH.Insert(0, new Warehouse { SEQ_NO = string.Empty, NAME = "(All)" }); this.lueWarehouse.Properties.DataSource = lstWH; } } using (ProductionTypeBLL pdtBll = new ProductionTypeBLL()) { this.grvAsmIn_rps_PRODUCTION_TYPE.DataSource = pdtBll.GetProductionTypeList(); } } catch (Exception ex) { XtraMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } }
private void InitializaLOVProductionType() { List <ProductionType> lstProductionType = null; try { using (ProductionTypeBLL pdtTypeBll = new ProductionTypeBLL()) { lstProductionType = pdtTypeBll.GetProductionTypeList(); } if (lstProductionType != null) { //for productionTypeList this.lueProductType.Properties.DataSource = lstProductionType; this.grvMachine_rps_lueMACHINE_TYPE.DataSource = lstProductionType; this.lueMACHINE_TYPE.Properties.DataSource = lstProductionType; } } catch (Exception ex) { XtraMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } }
private void InitializaLOVData() { try { using (ProductionTypeBLL pdtBll = new ProductionTypeBLL()) { List <ProductionType> lstProdType = pdtBll.GetProductionTypeList(); lstProdType.Insert(0, new ProductionType { SEQ_NO = string.Empty, NAME = "(All)" }); this.luePRODUCTION_TYPE.Properties.DataSource = lstProdType; } using (MachineBLL mcBll = new MachineBLL()) { List <Machine> lstMachine = mcBll.GetMachineList(string.Empty); lstMachine.Insert(0, new Machine { MC_NO = string.Empty, MACHINE_NAME = "(All)" }); this.lueMC_NO.Properties.DataSource = lstMachine; } using (PartyBLL partyBll = new PartyBLL()) { List <Party> lstParty = partyBll.LovPratyList("C", string.Empty); lstParty.Insert(0, new Party { PARTY_ID = string.Empty, PARTY_NAME = "(All)" }); this.lueCUSTOMER.Properties.DataSource = lstParty; } } catch (Exception ex) { XtraMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } }