예제 #1
0
        private void bunifuTextbox1_OnTextChange(object sender, EventArgs e)
        {
            conn.Open();
            string sql = "SELECT * FROM tblClientes where " + campo + " like '%" + bunifuTextbox1.text + "%'";

            sCommand = new SqlCommand(sql, conn);
            sAdapter = new SqlDataAdapter(sCommand);
            sBuilder = new SqlCommandBuilder(sAdapter);
            sDs      = new DataSet();
            sAdapter.Fill(sDs, "NombreComercial");
            sTable = sDs.Tables["NombreComercial"];
            clientes.DataSource    = sDs.Tables["NombreComercial"];
            clientes.ReadOnly      = true;
            clientes.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            conn.Close();
            try
            {
                string clientID          = clientes.Rows[clientes.SelectedRows[0].Index].Cells["ClienteID"].Value.ToString();
                string clientName        = clientes.Rows[clientes.SelectedRows[0].Index].Cells["NombreComercial"].Value.ToString();
                string clientPhone       = clientes.Rows[clientes.SelectedRows[0].Index].Cells["Cel"].Value.ToString();
                string clientAlternative = clientes.Rows[clientes.SelectedRows[0].Index].Cells["Tel"].Value.ToString();
                string clientEmail       = clientes.Rows[clientes.SelectedRows[0].Index].Cells["Email"].Value.ToString();
                Client newCurentClient   = new Client(clientID, clientName, clientPhone, clientAlternative, clientEmail);
                CurrentClient.SetCurrentClient(newCurentClient);
            }
            catch { }
            MascotaCliente();
            clientes.Columns[0].Visible = false;
        }
