Rename salesbook

This commit is contained in:
2025-06-26 10:08:21 +02:00
parent a34e673cd2
commit 3f2b7a6bb5
164 changed files with 267 additions and 262 deletions

View File

@@ -0,0 +1,8 @@
namespace salesbook.Shared.Core.Authorization.Enum;
public enum KeyGroupEnum
{
UtenteAziendale = 2,
Agenti = 5,
Tecnico = 22
}

View File

@@ -0,0 +1,100 @@
using salesbook.Shared.Core.Entity;
using salesbook.Shared.Core.Helpers.Enum;
namespace salesbook.Shared.Core.Dto;
public class ActivityDTO : StbActivity
{
public string? Commessa { get; set; }
public string? Cliente { get; set; }
public ActivityCategoryEnum Category { get; set; }
public bool Complete { get; set; }
public bool Deleted { get; set; }
public ActivityDTO Clone()
{
return (ActivityDTO)MemberwiseClone();
}
private bool Equals(ActivityDTO other)
{
return Commessa == other.Commessa &&
Cliente == other.Cliente &&
Category == other.Category &&
Complete == other.Complete && ActivityId == other.ActivityId && ActivityResultId == other.ActivityResultId && ActivityTypeId == other.ActivityTypeId && DataInsAct.Equals(other.DataInsAct) && ActivityDescription == other.ActivityDescription && ParentActivityId == other.ParentActivityId && TipoAnag == other.TipoAnag && CodAnag == other.CodAnag && CodJcom == other.CodJcom && CodJfas == other.CodJfas && Nullable.Equals(EstimatedDate, other.EstimatedDate) && Nullable.Equals(EstimatedTime, other.EstimatedTime) && Nullable.Equals(AlarmDate, other.AlarmDate) && Nullable.Equals(AlarmTime, other.AlarmTime) && Nullable.Equals(EffectiveDate, other.EffectiveDate) && Nullable.Equals(EffectiveTime, other.EffectiveTime) && ResultDescription == other.ResultDescription && Nullable.Equals(EstimatedEnddate, other.EstimatedEnddate) && Nullable.Equals(EstimatedEndtime, other.EstimatedEndtime) && Nullable.Equals(EffectiveEnddate, other.EffectiveEnddate) && Nullable.Equals(EffectiveEndtime, other.EffectiveEndtime) && UserCreator == other.UserCreator && UserName == other.UserName && Nullable.Equals(PercComp, other.PercComp) && Nullable.Equals(EstimatedHours, other.EstimatedHours) && CodMart == other.CodMart && PartitaMag == other.PartitaMag && Matricola == other.Matricola && Priorita == other.Priorita && Nullable.Equals(ActivityPlayCounter, other.ActivityPlayCounter) && ActivityEvent == other.ActivityEvent && Guarantee == other.Guarantee && Note == other.Note && Rfid == other.Rfid && IdLotto == other.IdLotto && PersonaRif == other.PersonaRif && HrNum == other.HrNum && Gestione == other.Gestione && Nullable.Equals(DataOrd, other.DataOrd) && NumOrd == other.NumOrd && IdStep == other.IdStep && IdRiga == other.IdRiga && Nullable.Equals(OraInsAct, other.OraInsAct) && IndiceGradimento == other.IndiceGradimento && NoteGradimento == other.NoteGradimento && FlagRisolto == other.FlagRisolto && FlagTipologia == other.FlagTipologia && OreRapportino == other.OreRapportino && UserModifier == other.UserModifier && Nullable.Equals(OraModAct, other.OraModAct) && Nullable.Equals(OraViewAct, other.OraViewAct) && CodVdes == other.CodVdes && CodCmac == other.CodCmac && WrikeId == other.WrikeId && CodMgrp == other.CodMgrp && PlanId == other.PlanId;
}
public override bool Equals(object? obj)
{
if (obj is null) return false;
if (ReferenceEquals(this, obj)) return true;
return obj.GetType() == GetType() && Equals((ActivityDTO)obj);
}
public override int GetHashCode()
{
var hashCode = new HashCode();
hashCode.Add(ActivityId);
hashCode.Add(ActivityResultId);
hashCode.Add(ActivityTypeId);
hashCode.Add(DataInsAct);
hashCode.Add(ActivityDescription);
hashCode.Add(ParentActivityId);
hashCode.Add(TipoAnag);
hashCode.Add(CodAnag);
hashCode.Add(CodJcom);
hashCode.Add(CodJfas);
hashCode.Add(EstimatedDate);
hashCode.Add(EstimatedTime);
hashCode.Add(AlarmDate);
hashCode.Add(AlarmTime);
hashCode.Add(EffectiveDate);
hashCode.Add(EffectiveTime);
hashCode.Add(ResultDescription);
hashCode.Add(EstimatedEnddate);
hashCode.Add(EstimatedEndtime);
hashCode.Add(EffectiveEnddate);
hashCode.Add(EffectiveEndtime);
hashCode.Add(UserCreator);
hashCode.Add(UserName);
hashCode.Add(PercComp);
hashCode.Add(EstimatedHours);
hashCode.Add(CodMart);
hashCode.Add(PartitaMag);
hashCode.Add(Matricola);
hashCode.Add(Priorita);
hashCode.Add(ActivityPlayCounter);
hashCode.Add(ActivityEvent);
hashCode.Add(Guarantee);
hashCode.Add(Note);
hashCode.Add(Rfid);
hashCode.Add(IdLotto);
hashCode.Add(PersonaRif);
hashCode.Add(HrNum);
hashCode.Add(Gestione);
hashCode.Add(DataOrd);
hashCode.Add(NumOrd);
hashCode.Add(IdStep);
hashCode.Add(IdRiga);
hashCode.Add(OraInsAct);
hashCode.Add(IndiceGradimento);
hashCode.Add(NoteGradimento);
hashCode.Add(FlagRisolto);
hashCode.Add(FlagTipologia);
hashCode.Add(OreRapportino);
hashCode.Add(UserModifier);
hashCode.Add(OraModAct);
hashCode.Add(OraViewAct);
hashCode.Add(CodVdes);
hashCode.Add(CodCmac);
hashCode.Add(WrikeId);
hashCode.Add(CodMgrp);
hashCode.Add(PlanId);
hashCode.Add(Commessa);
hashCode.Add(Cliente);
hashCode.Add(Category);
hashCode.Add(Complete);
return hashCode.ToHashCode();
}
}

View File

@@ -0,0 +1,20 @@
using salesbook.Shared.Core.Helpers;
using salesbook.Shared.Core.Helpers.Enum;
namespace salesbook.Shared.Core.Dto;
public class FilterActivityDTO
{
public string? Text { get; set; }
public IEnumerable<string>? User { get; set; }
public string? Type { get; set; }
public string? Result { get; set; }
public ActivityCategoryEnum? Category { get; set; }
public bool ClearFilter =>
Text.IsNullOrEmpty() &&
User.IsNullOrEmpty() &&
Type.IsNullOrEmpty() &&
Result.IsNullOrEmpty() &&
Category == null;
}

