Esempio n. 1
0
    protected void btnsave_Click(object sender, EventArgs e)
    {
        Clients clientobj= new Clients();
        clientobj._id = Guid.NewGuid();
        clientobj._name = nametxt.Text;
        clientobj._email = emailtxt.Text;
        clientobj._password = passwordtxt.Text;
        FileUpload FileUpload1 = (FileUpload)FindControl("picupload");
        string virtualFolder = "~/ProfilePics/";
        string physicalFolder = Server.MapPath(virtualFolder);
        string fileName = Guid.NewGuid().ToString();
        string extension = System.IO.Path.GetExtension(FileUpload1.FileName);
        FileUpload1.SaveAs(System.IO.Path.Combine(physicalFolder, fileName + extension));

        clientobj._ProfilePicture = virtualFolder + fileName + extension;
        clientobj.SaveClient();

        //Creates the session and redirect the user to the Main page.
        Session["UserInfo"] = clientobj;
        Session["id"] = clientobj._id;
        Session["name"] = clientobj._name;
        Session["password"] = clientobj._password;
        Session["ProfilePicture"] = clientobj._ProfilePicture;
        Session["email"] = clientobj._email;
        Response.Redirect("/");
    }
Esempio n. 2
0
 protected void btnupdate_Click(object sender, EventArgs e)
 {
     Clients client = new Clients();
     client._id = new Guid(Session["id"].ToString());
     client._name = nametxt.Text;
     client._email = emailtxt.Text;
     if (picupload.FileBytes.Length > 0)
     {
         FileUpload FileUpload1 = (FileUpload)FindControl("picupload");
         string virtualFolder = "~/ProfilePics/";
         string physicalFolder = Server.MapPath(virtualFolder);
         string fileName = Guid.NewGuid().ToString();
         string extension = System.IO.Path.GetExtension(picupload.FileName);
         picupload.SaveAs(System.IO.Path.Combine(physicalFolder, fileName + extension));
         client._ProfilePicture = virtualFolder + fileName + extension;
     }
     else {
         client._ProfilePicture = Session["profilepicture"].ToString();
     }
     client.EditClient();
     Session["name"] = client._name;
     Session["email"] = client._email;
     Session["profilepicture"] = client._ProfilePicture;
     Response.Redirect("profile.aspx");
 }
Esempio n. 3
0
        public frmFicheClient(int intTypeChargementFicheClient, Clients.ObjetClient objClient)
        {
            InitializeComponent();
            this.m_intTypeChargementFicheClient = intTypeChargementFicheClient;

            if (objClient != null)
                this.m_objClient = (Clients.ObjetClient)objClient.Clone();

            this.Inititialize();
        }
Esempio n. 4
0
    protected void btndelete_Click(object sender, EventArgs e)
    {
        Clients client = new Clients();
        client._id = new Guid(Session["id"].ToString());
        client.DeleteClient();

        Session["UserInfo"] = null;
        Session["name"] = null;
        Session["Password"] = null;
        Response.Redirect("Default.aspx");
    }
        /// <summary>
        /// Bouton Modifier un Client, récupère l'index du Client sélectionné et affiche ses informations dans la fenêtre.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button_Modifier_Client_Click(object sender, EventArgs e)
        {
            Clients modif = new Clients();
            iIndexSelected = Convert.ToInt32(listView_Client.Items[iIndexSelected].Text);
            modif = CDAO.Find(iIndexSelected);
            Gestion_Fiche_Client fiche_client = new Gestion_Fiche_Client(true, modif);
            if (fiche_client.ShowDialog() != System.Windows.Forms.DialogResult.Cancel)
            {
                Rafraichir();

            }
        }
Esempio n. 6
0
 public void GotoClient(Clients client, string roomName = "defualt")
 {
     if (current != client)
     {
         current = client;
         if (current == Clients.Game)
             GameClient.Initialize(roomName);
         else if (current == Clients.Intro)
             IntroClient.Initialize();
         else if (current == Clients.Menu)
             MenuClient.Initialize();
     }
 }
Esempio n. 7
0
 public async Task<ViewResult> Index()
 {
     var clients = new Clients();
     if (Redis.IsConnected)
     {
         var ids =await Redis.GetDatabase().SetMembersAsync(ConnectionList);
         clients.Ids = ids.ToStringArray();
     }
     else
     {
         clients.Ids = ClientList.Keys.ToArray();
     }
     return View(clients);
 }
Esempio n. 8
0
        static TokenResponse RequestToken()
        {
            var client = new TokenClient(
                Constants.TokenEndpoint,
                "roclient",
                "secret");

            // idsrv supports additional non-standard parameters 
            // that get passed through to the user service
            var optional = new
            {
                acr_values = "tenant:custom_account_store1 foo bar quux"
            };

            return client.RequestResourceOwnerPasswordAsync("bob", "bob", "api1 api2", optional).Result;
        }
Esempio n. 9
0
        static Global()
        {
            var clients = new Clients();

            clients.Initialize( ClientsFactory.CreateClient( BoundedContextsContainer.Foundation, ( viewStore, sender ) => new SimpleClient< IFoundationCommand >( viewStore, sender ), AttributesFactory ) );
            clients.Initialize( ClientsFactory.CreateClient( BoundedContextsContainer.Channels, ( viewStore, sender ) => new SimpleClient< IChannelsCommand >( viewStore, sender ), AttributesFactory ) );
            clients.Initialize( ClientsFactory.CreateClient( BoundedContextsContainer.Data, ( viewStore, sender ) => new SimpleClient< IDataCommand >( viewStore, sender ), AttributesFactory ) );
            clients.Initialize( ClientsFactory.CreateClient( BoundedContextsContainer.Inventory, ( viewStore, sender ) => new SimpleClient< IInventoryCommand >( viewStore, sender ), AttributesFactory ) );
            clients.Initialize( ClientsFactory.CreateClient( BoundedContextsContainer.Receiving, ( viewStore, sender ) => new SimpleClient< IReceivingCommand >( viewStore, sender ), AttributesFactory ) );

            Foundation = clients.Foundation;
            Channels = clients.Channels;
            Data = clients.Data;
            Inventory = clients.Inventory;
            Receiving = clients.Receiving;
        }