예제 #2
0
        /// <summary>
        /// send to currently logined client busy symbol list
        /// </summary>
        public void SendBusySymbolListToClient()
        {
            string ticknetstr  = "";
            var    dnetsmblist = new DNetBusySymbolList();

            foreach (var item in BusySymbols)
            {
                if (item.IsDataNet)
                //    datanetstr += item.ID.ToString(CultureInfo.InvariantCulture) + ",";
                {
                    dnetsmblist.BusySymbols.Add(item);
                }

                if (item.IsTickNet)
                {
                    ticknetstr += item.ID.ToString(CultureInfo.InvariantCulture) + ",";
                }
            }

            var xEle = new XElement("BusySymbols",
                                    from emp in dnetsmblist.BusySymbols
                                    select new XElement("BSymbol",
                                                        new XElement("ID", emp.ID),
                                                        from tframes in emp.TimeFrames
                                                        select new XElement("TimeFrame", tframes.TimeFrame)
                                                        ));

            var sw = new StringWriter();
            var tx = new XmlTextWriter(sw);

            xEle.WriteTo(tx);
            string datanetstr = sw.ToString();

            // if (client.IsDexportConnected) client.DexportProxy.SendAllowedSymbolList(str);

            //client.TClientProxy.SendAllowedSymbolGroups(str);
            try
            {
                if (CurrentLoginTypeDnet)
                {
                    CurrentClient.GetClientProxy <IDataAdminService>().SendAllowedSymbolList(datanetstr);
                }

                if (CurrentLoginTypeTnet)
                {
                    CurrentClient.GetClientProxy <IDataAdminService>().SendAllowedSymbolList(ticknetstr);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                ErrorReport(new ErrorInfo
                {
                    AdditionalInformation = "",
                    ErrorText             = ex.Message,
                    InvokeTime            = DateTime.Now,
                    MethodName            = "SendBusySymbolListToClient"
                });
            }
        }
        public async Task <string> GetPackageVersion(
            [NotNull]
            string packageName)
        {
            if (packageName == null)
            {
                throw new ArgumentNullException(nameof(packageName));
            }

            if (PackageVersions.TryGetValue(packageName, out string version))
            {
                return(version);
            }
            else
            {
                dynamic apiQuery = JsonConvert.DeserializeObject(
                    await CurrentClient.DownloadStringTaskAsync(
                        $"https://api.cdnjs.com/libraries/{packageName}?fields=version"));

                version = apiQuery.version;

                if (string.IsNullOrWhiteSpace(version))
                {
                    throw new Exception("Parse API error");
                }

                PackageVersions.TryAdd(packageName, version);

                return(version);
            }
        }
예제 #4
0
        public void DataExportClientLogin(DataAdminMessageFactory.LoginMessage loginParams, UserModel tempUser)
        {
            if (!(Clients.GetAllItems().Exists(a => a.UserName == loginParams.UsernameMD5)))
            //if client not in list and he/she want to connected with dnet
            {
                AddClient(CurrentClient, loginParams.NetType, tempUser); //add client
                return;
            }
            var clientInList = Clients.GetAllItems().Find(a => a.UserName == loginParams.UsernameMD5);

            if (clientInList.IsDexportConnected == false)
            {
                clientInList.IsDexportConnected = true;
                clientInList.DexportProxy       = CurrentClient.GetClientProxy <IDataAdminService>();
                clientInList.DexportClient      = CurrentClient;
                var usrModel = new UserModel();
                if (OnloggedInLog != null)
                {
                    var msg = new DataAdminMessageFactory.LogMessage
                    {
                        OperationStatus = DataAdminMessageFactory.LogMessage.Status.Finished,
                        LogType         = DataAdminMessageFactory.LogMessage.Log.Login,
                        Time            = DateTime.Now,
                        UserID          = tempUser.Id
                    };
                    var msgMain = "Client " + usrModel.Name + " connected from " + CurrentClient.RemoteEndPoint;
                    OnloggedInLog(msg, msgMain);
                }
                CurrentLoginTypeDexp = true;
                CurrentLoginTypeDnet = false;
                CurrentLoginTypeTnet = false;

                OnClientLogon(tempUser);
            }
        }
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            base.OnCreate(savedInstanceState);

            // Create your application here
            // Set the current instance of TodoActivity.
            SetContentView(Android.Resource.Layout.CustomerOffers);
            instance = this;
            try
            {
                this.OffersTable = CurrentClient.GetTable <Entities.Offer>();
                var offersList = await this.OffersTable.ToListAsync();

                lstOffers = FindViewById <ListView>(Android.Resource.Id.lstOffers);
                ObservableCollection <Offer> data = new ObservableCollection <Offer>(offersList);
                data.CollectionChanged += Data_CollectionChanged;
                adapter           = new CustomerOfferListAdapter(this, Android.Resource.Layout.CustomerOfferRow, data);
                lstOffers.Adapter = adapter;
                adapter.SetNotifyOnChange(true);
                adapter.NotifyDataSetChanged();
            }
            catch (Microsoft.WindowsAzure.MobileServices.MobileServiceInvalidOperationException iEx)
            {
                var response         = iEx.Response;
                var exceptionContent = await response.Content.ReadAsStringAsync();
            }
            catch (Exception ex)
            {
            }
            ConfigurePushNotifications();
        }
        public void HandleClientMessage(Connection cnn, Chetch.Messaging.Message message)
        {
            //record this
            LogMessage(CMDataSource.MessageDirection.INBOUND, message);

            switch (message.Type)
            {
            case MessageType.SHUTDOWN:
                break;

            case MessageType.STATUS_RESPONSE:
                if (message.HasValue("ServerID"))
                {
                    //send status request to all connected clients
                    var clients = message.GetList <String>("Connections");
                    System.Diagnostics.Trace.WriteLine(String.Format("Server status response shows {0} client connections ...", clients.Count));
                    foreach (var cs in clients)
                    {
                        var data       = cs.Split(' ');
                        var clientName = data[1];
                        if (clientName != null && clientName != String.Empty)
                        {
                            CurrentClient.RequestClientConnectionStatus(clientName);
                            System.Diagnostics.Trace.WriteLine("Requesting status of " + clientName);
                            //System.Threading.Thread.Sleep(100);
                        }
                    }
                }
                break;

            default:
                break;
            } //ehd switch
        }