View File

@@ -0,0 +1,16 @@
using System.Text.Json.Serialization;
using salesbook.Shared.Core.Entity;
namespace salesbook.Shared.Core.Dto;
public class SettingsResponseDTO
{
[JsonPropertyName("activityTypes")]
public List<StbActivityType>? ActivityTypes { get; set; }
[JsonPropertyName("activityResults")]
public List<StbActivityResult>? ActivityResults { get; set; }
[JsonPropertyName("stbUsers")]
public List<StbUser>? StbUsers { get; set; }
}

View File

@@ -0,0 +1,22 @@
using System.Text.Json.Serialization;
using salesbook.Shared.Core.Entity;
namespace salesbook.Shared.Core.Dto;
public class TaskSyncResponseDTO
{
[JsonPropertyName("anagClie")]
public List<AnagClie>? AnagClie { get; set; }
[JsonPropertyName("vtbDest")]
public List<VtbDest>? VtbDest { get; set; }
[JsonPropertyName("vtbCliePersRif")]
public List<VtbCliePersRif>? VtbCliePersRif { get; set; }
[JsonPropertyName("ptbPros")]
public List<PtbPros>? PtbPros { get; set; }
[JsonPropertyName("ptbProsRif")]
public List<PtbProsRif>? PtbProsRif { get; set; }
}

View File

@@ -0,0 +1,86 @@
using SQLite;
using System.Text.Json.Serialization;
namespace salesbook.Shared.Core.Entity;
[Table("anag_clie")]
public class AnagClie
{
[PrimaryKey, Column("cod_anag"), JsonPropertyName("codAnag")]
public string CodAnag { get; set; }
[Column("cod_vtip"), JsonPropertyName("codVtip")]
public string? CodVtip { get; set; }
[Column("cod_vage"), JsonPropertyName("codVage")]
public string? CodVage { get; set; }
[Column("rag_soc"), JsonPropertyName("ragSoc")]
public string RagSoc { get; set; }
[Column("indirizzo"), JsonPropertyName("indirizzo")]
public string Indirizzo { get; set; }
[Column("cap"), JsonPropertyName("cap")]
public string Cap { get; set; }
[Column("citta"), JsonPropertyName("citta")]
public string Citta { get; set; }
[Column("prov"), JsonPropertyName("prov")]
public string Prov { get; set; }
[Column("nazione"), JsonPropertyName("nazione")]
public string Nazione { get; set; }
[Column("telefono"), JsonPropertyName("telefono")]
public string? Telefono { get; set; }
[Column("fax"), JsonPropertyName("fax")]
public string Fax { get; set; }
[Column("part_iva"), JsonPropertyName("partIva")]
public string PartIva { get; set; }
[Column("cod_fisc"), JsonPropertyName("codFisc")]
public string CodFisc { get; set; }
[Column("note"), JsonPropertyName("note")]
public string Note { get; set; }
[Column("persona_rif"), JsonPropertyName("personaRif")]
public string PersonaRif { get; set; }
[Column("e_mail"), JsonPropertyName("eMail")]
public string? EMail { get; set; }
[Column("e_mail_pec"), JsonPropertyName("eMailPec")]
public string EMailPec { get; set; }
[Column("nome"), JsonPropertyName("nome")]
public string Nome { get; set; }
[Column("data_ins"), JsonPropertyName("dataIns")]
public DateTime? DataIns { get; set; } = DateTime.Now;
[Column("num_cell"), JsonPropertyName("numCell")]
public string NumCell { get; set; }
[Column("cognome"), JsonPropertyName("cognome")]
public string Cognome { get; set; }
[Column("diacod"), JsonPropertyName("diacod")]
public string Diacod { get; set; }
[Column("lat"), JsonPropertyName("lat")]
public decimal? Lat { get; set; }
[Column("lng"), JsonPropertyName("lng")]
public decimal? Lng { get; set; }
[Column("data_mod"), JsonPropertyName("dataMod")]
public DateTime? DataMod { get; set; } = DateTime.Now;
[Column("flag_stato"), JsonPropertyName("flagStato")]
public string FlagStato { get; set; }
}

View File

@@ -0,0 +1,110 @@
using System.Text.Json.Serialization;
using SQLite;
namespace salesbook.Shared.Core.Entity;
[Table("jtb_comt")]
public class JtbComt
{
[PrimaryKey, Column("cod_jcom"), JsonPropertyName("codJcom")]
public string CodJcom { get; set; }
[Column("cod_jfas"), JsonPropertyName("codJfas")]
public string CodJfas { get; set; }
[Column("cod_jflav"), JsonPropertyName("codJflav")]
public string CodJflav { get; set; }
[Column("descrizione"), JsonPropertyName("descrizione")]
public string Descrizione { get; set; }
[Column("importo"), JsonPropertyName("importo")]
public decimal Importo { get; set; } = 0;
[Column("data_inizi_lav"), JsonPropertyName("dataIniziLav")]
public DateTime? DataIniziLav { get; set; }
[Column("cod_mart"), JsonPropertyName("codMart")]
public string CodMart { get; set; }
[Column("data_cons"), JsonPropertyName("dataCons")]
public DateTime? DataCons { get; set; }
[Column("manuali"), JsonPropertyName("manuali")]
public string Manuali { get; set; }
[Column("note"), JsonPropertyName("note")]
public string Note { get; set; }
[Column("cod_anag"), JsonPropertyName("codAnag")]
public string? CodAnag { get; set; }
[Column("cod_divi"), JsonPropertyName("codDivi")]
public string CodDivi { get; set; } = "EURO";
[Column("cambio_divi"), JsonPropertyName("cambioDivi")]
public decimal CambioDivi { get; set; } = 1;
[Column("cod_divi_cont"), JsonPropertyName("codDiviCont")]
public string CodDiviCont { get; set; }
[Column("cambio_divi_cont"), JsonPropertyName("cambioDiviCont")]
public decimal CambioDiviCont { get; set; }
[Column("responsabile_com"), JsonPropertyName("responsabileCom")]
public string ResponsabileCom { get; set; }
[Column("stato_commessa"), JsonPropertyName("statoCommessa")]
public string StatoCommessa { get; set; }
[Column("tipo_commessa"), JsonPropertyName("tipoCommessa")]
public string TipoCommessa { get; set; }
[Column("descrizione_estesa"), JsonPropertyName("descrizioneEstesa")]
public string DescrizioneEstesa { get; set; }
[Column("perc_comp"), JsonPropertyName("percComp")]
public decimal PercComp { get; set; } = 0;
[Column("cod_vdes"), JsonPropertyName("codVdes")]
public string CodVdes { get; set; }
[Column("gestione"), JsonPropertyName("gestione")]
public string Gestione { get; set; }
[Column("data_ord"), JsonPropertyName("dataOrd")]
public DateTime? DataOrd { get; set; }
[Column("num_ord"), JsonPropertyName("numOrd")]
public int? NumOrd { get; set; }
[Column("matricola"), JsonPropertyName("matricola")]
public string Matricola { get; set; }
[Column("tipo_anag"), JsonPropertyName("tipoAnag")]
public string TipoAnag { get; set; }
[Column("flag_pubblica"), JsonPropertyName("flagPubblica")]
public string FlagPubblica { get; set; } = "N";
[Column("cig"), JsonPropertyName("cig")]
public string Cig { get; set; }
[Column("cup"), JsonPropertyName("cup")]
public string Cup { get; set; }
[Column("indirizzo_ente"), JsonPropertyName("indirizzoEnte")]
public string IndirizzoEnte { get; set; }
[Column("note_cons"), JsonPropertyName("noteCons")]
public string NoteCons { get; set; }
[Column("cod_vage"), JsonPropertyName("codVage")]
public string CodVage { get; set; }
[Column("cod_jflav_tec"), JsonPropertyName("codJflavTec")]
public string CodJflavTec { get; set; }
[Column("note_tecniche"), JsonPropertyName("noteTecniche")]
public string NoteTecniche { get; set; }
}