Esempio n. 10
0
    protected void btnchange_Click(object sender, EventArgs e)
    {
        Clients client = new Clients();
        string oldPassword = oldpasstxt.Text;
        string newPassword= newpasstxt.Text;

        //Validate the password with the actual password of the user
        client._id = new Guid(Session["id"].ToString());
        passwordDt = client.RetrievePassword();
        if (passwordDt.Rows[0]["password"].ToString() == oldPassword)
        {
            client._password = newPassword;
            client.EditPassword();
            Response.Redirect("profile.aspx");
        }
        else {
            Response.Write("wrong password!");
        }
    }
Esempio n. 11
0
        private void setBindings()
        {
            TypesofAgreement typesofAgreement = new TypesofAgreement();
            Binding binding1 = new Binding();

            binding1.Source = typesofAgreement;
            cboTypeofAgreement.SetBinding(ListBox.ItemsSourceProperty, binding1);

            Statuses statuses = new Statuses();
            Binding binding2 = new Binding();

            binding2.Source = statuses;
            cboStatus.SetBinding(ListBox.ItemsSourceProperty, binding2);
            lstStatusSelect.SetBinding(ListBox.ItemsSourceProperty, binding2);

            UIDepartments departments = new UIDepartments();
            Binding binding3 = new Binding();

            binding3.Source = departments;
            cboUIDepartment.SetBinding(ListBox.ItemsSourceProperty, binding3);
            cboUIDepartmentSearch.SetBinding(ListBox.ItemsSourceProperty, binding3);

            ReimbursementPeriods reimbursementPeriods = new ReimbursementPeriods();
            Binding binding4 = new Binding();

            binding4.Source = reimbursementPeriods;
            cboReimbursement1Period.SetBinding(ListBox.ItemsSourceProperty, binding4);
            cboReimbursement2Period.SetBinding(ListBox.ItemsSourceProperty, binding4);
            cboReimbursement3Period.SetBinding(ListBox.ItemsSourceProperty, binding4);
            cboTravelReimbursementPeriod.SetBinding(ListBox.ItemsSourceProperty, binding4);

            Clients clients = new Clients();
            Binding binding5 = new Binding();

            binding5.Source = clients;
            cboClients.SetBinding(ListBox.ItemsSourceProperty, binding5);

        }
