/** * Returns first repetition of ROL (Role) - creates it if necessary */ public ROL getROL() { ROL ret = null; try { ret = (ROL)this.get_Renamed("ROL"); } catch (HL7Exception e) { HapiLogFactory.getHapiLog(GetType()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e); throw new System.Exception("An unexpected error ocurred", e); } return(ret); }
/* * * public USUARIO UsuarioViewToUsuario(UsuarioViewModel model) * { * USUARIO user = new USUARIO(); * user.RUT_USUARIO = model.RUT_USUARIO; * user.NOMBRE_USUARIO = model.NOMBRE_USUARIO; * user.APELLIDO_USUARIO = model.APELLIDO_USUARIO; * user.EMAIL_USUARIO = model.EMAIL_USUARIO; * user.PASSWORD = model.Password; * user.ROL_ID_ROL = model.Rol; * * return user; * }*/ public bool eliminarRol(int idRol) { ROL user = this.buscarRol(idRol); if (user != null) { this.context.ROL.Remove(user); this.context.SaveChanges(); return(true); } else { return(false); } }
// GET: EQUIPO/Edit/5 public ActionResult Edit(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ROL rOL = db.ROL.Find(id); if (rOL == null) { return(HttpNotFound()); } ViewBag.cedulaPK = new SelectList(db.EMPLEADO, "cedulaPK", "nombre", rOL.cedulaPK); ViewBag.idProyectoPK = new SelectList(db.PROYECTO, "idProyectoPK", "cedulaClienteFK", rOL.idProyectoPK); return(View(rOL)); }
public static ROL buscarRol(string rol) { using (EasyLifeEntities dbc = new EasyLifeEntities()) { ROL aux = (from u in dbc.ROL where u.DESCRIPCION_ROL == rol select u).SingleOrDefault(); if (aux != null) { return(aux); } else { return(null); } } }
public object getElement(object element) { object res = null; using (var entitie = new TAE2Entities()) { ROL Rol = (ROL)element; var query = (from cust in entitie.ROLs where cust.UNID_ROL == Rol.UNID_ROL select cust).ToList(); if (query.Count > 0) { res = query; } return(res); } }
public ROL Save(ROL rol) { int retorno = 0; ROL oRol = null; try { using (MyContext ctx = new MyContext()) { ctx.Configuration.LazyLoadingEnabled = false; oRol = GetRolByID(rol.Id); if (oRol == null) { ctx.ROL.Add(rol); retorno = ctx.SaveChanges(); } else { ctx.ROL.Add(rol); ctx.Entry(rol).State = EntityState.Modified; retorno = ctx.SaveChanges(); } } if (retorno >= 0) { oRol = GetRolByID(rol.Id); } return(oRol); } catch (DbUpdateException dbEx) { string mensaje = ""; Log.Error(dbEx, System.Reflection.MethodBase.GetCurrentMethod(), ref mensaje); throw new Exception(mensaje); } catch (Exception ex) { string mensaje = ""; Log.Error(ex, System.Reflection.MethodBase.GetCurrentMethod(), ref mensaje); throw; } }
public ActionResult Kaydet(ROL rol) { if (rol.ID == 0) { db.ROL.Add(rol); } else { var guncellerol = db.ROL.Find(rol.ID); if (guncellerol == null) { return(HttpNotFound()); } guncellerol.ROLADI = rol.ROLADI; } db.SaveChanges(); return(RedirectToAction("Index", "ROL")); }
private bool PopulateDoctor() { var ProviderRole = "PP"; var ProviderType = "GMPRC"; ISegment TargetRolSegment = null; foreach (var ROL in Msg.SegmentList("ROL")) { if (ROL.Field(3).Component(1).AsString.ToUpper() == ProviderRole && ROL.Field(9).Component(1).AsString.ToUpper() == ProviderType) { TargetRolSegment = ROL; } } if (TargetRolSegment == null) { //It is not an error to have no doctor, at least this is true for RMH DomainModel.Doctor = null; return(true); } else { DomainModel.Doctor.Given = TargetRolSegment.Field(4).Component(3).AsString; DomainModel.Doctor.Family = TargetRolSegment.Field(4).Component(2).AsString; //Doctor Address //(1: Business, 2: Mailing Address, 3:Temporary Address, 4:Residential/Home, 9: Not Specified) //At RMH we had issues in that we got many addresses and could not pick the one required for the current primary doctor surgery //This was resolved and the PMI is to now only send a single address that being the correct address. //For this reason I have changes the code below to just take the first address regardless of there being many, which there should not be. //If we did not get the target address then just take the first address. if (TargetRolSegment.Element(11).RepeatCount > 0) { ResolveAddress(TargetRolSegment.Element(11), DomainModel.Doctor.Address); } //Doctor Contacts (We only take the first of each type. ResolveContact(TargetRolSegment.Element(12), DomainModel.Doctor.Contact, PhoneUseType.Work.GetLiteral()); return(true); } }
public ActionResult Rol(ROL poRol) { lsUsuario = User.Identity.Name.Split('_'); try { if (string.IsNullOrEmpty(poRol.Descripcion)) { ModelState.AddModelError("ErrorDescripcion", "El Campo Descripción es obligatorio"); } if (string.IsNullOrEmpty(poRol.EstadoRegistro)) { ModelState.AddModelError("ErrorEstado", "El Campo Estado es obligatorio"); } if (ModelState.IsValid) { clsDRol poOpcion = new clsDRol(); string psMensaje = poOpcion.GuardarRol(poRol, lsUsuario[0], Request.UserHostAddress); SetSuccessMessage(psMensaje); return(RedirectToAction("Rol")); } else { return(View(poRol)); } } catch (DbEntityValidationException e) { clsDError = new clsDError(); lsUsuario = User.Identity.Name.Split('_'); string Mensaje = clsDError.ControlError(lsUsuario[0], Request.UserHostAddress, this.ControllerContext.RouteData.Values["controller"].ToString(), "Metodo: " + this.ControllerContext.RouteData.Values["action"].ToString(), null, e); SetErrorMessage(Mensaje); return(RedirectToAction("Rol")); } catch (Exception ex) { clsDError = new clsDError(); lsUsuario = User.Identity.Name.Split('_'); string Mensaje = clsDError.ControlError(lsUsuario[0], Request.UserHostAddress, this.ControllerContext.RouteData.Values["controller"].ToString(), "Metodo: " + this.ControllerContext.RouteData.Values["action"].ToString(), ex, null); SetErrorMessage(Mensaje); return(RedirectToAction("Rol")); } }
public ActionResult Create(ROL model) { if (ModelState.IsValid) { if (context.insertarRol(model)) { return(RedirectToAction("Index")); } else { ModelState.AddModelError(string.Empty, "Usuario ya existe"); return(View(model)); } } else { return(View(model)); } }
public void insertElementSync(object element) { if (element != null) { using (var entity = new TAE2Entities()) { ROL rol = (ROL)element; //Sync var modifiedSync = entity.SYNCs.First(p => p.UNID_SYNC == 20120101000000000); modifiedSync.ACTUAL_DATE = UNID.getNewUNID(); entity.SaveChanges(); // entity.ROLs.AddObject(rol); entity.SaveChanges(); } } }
public Rol(ROL r, USUARIO uu) { this.UnidRol = r.UNID_ROL; this.Name = r.ROL_NAME; this.IsActive = r.IS_ACTIVE; this.IsModified = r.IS_MODIFIED; this.IsSystemRol = r.IS_SYSTEM_ROOL; this.RecibirMails = r.RECIBIR_MAILS; UsuariosCollection = new ObservableCollection <User>(); MenuCollection = new ObservableCollection <Menu>(); foreach (USUARIO_ROL ur in r.USUARIO_ROL) { if (ur.IS_ACTIVE) { User u = new User(); u.Actived = true; u.Mail = ur.USUARIO.USUARIO_MAIL; u.UnidUser = ur.USUARIO.UNID_USUARIO; UsuariosCollection.Add(u); } } foreach (ROL_MENU rm in r.ROL_MENU) { if (rm.IS_ACTIVE) { Menu m = new Menu(); m.Actived = true; m.MenuName = rm.MENU.MENU_NAME; m.UnidMenu = rm.MENU.UNID_MENU; MenuCollection.Add(m); } } this.ActualUser = uu; }
// GET: Roles/Details/5 public ActionResult Details(int?id) { int pagina = 613; //ID EN BASE DE DATOS using (TAT001Entities db = new TAT001Entities()) { string u = User.Identity.Name; //string u = "admin"; var user = db.USUARIOs.Where(a => a.ID.Equals(u)).FirstOrDefault(); ViewBag.permisos = db.PAGINAVs.Where(a => a.ID.Equals(user.ID)).ToList(); ViewBag.carpetas = db.CARPETAVs.Where(a => a.USUARIO_ID.Equals(user.ID)).ToList(); ViewBag.usuario = user; ViewBag.returnUrl = Request.Url.PathAndQuery;; ViewBag.rol = user.PUESTO.PUESTOTs.Where(a => a.SPRAS_ID.Equals(user.SPRAS_ID)).FirstOrDefault().TXT50; ViewBag.Title = db.PAGINAs.Where(a => a.ID.Equals(pagina)).FirstOrDefault().PAGINATs.Where(b => b.SPRAS_ID.Equals(user.SPRAS_ID)).FirstOrDefault().TXT50; ViewBag.warnings = db.WARNINGVs.Where(a => (a.PAGINA_ID.Equals(pagina) || a.PAGINA_ID.Equals(0)) && a.SPRAS_ID.Equals(user.SPRAS_ID)).ToList(); ViewBag.textos = db.TEXTOes.Where(a => (a.PAGINA_ID.Equals(pagina) || a.PAGINA_ID.Equals(0)) && a.SPRAS_ID.Equals(user.SPRAS_ID)).ToList(); try { string p = Session["pais"].ToString(); ViewBag.pais = p + ".png"; } catch { //ViewBag.pais = "mx.png"; //return RedirectToAction("Pais", "Home"); } Session["spras"] = user.SPRAS_ID; } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ROL rOL = db.ROLs.Find(id); if (rOL == null) { return(HttpNotFound()); } return(View(rOL)); }
/// <summary> /// Buscar el rol por su id /// </summary> /// <returns></returns> public bool Read() { try { using (var db = new DBEntities()) { ROL rol = db.ROL.Where(r => r.ID_ROL == this.IdRol).FirstOrDefault(); if (rol != null) { this.NombreRol = rol.NOMBRE_ROL; return(true); } return(false); } } catch (Exception ex) { Console.WriteLine(ex.Message); return(false); } }
public void deleteElement(object element, USUARIO u) { if (element != null) { using (var entity = new TAE2Entities()) { ROL rol = (ROL)element; var modifiedRol = entity.ROLs.First(p => p.UNID_ROL == rol.UNID_ROL); modifiedRol.IS_ACTIVE = false; //Sync modifiedRol.IS_MODIFIED = true; modifiedRol.LAST_MODIFIED_DATE = UNID.getNewUNID(); var modifiedSync = entity.SYNCs.First(p => p.UNID_SYNC == 20120101000000000); modifiedSync.ACTUAL_DATE = UNID.getNewUNID(); // entity.SaveChanges(); UNID.Master(rol, u, -1, "Emininación"); } } }
public bool editarRool(int id, ROL model) { try { ROL var = buscarRol(id); if (var != null) { var.NOMBRE = model.NOMBRE; this.context.SaveChanges(); return(true); } else { return(false); } } catch (Exception) { return(false); } }
public ActionResult Edit(int id, ROL rol) { if (ModelState.IsValid) { bool edit = this.context.editarRool(id, rol); if (edit != false) { return(RedirectToAction("Index")); } else { ModelState.AddModelError(string.Empty, "Error en editar la mesa"); return(View(rol)); } } else { ModelState.AddModelError(string.Empty, "Error en editar la mesa"); return(View(rol)); } }
public void modifyRol() { AppRolDataMapper RolDM = new AppRolDataMapper(); AppUsuarioRol Rol_UsuarioDM = new AppUsuarioRol(); AppRolMenuDataMapper Rol_MenuDM = new AppRolMenuDataMapper(); AppMenuDataMapper MenuDM = new AppMenuDataMapper(); Rol_UsuarioDM.deleteElementsByRol(this.UnidRol); Rol_MenuDM.deleteElementsByRol(this.UnidRol); ROL rrr = new ROL(); rrr.IS_ACTIVE = true; rrr.IS_MODIFIED = true; rrr.IS_SYSTEM_ROOL = this.IsSystemRol; rrr.RECIBIR_MAILS = this.RecibirMails; rrr.ROL_NAME = this.Name; rrr.UNID_ROL = UnidRol; RolDM.udpateElement(rrr, this.ActualUser); foreach (User u in UsuariosCollection) { USUARIO_ROL ur = new USUARIO_ROL(); ur.UNID_ROL = this.UnidRol; ur.UNID_USUARIO = u.UnidUser; Rol_UsuarioDM.upsertElement(ur); } foreach (Menu minim in MenuCollection) { MENU mm = new MENU(); mm.MENU_NAME = minim.MenuName; mm = (MENU)MenuDM.getElementByName(mm); ROL_MENU rm = new ROL_MENU(); rm.UNID_MENU = mm.UNID_MENU; rm.UNID_ROL = this.UnidRol; Rol_MenuDM.upsertElement(rm); } }
public void udpateElementSync(object element) { if (element != null) { using (var entity = new TAE2Entities()) { ROL rol = (ROL)element; var modifiedRol = entity.ROLs.First(p => p.UNID_ROL == rol.UNID_ROL); modifiedRol.ROL_NAME = rol.ROL_NAME; modifiedRol.IS_ACTIVE = rol.IS_ACTIVE; modifiedRol.RECIBIR_MAILS = rol.RECIBIR_MAILS; modifiedRol.IS_SYSTEM_ROOL = rol.IS_SYSTEM_ROOL; //Sync modifiedRol.IS_MODIFIED = true; modifiedRol.LAST_MODIFIED_DATE = UNID.getNewUNID(); var modifiedSync = entity.SYNCs.First(p => p.UNID_SYNC == 20120101000000000); modifiedSync.ACTUAL_DATE = UNID.getNewUNID(); // entity.SaveChanges(); } } }
public void saveRol() { AppRolDataMapper rolDM = new AppRolDataMapper(); AppUsuarioRol ar = new AppUsuarioRol(); AppRolMenuDataMapper am = new AppRolMenuDataMapper(); AppMenuDataMapper menu = new AppMenuDataMapper(); ROL rrr = new ROL(); rrr.IS_ACTIVE = true; rrr.IS_MODIFIED = true; rrr.IS_SYSTEM_ROOL = this.IsSystemRol; rrr.RECIBIR_MAILS = this.RecibirMails; rrr.ROL_NAME = this.Name; this.UnidRol = UNID.getNewUNID(); rrr.UNID_ROL = UnidRol; rolDM.insertElement(rrr, this.ActualUser); foreach (User u in UsuariosCollection) { USUARIO_ROL ur = new USUARIO_ROL(); ur.UNID_ROL = this.UnidRol; ur.UNID_USUARIO = u.UnidUser; ar.insertElement(ur); } foreach (Menu minim in MenuCollection) { MENU mm = new MENU(); mm.MENU_NAME = minim.MenuName; mm = (MENU)menu.getElementByName(mm); ROL_MENU rm = new ROL_MENU(); rm.UNID_MENU = mm.UNID_MENU; rm.UNID_ROL = this.UnidRol; am.insertElement(rm); } }
protected HashSet <StatsInfo.TIPO_PERSONAJE> clasesParaElRol(ROL rol) { HashSet <StatsInfo.TIPO_PERSONAJE> clases = new HashSet <StatsInfo.TIPO_PERSONAJE>(); switch (rol) { //ROLES DUROS case ROL.DEFENSOR: clases.Add(StatsInfo.TIPO_PERSONAJE.PESADA); break; case ROL.FLANQUEADOR: clases.Add(StatsInfo.TIPO_PERSONAJE.INFANTERIA); break; case ROL.SNIPER: clases.Add(StatsInfo.TIPO_PERSONAJE.ARQUERO); break; case ROL.CASTER: clases.Add(StatsInfo.TIPO_PERSONAJE.MAJITO); break; //ROLES BLANDOS case ROL.MELEE: clases.Add(StatsInfo.TIPO_PERSONAJE.PESADA); clases.Add(StatsInfo.TIPO_PERSONAJE.INFANTERIA); break; case ROL.RANGED: clases.Add(StatsInfo.TIPO_PERSONAJE.ARQUERO); clases.Add(StatsInfo.TIPO_PERSONAJE.MAJITO); break; } return(clases); }
private void RC(bool EXV = false) { try { ROL.Refresh(); if (ROL.Items.Count > 0) { ROL.Items.Clear(); } RCL.Refresh(); if (RCL.Items.Count > 0) { RCL.Items.Clear(); } } catch (Exception EX) { if (EXV) { MessageBox.Show(EX.Message + "\n\n" + EX.StackTrace + "\n\n" + EX.Data); } } }
///<summary> ///Removes the given ROL ///</summary> public void RemoveROL(ROL toRemove) { this.RemoveStructure("ROL", toRemove); }
/// <summary> /// Constructs an HL7 segment for the specified Segments enum object /// </summary> /// <param name="seg">The Segments enum object to construct for</param> public Segment(Segments seg) { switch (seg) { case Segments.ABS: ABS abs = new ABS(); Name = abs.Name; Description = abs.Description; Fields = abs.Fields; break; case Segments.ACC: ACC acc = new ACC(); Name = acc.Name; Description = acc.Description; Fields = acc.Fields; break; case Segments.ADD: ADD add = new ADD(); Name = add.Name; Description = add.Description; Fields = add.Fields; break; case Segments.AFF: AFF aff = new AFF(); Name = aff.Name; Description = aff.Description; Fields = aff.Fields; break; case Segments.AIG: AIG aig = new AIG(); Name = aig.Name; Description = aig.Description; Fields = aig.Fields; break; case Segments.AIL: AIL ail = new AIL(); Name = ail.Name; Description = ail.Description; Fields = ail.Fields; break; case Segments.AIP: AIP aip = new AIP(); Name = aip.Name; Description = aip.Description; Fields = aip.Fields; break; case Segments.AIS: AIS ais = new AIS(); Name = ais.Name; Description = ais.Description; Fields = ais.Fields; break; case Segments.AL1: AL1 al1 = new AL1(); Name = al1.Name; Description = al1.Description; Fields = al1.Fields; break; case Segments.APR: APR apr = new APR(); Name = apr.Name; Description = apr.Description; Fields = apr.Fields; break; case Segments.ARQ: ARQ arq = new ARQ(); Name = arq.Name; Description = arq.Description; Fields = arq.Fields; break; case Segments.AUT: AUT aut = new AUT(); Name = aut.Name; Description = aut.Description; Fields = aut.Fields; break; case Segments.BHS: BHS bhs = new BHS(); Name = bhs.Name; Description = bhs.Description; Fields = bhs.Fields; break; case Segments.BLC: BLC blc = new BLC(); Name = blc.Name; Description = blc.Description; Fields = blc.Fields; break; case Segments.BLG: BLG blg = new BLG(); Name = blg.Name; Description = blg.Description; Fields = blg.Fields; break; case Segments.BPO: BPO bpo = new BPO(); Name = bpo.Name; Description = bpo.Description; Fields = bpo.Fields; break; case Segments.BPX: BPX bpx = new BPX(); Name = bpx.Name; Description = bpx.Description; Fields = bpx.Fields; break; case Segments.BTS: BTS bts = new BTS(); Name = bts.Name; Description = bts.Description; Fields = bts.Fields; break; case Segments.BTX: BTX btx = new BTX(); Name = btx.Name; Description = btx.Description; Fields = btx.Fields; break; case Segments.CDM: CDM cdm = new CDM(); Name = cdm.Name; Description = cdm.Description; Fields = cdm.Fields; break; case Segments.CER: CER cer = new CER(); Name = cer.Name; Description = cer.Description; Fields = cer.Fields; break; case Segments.CM0: CM0 cm0 = new CM0(); Name = cm0.Name; Description = cm0.Description; Fields = cm0.Fields; break; case Segments.CM1: CM1 cm1 = new CM1(); Name = cm1.Name; Description = cm1.Description; Fields = cm1.Fields; break; case Segments.CM2: CM2 cm2 = new CM2(); Name = cm2.Name; Description = cm2.Description; Fields = cm2.Fields; break; case Segments.CNS: CNS cns = new CNS(); Name = cns.Name; Description = cns.Description; Fields = cns.Fields; break; case Segments.CON: CON con = new CON(); Name = con.Name; Description = con.Description; Fields = con.Fields; break; case Segments.CSP: CSP csp = new CSP(); Name = csp.Name; Description = csp.Description; Fields = csp.Fields; break; case Segments.CSR: CSR csr = new CSR(); Name = csr.Name; Description = csr.Description; Fields = csr.Fields; break; case Segments.CSS: CSS css = new CSS(); Name = css.Name; Description = css.Description; Fields = css.Fields; break; case Segments.CTD: CTD ctd = new CTD(); Name = ctd.Name; Description = ctd.Description; Fields = ctd.Fields; break; case Segments.CTI: CTI cti = new CTI(); Name = cti.Name; Description = cti.Description; Fields = cti.Fields; break; case Segments.DB1: DB1 db1 = new DB1(); Name = db1.Name; Description = db1.Description; Fields = db1.Fields; break; case Segments.DG1: DG1 dg1 = new DG1(); Name = dg1.Name; Description = dg1.Description; Fields = dg1.Fields; break; case Segments.DRG: DRG drg = new DRG(); Name = drg.Name; Description = drg.Description; Fields = drg.Fields; break; case Segments.DSC: DSC dsc = new DSC(); Name = dsc.Name; Description = dsc.Description; Fields = dsc.Fields; break; case Segments.DSP: DSP dsp = new DSP(); Name = dsp.Name; Description = dsp.Description; Fields = dsp.Fields; break; case Segments.ECD: ECD ecd = new ECD(); Name = ecd.Name; Description = ecd.Description; Fields = ecd.Fields; break; case Segments.ECR: ECR ecr = new ECR(); Name = ecr.Name; Description = ecr.Description; Fields = ecr.Fields; break; case Segments.EDU: EDU edu = new EDU(); Name = edu.Name; Description = edu.Description; Fields = edu.Fields; break; case Segments.EQL: EQL eql = new EQL(); Name = eql.Name; Description = eql.Description; Fields = eql.Fields; break; case Segments.EQP: EQP eqp = new EQP(); Name = eqp.Name; Description = eqp.Description; Fields = eqp.Fields; break; case Segments.EQU: EQU equ = new EQU(); Name = equ.Name; Description = equ.Description; Fields = equ.Fields; break; case Segments.ERQ: ERQ erq = new ERQ(); Name = erq.Name; Description = erq.Description; Fields = erq.Fields; break; case Segments.ERR: ERR err = new ERR(); Name = err.Name; Description = err.Description; Fields = err.Fields; break; case Segments.EVN: EVN evn = new EVN(); Name = evn.Name; Description = evn.Description; Fields = evn.Fields; break; case Segments.FAC: FAC fac = new FAC(); Name = fac.Name; Description = fac.Description; Fields = fac.Fields; break; case Segments.FHS: FHS fhs = new FHS(); Name = fhs.Name; Description = fhs.Description; Fields = fhs.Fields; break; case Segments.FT1: FT1 ft1 = new FT1(); Name = ft1.Name; Description = ft1.Description; Fields = ft1.Fields; break; case Segments.FTS: FTS fts = new FTS(); Name = fts.Name; Description = fts.Description; Fields = fts.Fields; break; case Segments.GOL: GOL gol = new GOL(); Name = gol.Name; Description = gol.Description; Fields = gol.Fields; break; case Segments.GP1: GP1 gp1 = new GP1(); Name = gp1.Name; Description = gp1.Description; Fields = gp1.Fields; break; case Segments.GP2: GP2 gp2 = new GP2(); Name = gp2.Name; Description = gp2.Description; Fields = gp2.Fields; break; case Segments.GT1: GT1 gt1 = new GT1(); Name = gt1.Name; Description = gt1.Description; Fields = gt1.Fields; break; case Segments.IAM: IAM iam = new IAM(); Name = iam.Name; Description = iam.Description; Fields = iam.Fields; break; case Segments.IIM: IIM iim = new IIM(); Name = iim.Name; Description = iim.Description; Fields = iim.Fields; break; case Segments.IN1: IN1 in1 = new IN1(); Name = in1.Name; Description = in1.Description; Fields = in1.Fields; break; case Segments.IN2: IN2 in2 = new IN2(); Name = in2.Name; Description = in2.Description; Fields = in2.Fields; break; case Segments.IN3: IN3 in3 = new IN3(); Name = in3.Name; Description = in3.Description; Fields = in3.Fields; break; case Segments.INV: INV inv = new INV(); Name = inv.Name; Description = inv.Description; Fields = inv.Fields; break; case Segments.IPC: IPC ipc = new IPC(); Name = ipc.Name; Description = ipc.Description; Fields = ipc.Fields; break; case Segments.ISD: ISD isd = new ISD(); Name = isd.Name; Description = isd.Description; Fields = isd.Fields; break; case Segments.LAN: LAN lan = new LAN(); Name = lan.Name; Description = lan.Description; Fields = lan.Fields; break; case Segments.LCC: LCC lcc = new LCC(); Name = lcc.Name; Description = lcc.Description; Fields = lcc.Fields; break; case Segments.LCH: LCH lch = new LCH(); Name = lch.Name; Description = lch.Description; Fields = lch.Fields; break; case Segments.LDP: LDP ldp = new LDP(); Name = ldp.Name; Description = ldp.Description; Fields = ldp.Fields; break; case Segments.LOC: LOC loc = new LOC(); Name = loc.Name; Description = loc.Description; Fields = loc.Fields; break; case Segments.LRL: LRL lrl = new LRL(); Name = lrl.Name; Description = lrl.Description; Fields = lrl.Fields; break; case Segments.MFA: MFA mfa = new MFA(); Name = mfa.Name; Description = mfa.Description; Fields = mfa.Fields; break; case Segments.MFE: MFE mfe = new MFE(); Name = mfe.Name; Description = mfe.Description; Fields = mfe.Fields; break; case Segments.MFI: MFI mfi = new MFI(); Name = mfi.Name; Description = mfi.Description; Fields = mfi.Fields; break; case Segments.MRG: MRG mrg = new MRG(); Name = mrg.Name; Description = mrg.Description; Fields = mrg.Fields; break; case Segments.MSA: MSA msa = new MSA(); Name = msa.Name; Description = msa.Description; Fields = msa.Fields; break; case Segments.MSH: MSH msh = new MSH(); Name = msh.Name; Description = msh.Description; Fields = msh.Fields; break; case Segments.NCK: NCK nck = new NCK(); Name = nck.Name; Description = nck.Description; Fields = nck.Fields; break; case Segments.NDS: NDS nds = new NDS(); Name = nds.Name; Description = nds.Description; Fields = nds.Fields; break; case Segments.NK1: NK1 nk1 = new NK1(); Name = nk1.Name; Description = nk1.Description; Fields = nk1.Fields; break; case Segments.NPU: NPU npu = new NPU(); Name = npu.Name; Description = npu.Description; Fields = npu.Fields; break; case Segments.NSC: NSC nsc = new NSC(); Name = nsc.Name; Description = nsc.Description; Fields = nsc.Fields; break; case Segments.NST: NST nst = new NST(); Name = nst.Name; Description = nst.Description; Fields = nst.Fields; break; case Segments.NTE: NTE nte = new NTE(); Name = nte.Name; Description = nte.Description; Fields = nte.Fields; break; case Segments.OBR: OBR obr = new OBR(); Name = obr.Name; Description = obr.Description; Fields = obr.Fields; break; case Segments.OBX: OBX obx = new OBX(); Name = obx.Name; Description = obx.Description; Fields = obx.Fields; break; case Segments.ODS: ODS ods = new ODS(); Name = ods.Name; Description = ods.Description; Fields = ods.Fields; break; case Segments.ODT: ODT odt = new ODT(); Name = odt.Name; Description = odt.Description; Fields = odt.Fields; break; case Segments.OM1: OM1 om1 = new OM1(); Name = om1.Name; Description = om1.Description; Fields = om1.Fields; break; case Segments.OM2: OM2 om2 = new OM2(); Name = om2.Name; Description = om2.Description; Fields = om2.Fields; break; case Segments.OM3: OM3 om3 = new OM3(); Name = om3.Name; Description = om3.Description; Fields = om3.Fields; break; case Segments.OM4: OM4 om4 = new OM4(); Name = om4.Name; Description = om4.Description; Fields = om4.Fields; break; case Segments.OM5: OM5 om5 = new OM5(); Name = om5.Name; Description = om5.Description; Fields = om5.Fields; break; case Segments.OM6: OM6 om6 = new OM6(); Name = om6.Name; Description = om6.Description; Fields = om6.Fields; break; case Segments.OM7: OM7 om7 = new OM7(); Name = om7.Name; Description = om7.Description; Fields = om7.Fields; break; case Segments.ORC: ORC orc = new ORC(); Name = orc.Name; Description = orc.Description; Fields = orc.Fields; break; case Segments.ORG: ORG org = new ORG(); Name = org.Name; Description = org.Description; Fields = org.Fields; break; case Segments.OVR: OVR ovr = new OVR(); Name = ovr.Name; Description = ovr.Description; Fields = ovr.Fields; break; case Segments.PCR: PCR pcr = new PCR(); Name = pcr.Name; Description = pcr.Description; Fields = pcr.Fields; break; case Segments.PD1: PD1 pd1 = new PD1(); Name = pd1.Name; Description = pd1.Description; Fields = pd1.Fields; break; case Segments.PDA: PDA pda = new PDA(); Name = pda.Name; Description = pda.Description; Fields = pda.Fields; break; case Segments.PDC: PDC pdc = new PDC(); Name = pdc.Name; Description = pdc.Description; Fields = pdc.Fields; break; case Segments.PEO: PEO peo = new PEO(); Name = peo.Name; Description = peo.Description; Fields = peo.Fields; break; case Segments.PES: PES pes = new PES(); Name = pes.Name; Description = pes.Description; Fields = pes.Fields; break; case Segments.PID: PID pid = new PID(); Name = pid.Name; Description = pid.Description; Fields = pid.Fields; break; case Segments.PR1: PR1 pr1 = new PR1(); Name = pr1.Name; Description = pr1.Description; Fields = pr1.Fields; break; case Segments.PRA: PRA pra = new PRA(); Name = pra.Name; Description = pra.Description; Fields = pra.Fields; break; case Segments.PRB: PRB prb = new PRB(); Name = prb.Name; Description = prb.Description; Fields = prb.Fields; break; case Segments.PRC: PRC prc = new PRC(); Name = prc.Name; Description = prc.Description; Fields = prc.Fields; break; case Segments.PRD: PRD prd = new PRD(); Name = prd.Name; Description = prd.Description; Fields = prd.Fields; break; case Segments.PSH: PSH psh = new PSH(); Name = psh.Name; Description = psh.Description; Fields = psh.Fields; break; case Segments.PTH: PTH pth = new PTH(); Name = pth.Name; Description = pth.Description; Fields = pth.Fields; break; case Segments.PV1: PV1 pv1 = new PV1(); Name = pv1.Name; Description = pv1.Description; Fields = pv1.Fields; break; case Segments.PV2: PV2 pv2 = new PV2(); Name = pv2.Name; Description = pv2.Description; Fields = pv2.Fields; break; case Segments.QAK: QAK qak = new QAK(); Name = qak.Name; Description = qak.Description; Fields = qak.Fields; break; case Segments.QID: QID qid = new QID(); Name = qid.Name; Description = qid.Description; Fields = qid.Fields; break; case Segments.QPD: QPD qpd = new QPD(); Name = qpd.Name; Description = qpd.Description; Fields = qpd.Fields; break; case Segments.QRD: QRD qrd = new QRD(); Name = qrd.Name; Description = qrd.Description; Fields = qrd.Fields; break; case Segments.QRF: QRF qrf = new QRF(); Name = qrf.Name; Description = qrf.Description; Fields = qrf.Fields; break; case Segments.QRI: QRI qri = new QRI(); Name = qri.Name; Description = qri.Description; Fields = qri.Fields; break; case Segments.RCP: RCP rcp = new RCP(); Name = rcp.Name; Description = rcp.Description; Fields = rcp.Fields; break; case Segments.RDF: RDF rdf = new RDF(); Name = rdf.Name; Description = rdf.Description; Fields = rdf.Fields; break; case Segments.RF1: RF1 rf1 = new RF1(); Name = rf1.Name; Description = rf1.Description; Fields = rf1.Fields; break; case Segments.RGS: RGS rgs = new RGS(); Name = rgs.Name; Description = rgs.Description; Fields = rgs.Fields; break; case Segments.RMI: RMI rmi = new RMI(); Name = rmi.Name; Description = rmi.Description; Fields = rmi.Fields; break; case Segments.ROL: ROL rol = new ROL(); Name = rol.Name; Description = rol.Description; Fields = rol.Fields; break; case Segments.RQ1: RQ1 rq1 = new RQ1(); Name = rq1.Name; Description = rq1.Description; Fields = rq1.Fields; break; case Segments.RQD: RQD rqd = new RQD(); Name = rqd.Name; Description = rqd.Description; Fields = rqd.Fields; break; case Segments.RXA: RXA rxa = new RXA(); Name = rxa.Name; Description = rxa.Description; Fields = rxa.Fields; break; case Segments.RXC: RXC rxc = new RXC(); Name = rxc.Name; Description = rxc.Description; Fields = rxc.Fields; break; case Segments.RXD: RXD rxd = new RXD(); Name = rxd.Name; Description = rxd.Description; Fields = rxd.Fields; break; case Segments.RXE: RXE rxe = new RXE(); Name = rxe.Name; Description = rxe.Description; Fields = rxe.Fields; break; case Segments.RXG: RXG rxg = new RXG(); Name = rxg.Name; Description = rxg.Description; Fields = rxg.Fields; break; case Segments.RXO: RXO rxo = new RXO(); Name = rxo.Name; Description = rxo.Description; Fields = rxo.Fields; break; case Segments.RXR: RXR rxr = new RXR(); Name = rxr.Name; Description = rxr.Description; Fields = rxr.Fields; break; case Segments.SAC: SAC sac = new SAC(); Name = sac.Name; Description = sac.Description; Fields = sac.Fields; break; case Segments.SCH: SCH sch = new SCH(); Name = sch.Name; Description = sch.Description; Fields = sch.Fields; break; case Segments.SFT: SFT sft = new SFT(); Name = sft.Name; Description = sft.Description; Fields = sft.Fields; break; case Segments.SID: SID sid = new SID(); Name = sid.Name; Description = sid.Description; Fields = sid.Fields; break; case Segments.SPM: SPM spm = new SPM(); Name = spm.Name; Description = spm.Description; Fields = spm.Fields; break; case Segments.SPR: SPR spr = new SPR(); Name = spr.Name; Description = spr.Description; Fields = spr.Fields; break; case Segments.STF: STF stf = new STF(); Name = stf.Name; Description = stf.Description; Fields = stf.Fields; break; case Segments.TCC: TCC tcc = new TCC(); Name = tcc.Name; Description = tcc.Description; Fields = tcc.Fields; break; case Segments.TCD: TCD tcd = new TCD(); Name = tcd.Name; Description = tcd.Description; Fields = tcd.Fields; break; case Segments.TQ1: TQ1 tq1 = new TQ1(); Name = tq1.Name; Description = tq1.Description; Fields = tq1.Fields; break; case Segments.TQ2: TQ2 tq2 = new TQ2(); Name = tq2.Name; Description = tq2.Description; Fields = tq2.Fields; break; case Segments.TXA: TXA txa = new TXA(); Name = txa.Name; Description = txa.Description; Fields = txa.Fields; break; case Segments.UB1: UB1 ub1 = new UB1(); Name = ub1.Name; Description = ub1.Description; Fields = ub1.Fields; break; case Segments.UB2: UB2 ub2 = new UB2(); Name = ub2.Name; Description = ub2.Description; Fields = ub2.Fields; break; case Segments.URD: URD urd = new URD(); Name = urd.Name; Description = urd.Description; Fields = urd.Fields; break; case Segments.URS: URS urs = new URS(); Name = urs.Name; Description = urs.Description; Fields = urs.Fields; break; case Segments.VAR: VAR var = new VAR(); Name = var.Name; Description = var.Description; Fields = var.Fields; break; case Segments.VTQ: VTQ vtq = new VTQ(); Name = vtq.Name; Description = vtq.Description; Fields = vtq.Fields; break; } }
public ApiResultModel <bool> Delete([FromBody] ROL aux) => GetApiResultModel(() => _rolService.Delete(aux));
public JsonResult Add(ROL rol, object [] checkbox) { bool exist = false; try { if (rol.ID == 0) { //AGREGAR var existe = repository.GetAll().Where(x => x.NOMBRE == rol.NOMBRE && x.ACTIVO == true).FirstOrDefault(); if (existe != null && existe.ACTIVO) { exist = true; } else { using (var scope = new TransactionScope()) { rol.FECHA_ALTA = DateTime.Now; rol.ACTIVO = true; repository.Add(rol); if (UpdateOperaciones(rol.ID, checkbox) == false) { return(null); } scope.Complete(); } } } else { //EDITAR var existe = repository.GetAll().Where(x => x.NOMBRE == rol.NOMBRE && x.ID != rol.ID && x.ACTIVO == true).FirstOrDefault(); if (existe != null && existe.ACTIVO) { exist = true; } else { using (var scope = new TransactionScope()) { var o = repository.GetAll().Where(x => x.ID == rol.ID).FirstOrDefault(); o.NOMBRE = rol.NOMBRE; repository.Update(o); //delete rol-operaciones if (UpdateOperaciones(rol.ID, null, true) == false) { return(null); } //add rol-operaciones if (UpdateOperaciones(rol.ID, checkbox) == false) { return(null); } scope.Complete(); } } } } catch (Exception EX) { var AJAS = EX.ToString(); return(null); } if (exist) { return(Json(new { success = exist })); } //if data exist return(List()); }
public ROL Save(ROL rol) { IRepositoryRol _repository = new RepositoryRol(); return(_repository.Save(rol)); }
private void button4_Click(object sender, EventArgs e) { SqlConnection Connection = new SqlConnection(Con.ConnectionString()); if (Cat.SelectedIndex == -1) { toolStripStatusLabel1.Text = "Please Select a Catagory"; Cat.Focus(); } else if (SubCat.SelectedIndex == -1) { toolStripStatusLabel1.Text = "Please Select Sub Catagory "; SubCat.Focus(); } else if (ItemNo.Text.ToString().Trim(' ') == "") { toolStripStatusLabel1.Text = "Please Enter Item No"; ItemNo.Text = ""; ItemNo.Focus(); } else if (Units.Text.ToString().Trim(' ') == "") { toolStripStatusLabel1.Text = "Please Enter Units"; Units.Text = ""; Units.Focus(); } else if (StockPrice.Text.ToString().Trim(' ') == "") { toolStripStatusLabel1.Text = "Please Enter Stock Price"; StockPrice.Text = ""; StockPrice.Focus(); } else if (SalesPrice.Text.ToString().Trim(' ') == "") { toolStripStatusLabel1.Text = "Please Enter Sales Price"; SalesPrice.Text = ""; SalesPrice.Focus(); } else if (UnitsInStock.Text.ToString().Trim(' ') == "") { toolStripStatusLabel1.Text = "Please Enter how many Units have in Stock"; UnitsInStock.Text = ""; UnitsInStock.Focus(); } else if (ROL.Text.ToString().Trim(' ') == "") { toolStripStatusLabel1.Text = "Please Enter ReOrder Level"; ROL.Text = ""; ROL.Focus(); } else if (Convert.ToDecimal(Profit.Text) < 0) { MessageBox.Show("Your Stock price larger than Sales Price" + Environment.NewLine + "Enter Correct Value or Change the Discount Rate", "Data Entry Problem", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);; SalesPrice.Focus(); } else { try { Connection.Open(); if (button4.Text.ToString() == "Save") { SqlCommand INSERT = new SqlCommand("INSERT INTO ItemList(ItemNo,Descriptions,Units,Catagory,SubCatagory,StockPrice,SalesPrice,Discount,UnitsInStock,ROL) VALUES(@ItemNo,@Descriptions,@Units,@Catagory,@SubCatagory,@StockPrice,@SalesPrice,@Discount,@UnitsInStock,@ROL)", Connection); INSERT.Parameters.AddWithValue("@ItemNo", ItemNo.Text.ToString()); INSERT.Parameters.AddWithValue("@Descriptions", Des.Text.ToString()); INSERT.Parameters.AddWithValue("@Units", Units.Text.ToString()); INSERT.Parameters.AddWithValue("@Catagory", Cat.SelectedItem.ToString()); INSERT.Parameters.AddWithValue("@SubCatagory", SubCat.SelectedItem.ToString()); INSERT.Parameters.AddWithValue("@StockPrice", Convert.ToDecimal(StockPrice.Text)); INSERT.Parameters.AddWithValue("@SalesPrice", Convert.ToDecimal(SalesPrice.Text)); INSERT.Parameters.AddWithValue("@Discount", Convert.ToInt16(Discount.Text)); INSERT.Parameters.AddWithValue("@UnitsInStock", Convert.ToInt64(UnitsInStock.Text)); INSERT.Parameters.AddWithValue("@ROL", Convert.ToInt32(ROL.Text)); if (INSERT.ExecuteNonQuery() == 1) { toolStripStatusLabel1.Text = "Sucessfully Saved"; ItemNo2.Items.Add(ItemNo.Text.ToString()); ItemNo.Text = ""; Des.Text = ""; Units.Text = ""; StockPrice.Clear(); SalesPrice.Text = ""; Discount.Text = ""; UnitsInStock.Text = ""; ROL.Text = ""; Profit.Text = "0.0"; ItemNo.Focus(); } else { toolStripStatusLabel1.Text = "Error Item Not Saved"; } } else { SqlCommand UPDES = new SqlCommand("UPDATE ItemList SET Descriptions=@Descriptions WHERE ItemNo=@ItemNo", Connection); UPDES.Parameters.AddWithValue("@Descriptions", Des.Text.ToString()); UPDES.Parameters.AddWithValue("@ItemNo", ItemNo.Text.ToString()); SqlCommand UPUNIT = new SqlCommand("UPDATE ItemList SET Units=@Units WHERE ItemNo=@ItemNo", Connection); UPUNIT.Parameters.AddWithValue("@Units", Units.Text.ToString()); UPUNIT.Parameters.AddWithValue("@ItemNo", ItemNo.Text.ToString()); SqlCommand UPCAT = new SqlCommand("UPDATE ItemList SET Catagory=@Catagory WHERE ItemNo=@ItemNo", Connection); UPCAT.Parameters.AddWithValue("@Catagory", Cat.SelectedItem.ToString()); UPCAT.Parameters.AddWithValue("@ItemNo", ItemNo.Text.ToString()); SqlCommand UPSUBCAT = new SqlCommand("UPDATE ItemList SET SubCatagory=@SubCatagory WHERE ItemNo=@ItemNo", Connection); UPSUBCAT.Parameters.AddWithValue("@SubCatagory", SubCat.SelectedItem.ToString()); UPSUBCAT.Parameters.AddWithValue("@ItemNo", ItemNo.Text.ToString()); SqlCommand UPSTOCKPRICE = new SqlCommand("UPDATE ItemList SET StockPrice=@StockPrice WHERE ItemNo=@ItemNo", Connection); UPSTOCKPRICE.Parameters.AddWithValue("@StockPrice", Convert.ToDecimal(StockPrice.Text)); UPSTOCKPRICE.Parameters.AddWithValue("@ItemNo", ItemNo.Text.ToString()); SqlCommand UPSALESPRICE = new SqlCommand("UPDATE ItemList SET SalesPrice=@SalesPrice WHERE ItemNo=@ItemNo", Connection); UPSALESPRICE.Parameters.AddWithValue("@SalesPrice", Convert.ToDecimal(SalesPrice.Text)); UPSALESPRICE.Parameters.AddWithValue("@ItemNo", ItemNo.Text.ToString()); SqlCommand UPDISCOUNT = new SqlCommand("UPDATE ItemList SET Discount=@Discount WHERE ItemNo=@ItemNo", Connection); UPDISCOUNT.Parameters.AddWithValue("@Discount", Convert.ToInt16(Discount.Text)); UPDISCOUNT.Parameters.AddWithValue("@ItemNo", ItemNo.Text.ToString()); SqlCommand UPUNITSINSTOCK = new SqlCommand("UPDATE ItemList SET UnitsInStock=@UnitsInStock WHERE ItemNo=@ItemNo", Connection); UPUNITSINSTOCK.Parameters.AddWithValue("@UnitsInStock", Convert.ToInt64(UnitsInStock.Text)); UPUNITSINSTOCK.Parameters.AddWithValue("@ItemNo", ItemNo.Text.ToString()); SqlCommand UPROL = new SqlCommand("UPDATE ItemList SET ROL=@ROL WHERE ItemNo=@ItemNo", Connection); UPROL.Parameters.AddWithValue("@ROL", Convert.ToInt32(ROL.Text)); UPROL.Parameters.AddWithValue("@ItemNo", ItemNo.Text.ToString()); int a, b, c, d, ei, f, g, h, i; a = UPDES.ExecuteNonQuery(); b = UPUNIT.ExecuteNonQuery(); c = UPSTOCKPRICE.ExecuteNonQuery(); d = UPSALESPRICE.ExecuteNonQuery(); ei = UPDISCOUNT.ExecuteNonQuery(); f = UPUNITSINSTOCK.ExecuteNonQuery(); g = UPROL.ExecuteNonQuery(); h = UPCAT.ExecuteNonQuery(); i = UPSUBCAT.ExecuteNonQuery(); if ((a == 1) && (b == 1) && (c == 1) && (d == 1) && (ei == 1) && (f == 1) && (g == 1) && (h == 1) && (i == 1)) { toolStripStatusLabel1.Text = "Update Sucessfully"; ItemNo.Text = ""; Des.Text = ""; Units.Text = ""; StockPrice.Text = ""; SalesPrice.Text = ""; Discount.SelectedIndex = 0; UnitsInStock.Text = ""; ROL.Text = ""; Profit.Text = "0.0"; Cat.Focus(); } else { toolStripStatusLabel1.Text = "Error, Item Not Updated"; } } Connection.Close(); } catch { } } }
public ApiResultModel <ROL> Update([FromBody] ROL aux) => GetApiResultModel(() => _rolService.Update(aux));
/// <summary> /// Guarda un rol /// </summary> /// <param name="rol">rol</param> public void SaveRol(ROL rol) { try { using (DQBaseContext context=new DQBaseContext(ConnectionString)) { context.ROL.ApplyChanges(rol); context.SaveChanges(); } } catch (Exception ex) { throw ex; } }
public AnonymousInstruction6(ROL parent) { this.parent = parent; }