View File

@@ -0,0 +1,131 @@
using SQLite;
using System.Text.Json.Serialization;
namespace salesbook.Shared.Core.Entity;
[Table("ptb_pros")]
public class PtbPros
{
[PrimaryKey, Column("cod_ppro"), JsonPropertyName("codPpro")]
public string CodPpro { get; set; }
[Column("agenzia_banca"), JsonPropertyName("agenziaBanca")]
public string AgenziaBanca { get; set; }
[Column("cap"), JsonPropertyName("cap")]
public string Cap { get; set; }
[Column("citta"), JsonPropertyName("citta")]
public string Citta { get; set; }
[Column("cod_abi"), JsonPropertyName("codAbi")]
public string CodAbi { get; set; }
[Column("cod_aliq"), JsonPropertyName("codAliq")]
public string CodAliq { get; set; }
[Column("cod_anag"), JsonPropertyName("codAnag")]
public string CodAnag { get; set; }
[Column("cod_banc"), JsonPropertyName("codBanc")]
public string CodBanc { get; set; }
[Column("cod_cab"), JsonPropertyName("codCab")]
public string CodCab { get; set; }
[Column("cod_fisc"), JsonPropertyName("codFisc")]
public string CodFisc { get; set; }
[Column("cod_paga"), JsonPropertyName("codPaga")]
public string CodPaga { get; set; }
[Column("cod_vage"), JsonPropertyName("codVage")]
public string CodVage { get; set; }
[Column("cod_vatt"), JsonPropertyName("codVatt")]
public string CodVatt { get; set; }
[Column("cod_vlis"), JsonPropertyName("codVlis")]
public string CodVlis { get; set; }
[Column("cod_vseg"), JsonPropertyName("codVseg")]
public string CodVseg { get; set; }
[Column("cod_vset"), JsonPropertyName("codVset")]
public string CodVset { get; set; }
[Column("cod_vtip"), JsonPropertyName("codVtip")]
public string CodVtip { get; set; }
[Column("cod_vzon"), JsonPropertyName("codVzon")]
public string CodVzon { get; set; }
[Column("data_ins"), JsonPropertyName("dataIns")]
public DateTime? DataIns { get; set; } = DateTime.Now;
[Column("descrizione_pag"), JsonPropertyName("descrizionePag")]
public string DescrizionePag { get; set; }
[Column("e_mail"), JsonPropertyName("eMail")]
public string EMail { get; set; }
[Column("fax"), JsonPropertyName("fax")]
public string Fax { get; set; }
[Column("flag_riv_clie"), JsonPropertyName("flagRivClie")]
public string FlagRivClie { get; set; } = "C";
[Column("fonte"), JsonPropertyName("fonte")]
public string Fonte { get; set; }
[Column("gg_chiusura"), JsonPropertyName("ggChiusura")]
public string GgChiusura { get; set; }
[Column("indirizzo"), JsonPropertyName("indirizzo")]
public string Indirizzo { get; set; }
[Column("nazione"), JsonPropertyName("nazione")]
public string Nazione { get; set; }
[Column("note"), JsonPropertyName("note")]
public string Note { get; set; }
[Column("part_iva"), JsonPropertyName("partIva")]
public string PartIva { get; set; }
[Column("persona_rif"), JsonPropertyName("personaRif")]
public string PersonaRif { get; set; }
[Column("prov"), JsonPropertyName("prov")]
public string Prov { get; set; }
[Column("rag_soc"), JsonPropertyName("ragSoc")]
public string RagSoc { get; set; }
[Column("rag_soc2"), JsonPropertyName("ragSoc2")]
public string RagSoc2 { get; set; }
[Column("sconto1"), JsonPropertyName("sconto1")]
public decimal Sconto1 { get; set; } = 0;
[Column("sconto2"), JsonPropertyName("sconto2")]
public decimal Sconto2 { get; set; } = 0;
[Column("telefono"), JsonPropertyName("telefono")]
public string Telefono { get; set; }
[Column("cuu_pa"), JsonPropertyName("cuuPa")]
public string CuuPa { get; set; }
[Column("e_mail_pec"), JsonPropertyName("eMailPec")]
public string EMailPec { get; set; }
[Column("flag_informativa"), JsonPropertyName("flagInformativa")]
public string FlagInformativa { get; set; } = "N";
[Column("flag_consenso"), JsonPropertyName("flagConsenso")]
public string FlagConsenso { get; set; } = "N";
[Column("username"), JsonPropertyName("userName")]
public string UserName { get; set; }
}

View File

@@ -0,0 +1,32 @@
using SQLite;
using System.Text.Json.Serialization;
namespace salesbook.Shared.Core.Entity;
[Table("ptb_pros_rif")]
public class PtbProsRif
{
[Column("cod_ppro"), JsonPropertyName("codPpro"), Indexed(Name = "PtbProsRifPK", Order = 1, Unique = true)]
public string CodPpro { get; set; }
[Column("id_pers_rif"), JsonPropertyName("idPersRif"), Indexed(Name = "PtbProsRifPK", Order = 2, Unique = true)]
public int IdPersRif { get; set; }
[Column("persona_rif"), JsonPropertyName("personaRif")]
public string PersonaRif { get; set; }
[Column("e_mail"), JsonPropertyName("eMail")]
public string EMail { get; set; }
[Column("fax"), JsonPropertyName("fax")]
public string Fax { get; set; }
[Column("mansione"), JsonPropertyName("mansione")]
public string Mansione { get; set; }
[Column("num_cellulare"), JsonPropertyName("numCellulare")]
public string NumCellulare { get; set; }
[Column("telefono"), JsonPropertyName("telefono")]
public string Telefono { get; set; }
}

View File