Esempio n. 12
0
 protected void btnLogin_Click(object sender, EventArgs e)
 {
     Clients clnobj = new Clients();
     clnobj._email = emailtxt.Text;
     clnobj._password = passwordtxt.Text;
     ClientUserInfo = clnobj.RetrieveClientInfo();
     if (ClientUserInfo.Rows.Count >= 1)
     {
         Session["UserInfo"] = ClientUserInfo;
         Session["id"] = ClientUserInfo.Rows[0]["id"];
         Session["name"] = ClientUserInfo.Rows[0]["name"];
         Session["ProfilePicture"] = ClientUserInfo.Rows[0]["ProfilePicture"];
         Session["email"] = ClientUserInfo.Rows[0]["email"];
         Response.Redirect("Default.aspx");
     }
     else {
         HttpContext _context = HttpContext.Current;
         _context.Items.Add("name", "Name test");
         _context.Items.Add("password", "Password test");
         _context.Items.Add("action", "login");
         Server.Transfer("Login.aspx");
     }
 }
        /// <summary>
        /// Chargement de la fenêtre de modification d'un client.
        /// </summary>
        /// <param name="b"></param>
        /// <param name="cli"></param>
        public Gestion_Fiche_Client(bool b, Clients cli)
        {
            InitializeComponent();
            bIsUpdate = b;
            Commerciaux com = new Commerciaux();
            com = CDAO.FindCom(cli.Commercial);
            if (cli.Type)
            {
                radioButton_Particulier.Checked = true;

            }
            else
            {
                radioButton_Entreprise.Checked = true;
            }
            textBox_ID.Text = Convert.ToString(cli.Id);
            textBox_Coeff.Text = Convert.ToString(Math.Round(cli.Coeff, 2));
            textBox_NomCommercial.Text = com.Nom;
            textBox_PrenomCommercial.Text = com.Prenom;
            if (cli.Civilite == "M")
                radioButton_Monsieur.Checked = true;
            else
                radioButton_Madame.Checked = true;
            textBox_Nom.Text = cli.Nom;
            textBox_Prenom.Text = cli.Prenom;
            textBox_Societe.Text = cli.Entreprise;
            textBox_Adresse.Text = cli.Adresse;
            textBox_CP.Text = cli.Codepostal;
            textBox_Ville.Text = cli.Ville;
            textBox_Pays.Text = cli.Pays;
            textBox_Mail.Text = cli.Mail;
            textBox_Tel.Text = cli.Telephone1;
            textBox_Tel2.Text = cli.Telephone2;
            radioButton_Particulier_CheckedChanged(null, null);
            radioButton_Entreprise_CheckedChanged(null, null);
            a = b = c = d = E = f = g = h = i = j = true;
        }
        /// <summary>
        /// Cherche un client.
        /// </summary>
        /// <param name="id">ID du client recherché</param>
        /// <returns>Retourne les informations du client recherché</returns>
        public Clients Find(int id)
        {
            _connect.Open();

            Clients retour = new Clients();

            SqlCommand requete = new SqlCommand("select * from CLIENTS where cli_id = @id", _connect);
            requete.Parameters.AddWithValue("@id", id);

            SqlDataReader lecture = requete.ExecuteReader();

            while (lecture.Read())
            {
                retour.Id = id;
                retour.Type = Convert.ToBoolean(lecture["cli_type"]);
                retour.Entreprise = Convert.ToString(lecture["cli_entreprise"]);
                retour.Civilite = Convert.ToString(lecture["cli_civilite"]);
                retour.Nom = Convert.ToString(lecture["cli_nom"]);
                retour.Prenom = Convert.ToString(lecture["cli_prenom"]);
                retour.Mail = Convert.ToString(lecture["cli_mail"]);
                retour.Telephone1 = Convert.ToString(lecture["cli_telephone1"]);
                retour.Telephone2 = Convert.ToString(lecture["cli_telephone2"]);
                retour.Coeff = Convert.ToSingle(lecture["cli_coeff"]);
                retour.Adresse = Convert.ToString(lecture["cli_adresse"]);
                retour.Ville = Convert.ToString(lecture["cli_ville"]);
                retour.Codepostal = Convert.ToString(lecture["cli_codepostal"]);
                retour.Pays = Convert.ToString(lecture["cli_pays"]);
                retour.Commercial = Convert.ToInt32(lecture["com_id"]);

            }
            lecture.Close();

            _connect.Close();

            return retour;
        }
    // ReSharper disable once FunctionComplexityOverflow
    void LoadClient(int clientId)
    {
        var objClient = new Clients().GetClient(clientId);

        //validate
        if (objClient.ClientId <= 0) Response.Redirect("400.aspx");

        //assign to label
        lblClientID.Text = objClient.ClientId.ToString();

        //status
        ddlClientStatus.SelectedValue = objClient.ClientStatus != null ? objClient.ClientStatus.ClientStatusId.ToString() : "0";
        txtClientName.Text = objClient.ClientName;
        txtSelectedParentCompanyID.Text = objClient.ParentClientId.ToString();
        txtParentCompany.Text = objClient.ParentClientName;
        ddlConsultant.SelectedValue = objClient.ConsultantId.ToString();
        ddlUser.SelectedValue = objClient.UserId.ToString();

        //contact
        txtEmail.Text = objClient.Email;
        txtTelephone.Text = objClient.Telephone;
        txtFax.Text = objClient.Fax;
        txtWebsite.Text = objClient.Website;

        //address
        if (objClient.Addresses != null)
        {
            var objGeneralAddress = objClient.Addresses.FirstOrDefault(x => x.Type == "General");
            if (objGeneralAddress != null)
            {
                txtAddress1.Text = objGeneralAddress.Address1;
                txtAddress3.Text = objGeneralAddress.Address2;
                txtAddress2.Text = objGeneralAddress.Address3;
                txtCity.Text = objGeneralAddress.City;
                txtPostcode.Text = objGeneralAddress.Postcode;
                txtCounty.Text = objGeneralAddress.County;
                ddlCountry.SelectedValue = objGeneralAddress.Country;
            }
        }

        //source
        ddlSource.SelectedValue = objClient.Source != null ? objClient.Source.SourceId.ToString() : "0";
        txtSourceOther.Text = objClient.SourceOther;

        //company info
        txtEmployees.Text = objClient.Employees;
        txtTurnover.Text = objClient.Turnover;
        txtProfit.Text = objClient.Profit;
        txtRegNo.Text = objClient.RegNo;
        if (objClient.IsLimitedCompany) chbLimitedCompany.Checked = true;

        //social
        txtLinkedIn.Text = objClient.LinkedIn;
        txtFacebook.Text = objClient.Facebook;
        txtTwitter.Text = objClient.Twitter;
        txtGoogle.Text = objClient.Google;

        //additional info
        txtSicCode.Text = objClient.SicCode;
        //location
        if (objClient.Location != null)
        {
            txtSelectedLocationID.Text = objClient.Location.LocationId.ToString();
            txtLocation.Text = objClient.Location.LocationText;
        }
        //sectors
        foreach (var sector in objClient.Sectors)
        {
            foreach (ListItem item in chbListSectors.Items)
            {
                if (sector.SectorId.ToString() == item.Value)
                {
                    item.Selected = true;
                    break;
                }
            }
        }


        //BIND OTHER ADDRESS

    }
Esempio n. 16
0
 public void OnCardAssigned(CardItem card, ActivityListItem activity)
 {
     Clients.Group(card.BoardId.ToString()).addToActivityStream(activity);
     Clients.OthersInGroup(card.BoardId.ToString()).displayMessage(activity.Description);
     Clients.OthersInGroup(card.BoardId.ToString()).onCardAssigned(card);
 }
Esempio n. 17
0
 /// <summary>
 /// 向指定Id推送消息
 /// </summary>
 /// <param name="userid">要推送消息的对象</param>
 /// <param name="message"></param>
 /// <returns></returns>
 public Task Echo(string userid, string message)
 {
     return(Clients.Client(Context.ConnectionId).SendAsync("ReceiveMessage", $"{Context.ConnectionId}: {message}"));
 }