예제 #7
0
        public ClientWindow(CurrentClient cc)
        {
            InitializeComponent();

            currentClient = cc;
            this.Loaded  += ClientWindow_Loaded;
        }
예제 #8
0
        //takes care of client-server interactions when the game is over
        private void GameOver()
        {
            CurrentClient.RaiseReply("\x01");
            var gos = new GameOverState(CurrentClient);

            gos.SetGameStats(CurrentGame.GetStats());
            CurrentClient.CurrentState = gos;
        }
 public string GetStrByIntListWithSpliter(List <int> intList, string spliter)
 {
     if (!StringHelperProxySoapHeader.IsValid)
     {
         return(null);
     }
     return(CurrentClient.GetStrByIntListWithSpliter(CurrentHeader, intList.ToArray(), spliter));
 }
 public string GetMd5SaltStrResult(string str, string salt)
 {
     if (!StringHelperProxySoapHeader.IsValid)
     {
         return(null);
     }
     return(CurrentClient.GetMd5SaltStrResult(CurrentHeader, str, salt));
 }
 public string GetEncryptStrResult(string str, string encodingStr = "utf8")
 {
     if (!StringHelperProxySoapHeader.IsValid)
     {
         return(null);
     }
     return(CurrentClient.GetEncryptStrResult(CurrentHeader, str, encodingStr));
 }
 public bool IsBetweenLengthNum(string input, int min, int max)
 {
     if (!StringHelperProxySoapHeader.IsValid)
     {
         return(false);
     }
     return(CurrentClient.IsBetweenLengthNum(CurrentHeader, input, min, max));
 }
 public string ReplaceSpecialStr(string sourceStr, string specialStr)
 {
     if (!StringHelperProxySoapHeader.IsValid)
     {
         return(null);
     }
     return(CurrentClient.ReplaceSpecialStr(CurrentHeader, sourceStr, specialStr));
 }
 public bool IsNumAndLetterAndUnderline(string input)
 {
     if (!StringHelperProxySoapHeader.IsValid)
     {
         return(false);
     }
     return(CurrentClient.IsNumAndLetterAndUnderline(CurrentHeader, input));
 }
 public bool IsPositiveRealNumWithZeroToThreeDecimalPlaces(string input)
 {
     if (!StringHelperProxySoapHeader.IsValid)
     {
         return(false);
     }
     return(CurrentClient.IsPositiveRealNumWithZeroToThreeDecimalPlaces(CurrentHeader, input));
 }
 public List <string> GetSplitStrByRegexPatternResult(string sourceStr, string patternStr, bool isDistinct = false)
 {
     if (!StringHelperProxySoapHeader.IsValid)
     {
         return(null);
     }
     return(CurrentClient.GetSplitStrByRegexPatternResult(CurrentHeader, sourceStr, patternStr, isDistinct).ToList());
 }
 public bool IsMatch(string input, string pattern, int options = 0)
 {
     if (!StringHelperProxySoapHeader.IsValid)
     {
         return(false);
     }
     return(CurrentClient.IsMatch(CurrentHeader, input, pattern, options));
 }
 public List <string> GetStringListBySplitStr(string splitStr, char spliter, bool isDistinct = false)
 {
     if (!StringHelperProxySoapHeader.IsValid)
     {
         return(null);
     }
     return(CurrentClient.GetStringListBySplitStr(CurrentHeader, splitStr, spliter, isDistinct).ToList());
 }
 public int GetStrLength(string input)
 {
     if (!StringHelperProxySoapHeader.IsValid)
     {
         return(-1);
     }
     return(CurrentClient.GetStrLength(CurrentHeader, input));
 }
 public bool IsPostalCode(string input)
 {
     if (!StringHelperProxySoapHeader.IsValid)
     {
         return(false);
     }
     return(CurrentClient.IsPostalCode(CurrentHeader, input));
 }
 public bool IsIpAddress(string input)
 {
     if (!StringHelperProxySoapHeader.IsValid)
     {
         return(false);
     }
     return(CurrentClient.IsIpAddress(CurrentHeader, input));
 }
 public bool IsUserNameWithSpecifiedLength(string input, int min = 4, int max = 15)
 {
     if (!StringHelperProxySoapHeader.IsValid)
     {
         return(false);
     }
     return(CurrentClient.IsUserNameWithSpecifiedLength(CurrentHeader, input, min, max));
 }
 public bool IsChineseCharacter(string input)
 {
     if (!StringHelperProxySoapHeader.IsValid)
     {
         return(false);
     }
     return(CurrentClient.IsChineseCharacter(CurrentHeader, input));
 }
 public string ToHalfWidthStr(string input)
 {
     if (!StringHelperProxySoapHeader.IsValid)
     {
         return(null);
     }
     return(CurrentClient.ToHalfWidthStr(CurrentHeader, input));
 }
 public bool IsLowerCaseLetter(string input)
 {
     if (!StringHelperProxySoapHeader.IsValid)
     {
         return(false);
     }
     return(CurrentClient.IsLowerCaseLetter(CurrentHeader, input));
 }
 public bool IsSpecifiedLengthNumStr(string input, int length)
 {
     if (!StringHelperProxySoapHeader.IsValid)
     {
         return(false);
     }
     return(CurrentClient.IsSpecifiedLengthNumStr(CurrentHeader, input, length));
 }
 public bool IsNonZeroNegativeInteger(string input)
 {
     if (!StringHelperProxySoapHeader.IsValid)
     {
         return(false);
     }
     return(CurrentClient.IsNonZeroNegativeInteger(CurrentHeader, input));
 }
        public string GetSubStrByLength(string input, int length, string fixStr = "...")
        {
            if (!StringHelperProxySoapHeader.IsValid)
            {
                return(null);
            }

            return(CurrentClient.GetSubStrByLength(CurrentHeader, input, length, fixStr));
        }
        /// <summary>
        /// Private task to get user information from mobile api
        /// </summary>
        /// <returns>boolean true if current authorization is valid when online or if offline and user info is cached</returns>
        public async Task <bool> GetUserInfo()
        {
            bool success = false;

            if (CrossConnectivity.Current.IsConnected)
            {
                try
                {
                    switch (Provider)
                    {
                    case Provider.Custom:
                        var customresult = await CurrentClient.InvokeApiAsync("Account/UserInfo", HttpMethod.Get, null);

                        UserEmail = customresult.SelectToken("Email").Value <string>();
                        Name      = string.Empty;
                        success   = true;
                        break;

                    case Provider.Google:
                    case Provider.Facebook:
                        var extResult = await CurrentClient.InvokeApiAsync("/.auth/me", HttpMethod.Get, null);

                        UserEmail = extResult[0].SelectToken("user_id").Value <string>();
                        var claims = extResult[0].SelectToken("user_claims");
                        foreach (var claim in claims)
                        {
                            string typ = claim.SelectToken("typ").Value <string>();
                            if (typ == "name" || typ == @"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name")
                            {
                                Name = claim.SelectToken("val").Value <string>();
                                break;
                            }
                        }
                        //foreach( var claim in claims)
                        //{
                        //    if(claim.s)

                        //                           }
                        success = true;
                        break;

                    default:
                        break;
                    }
                } catch (Exception ex)
                {
                    SignOut();
                }
            }
            else if (!string.IsNullOrEmpty(Token))
            {
                success = true;
            }

            return(success);
        }
예제 #30
0
        /// <summary>
        ///     Invoked by the client including the parameter.
        /// </summary>
        /// <param name="poco"></param>
        public void SomeRemoteMagic(SimplePoco poco)
        {
            ServerConsole.DebugLine("Recv poco obj from client! {0}: {1}", poco.Id, poco.Title);
            Debug.WriteLine(poco);

            // Get client proxy and invoke a answer to the poco
            var proxy = CurrentClient.GetClientProxy <ITestClient>();

            proxy.SomeClientMagic("Got your poco, ty client!");
        }