@@ -0,0 +1,176 @@
using SQLite;
using System.Text.Json.Serialization;
namespace salesbook.Shared.Core.Entity;
[Table("stb_activity")]
public class StbActivity
{
[PrimaryKey, Column("activity_id"), JsonPropertyName("activityId")]
public string ActivityId { get; set; }
[Column("activity_result_id"), JsonPropertyName("activityResultId")]
public string? ActivityResultId { get; set; }
[Column("activity_type_id"), JsonPropertyName("activityTypeId")]
public string? ActivityTypeId { get; set; }
[Column("data_ins_act"), JsonPropertyName("dataInsAct")]
public DateTime DataInsAct { get; set; } = DateTime.Now;
[Column("activity_description"), JsonPropertyName("activityDescription")]
public string? ActivityDescription { get; set; }
[Column("parent_activity_id"), JsonPropertyName("parentActivityId")]
public string? ParentActivityId { get; set; }
[Column("tipo_anag"), JsonPropertyName("tipoAnag")]
public string? TipoAnag { get; set; }
[Column("cod_anag"), JsonPropertyName("codAnag")]
public string? CodAnag { get; set; }
[Column("cod_jcom"), JsonPropertyName("codJcom")]
public string? CodJcom { get; set; }
[Column("cod_jfas"), JsonPropertyName("codJfas")]
public string? CodJfas { get; set; }
[Column("estimated_date"), JsonPropertyName("estimatedDate")]
public DateTime? EstimatedDate { get; set; }
[Column("estimated_time"), JsonPropertyName("estimatedTime")]
public DateTime? EstimatedTime { get; set; }
[Column("alarm_date"), JsonPropertyName("alarmDate")]
public DateTime? AlarmDate { get; set; }
[Column("alarm_time"), JsonPropertyName("alarmTime")]
public DateTime? AlarmTime { get; set; }
[Column("effective_date"), JsonPropertyName("effectiveDate")]
public DateTime? EffectiveDate { get; set; }
[Column("effective_time"), JsonPropertyName("effectiveTime")]
public DateTime? EffectiveTime { get; set; }
[Column("result_description"), JsonPropertyName("resultDescription")]
public string? ResultDescription { get; set; }
[Column("estimated_enddate"), JsonPropertyName("estimatedEnddate")]
public DateTime? EstimatedEnddate { get; set; }
[Column("estimated_endtime"), JsonPropertyName("estimatedEndtime")]
public DateTime? EstimatedEndtime { get; set; }
[Column("effective_enddate"), JsonPropertyName("effectiveEnddate")]
public DateTime? EffectiveEnddate { get; set; }
[Column("effective_endtime"), JsonPropertyName("effectiveEndtime")]
public DateTime? EffectiveEndtime { get; set; }
[Column("user_creator"), JsonPropertyName("userCreator")]
public string? UserCreator { get; set; }
[Column("user_name"), JsonPropertyName("userName")]
public string? UserName { get; set; }
[Column("perc_comp"), JsonPropertyName("percComp")]
public double? PercComp { get; set; } = 0;
[Column("estimated_hours"), JsonPropertyName("estimatedHours")]
public double? EstimatedHours { get; set; } = 0;
[Column("cod_mart"), JsonPropertyName("codMart")]
public string? CodMart { get; set; }
[Column("partita_mag"), JsonPropertyName("partitaMag")]
public string? PartitaMag { get; set; }
[Column("matricola"), JsonPropertyName("matricola")]
public string? Matricola { get; set; }
[Column("priorita"), JsonPropertyName("priorita")]
public int? Priorita { get; set; } = 0;
[Column("activity_play_counter"), JsonPropertyName("activityPlayCounter")]
public double? ActivityPlayCounter { get; set; } = 0;
[Column("activity_event"), JsonPropertyName("activityEvent")]
public string? ActivityEvent { get; set; }
[Column("guarantee"), JsonPropertyName("guarantee")]
public string? Guarantee { get; set; }
[Column("note"), JsonPropertyName("note")]
public string? Note { get; set; }
[Column("rfid"), JsonPropertyName("rfid")]
public string? Rfid { get; set; }
[Column("id_lotto"), JsonPropertyName("idLotto")]
public int? IdLotto { get; set; }
[Column("persona_rif"), JsonPropertyName("personaRif")]
public string? PersonaRif { get; set; }
[Column("hr_num"), JsonPropertyName("hrNum")]
public int? HrNum { get; set; }
[Column("gestione"), JsonPropertyName("gestione")]
public string? Gestione { get; set; }
[Column("data_ord"), JsonPropertyName("dataOrd")]
public DateTime? DataOrd { get; set; }
[Column("num_ord"), JsonPropertyName("numOrd")]
public int? NumOrd { get; set; }
[Column("id_step"), JsonPropertyName("idStep")]
public int? IdStep { get; set; }
[Column("id_riga"), JsonPropertyName("idRiga")]
public int? IdRiga { get; set; }
[Column("ora_ins_act"), JsonPropertyName("oraInsAct")]
public DateTime? OraInsAct { get; set; }
[Column("indice_gradimento"), JsonPropertyName("indiceGradimento")]
public decimal? IndiceGradimento { get; set; } = 0;
[Column("note_gradimento"), JsonPropertyName("noteGradimento")]
public string? NoteGradimento { get; set; }
[Column("flag_risolto"), JsonPropertyName("flagRisolto")]
public string? FlagRisolto { get; set; } = "N";
[Column("flag_tipologia"), JsonPropertyName("flagTipologia")]
public string? FlagTipologia { get; set; }
[Ignore, JsonPropertyName("oreRapportino")]
public decimal? OreRapportino { get; set; }
[Column("user_modifier"), JsonPropertyName("userModifier")]
public string? UserModifier { get; set; }
[Column("ora_mod_act"), JsonPropertyName("oraModAct")]
public DateTime? OraModAct { get; set; } = DateTime.Now;
[Column("ora_view_act"), JsonPropertyName("oraViewAct")]
public DateTime? OraViewAct { get; set; }
[Column("cod_vdes"), JsonPropertyName("codVdes")]
public string? CodVdes { get; set; }
[Column("cod_cmac"), JsonPropertyName("codCmac")]
public string? CodCmac { get; set; }
[Column("wrike_id"), JsonPropertyName("wrikeId")]
public string? WrikeId { get; set; }
[Column("cod_mgrp"), JsonPropertyName("codMgrp")]
public string? CodMgrp { get; set; }
[Column("plan_id"), JsonPropertyName("planId")]
public long? PlanId { get; set; }
}

View File

