private void rpiArticle_ButtonClick(object sender, ButtonPressedEventArgs e) { var oxf = new xfSearchWarehouseArticle(); oxf.rowsel.COD_ALMA = (int?)lkeCOD_ALMA.EditValue; if (oxf.ShowDialog() == DialogResult.OK) { var olst = (List<BEOutputGoodsDetail>)gdvDetail.DataSource; var exist = olst.Exists(item => item.COD_ARTI == oxf.rowsel.COD_ARTI); if (!exist) { var row = new BEOutputGoodsDetail() { COD_ARTI = oxf.rowsel.COD_ARTI, ALF_CODI_ARTI = oxf.rowsel.ALF_CODI_ARTI, ALF_ARTI = oxf.rowsel.ALF_ARTI, NUM_CANT = 1, COD_ALMA = oxf.rowsel.COD_ALMA, COD_USUA_CREA = SESSION_USER }; gdvDetail.DeleteRow(gdvDetail.FocusedRowHandle); olst.Add(row); gdvDetail.RefreshData(); gdvDetail.MoveLast(); gdvDetail.FocusedColumn = gcNUM_CANT; gdvDetail.ShowEditor(); } else { XtraMessageBox.Show(WhMessage.MsgExistArticle, WhMessage.MsgInsCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }
private void Set_Operation(int index) { try { if (index == 0) { gdvDetail.CloseEditor(); gdvDetail.RefreshData(); var olst = (List<BEOutputGoodsDetail>)gdvDetail.DataSource; var i = 1; olst.ForEach(obej => { var context = new ValidationContext(obej, null, null); var errors = new List<ValidationResult>(); if (!Validator.TryValidateObject(obej, context, errors, true)) { foreach (ValidationResult result in errors) throw new ArgumentException(string.Format("{0}\nFila: {1}", result.ErrorMessage, i)); } i++; }); var obj = new BEOutputGoodsDetail() { COD_USUA_CREA = SESSION_USER }; olst.Add(obj); gdvDetail.RefreshData(); gdvDetail.MoveLast(); gdvDetail.FocusedColumn = gcALF_CODI_ARTI; gdvDetail.ShowEditor(); } else { gdvDetail.DeleteRow(gdvDetail.FocusedRowHandle); gdvDetail.RefreshData(); } } catch (Exception ex) { XtraMessageBox.Show(ex.Message, WhMessage.MsgInsCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void Get_Load() { SESSION_USER = ((xfMain)MdiParent).SESSION_USER; SESSION_PERF = ((xfMain)MdiParent).SESSION_PERF; SESSION_COMP = ((xfMain)MdiParent).SESSION_COMP; var obral = new BRWarehouse(); var oBeM = new BEReason(); oBeM.COD_COMP = SESSION_COMP; oBeM.COD_TIPO_MOTI = 2; oBeM.NUM_ACCI = 4; var obrmo = new BRSVMC_MOTI(); var olsal = obral.Get_PSGN_SPLS_SVMC_ALMA(SESSION_COMP); var olsre = obral.Get_PSGN_SPLS_SVMC_SOCI_NEGO(SESSION_COMP); var olsmo = obrmo.Get_SVPR_MOTI_LIST(oBeM); lkeCOD_ALMA.Properties.DataSource = olsal; lkeCOD_ALMA.Properties.Columns.Clear(); var lkci = new LookUpColumnInfo("ALF_ALMA", "Almacén", 20); lkeCOD_ALMA.Properties.Columns.Add(lkci); lkeCOD_ALMA.Properties.DisplayMember = "ALF_ALMA"; lkeCOD_ALMA.Properties.ValueMember = "COD_ALMA"; lkeCOD_SOCI_NEGO_RESP.Properties.DataSource = olsre; lkeCOD_SOCI_NEGO_RESP.Properties.Columns.Clear(); lkci = new LookUpColumnInfo("ALF_NOMB", "Responsable", 20); lkeCOD_SOCI_NEGO_RESP.Properties.Columns.Add(lkci); lkeCOD_SOCI_NEGO_RESP.Properties.DisplayMember = "ALF_NOMB"; lkeCOD_SOCI_NEGO_RESP.Properties.ValueMember = "COD_SOCI_NEGO"; lkeCOD_MOTI.Properties.DataSource = olsmo; lkeCOD_MOTI.Properties.Columns.Clear(); lkci = new LookUpColumnInfo("ALF_MOTI", "Motivo", 20); lkeCOD_MOTI.Properties.Columns.Add(lkci); lkeCOD_MOTI.Properties.DisplayMember = "ALF_MOTI"; lkeCOD_MOTI.Properties.ValueMember = "COD_MOTI"; var obj = new BEOutputGoodsDetail() { COD_USUA_CREA = SESSION_USER }; var olst = new List<BEOutputGoodsDetail>(); olst.Add(obj); gdcDetail.DataSource = olst; }