/// <summary> /// /// </summary> /// <param name="Broker"></param> /// <returns></returns> public static int Update(SocialClientes Broker) { using (MsSqlFacade<SocialClientes, SocialClientesMapper> facade = new MsSqlFacade<SocialClientes, SocialClientesMapper>()) { //// we use the Collection to build the broker entity on an abstract phase to manage it as a all return facade.Update(Broker); } }
/// <summary> /// /// </summary> /// <param name="cliente"></param> /// <returns></returns> public static int CreateSocialCliente(SocialClientes cliente) { try { using (MsSqlFacade<SocialClientes, SocialClientesMapper> facade = new MsSqlFacade<SocialClientes, SocialClientesMapper>()) { return facade.Create(cliente); } } catch { /// in case that fails, we give an empty list return -1; } }
/// <summary> /// /// </summary> /// <param name="context"></param> public void ProcessRequest(HttpContext context) { try { /// this is the empy response string Html = string.Empty; /// Dictionary Collection Native Encryption Dictionary<string, string> Collection = cl.maia.bus.Utils.ContextForm.ProcessNativeEncryptedForm(context.Request.Form); /// new expando object dynamic dynamic_obj = new ExpandoObject(); /// foreach string for the value collection foreach (KeyValuePair<string, string> kvp in Collection) { /// value for the parse id if (kvp.Key == "__id") { dynamic_obj.ID = kvp.Value; } /// value for the parse id if (kvp.Key == "__u") { dynamic_obj.UsuarioSocial = kvp.Value; } /// value for the parse id if (kvp.Key == "__t") { dynamic_obj.TipoSocial = kvp.Value; } /// value for the parse id if (kvp.Key == "__l") { dynamic_obj.Locacion = kvp.Value; } /// value for the parse id if (kvp.Key == "__d") { dynamic_obj.Descripcion = kvp.Value; } /// value for the parse id if (kvp.Key == "__u") { dynamic_obj.UrlImagen = kvp.Value; } } SocialClientes entity = new SocialClientes(); entity.Descripcion = dynamic_obj.Descripcion; entity.Locacion = dynamic_obj.Locacion; entity.NombreSocial = dynamic_obj.NombreSocial; entity.TipoSocial = int.Parse(dynamic_obj.TipoSocial); entity.Locacion = dynamic_obj.Locacion; entity.UrlImagen = dynamic_obj.UrlImagen; entity.UsuarioSocial = dynamic_obj.UsuarioSocial; int id_aux = int.Parse(dynamic_obj.ID); string json = string.Empty; if (id_aux != -1) { /// json json = ClientLogics.CreateSocialCliente(entity).ToString(); } else { json = ClientLogics.UpdateSocialCliente(entity).ToString(); } /// context response context.Response.Write(json); } catch(Exception ex) { /// context response as an error context.Response.Write("{\"acknowledge\": {\"response\": \""+ex.ToString()+"\"}"); } }