@@ -0,0 +1,32 @@
using SQLite;
using System.Text.Json.Serialization;
namespace salesbook.Shared.Core.Entity;
[Table("stb_activity_result")]
public class StbActivityResult
{
[PrimaryKey, Column("activity_result_id"), JsonPropertyName("activityResultId")]
public string ActivityResultId { get; set; }
[Column("path_icona"), JsonPropertyName("pathIcona")]
public string? PathIcona { get; set; }
[Column("flag_save_rap_lav"), JsonPropertyName("flagSaveRapLav")]
public string FlagSaveRapLav { get; set; } = "N";
[Column("flag_activity_result"), JsonPropertyName("flagActivityResult")]
public int? FlagActivityResult { get; set; } = 1;
[Column("flag_insert_activity"), JsonPropertyName("flagInsertActivity")]
public string FlagInsertActivity { get; set; } = "N";
[Column("flag_attivo"), JsonPropertyName("flagAttivo")]
public string FlagAttivo { get; set; } = "S";
[Column("flag_invio_notifica"), JsonPropertyName("flagInvioNotifica")]
public string FlagInvioNotifica { get; set; } = "N";
[Column("flag_stato_attivita"), JsonPropertyName("flagStatoAttivita")]
public string FlagStatoAttivita { get; set; } = "N";
}

View File

@@ -0,0 +1,41 @@
using SQLite;
using System.Text.Json.Serialization;
namespace salesbook.Shared.Core.Entity;
[Table("stb_activity_type")]
public class StbActivityType
{
[Column("activity_type_id"), JsonPropertyName("activityTypeId"), Indexed(Name = "ActivityTypePK", Order = 1, Unique = true)]
public string ActivityTypeId { get; set; }
[Column("flag_tipologia"), JsonPropertyName("flagTipologia"), Indexed(Name = "ActivityTypePK", Order = 2, Unique = true)]
public string FlagTipologia { get; set; }
[Column("estimated_duration"), JsonPropertyName("estimatedDuration")]
public double? EstimatedDuration { get; set; } = 0;
[Column("link_gest"), JsonPropertyName("linkGest")]
public string? LinkGest { get; set; }
[Column("cod_jfas"), JsonPropertyName("codJfas")]
public string? CodJfas { get; set; }
[Column("user_name"), JsonPropertyName("userName")]
public string? UserName { get; set; }
[Column("flag_sal"), JsonPropertyName("flagSal")]
public string FlagSal { get; set; } = "N";
[Column("flag_set_alarm"), JsonPropertyName("flagSetAlarm")]
public string FlagSetAlarm { get; set; } = "N";
[Column("flag_attiva"), JsonPropertyName("flagAttiva")]
public string FlagAttiva { get; set; } = "S";
[Column("flag_generate_mov"), JsonPropertyName("flagGenerateMov")]
public string FlagGenerateMov { get; set; } = "S";
[Column("flag_view_calendar"), JsonPropertyName("flagViewCalendar")]
public bool FlagViewCalendar { get; set; }
}

View File

@@ -0,0 +1,14 @@
using SQLite;
using System.Text.Json.Serialization;
namespace salesbook.Shared.Core.Entity;
[Table("stb_user")]
public class StbUser
{
[PrimaryKey, Column("user_name"), JsonPropertyName("userName")]
public string UserName { get; set; }
[Column("full_name"), JsonPropertyName("fullName")]
public string FullName { get; set; }
}

View File

@@ -0,0 +1,41 @@
using SQLite;
using System.Text.Json.Serialization;
namespace salesbook.Shared.Core.Entity;
[Table("vtb_clie_pers_rif")]
public class VtbCliePersRif
{
[Column("id_pers_rif"), JsonPropertyName("idPersRif"), Indexed(Name = "VtbCliePersRifPK", Order = 1, Unique = true)]
public int IdPersRif { get; set; }
[Column("cod_anag"), JsonPropertyName("codAnag"), Indexed(Name = "VtbCliePersRifPK", Order = 2, Unique = true)]
public string CodAnag { get; set; }
[Column("persona_rif"), JsonPropertyName("personaRif")]
public string PersonaRif { get; set; }
[Column("mansione"), JsonPropertyName("mansione")]
public string? Mansione { get; set; }
[Column("telefono"), JsonPropertyName("telefono")]
public string? Telefono { get; set; }
[Column("fax"), JsonPropertyName("fax")]
public string Fax { get; set; }
[Column("e_mail"), JsonPropertyName("eMail")]
public string? EMail { get; set; }
[Column("num_cellulare"), JsonPropertyName("numCellulare")]
public string? NumCellulare { get; set; }
[Column("tipo_indirizzo"), JsonPropertyName("tipoIndirizzo")]
public string TipoIndirizzo { get; set; }
[Column("cod_vdes"), JsonPropertyName("codVdes")]
public string CodVdes { get; set; }
[Column("data_ult_agg"), JsonPropertyName("dataUltAgg")]
public DateTime? DataUltAgg { get; set; } = DateTime.Now;
}

View File