Esempio n. 18
0
 public Task SendAnonymousObject()
 {
     return(Clients.Client(Context.ConnectionId).SendAsync("Send", new { }));
 }
    /// <summary>
    /// Save Client
    /// </summary>
    private void SaveClient()
    {
        var client = new Client
        {
            ClientId = Convert.ToInt32(lblClientId.Text),
            ClientName = txtClientName.Text,
            Email = txtEmail.Text,
            Telephone = txtTelephone.Text, 
            Website = txtWebsite.Text,   
        };
      

 
        // save the client id
        var clientId = new Clients().AddUpdateClient(client);

        //save client logo 
        if (!string.IsNullOrEmpty(txtUploadUrl.Text))
        {
            var logoDoc = new Document
            {
                RefId = clientId,
                DocumentTypeValue = 7,
                UploadUrl = txtUploadUrl.Text
            };
            var isSuccess = new Documents().SaveDocuments(new List<Document> { logoDoc });
        }
        txtUploadUrl.Text = "";
        lblClientId.Text = clientId.ToString();
        LoadClient();
    }
 internal ClientNotAuthorizedException(Clients.IClient client) : base(String.Format("Cannot perform operation while {0} is not logged in.", client.GetType().Name))
 {
     this.Client = client;
 }
        /// <summary>
        /// Mise à jour d'un client dans la base de données
        /// </summary>
        /// <param name="cli"></param>
        public void Update(Clients cli)
        {
            _connect.Open();

            SqlCommand requete = new SqlCommand("update CLIENTS set cli_type = @type, cli_entreprise = @entreprise, cli_civilite = @civilite, cli_nom = @nom, cli_prenom = @prenom, cli_mail = @mail, cli_telephone1 = @telephone1, cli_telephone2 = @telephone2, cli_coeff = @coeff, cli_adresse = @adresse, cli_ville = @ville, cli_codepostal = @codepostal, cli_pays = @pays where cli_id = @id", _connect);
            requete.Parameters.AddWithValue("@id", cli.Id);
            requete.Parameters.AddWithValue("@type", cli.Type);
            if (cli.Entreprise == string.Empty)
            {
                requete.Parameters.AddWithValue("@entreprise", DBNull.Value);
            }
            else
            {
                requete.Parameters.AddWithValue("@entreprise", cli.Entreprise);
            }
            requete.Parameters.AddWithValue("@civilite", cli.Civilite);
            requete.Parameters.AddWithValue("@nom", cli.Nom);
            requete.Parameters.AddWithValue("@prenom", cli.Prenom);
            requete.Parameters.AddWithValue("@mail", cli.Mail);
            requete.Parameters.AddWithValue("@telephone1", cli.Telephone1);
            if (cli.Telephone2 == string.Empty)
            {
                requete.Parameters.AddWithValue("@telephone2", DBNull.Value);

            }
            else
            {
                requete.Parameters.AddWithValue("@telephone2", cli.Telephone2);
            }
            requete.Parameters.AddWithValue("@coeff", cli.Coeff);
            requete.Parameters.AddWithValue("@adresse", cli.Adresse);
            requete.Parameters.AddWithValue("@ville", cli.Ville);
            requete.Parameters.AddWithValue("@codepostal", cli.Codepostal);
            requete.Parameters.AddWithValue("@pays", cli.Pays);

            requete.ExecuteNonQuery();

            _connect.Close();
        }
Esempio n. 22
0
        public async Task DelayedSend(string connectionId, string message)
        {
            await Task.Delay(100);

            await Clients.Client(connectionId).Send(message);
        }
Esempio n. 23
0
 public Task SendToMultipleClients(string message, IReadOnlyList <string> connectionIds)
 {
     return(Clients.Clients(connectionIds).Send(message));
 }
Esempio n. 24
0
 public Task ConnectionSendMethod(string connectionId, string message)
 {
     return(Clients.Client(connectionId).Send(message));
 }
Esempio n. 25
0
 public Task SendToMultipleUsers(List <string> userIds, string message)
 {
     return(Clients.Users(userIds).Send(message));
 }
Esempio n. 26
0
 public Task ClientSendMethod(string userId, string message)
 {
     return(Clients.User(userId).Send(message));
 }
Esempio n. 27
0
 public Task SendToMultipleUsers(IReadOnlyList <string> userIds, string message)
 {
     return(Clients.Users(userIds).SendAsync("Send", message));
 }
    void Save()
    {

        var objClient = new Client()
        {
            ClientId = int.Parse(lblClientID.Text),
            ClientName = txtClientName.Text,
            ClientStatus = new ClientStatus() { ClientStatusId = int.Parse(ddlClientStatus.SelectedValue) },
            ParentClientId = int.Parse(txtSelectedParentCompanyID.Text),
            ConsultantId = int.Parse(ddlConsultant.SelectedValue),
            UserId = int.Parse(ddlUser.SelectedValue),
            Email = txtEmail.Text,
            Telephone = txtTelephone.Text,
            Fax = txtFax.Text,
            Website = txtWebsite.Text,

            Addresses = new List<Address>() { new Address { 
                Type = "General",
                Address1 = txtAddress1.Text,
                Address2 = txtAddress2.Text,
                Address3 = txtAddress3.Text,
                City = txtCity.Text,
                Postcode = txtPostcode.Text,
                County = txtCounty.Text,
                Country = ddlCountry.SelectedValue
            } },

            Source = new Source { SourceId = int.Parse(ddlSource.SelectedValue) },
            SourceOther = txtSourceOther.Text,
            Employees = txtEmployees.Text,
            Turnover = txtTurnover.Text,
            Profit = txtProfit.Text,
            IsLimitedCompany = chbLimitedCompany.Checked ? true : false,
            RegNo = txtRegNo.Text,
            SicCode = txtSicCode.Text,
            LinkedIn = txtLinkedIn.Text,
            Facebook = txtFacebook.Text,
            Twitter = txtTwitter.Text,
            Google = txtGoogle.Text,
            LastUpdatedBy = LoginUser.GetLoggedInUserId(),
            Location =  new Location{LocationId = Convert.ToInt32(txtSelectedLocationID.Text)},
            SectorIds = String.Join(",", chbListSectors.Items.Cast<ListItem>().Where(i => i.Selected).Select(i => i.Value)),
            LastContactedBy = Convert.ToInt32(lblUserId.Text)
            
        };

        //save
        var clientId = new Clients().AddUpdateClient(objClient);

        //load
        LoadClient(clientId);
    }
        /// <summary>
        /// On liste les clients de la base de données.
        /// </summary>
        /// <returns></returns>
        public List<Clients> Liste()
        {
            _connect.Open();

            List<Clients> resultat = new List<Clients>();

            SqlCommand requete = new SqlCommand("select * from CLIENTS", _connect);
            SqlDataReader lecture = requete.ExecuteReader();

            while (lecture.Read())
            {
                Clients c = new Clients();
                c.Id = Convert.ToInt32(lecture["cli_id"]);
                c.Type = Convert.ToBoolean(lecture["cli_type"]);
                c.Entreprise = Convert.ToString(lecture["cli_entreprise"]);
                c.Civilite = Convert.ToString(lecture["cli_civilite"]);
                c.Nom = Convert.ToString(lecture["cli_nom"]);
                c.Prenom = Convert.ToString(lecture["cli_prenom"]);
                c.Mail = Convert.ToString(lecture["cli_mail"]);
                c.Telephone1 = Convert.ToString(lecture["cli_telephone1"]);
                c.Telephone2 = Convert.ToString(lecture["cli_telephone2"]);
                c.Coeff = Convert.ToSingle(lecture["cli_coeff"]);
                c.Adresse = Convert.ToString(lecture["cli_adresse"]);
                c.Ville = Convert.ToString(lecture["cli_ville"]);
                c.Codepostal = Convert.ToString(lecture["cli_codepostal"]);
                c.Pays = Convert.ToString(lecture["cli_pays"]);
                resultat.Add(c);
            }
            lecture.Close();

            _connect.Close();

            return resultat;
        }
