Beispiel #1
0
        public static int InsertUpdatetT_OE_REF_SYNONYMS(int?sYNONYM_IDX, string sYNONYM_TEXT, int?cREATE_USER = 0)
        {
            using (EECIPEntities ctx = new EECIPEntities())
            {
                try
                {
                    Boolean insInd = false;

                    T_OE_REF_SYNONYMS e = (from c in ctx.T_OE_REF_SYNONYMS
                                           where c.SYNONYM_IDX == sYNONYM_IDX
                                           select c).FirstOrDefault();

                    if (e == null)
                    {
                        insInd           = true;
                        e                = new T_OE_REF_SYNONYMS();
                        e.CREATE_DT      = System.DateTime.Now;
                        e.CREATE_USERIDX = cREATE_USER;
                    }
                    else
                    {
                        e.MODIFY_DT      = System.DateTime.Now;
                        e.MODIFY_USERIDX = cREATE_USER;
                    }


                    if (sYNONYM_TEXT != null)
                    {
                        e.SYNONYM_TEXT = sYNONYM_TEXT.ToLower();
                    }


                    if (insInd)
                    {
                        ctx.T_OE_REF_SYNONYMS.Add(e);
                    }

                    ctx.SaveChanges();
                    return(e.SYNONYM_IDX);
                }
                catch (Exception ex)
                {
                    LogEFException(ex);
                    return(0);
                }
            }
        }
Beispiel #2
0
        public static int DeleteT_OE_REF_SYNONYMS(int id)
        {
            using (EECIPEntities ctx = new EECIPEntities())
            {
                try
                {
                    T_OE_REF_SYNONYMS rec = new T_OE_REF_SYNONYMS {
                        SYNONYM_IDX = id
                    };
                    ctx.Entry(rec).State = System.Data.Entity.EntityState.Deleted;
                    ctx.SaveChanges();

                    return(1);
                }
                catch (Exception ex)
                {
                    LogEFException(ex);
                    return(0);
                }
            }
        }