private void BindMaterialType() { try { materialtypeBllList = new MaterialTypeBLL(); MaterialType mt = new MaterialType(); materialtypeList = materialtypeBllList.GetAll(); if (materialtypeList.Count > 0) { mt = materialtypeList[0]; materialtypeList[0] = new MaterialType() { MaterialTypeId = 0, _MaterialType = "Other", isActive = true }; materialtypeList.Add(mt); comboMaterialType.DataSource = materialtypeList.Where(x => x.isActive == true).ToList(); comboMaterialType.DisplayMember = "_MaterialType"; } else { materialtypeList = new List <MaterialType>(); materialtypeList.Add(new MaterialType() { MaterialTypeId = 0, _MaterialType = "Other" }); comboMaterialType.DataSource = materialtypeList; comboMaterialType.DisplayMember = "_MaterialType"; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void GetMTLTypeList(string findValue) { List <MaterialType> lstMTLtype = null; try { base.ExecutionStart(); base.BeginProcessing("Begin Load data...", "Please Waiting for Loading Data"); using (MaterialTypeBLL mtlTypeBll = new MaterialTypeBLL()) { lstMTLtype = mtlTypeBll.GetMTLTypeList(findValue); } this.grdMTLType.DataSource = lstMTLtype; this.dntMaterial.DataSource = lstMTLtype; base.ExecutionStop(); } catch (Exception ex) { base.FinishedProcessing(); XtraMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } finally { base.FinishedProcessing(); ((frmMainMenu)this.ParentForm).ExecuteTime.Caption = base.ExecuteTime; } }
private void GetBindingMTLType(string mtlTypeid) { MaterialType mtlType = null; try { using (MaterialTypeBLL mtlTypeBll = new MaterialTypeBLL()) { mtlType = mtlTypeBll.GetMTLType(mtlTypeid); } if (mtlType != null) { this.txtSEQ_NO.Text = mtlType.SEQ_NO; this.txtNAME.Text = mtlType.NAME; this.txtREMARK.Text = mtlType.REMARK; this.icbREC_STAT.EditValue = mtlType.REC_STAT; } else { this.ClearDataOnScreen(); XtraMessageBox.Show(this, "No Data found.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); } } catch (Exception ex) { XtraMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } }
public async Task <IActionResult> GetMaterialType() { try { if (_cache.TryGetValue("CACHE_MASTER_MATERIALTYPE", out List <M_MaterialType> c_lstMatType)) { return(Json(new { data = c_lstMatType })); } MemoryCacheEntryOptions options = new MemoryCacheEntryOptions { AbsoluteExpirationRelativeToNow = TimeSpan.FromSeconds(300), SlidingExpiration = TimeSpan.FromSeconds(60), Priority = CacheItemPriority.NeverRemove }; using (var matTypeBll = new MaterialTypeBLL()) { var lstMatType = await matTypeBll.GetMaterialType(null); _cache.Set("CACHE_MASTER_MATERIALTYPE", lstMatType, options); return(Json(new { data = lstMatType })); } } catch (Exception ex) { return(BadRequest(new { success = false, message = ex.Message })); } //using (var matTypeBll = new MaterialTypeBLL()) //{ // return Json(new { data = await matTypeBll.GetMaterialType(null) }); //} }
public InsertNewMaterialType() { InitializeComponent(); mtbll = new MaterialTypeBLL(); mt = new MaterialType(); mtValidate = new MaterialTypeValidation(); }
public void GetMaterialtypeList() { List <MaterialType> lstMtlType = null; try { base.BeginProcessing("Begin Load data...", "Please Waiting for Loading Data"); using (MaterialTypeBLL mtltypeBll = new MaterialTypeBLL()) { lstMtlType = mtltypeBll.GetMTLTypeList(string.Empty); } this.grdMaterial.DataSource = lstMtlType; } catch (Exception ex) { base.FinishedProcessing(); XtraMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } finally { base.FinishedProcessing(); } }
public async Task <IActionResult> UploadModelData(List <M_MaterialType> lstMatType) { var uId = await base.CurrentUserId(); lstMatType.ForEach(m => { m.Created_By = uId; }); try { using (var matTypeBll = new MaterialTypeBLL()) { var rowaffected = await matTypeBll.BulkInsertMaterialType(lstMatType); _cache.Remove("CACHE_MASTER_MATERIALTYPE"); } return(Json(new { success = true, data = lstMatType, message = "Import Success." })); } catch (Exception ex) { return(Json(new { success = false, data = lstMatType, message = ex.Message })); } }
public async Task <IActionResult> Edit([Bind("MatTypeCode,MatTypeName,MatTypeDesc,CompanyCode,Id,Is_Active,Created_Date,Created_By,Updated_Date,Updated_By")] M_MaterialType m_MaterialType) { if (ModelState.IsValid) { m_MaterialType.Updated_By = await base.CurrentUserId(); ResultObject resultObj; try { using (var matTypeBll = new MaterialTypeBLL()) { resultObj = await matTypeBll.UpdateMaterialType(m_MaterialType); _cache.Remove("CACHE_MASTER_MATERIALTYPE"); } return(Json(new { success = true, data = (M_MaterialType)resultObj.ObjectValue, message = "Material Type Update." })); } catch (Exception ex) { return(Json(new { success = false, data = m_MaterialType, 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_MaterialType, message = "Update Failed" })); }
public async Task <IActionResult> DeleteConfirmed(int?id) { if (id == null) { return(NotFound()); } ResultObject resultObj; try { if (_cache.TryGetValue("CACHE_MASTER_MATERIALTYPE", out List <M_MaterialType> c_lstMatType)) { var m_MaterialType = c_lstMatType.Find(m => m.Id == id); if (m_MaterialType == null) { return(NotFound()); } m_MaterialType.Updated_By = await base.CurrentUserId(); using (var matTypeBll = new MaterialTypeBLL()) { resultObj = await matTypeBll.DeleteMaterialType(m_MaterialType); _cache.Remove("CACHE_MASTER_MATERIALTYPE"); } return(Json(new { success = true, data = (M_MaterialType)resultObj.ObjectValue, message = "Material Type Deleted." })); } using (var matTypeBll = new MaterialTypeBLL()) { var lstMatType = await matTypeBll.GetMaterialType(id); var m_MaterialType = lstMatType.First(); if (m_MaterialType == null) { return(NotFound()); } m_MaterialType.Updated_By = await base.CurrentUserId(); resultObj = await matTypeBll.DeleteMaterialType(m_MaterialType); _cache.Remove("CACHE_MASTER_MATERIALTYPE"); } return(Json(new { success = true, data = (M_MaterialType)resultObj.ObjectValue, message = "Material 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 UpdateMachine() { string result = string.Empty; try { this.Cursor = Cursors.WaitCursor; MaterialType mtlType = new MaterialType(); mtlType.SEQ_NO = this.txtSEQ_NO.Text; mtlType.NAME = this.txtNAME.Text; mtlType.REMARK = this.txtREMARK.Text; mtlType.REC_STAT = (bool)this.icbREC_STAT.EditValue; using (MaterialTypeBLL mtlTypeBll = new MaterialTypeBLL()) { result = mtlTypeBll.UpdateMTLType(mtlType, ((frmMainMenu)this.ParentForm).UserID); } if (result.Equals("OK")) { GridView view = (GridView)this.grdMTLType.Views[0]; view.BeginDataUpdate(); view.SetFocusedRowCellValue("NAME", mtlType.NAME); view.SetFocusedRowCellValue("REMARK", mtlType.REMARK); view.SetFocusedRowCellValue("REC_STAT", mtlType.REC_STAT); view.EndDataUpdate(); NotifierResult.Show("Update Complete", "Result", 50, 1000, 50, NotifyType.Safe); } else { NotifierResult.Show(result, "Error", 100, 1000, 0, NotifyType.Warning); } } catch (Exception ex) { this.Cursor = Cursors.Default; NotifierResult.Show(ex.Message, "Error", 100, 1000, 0, NotifyType.Warning); } finally { this.Cursor = Cursors.Default; this.FormState = eFormState.ReadOnly; } }
public void GetMaterialtypeListSearchValue(string search) { List <MaterialType> lstMtlType = null; try { using (MaterialTypeBLL mtltypeBll = new MaterialTypeBLL()) { lstMtlType = mtltypeBll.GetMTLTypeList(search); } this.grdMaterial.DataSource = lstMtlType; } catch (Exception ex) { XtraMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } }
// GET: Master/MaterialType/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_MATERIALTYPE", out List <M_MaterialType> c_lstMatType)) { var m_MaterialType = c_lstMatType.Find(m => m.Id == id); if (m_MaterialType == null) { return(NotFound()); } return(PartialView(m_MaterialType)); } using (var matTypeBll = new MaterialTypeBLL()) { var lstMatType = await matTypeBll.GetMaterialType(id); var m_MaterialType = lstMatType.First(); if (m_MaterialType == null) { return(NotFound()); } return(PartialView(m_MaterialType)); } } catch (Exception ex) { return(BadRequest(new { success = false, message = ex.Message })); } }
private void BindMaterialType(MaterialType materialtype) { try { materialtypeBllList = new MaterialTypeBLL(); MaterialType mt = new MaterialType(); materialtypeList = materialtypeBllList.GetAll(); if (materialtypeList.Count > 0) { mt = materialtypeList[0]; materialtypeList[0] = materialtype; materialtypeList.Add(mt); comboMaterialType.DataSource = materialtypeList.ToList(); comboMaterialType.DisplayMember = "_MaterialType"; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void InsertMachine() { string result = string.Empty; try { this.Cursor = Cursors.WaitCursor; MaterialType mtlType = new MaterialType(); mtlType.SEQ_NO = this.txtSEQ_NO.Text; mtlType.NAME = this.txtNAME.Text; mtlType.REMARK = this.txtREMARK.Text; mtlType.REC_STAT = (bool)this.icbREC_STAT.EditValue; using (MaterialTypeBLL mtlTypeBll = new MaterialTypeBLL()) { result = mtlTypeBll.InsertMTLType(mtlType, ((frmMainMenu)this.ParentForm).UserID); } if (result.Equals("OK")) { NotifierResult.Show("Insert Complete", "Result", 50, 1000, 50, NotifyType.Safe); } else { NotifierResult.Show(result, "Error", 100, 1000, 0, NotifyType.Warning); } } catch (Exception ex) { this.Cursor = Cursors.Default; NotifierResult.Show(ex.Message, "Error", 100, 1000, 0, NotifyType.Warning); } finally { this.Cursor = Cursors.Default; this.FormState = eFormState.ReadOnly; this.GetMTLTypeList(string.Empty); if (result.Equals("OK")) { GridView viewList = (GridView)this.grdMTLType.Views[0]; viewList.ClearSorting(); int position = UiUtility.GetRowHandleByColumnValue(viewList, "SEQ_NO", this.txtSEQ_NO.Text); if (position != 0) { if (position != GridControl.InvalidRowHandle) { this.dntMaterial.Position = position; } } else { viewList.FocusedRowHandle = 0; } } } }
private void DashboardForm_Load(object sender, EventArgs e) { subscriberBLL = new SubscriberBLL(); borrbll = new BorrowBLL(); mtbll = new MaterialTypeBLL(); mbll = new MaterialBLL(); try { MonthBorrowStatistics = borrbll.Last12MonthBorrowStatistics(); subscribers = subscriberBLL.BestSubscribers().ToList(); materialList = mbll.GetAll(); chartMaterials.Dock = DockStyle.Fill; Series series = new Series("Material", ViewType.Line); series.DataSource = MonthBorrowStatistics; series.ArgumentDataMember = "Month"; series.ValueDataMembers.AddRange("BorrowingsCount"); chartMaterials.Series.Add(series); LineSeriesView view = (LineSeriesView)series.View; view.MarkerVisibility = DevExpress.Utils.DefaultBoolean.True; series.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; series.Label.ResolveOverlappingMode = ResolveOverlappingMode.HideOverlapped; // Create a chart title. ChartTitle chartTitle = new ChartTitle(); chartTitle.Text = "Months Timeline"; chartMaterials.Titles.Add(chartTitle); // Customize axes. XYDiagram diagram = chartMaterials.Diagram as XYDiagram; diagram.AxisX.DateTimeScaleOptions.GridSpacing = 9; diagram.AxisX.WholeRange.SideMarginsValue = 0.5; diagram.AxisY.WholeRange.AlwaysShowZeroLevel = false; // Hide a legend if necessary. chartMaterials.Legend.Visibility = DevExpress.Utils.DefaultBoolean.False; } catch (Exception) { } //SideBySide chart //ChartControl sideBySideBarChart = chartMaterials; //Series series1 = new Series("Side-by-Side Bar Series 1", ViewType.Pie3D); //series1.DataSource = materialList; //series1.ArgumentDataMember = "Title"; //series1.ValueDataMembers.AddRange("MaterialId"); //sideBySideBarChart.Series.Add(series1); //sideBySideBarChart.Legend.Visibility = DevExpress.Utils.DefaultBoolean.True; //((XYDiagram)sideBySideBarChart.Diagram).Rotated = true; //ChartTitle chartTitle1 = new ChartTitle(); //chartTitle1.Text = "Side-by-Side Bar Chart"; //sideBySideBarChart.Titles.Add(chartTitle1); //Add the chart to the form. //sideBySideBarChart.Dock = DockStyle.Left; try { materials = mbll.MostBorrowedBooks(); Series serie = new Series("Materials", ViewType.Bar); serie.ArgumentScaleType = ScaleType.Qualitative; serie.ValueScaleType = ScaleType.Numerical; serie.ArgumentDataMember = "Title"; serie.ValueDataMembers.AddRange("Borrowings"); chartMostBorrowedMaterials.Series.Add(serie); chartMostBorrowedMaterials.DataSource = materials; } catch (Exception) { } // PIE CHART => try { mts = mtbll.MostBorrowedMaterialTypes(); piechart.Titles.Add(new ChartTitle() { Text = "MaterialTypes" }); Series series1 = new Series("Most borrowed MaterialTypes", ViewType.Pie); series1.DataSource = mts; series1.ArgumentDataMember = "_MaterialType"; series1.ValueDataMembers.AddRange("Borrowings"); piechart.Series.Add(series1); series1.LegendTextPattern = "{A}"; ((PieSeriesLabel)series1.Label).Position = PieSeriesLabelPosition.TwoColumns; ((PieSeriesLabel)series1.Label).ResolveOverlappingMode = ResolveOverlappingMode.Default; PieSeriesView myView = (PieSeriesView)series1.View; // Specify a data filter to explode points. myView.ExplodedPointsFilters.Add(new SeriesPointFilter(SeriesPointKey.Value_1, DataFilterCondition.GreaterThanOrEqual, 9)); myView.ExplodedPointsFilters.Add(new SeriesPointFilter(SeriesPointKey.Argument, DataFilterCondition.NotEqual, "Others")); myView.ExplodeMode = PieExplodeMode.UseFilters; myView.ExplodedDistancePercentage = 30; myView.RuntimeExploding = true; // Customize the legend. piechart.Legend.Visibility = DevExpress.Utils.DefaultBoolean.True; // Add the chart to the form. piechart.Dock = DockStyle.Fill; } catch (Exception) { } }