@@ -0,0 +1,197 @@
using SQLite;
using System.Text.Json.Serialization;
namespace salesbook.Shared.Core.Entity;
[Table("vtb_dest")]
public class VtbDest
{
[Column("cod_anag"), JsonPropertyName("codAnag"), Indexed(Name = "VtbDestPK", Order = 1, Unique = true)]
public string CodAnag { get; set; }
[Column("cod_vdes"), JsonPropertyName("codVdes"), Indexed(Name = "VtbDestPK", Order = 2, Unique = true)]
public string CodVdes { get; set; }
[Column("destinatario"), JsonPropertyName("destinatario")]
public string Destinatario { get; set; }
[Column("indirizzo"), JsonPropertyName("indirizzo")]
public string Indirizzo { get; set; }
[Column("cap"), JsonPropertyName("cap")]
public string Cap { get; set; }
[Column("citta"), JsonPropertyName("citta")]
public string Citta { get; set; }
[Column("prov"), JsonPropertyName("prov")]
public string Prov { get; set; }
[Column("nazione"), JsonPropertyName("nazione")]
public string Nazione { get; set; }
[Column("tel"), JsonPropertyName("tel")]
public string Tel { get; set; }
[Column("fax"), JsonPropertyName("fax")]
public string Fax { get; set; }
[Column("note"), JsonPropertyName("note")]
public string Note { get; set; }
[Column("fonte"), JsonPropertyName("fonte")]
public string Fonte { get; set; }
[Column("cod_centro_azi"), JsonPropertyName("codCentroAzi")]
public string CodCentroAzi { get; set; }
[Column("gg_cons"), JsonPropertyName("ggCons")]
public int GgCons { get; set; } = 0;
[Column("cod_aliq_out"), JsonPropertyName("codAliqOut")]
public string CodAliqOut { get; set; }
[Column("cod_aliq_in"), JsonPropertyName("codAliqIn")]
public string CodAliqIn { get; set; }
[Column("descriz_aliq_out"), JsonPropertyName("descrizAliqOut")]
public string DescrizAliqOut { get; set; }
[Column("cod_vzon"), JsonPropertyName("codVzon")]
public string CodVzon { get; set; }
[Column("cod_vlis"), JsonPropertyName("codVlis")]
public string CodVlis { get; set; }
[Column("cod_vage"), JsonPropertyName("codVage")]
public string CodVage { get; set; }
[Column("persona_rif"), JsonPropertyName("personaRif")]
public string PersonaRif { get; set; }
[Column("part_iva"), JsonPropertyName("partIva")]
public string PartIva { get; set; }
[Column("cod_affiliazione"), JsonPropertyName("codAffiliazione")]
public string CodAffiliazione { get; set; }
[Column("indirizzo_legale"), JsonPropertyName("indirizzoLegale")]
public string IndirizzoLegale { get; set; }
[Column("cap_legale"), JsonPropertyName("capLegale")]
public string CapLegale { get; set; }
[Column("citta_legale"), JsonPropertyName("cittaLegale")]
public string CittaLegale { get; set; }
[Column("prov_legale"), JsonPropertyName("provLegale")]
public string ProvLegale { get; set; }
[Column("nazione_legale"), JsonPropertyName("nazioneLegale")]
public string NazioneLegale { get; set; }
[Column("cod_mdep"), JsonPropertyName("codMdep")]
public string CodMdep { get; set; }
[Column("flag_domic_riba"), JsonPropertyName("flagDomicRiba")]
public string FlagDomicRiba { get; set; }
[Column("flag_attivo"), JsonPropertyName("flagAttivo")]
public string FlagAttivo { get; set; } = "S";
[Column("flag_esponi"), JsonPropertyName("flagEsponi")]
public string FlagEsponi { get; set; } = "S";
[Column("rag_soc_legale"), JsonPropertyName("ragSocLegale")]
public string RagSocLegale { get; set; }
[Column("cod_alis"), JsonPropertyName("codAlis")]
public string CodAlis { get; set; }
[Column("cod_vpre"), JsonPropertyName("codVpre")]
public string CodVpre { get; set; }
[Column("cod_vcom"), JsonPropertyName("codVcom")]
public string CodVcom { get; set; }
[Column("cod_sco_cli"), JsonPropertyName("codScoCli")]
public string CodScoCli { get; set; }
[Column("e_mail"), JsonPropertyName("eMail")]
public string EMail { get; set; }
[Column("data_cessazione"), JsonPropertyName("dataCessazione")]
public DateTime? DataCessazione { get; set; }
[Column("data_attivazione"), JsonPropertyName("dataAttivazione")]
public DateTime? DataAttivazione { get; set; }
[Column("cod_vvet"), JsonPropertyName("codVvet")]
public string CodVvet { get; set; }
[Column("gg_chiusura"), JsonPropertyName("ggChiusura")]
public string GgChiusura { get; set; }
[Column("tipo_negozio"), JsonPropertyName("tipoNegozio")]
public string TipoNegozio { get; set; }
[Column("cod_ean"), JsonPropertyName("codEan")]
public string CodEan { get; set; }
[Column("flag_stampa_prezzi"), JsonPropertyName("flagStampaPrezzi")]
public string FlagStampaPrezzi { get; set; } = "S";
[Column("cod_aliq"), JsonPropertyName("codAliq")]
public string CodAliq { get; set; }
[Column("cod_griglia"), JsonPropertyName("codGriglia")]
public string CodGriglia { get; set; }
[Column("cod_acc"), JsonPropertyName("codAcc")]
public string CodAcc { get; set; }
[Column("cod_vtip"), JsonPropertyName("codVtip")]
public string CodVtip { get; set; }
[Column("cod_vset"), JsonPropertyName("codVset")]
public string CodVset { get; set; }
[Column("cod_vseg"), JsonPropertyName("codVseg")]
public string CodVseg { get; set; }
[Column("cod_vatt"), JsonPropertyName("codVatt")]
public string CodVatt { get; set; }
[Column("cod_fisc"), JsonPropertyName("codFisc")]
public string CodFisc { get; set; }
[Column("cuu_pa"), JsonPropertyName("cuuPa")]
public string CuuPa { get; set; }
[Column("e_mail_pec"), JsonPropertyName("eMailPec")]
public string EMailPec { get; set; }
[Column("flag_stabile_org"), JsonPropertyName("flagStabileOrg")]
public string FlagStabileOrg { get; set; }
[Column("lat"), JsonPropertyName("lat")]
public decimal? Lat { get; set; }
[Column("lng"), JsonPropertyName("lng")]
public decimal? Lng { get; set; }
[Column("term_cons"), JsonPropertyName("termCons")]
public string TermCons { get; set; }
[Column("itinerario"), JsonPropertyName("itinerario")]
public string Itinerario { get; set; }
[Column("imp_min_ord"), JsonPropertyName("impMinOrd")]
public decimal ImpMinOrd { get; set; } = 0;
[Column("part_iva_legale"), JsonPropertyName("partIvaLegale")]
public string PartIvaLegale { get; set; }
[Column("cod_fisc_legale"), JsonPropertyName("codFiscLegale")]
public string CodFiscLegale { get; set; }
}

View File

@@ -0,0 +1,24 @@
using salesbook.Shared.Core.Helpers.Enum;
namespace salesbook.Shared.Core.Helpers;
public static class ActivityCategoryHelper
{
public static string ConvertToHumanReadable(this ActivityCategoryEnum activityCategory)
{
return activityCategory switch
{
ActivityCategoryEnum.Memo => "memo",
ActivityCategoryEnum.Interna => "interna",
ActivityCategoryEnum.Commessa => "commessa",
_ => throw new ArgumentOutOfRangeException(nameof(activityCategory), activityCategory, null)
};
}
public static List<ActivityCategoryEnum> AllActivityCategory =>
[
ActivityCategoryEnum.Memo,
ActivityCategoryEnum.Interna,
ActivityCategoryEnum.Commessa
];
}

View File

@@ -0,0 +1,8 @@
namespace salesbook.Shared.Core.Helpers.Enum;
public enum ActivityCategoryEnum
{
Memo = 0,
Interna = 1,
Commessa = 2
}

View File

@@ -0,0 +1,11 @@
namespace salesbook.Shared.Core.Helpers;
class IconConstants
{
public class Chip
{
public const string Stato = "ri-list-check-3 fa-fw fa-chip";
public const string User = "ri-user-fill fa-fw fa-chip";
public const string Time = "ri-time-line fa-fw fa-chip";
}
}

View File

@@ -0,0 +1,17 @@
using salesbook.Shared.Core.Authorization.Enum;
namespace salesbook.Shared.Core.Helpers;
public static class KeyGroupHelper
{
public static string ConvertToHumanReadable(this KeyGroupEnum keyGroup)
{
return keyGroup switch
{
KeyGroupEnum.Agenti => "Agenti",
KeyGroupEnum.Tecnico => "Tecnico",
KeyGroupEnum.UtenteAziendale => "Utente Aziendale",
_ => throw new ArgumentOutOfRangeException(nameof(keyGroup), keyGroup, null)
};
}
}

View File