Esempio n. 30
0
 public Task SendToAllExcept(string message, IReadOnlyList <string> excludedConnectionIds)
 {
     return(Clients.AllExcept(excludedConnectionIds).Send(message));
 }
Esempio n. 31
0
 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     Clients client = new Clients();
     client.Show();
 }
Esempio n. 32
0
 public Task GroupSendMethod(string groupName, string message)
 {
     return(Clients.Group(groupName).SendAsync("Send", message));
 }
Esempio n. 33
0
        /// <summary>
        /// 主动注册客户端
        /// </summary>
        /// <param name="name"></param>
        /// <param name="companyName"></param>
        /// <param name="loginName"></param>
        /// <param name="loginPWD"></param>
        /// <returns></returns>
        public JsonResult RegisterClient(string name, string companyName, string loginName, string loginPWD,string code)
        {
            int result = 0;
            Dictionary<string, object> JsonDictionary = new Dictionary<string, object>();

            bool bl = OrganizationBusiness.IsExistLoginName(loginName);
            if (bl){
                result = 2;
            }
            else
            {
                bl = Common.Common.ValidateMobilePhoneCode(loginName, code);
                if (!bl){
                    result = 3;
                }
                else
                {
                    Clients client = new Clients() { CompanyName=companyName,ContactName=name};
                    ClientBusiness.InsertClient(client, loginName, loginPWD, string.Empty, out result);

                    if (result == 1)
                    {
                        string operateip = Common.Common.GetRequestIP();
                        int outResult;
                        CloudSalesEntity.Users user = CloudSalesBusiness.OrganizationBusiness.GetUserByUserName(loginName, loginPWD, out outResult, operateip);
                        if (user != null){
                            Session["ClientManager"] = user;
                        }

                        Common.Common.ClearMobilePhoneCode(loginName);
                    }
                    else
                        result = 0;
                }
            }

            JsonDictionary.Add("Result", result);
            return new JsonResult()
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            };
        }
