private void Get_Load() { var obr = new BRModelArticle(); var olst = obr.Get_PSGN_SPLS_SVMC_MODE_ARTI(xfMain.SgIns.SESSION_COMP); if (olst.Count == 0) { var obj = new BEModelArticle() { IND_MNTN = 1, COD_USUA_CREA = xfMain.SgIns.SESSION_USER }; olst.Add(obj); } gdcGeneric.DataSource = olst; BeginInvoke(new MethodInvoker(() => { gdvGeneric.MoveLast(); gdvGeneric.FocusedColumn = gdvGeneric.VisibleColumns[1]; gdvGeneric.ShowEditor(); })); }
private void Get_Load() { SESSION_USER = ((xfMain)MdiParent).SESSION_USER; SESSION_PERF = ((xfMain)MdiParent).SESSION_PERF; SESSION_COMP = ((xfMain)MdiParent).SESSION_COMP; var obrt = new BRTypeArticle(); var oltp = obrt.Get_PSGN_SPLS_SVMC_TIPO_ARTI(SESSION_COMP); lkeCOD_TIPO_ARTI.Properties.DataSource = oltp; lkeCOD_TIPO_ARTI.Properties.Columns.Clear(); var lkci = new LookUpColumnInfo("ALF_TIPO_ARTI", "Tipos de Artículo", 20); lkeCOD_TIPO_ARTI.Properties.Columns.Add(lkci); lkeCOD_TIPO_ARTI.Properties.DisplayMember = "ALF_TIPO_ARTI"; lkeCOD_TIPO_ARTI.Properties.ValueMember = "COD_TIPO_ARTI"; var obrm = new BRModelArticle(); var olmp = obrm.Get_PSGN_SPLS_SVMC_MODE_ARTI(SESSION_COMP); lkeCOD_MODE_ARTI.Properties.DataSource = olmp; lkeCOD_MODE_ARTI.Properties.Columns.Clear(); lkci = new LookUpColumnInfo("ALF_MODE_ARTI", "Modelos de Artículo", 20); lkeCOD_MODE_ARTI.Properties.Columns.Add(lkci); lkeCOD_MODE_ARTI.Properties.DisplayMember = "ALF_MODE_ARTI"; lkeCOD_MODE_ARTI.Properties.ValueMember = "COD_MODE_ARTI"; StateControls(true); }
private void Set_Save() { MessageBoxIcon msgIcon = MessageBoxIcon.Warning; try { gdvGeneric.CloseEditor(); gdvGeneric.RefreshData(); var olst = (List<BEModelArticle>)gdvGeneric.DataSource; var i = 1; olst.ForEach(item => { var context = new ValidationContext(item, null, null); var errors = new List<ValidationResult>(); if (!Validator.TryValidateObject(item, context, errors, true)) { foreach (ValidationResult result in errors) { msgIcon = MessageBoxIcon.Warning; throw new ArgumentException(string.Format("{0}\nFila: {1}", result.ErrorMessage, i)); } } i++; }); var obr = new BRModelArticle(); var obej = new BEModelArticle(); obr.Set_PSGN_SPMT_SVMC_MODE_ARTI(obej, olst); if (!string.IsNullOrWhiteSpace(obej.MSG_MNTN)) { msgIcon = MessageBoxIcon.Error; throw new ArgumentException(obej.MSG_MNTN); } olst.RemoveAll(item => item.IND_MNTN == 3); olst.ForEach(item => item.IND_MNTN = 0); gdvGeneric.RefreshData(); XtraMessageBox.Show(WhMessage.MsgSuccessfully, WhMessage.MsgInsCaption, MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { XtraMessageBox.Show(ex.Message, WhMessage.MsgInsCaption, MessageBoxButtons.OK, msgIcon); } }