@@ -0,0 +1,13 @@
using AutoMapper;
using salesbook.Shared.Core.Dto;
using salesbook.Shared.Core.Entity;
namespace salesbook.Shared.Core.Helpers;
public class MappingProfile : Profile
{
public MappingProfile()
{
CreateMap<StbActivity, ActivityDTO>();
}
}

View File

@@ -0,0 +1,28 @@
using MudBlazor;
using salesbook.Shared.Components.SingleElements.Modal;
using salesbook.Shared.Core.Dto;
namespace salesbook.Shared.Core.Helpers;
public class ModalHelpers
{
public static async Task<DialogResult?> OpenActivityForm(IDialogService dialog, ActivityDTO? activity, string? id)
{
var modal = await dialog.ShowAsync<ActivityForm>(
"Activity form",
new DialogParameters<ActivityForm>
{
{ x => x.Id, id },
{ x => x.ActivityCopied, activity }
},
new DialogOptions
{
FullScreen = true,
CloseButton = false,
NoHeader = true
}
);
return await modal.Result;
}
}

View File

@@ -0,0 +1,19 @@
using System.Collections;
namespace salesbook.Shared.Core.Helpers;
public static class ObjectExtensions
{
public static bool IsNullOrEmpty(this IEnumerable? obj) =>
obj == null || obj.GetEnumerator().MoveNext() == false;
public static bool IsNullOrEmpty(this string? obj) =>
string.IsNullOrEmpty(obj);
public static bool EqualsIgnoreCase(this string obj, string anotherString) =>
string.Equals(obj, anotherString, StringComparison.OrdinalIgnoreCase);
public static bool ContainsIgnoreCase(this string obj, string anotherString) =>
obj.Contains(anotherString, StringComparison.OrdinalIgnoreCase);
}

View File

@@ -0,0 +1,13 @@
namespace salesbook.Shared.Core.Interface;
public interface IFormFactor
{
public string GetFormFactor();
public string GetPlatform();
public bool IsWeb()
{
var formFactor = GetFormFactor();
return formFactor == "Web";
}
}

View File

@@ -0,0 +1,17 @@
using salesbook.Shared.Core.Dto;
using salesbook.Shared.Core.Entity;
namespace salesbook.Shared.Core.Interface;
public interface IIntegryApiService
{
Task<List<StbActivity>?> RetrieveActivity(string? dateFilter = null);
Task<List<JtbComt>?> RetrieveAllCommesse(string? dateFilter = null);
Task<TaskSyncResponseDTO> RetrieveAnagClie(string? dateFilter = null);
Task<TaskSyncResponseDTO> RetrieveProspect(string? dateFilter = null);
Task<SettingsResponseDTO> RetrieveSettings();
Task DeleteActivity(string activityId);
Task<List<StbActivity>?> SaveActivity(ActivityDTO activity);
}

View File

@@ -0,0 +1,18 @@
using System.Linq.Expressions;
using salesbook.Shared.Core.Dto;
using salesbook.Shared.Core.Entity;
namespace salesbook.Shared.Core.Interface;
public interface IManageDataService
{
Task<List<T>> GetTable<T>(Expression<Func<T, bool>>? whereCond = null) where T : new();
Task<List<ActivityDTO>> GetActivity(Expression<Func<StbActivity, bool>>? whereCond = null);
Task InsertOrUpdate<T>(T objectToSave);
Task Delete<T>(T objectToDelete);
Task DeleteActivity(ActivityDTO activity);
Task ClearDb();
}

View File

@@ -0,0 +1,6 @@
namespace salesbook.Shared.Core.Interface;
public interface INetworkService
{
public bool IsNetworkAvailable();
}

View File

@@ -0,0 +1,10 @@
namespace salesbook.Shared.Core.Interface;
public interface ISyncDbService
{
Task GetAndSaveActivity(string? dateFilter = null);
Task GetAndSaveCommesse(string? dateFilter = null);
Task GetAndSaveProspect(string? dateFilter = null);
Task GetAndSaveClienti(string? dateFilter = null);
Task GetAndSaveSettings(string? dateFilter = null);
}

View File

@@ -0,0 +1,6 @@
using CommunityToolkit.Mvvm.Messaging.Messages;
using salesbook.Shared.Core.Dto;
namespace salesbook.Shared.Core.Messages.Activity.Copy;
public class CopyActivityMessage(ActivityDTO value) : ValueChangedMessage<ActivityDTO>(value);

View File

@@ -0,0 +1,17 @@
using CommunityToolkit.Mvvm.Messaging;
using salesbook.Shared.Core.Dto;
namespace salesbook.Shared.Core.Messages.Activity.Copy;
public class CopyActivityService
{
public event Action<ActivityDTO>? OnCopyActivity;
public CopyActivityService(IMessenger messenger)
{
messenger.Register<CopyActivityMessage>(this, (_, o) =>
{
OnCopyActivity?.Invoke(o.Value);
});
}
}

View File

@@ -0,0 +1,5 @@
using CommunityToolkit.Mvvm.Messaging.Messages;
namespace salesbook.Shared.Core.Messages.Activity.New;
public class NewActivityMessage(string value) : ValueChangedMessage<string>(value);

View File

@@ -0,0 +1,16 @@
using CommunityToolkit.Mvvm.Messaging;
namespace salesbook.Shared.Core.Messages.Activity.New;
public class NewActivityService
{
public event Action<string>? OnActivityCreated;
public NewActivityService(IMessenger messenger)
{
messenger.Register<NewActivityMessage>(this, (_, o) =>
{
OnActivityCreated?.Invoke(o.Value);
});
}
}

View File

@@ -0,0 +1,16 @@
using CommunityToolkit.Mvvm.Messaging;
namespace salesbook.Shared.Core.Messages.Back;
public class BackNavigationService
{
public event Action? OnHardwareBack;
public BackNavigationService(IMessenger messenger)
{
messenger.Register<HardwareBackMessage>(this, (_, _) =>
{
OnHardwareBack?.Invoke();
});
}
}

View File

@@ -0,0 +1,5 @@
using CommunityToolkit.Mvvm.Messaging.Messages;
namespace salesbook.Shared.Core.Messages.Back;
public class HardwareBackMessage(string value) : ValueChangedMessage<string>(value);

View File