Esempio n. 34
0
 public Task GroupExceptSendMethod(string groupName, string message, IReadOnlyList <string> excludedConnectionIds)
 {
     return(Clients.GroupExcept(groupName, excludedConnectionIds).SendAsync("Send", message));
 }
        /// <summary>
        /// Bouton pour valider l'ajout ou la modification d'un client.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button_Valider_Click(object sender, EventArgs e)
        {
            if (this.Validate(false))
            {
                if (!bIsUpdate)
                {
                    try
                    {
                        Random rand = new Random();
                        Clients ajout = new Clients();
                        ajout.Nom = textBox_Nom.Text;
                        ajout.Prenom = textBox_Prenom.Text;
                        ajout.Type = radioButton_Entreprise.Checked ? false : true;
                        ajout.Entreprise = textBox_Societe.Text;
                        ajout.Civilite = radioButton_Monsieur.Checked ? "M" : "Mme";
                        ajout.Mail = textBox_Mail.Text;
                        ajout.Telephone1 = textBox_Tel.Text;
                        ajout.Telephone2 = textBox_Tel2.Text;
                        ajout.Coeff = Math.Round(Convert.ToDouble(textBox_Coeff.Text), 2);
                        ajout.Adresse = textBox_Adresse.Text;
                        ajout.Ville = textBox_Ville.Text;
                        ajout.Codepostal = textBox_CP.Text;
                        ajout.Pays = textBox_Pays.Text;
                        ajout.Commercial = rand.Next(1, 5);

                        CDAO.Insert(ajout);
                        MessageBox.Show("Le client " + textBox_Nom.Text + " " + textBox_Prenom.Text + " a bien été ajouté", "Ajout Fiche Client", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.Close();
                    }

                    catch (Exception ee)
                    {

                        MessageBox.Show(ee.ToString());
                    }
                }
                else
                {
                    try
                    {

                        Clients modif = new Clients();
                        modif.Id = Convert.ToInt32(textBox_ID.Text);
                        modif.Nom = textBox_Nom.Text;
                        modif.Prenom = textBox_Prenom.Text;
                        modif.Type = radioButton_Entreprise.Checked ? false : true;
                        modif.Entreprise = textBox_Societe.Text;
                        modif.Civilite = radioButton_Monsieur.Checked ? "M" : "Mme";
                        modif.Mail = textBox_Mail.Text;
                        modif.Telephone1 = textBox_Tel.Text;
                        modif.Telephone2 = textBox_Tel2.Text;
                        modif.Coeff = Math.Round(Convert.ToDouble(textBox_Coeff.Text), 2);
                        modif.Adresse = textBox_Adresse.Text;
                        modif.Ville = textBox_Ville.Text;
                        modif.Codepostal = textBox_CP.Text;
                        modif.Pays = textBox_Pays.Text;

                        CDAO.Update(modif);
                        MessageBox.Show("Le client " + textBox_Nom.Text + " " + textBox_Prenom.Text + " a bien été modifié", "Modification Fiche Client");
                    }

                    catch (Exception ee)
                    {

                        MessageBox.Show(ee.ToString());
                    }
                }
            }
        }
Esempio n. 36
0
 public Task SendToMultipleGroups(string message, IReadOnlyList <string> groupNames)
 {
     return(Clients.Groups(groupNames).SendAsync("Send", message));
 }
Esempio n. 37
0
        /// <summary>
        /// 推出指定组并向组推送消息
        /// </summary>
        /// <param name="groupName"></param>
        /// <returns></returns>
        public async Task LeaveGroup(string groupName)
        {
            await Groups.RemoveFromGroupAsync(Context.ConnectionId, groupName);

            await Clients.Group(groupName).SendAsync("ReceiveMessage", $"{Context.ConnectionId} left {groupName}");
        }
Esempio n. 38
0
 public Task SendToOthersInGroup(string groupName, string message)
 {
     return(Clients.OthersInGroup(groupName).SendAsync("Send", message));
 }
Esempio n. 39
0
 public void OnCardDeleted(int boardId, int columnId, int cardId, ActivityListItem activity)
 {
     Clients.Group(boardId.ToString()).addToActivityStream(activity);
     Clients.OthersInGroup(boardId.ToString()).displayMessage(activity.Description);
     Clients.OthersInGroup(boardId.ToString()).onCardDeleted(columnId, cardId);
 }
Esempio n. 40
0
 public async override Task OnUserConnected(UserDetails user)
 {
     await Clients.Client(user.ConnectionId)
     .SendAsync("OnUserJoined", $"Welcome {user.Name}");
 }
Esempio n. 41
0
 public void OnCardCommentAdded(int boardId, CardCommentViewModel cardComment, ActivityListItem activity)
 {
     Clients.Group(boardId.ToString()).addToActivityStream(activity);
     Clients.OthersInGroup(boardId.ToString()).displayMessage(activity.Description);
     Clients.OthersInGroup(boardId.ToString()).onCardCommentAdded(cardComment);
 }
Esempio n. 42
0
 public Task Do(int index)
 {
     // Groups.Add(Context.ConnectionId, "one").Wait();
     Groups.Add(Context.ConnectionId, "one").Wait();
     return(Clients.Group("one").Do(index));
 }
Esempio n. 43
0
    protected void Page_Load(object sender, EventArgs e)
    {
        var device = WURFLManagerBuilder.Instance.GetDeviceForRequest(Request.UserAgent);

        ResourcesLocation = ConfigurationManager.AppSettings["WebClientResourcesLocation"] ?? ConfigurationManager.AppSettings["ResourcesLocation"] + "/webclient";
        bool isMobile = device.GetCapability("is_smartphone") == "true";

        BodyClass = string.Format("fs-player wwt-webclient-wrapper {0}", isMobile ? "mobile" : "desktop");

        if (Request.QueryString["debug"] != null)
        {
            DebugQs = "?debug=true&v=" + ResourcesVersion;
            Debug = true;
            if (Request.QueryString["debug"] == "chrome")
            {
                Debug = false;
                DebugChrome = true;
                DebugQs = "";
            }
            else if (Request.QueryString["debug"] == "local")
            {
                SDKLocation = "sdk/wwtsdk.aspx" + DebugQs;
            }
            else if (Request.QueryString["debug"] == "localmin")
            {
                SDKLocation = "wwtsdk.min.js" + DebugQs;
            }
            else {
                SDKLocation += "?debug=true";
            }
        }
        if (Request.QueryString["ads"] != null)
        {
            ADS = true;
        }
        if (Request.Cookies["preferredClient"] != null)
        {
            switch (Request.Cookies["preferredClient"].Value)
            {
                case "SL":
                    Client = Clients.Silverlight;
                    break;
                case "WWT":
                    Client = Clients.WWT;
                    break;
                case "Mobile":
                    Client = Clients.Mobile;
                    break;
                default:
                    Client = Clients.Html5;
                    break;
            }
        }
        if (Request.QueryString["client"] != null)
        {
            HttpCookie cookie = Request.Cookies["preferredClient"] ?? new HttpCookie("preferredClient");
            char c = Request.QueryString["client"].ToString(CultureInfo.InvariantCulture).ToLower().ToCharArray()[0];
            if (c == 'h')
            {
                Client = Clients.Html5;
                cookie.Value = "HTML5";
            }
            else if (c == 's')
            {
                Client = Clients.Silverlight;
                cookie.Value = "SL";
            }
            else if (c == 'm')
            {
                Client = Clients.Mobile;
                cookie.Value = "Mobile";
            }
            else if (c == 'w')
            {
                Client = Clients.WWT;
                cookie.Value = "WWT";
            }

            HttpContext.Current.Response.Cookies.Add(cookie);

        }

        if (Client == Clients.Html5 && isMobile)
        {
            Response.Redirect(string.Format("/webclient/?client=mobile{0}", Debug ? "&debug=true" : ""));
        }
        else if (Client == Clients.Mobile && !isMobile)
        {
            Response.Redirect(string.Format("/webclient/?client=html5{0}", Debug ? "&debug=true" : ""));
        }
    }
Esempio n. 44
0
 public Task BroadcastToGroup(string groupName, Notification notification, CancellationToken cancellationToken = default) =>
 Clients.Group(groupName).SendAsync(ClientMethod, notification, cancellationToken);
        /// <summary>
        /// Insérer un client dans la base de données
        /// </summary>
        /// <param name="cli"></param>
        public void Insert(Clients cli)
        {
            _connect.Open();

            SqlCommand requete = new SqlCommand("insert into CLIENTS (cli_type, cli_entreprise, cli_civilite, cli_nom, cli_prenom, cli_mail, cli_telephone1, cli_telephone2, cli_coeff, cli_adresse, cli_ville, cli_codepostal, cli_pays, com_id) values (@type, @entreprise, @civilite, @nom, @prenom, @mail, @telephone1, @telephone2, @coeff, @adresse, @ville, @codepostal, @pays, @commercial);", _connect);
            requete.Parameters.AddWithValue("@type", cli.Type);
            if (cli.Entreprise == string.Empty)
            {
                requete.Parameters.AddWithValue("@entreprise", DBNull.Value);
            }
            else
            {
                requete.Parameters.AddWithValue("@entreprise", cli.Entreprise);
            }
            requete.Parameters.AddWithValue("@civilite", cli.Civilite);
            requete.Parameters.AddWithValue("@nom", cli.Nom);
            requete.Parameters.AddWithValue("@prenom", cli.Prenom);
            requete.Parameters.AddWithValue("@mail", cli.Mail);
            requete.Parameters.AddWithValue("@telephone1", cli.Telephone1);
            if (cli.Telephone2 == string.Empty)
            {
                requete.Parameters.AddWithValue("@telephone2", DBNull.Value);

            }
            else
            {
                requete.Parameters.AddWithValue("@telephone2", cli.Telephone2);
            }
            requete.Parameters.AddWithValue("@coeff", cli.Coeff);
            requete.Parameters.AddWithValue("@adresse", cli.Adresse);
            requete.Parameters.AddWithValue("@ville", cli.Ville);
            requete.Parameters.AddWithValue("@codepostal", cli.Codepostal);
            requete.Parameters.AddWithValue("@pays", cli.Pays);
            requete.Parameters.AddWithValue("@commercial", cli.Commercial);

            requete.ExecuteNonQuery();

            //Récupère l'ID max
            SqlCommand requete2 = new SqlCommand("select max(cli_id) from CLIENTS", _connect);
            int id = (int)requete2.ExecuteScalar();
            cli.Id = id;

            _connect.Close();
        }
Esempio n. 46
0
 public Task SendToConnection(string connectionId, Notification notification, CancellationToken cancellationToken = default) =>
 Clients.Client(connectionId).SendAsync(ClientMethod, notification, cancellationToken);
        /// <summary>
        /// Recherche en "temps réel"
        /// </summary>
        /// <param name="ent"></param>
        /// <param name="nom"></param>
        /// <param name="prenom"></param>
        /// <param name="adresse"></param>
        /// <param name="cp"></param>
        /// <param name="ville"></param>
        /// <param name="pays"></param>
        /// <param name="mail"></param>
        /// <param name="tel"></param>
        /// <returns></returns>
        public List<Clients> Recherche(string ent, string nom, string prenom, string adresse, string cp, string ville, string pays, string mail, string tel)
        {
            ent = "%" + ent + "%";
            nom = "%" + nom + "%";
            prenom = "%" + prenom + "%";
            adresse = "%" + adresse + "%";
            cp = "%" + cp + "%";
            ville = "%" + ville + "%";
            pays = "%" + pays + "%";
            mail = "%" + mail + "%";
            tel = "%" + tel + "%";
            _connect.Open();

            List<Clients> resultat = new List<Clients>();

            SqlCommand requete = new SqlCommand();
            requete.Connection = _connect;

            string str_requete = "select * from CLIENTS WHERE cli_nom like @nom AND cli_prenom like @prenom AND cli_adresse like @adresse AND cli_codepostal like @cp AND cli_ville like @ville AND cli_pays like @pays AND cli_mail like @mail AND (cli_telephone1 like @tel OR cli_telephone2 like @tel)";
            if (ent != "%%")
            {
                str_requete += " AND cli_entreprise LIKE @ent";
            }

            requete.CommandText = str_requete;
            requete.Parameters.AddWithValue("@ent", ent);
            requete.Parameters.AddWithValue("@nom", nom);
            requete.Parameters.AddWithValue("@prenom", prenom);
            requete.Parameters.AddWithValue("@adresse", adresse);
            requete.Parameters.AddWithValue("@cp", cp);
            requete.Parameters.AddWithValue("@ville", ville);
            requete.Parameters.AddWithValue("@pays", pays);
            requete.Parameters.AddWithValue("@mail", mail);
            requete.Parameters.AddWithValue("@tel", tel);
            SqlDataReader lecture = requete.ExecuteReader();

            while (lecture.Read())
            {
                Clients c = new Clients();
                c.Id = Convert.ToInt32(lecture["cli_id"]);
                c.Type = Convert.ToBoolean(lecture["cli_type"]);
                c.Entreprise = Convert.ToString(lecture["cli_entreprise"]);
                c.Civilite = Convert.ToString(lecture["cli_civilite"]);
                c.Nom = Convert.ToString(lecture["cli_nom"]);
                c.Prenom = Convert.ToString(lecture["cli_prenom"]);
                c.Mail = Convert.ToString(lecture["cli_mail"]);
                c.Telephone1 = Convert.ToString(lecture["cli_telephone1"]);
                c.Telephone2 = Convert.ToString(lecture["cli_telephone2"]);
                c.Coeff = Convert.ToSingle(lecture["cli_coeff"]);
                c.Adresse = Convert.ToString(lecture["cli_adresse"]);
                c.Ville = Convert.ToString(lecture["cli_ville"]);
                c.Codepostal = Convert.ToString(lecture["cli_codepostal"]);
                c.Pays = Convert.ToString(lecture["cli_pays"]);
                resultat.Add(c);
            }

            _connect.Close();

            return resultat;
        }
Esempio n. 48
0
 public async Task SendFrameData(FrameDataBundle data)
 {
     await Clients.Group(GetGroupId(CurrentContextUserId)).UserSentFrames(CurrentContextUserId, data);
 }
        public async Task SendCommand(Command command)
        {
            // await Clients.Others.Command(command);

            await Clients.Groups(command.ToUnit).Command(command);
        }
Esempio n. 50
0
        // GET: api/client
        public List <Client> Get()
        {
            Clients clients = new Clients();

            return(clients.GetList());
        }
        /// <summary>
        /// Permet la recherche du client par l'ID
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void textBox_ID_TextChanged(object sender, EventArgs e)
        {
            if (textBox_ID.Text == string.Empty)
            {
                //textBox_CP.Enabled = true;
                Rafraichir();
            }
            else
            {
                //textBox_CP.Enabled = false;
                try
                {
                    listView_Client.Items.Clear();
                    Clients result = new Clients();
                    int i;
                    Int32.TryParse(textBox_ID.Text, out i);
                    result = CDAO.Find(i);
                    string sType;
                    if (result.Type)
                    {
                        sType = "Particulier";
                    }
                    else
                    {
                        sType = "Entreprise";
                    }
                    listView_Client.Items.Add(
                        new ListViewItem(new[] {
                                result.Id.ToString(),
                                sType,
                                Math.Round(result.Coeff,2).ToString(),
                                result.Entreprise,
                                result.Nom.ToString(),
                                result.Prenom.ToString(),
                                result.Adresse.ToString(),
                                result.Codepostal.ToString(),
                                result.Ville.ToString(),
                                result.Pays.ToString(),
                                result.Mail.ToString(),
                                result.Telephone1.ToString(),
                                result.Telephone2.ToString()
                            }));
                }

                catch (Exception)
                {
                    //
                }
            }
        }
Esempio n. 52
0
        // GET: api/client/5
        public Client Get(int id)
        {
            Clients clients = new Clients();

            return(clients.GetClient(id));
        }
Esempio n. 53
0
        //明道登录回掉
        public ActionResult MDCallBack(string code, string state)
        {
            string operateip = Common.Common.GetRequestIP();
            var user = OauthBusiness.GetMDUser(code);
            if (user.error_code <= 0)
            {
                var model = OrganizationBusiness.GetUserByMDUserID(user.user.id, user.user.project.id, operateip);
                //已注册云销账户
                if (model != null)
                {
                    //未注销
                    if (model.Status.Value != 9)
                    {
                        model.MDToken = user.user.token;
                        if (string.IsNullOrEmpty(model.Avatar)) model.Avatar = user.user.avatar;

                        Session["ClientManager"] = model;
                        if (string.IsNullOrEmpty(state))
                            return Redirect("/Home/Index");
                        else
                            return Redirect(state);
                    }
                }
                else
                {
                    int error = 0;
                    bool isAdmin = MD.SDK.Entity.App.AppBusiness.IsAppAdmin(user.user.token, user.user.id, out error);
                    if (isAdmin)
                    {
                        bool bl = AgentsBusiness.IsExistsMDProject(user.user.project.id);
                        //明道网络未注册
                        if (!bl)
                        {
                            int result = 0;
                            Clients clientModel = new Clients();
                            clientModel.CompanyName = user.user.project.name;
                            clientModel.ContactName = user.user.name;
                            clientModel.MobilePhone = user.user.mobile_phone;
                            var clientid = ClientBusiness.InsertClient(clientModel, "", "", "", out result, user.user.email, user.user.id, user.user.project.id);
                            if (!string.IsNullOrEmpty(clientid))
                            {
                                var current = OrganizationBusiness.GetUserByMDUserID(user.user.id, user.user.project.id, operateip);

                                current.MDToken = user.user.token;
                                if (string.IsNullOrEmpty(current.Avatar)) current.Avatar = user.user.avatar;
                                Session["ClientManager"] = current;

                                if(string.IsNullOrEmpty(state))
                                return Redirect("/Home/Index");
                                else
                                    return Redirect(state);
                            }

                        }
                        else
                        {
                            int result = 0;
                            var current = OrganizationBusiness.CreateUser("", "", user.user.name, user.user.mobile_phone, user.user.email, "", "", "", "", "", "", "", "", user.user.id, user.user.project.id, 1, "", out result);
                            if (current != null)
                            {
                                current.MDToken = user.user.token;
                                if (string.IsNullOrEmpty(current.Avatar)) current.Avatar = user.user.avatar;

                                Session["ClientManager"] = current;

                                if (string.IsNullOrEmpty(state))
                                    return Redirect("/Home/Index");
                                else
                                    return Redirect(state);
                            }
                        }
                    }
                    else
                    {
                        return Redirect("/Home/Login?Status=1");
                    }
                }
            }
            return Redirect("/Home/Login");
        }
Esempio n. 54
0
 public void NotifyUser(string payload, string userId)
 {
     Clients.Clients(_common.GetConnectedUsers(userId)).notifyClients(payload);
 }
Esempio n. 55
0
 private void LoadInfosClientInObject(Clients.ObjetClient objClient)
 {
     objClient.AdresseClient = this.TXT_ADRESSE_CLIENT.Text;
     objClient.CodePostalClient = this.TXT_CODE_POSTAL_CLIENT.Text;
     objClient.FaxClient = this.TXT_FAX_CLIENT.Text;
     objClient.MailClient = this.TXT_MAIL_CLIENT.Text;
     objClient.NomClient = this.TXT_NOM_CLIENT.Text;
     objClient.PaysClient = this.TXT_PAYS_CLIENT.Text;
     objClient.PortableClient = this.TXT_PORTABLE_CLIENT.Text;
     objClient.PrenomClient = this.TXT_PRENOM_CLIENT.Text;
     objClient.RaisonSocialeClient = this.TXT_RAISON_SOCIALE_CLIENT.Text;
     objClient.TelephoneClient = this.TXT_TELEPHONE_CLIENT.Text;
     objClient.VilleClient = this.TXT_VILLE_CLIENT.Text;
 }
Esempio n. 56
0
 /// <summary>
 /// 向指定组推送消息
 /// </summary>
 /// <param name="groupName"></param>
 /// <param name="message"></param>
 /// <returns></returns>
 public Task SendToGroup(string groupName, string message)
 {
     return(Clients.Group(groupName).SendAsync("ReceiveMessage", $"{Context.ConnectionId}@{groupName}: {message}"));
 }
Esempio n. 57
0
 private void btn_clients_Click_1(object sender, EventArgs e)
 {
     this.Close();
     Clients c = new Clients();
     c.Show();
 }
Esempio n. 58
0
        /// <summary>
        /// 加入指定组并向组推送消息
        /// </summary>
        /// <param name="groupName"></param>
        /// <returns></returns>
        public async Task JoinGroup(string groupName)
        {
            await Groups.AddToGroupAsync(Context.ConnectionId, groupName);

            await Clients.Group(groupName).SendAsync("ReceiveMessage", $"{Context.ConnectionId} joined {groupName}");
        }
Esempio n. 59
0
 public void ResponseForMatch(string connectionIdToResponse, bool confirmation)
 {
     Clients.Client(connectionIdToResponse).responseFormMatchCallback(confirmation);
 }
Esempio n. 60
0
 public void GetGroups(string nameUser, string group)
 {
     string[] list   = _connections.GetConnections(nameUser).ToArray();
     string[] group1 = _groups.GetConnections(group).ToArray();
     Clients.Client(list[0]).SetGroups(group1);
 }