示例#1
0
        public static bool AddOrUpdateContact(ContactSite objContact, out string sIdCreated)
        {
            try
            {
                using (var objDal = new BaseDAL_II())
                {
                    if (objContact.ContactSiteKey == null || objContact.ContactSiteKey.ToString().Trim().Equals("00000000-0000-0000-0000-000000000000"))
                    {
                        objContact.ContactSiteKey = Guid.NewGuid();
                        objDal.guardar(objContact);
                    }
                    else
                    {
                        objDal.actualizar(objContact, "ContactSiteKey");
                    }
                }
            }
            catch (Exception ex)
            {
                sIdCreated = null;
                return(false);
            }

            sIdCreated = objContact.ContactSiteKey.ToString();
            return(true);
        }
        public static bool AddOrUpdateUser(Usuario objUser, out string sIdCreated)
        {
            try
            {
                using (var objDal = new BaseDAL_II())
                {
                    if (objUser.UsuarioKey == null || objUser.UsuarioKey.ToString().Trim().Equals("00000000-0000-0000-0000-000000000000"))
                    {
                        objUser.UsuarioKey = Guid.NewGuid();
                        sIdCreated         = objUser.UsuarioKey.ToString();
                        objDal.guardar(objUser);
                    }
                    else
                    {
                        objDal.actualizar(objUser, "UsuarioKey");
                    }
                }
            }
            catch (Exception ex)
            {
                sIdCreated = null;
                return(false);
            }

            sIdCreated = null;
            return(true);
        }