@@ -0,0 +1,56 @@
using IntegryApiClient.Core.Domain.Abstraction.Contracts.Account;
using System.Security.Claims;
using Microsoft.AspNetCore.Components.Authorization;
namespace salesbook.Shared.Core.Services;
public class AppAuthenticationStateProvider : AuthenticationStateProvider
{
private readonly IUserSession _userSession;
private readonly IUserAccountService _userAccountService;
public AppAuthenticationStateProvider(IUserSession userSession, IUserAccountService userAccountService)
{
_userSession = userSession;
_userAccountService = userAccountService;
userAccountService.ExpiredUserSession += (_, _) =>
NotifyAuthenticationStateChanged(LoadAuthenticationState());
}
public override async Task<AuthenticationState> GetAuthenticationStateAsync()
{
return await LoadAuthenticationState();
}
public async Task SignOut()
{
await _userAccountService.Logout();
NotifyAuthenticationState();
}
public void NotifyAuthenticationState()
{
NotifyAuthenticationStateChanged(LoadAuthenticationState());
}
private async Task<AuthenticationState> LoadAuthenticationState()
{
if (!await _userSession.IsLoggedIn() || !await _userSession.IsRefreshTokenValid())
{
return new AuthenticationState(
new ClaimsPrincipal(
new ClaimsIdentity()
)
);
}
var claimIdentity = new ClaimsIdentity(_userSession.JwtToken!.Claims, "jwt");
var user = new ClaimsPrincipal(claimIdentity);
var authenticationState = new AuthenticationState(user);
return authenticationState;
}
}

View File

@@ -0,0 +1,70 @@
using IntegryApiClient.Core.Domain.Abstraction.Contracts.Account;
using IntegryApiClient.Core.Domain.RestClient.Contacts;
using salesbook.Shared.Core.Dto;
using salesbook.Shared.Core.Entity;
using salesbook.Shared.Core.Interface;
namespace salesbook.Shared.Core.Services;
public class IntegryApiService(IIntegryApiRestClient integryApiRestClient, IUserSession userSession)
: IIntegryApiService
{
public Task<List<StbActivity>?> RetrieveActivity(string? dateFilter)
{
var queryParams = new Dictionary<string, object> { { "dateFilter", dateFilter ?? "2020-01-01" } };
return integryApiRestClient.AuthorizedGet<List<StbActivity>?>("crm/retrieveActivity", queryParams);
}
public Task<List<JtbComt>?> RetrieveAllCommesse(string? dateFilter)
{
var queryParams = new Dictionary<string, object>();
if (dateFilter != null)
{
queryParams.Add("dateFilter", dateFilter);
}
return integryApiRestClient.AuthorizedGet<List<JtbComt>?>("crm/retrieveCommesse", queryParams);
}
public Task<TaskSyncResponseDTO> RetrieveAnagClie(string? dateFilter)
{
var queryParams = new Dictionary<string, object>();
if (dateFilter != null)
{
queryParams.Add("dateFilter", dateFilter);
}
return integryApiRestClient.AuthorizedGet<TaskSyncResponseDTO>("crm/retrieveClienti", queryParams)!;
}
public Task<TaskSyncResponseDTO> RetrieveProspect(string? dateFilter)
{
var queryParams = new Dictionary<string, object>();
if (dateFilter != null)
{
queryParams.Add("dateFilter", dateFilter);
}
return integryApiRestClient.AuthorizedGet<TaskSyncResponseDTO>("crm/retrieveProspect", queryParams)!;
}
public Task<SettingsResponseDTO> RetrieveSettings() =>
integryApiRestClient.AuthorizedGet<SettingsResponseDTO>("crm/retrieveSettings")!;
public Task DeleteActivity(string activityId)
{
var queryParams = new Dictionary<string, object>
{
{ "activityId", activityId }
};
return integryApiRestClient.AuthorizedGet<object>($"activity/delete", queryParams);
}
public Task<List<StbActivity>?> SaveActivity(ActivityDTO activity) =>
integryApiRestClient.AuthorizedPost<List<StbActivity>?>("crm/saveActivity", activity);
}

View File

@@ -0,0 +1,118 @@
namespace salesbook.Shared.Core.Utility;
public static class UtilityColor
{
public static string CalcHexColor(string input)
{
try
{
var hue = (int)(Math.Abs(input.GetHashCode()) * 137.508 % 360);
var data = new HSL(hue, 0.90f, 0.85f);
var myColor = HSLToRGB(data);
return myColor.R.ToString("X2") + myColor.G.ToString("X2") + myColor.B.ToString("X2");
}
catch (Exception e)
{
Console.WriteLine(e.Message);
return "dddddd";
}
}
private struct RGB(byte r, byte g, byte b)
{
public byte R
{
get => r;
set => r = value;
}
public byte G
{
get => g;
set => g = value;
}
public byte B
{
get => b;
set => b = value;
}
public bool Equals(RGB rgb)
{
return (this.R == rgb.R) && (this.G == rgb.G) && (this.B == rgb.B);
}
}
private struct HSL(int h, float s, float l)
{
public int H
{
get => h;
set => h = value;
}
public float S
{
get => s;
set => s = value;
}
public float L
{
get => l;
set => l = value;
}
public bool Equals(HSL hsl)
{
return H == hsl.H && (this.S == hsl.S) && (this.L == hsl.L);
}
}
private static RGB HSLToRGB(HSL hsl)
{
byte r;
byte g;
byte b;
var hue = (float)hsl.H / 360;
if (hsl.S == 0)
{
r = g = b = (byte)(hsl.L * 255);
}
else
{
var v2 = hsl.L < 0.5 ? hsl.L * (1 + hsl.S) : hsl.L + hsl.S - hsl.L * hsl.S;
var v1 = 2 * hsl.L - v2;
r = (byte)(255 * HueToRGB(v1, v2, hue + 1.0f / 3));
g = (byte)(255 * HueToRGB(v1, v2, hue));
b = (byte)(255 * HueToRGB(v1, v2, hue - 1.0f / 3));
}
return new RGB(r, g, b);
}
private static float HueToRGB(float v1, float v2, float vH)
{
if (vH < 0)
vH += 1;
if (vH > 1)
vH -= 1;
if (6 * vH < 1)
return v1 + (v2 - v1) * 6 * vH;
if (2 * vH < 1)
return v2;
if (3 * vH < 2)
return v1 + (v2 - v1) * (2.0f / 3 - vH) * 6;
return v1;
}
}

View File

@@ -0,0 +1,38 @@
using System.Globalization;
namespace salesbook.Shared.Core.Utility;
public static class UtilityString
{
public static string ExtractInitials(string fullname)
{
return string.Concat(fullname
.Split(' ', StringSplitOptions.RemoveEmptyEntries)
.Take(3)
.Select(word => char.ToUpper(word[0])));
}
public static string FirstCharToUpper(this string input) =>
input switch
{
null => throw new ArgumentNullException(nameof(input)),
"" => throw new ArgumentException($"{nameof(input)} cannot be empty", nameof(input)),
_ => input[0].ToString().ToUpper() + input[1..]
};
public static (string Upper, string Lower, string SentenceCase, string TitleCase) FormatString(string input)
{
if (string.IsNullOrWhiteSpace(input))
return (string.Empty, string.Empty, string.Empty, string.Empty);
var upper = input.ToUpper();
var lower = input.ToLower();
var sentenceCase = char.ToUpper(lower[0]) + lower[1..];
var textInfo = CultureInfo.CurrentCulture.TextInfo;
var titleCase = textInfo.ToTitleCase(lower);
return (upper, lower, sentenceCase, titleCase);
}
}