示例#1
0
        public void Update(string unique, Entity entity)
        {
            ExecutorClient client = new ExecutorClient();

            client.Endpoint.Behaviors.Add(new WebHttpBehavior());
            client.Execute("Exchange.Single", "Update", new object[] { unique, entity });
            client.Close();
        }
示例#2
0
        private void Zhhwy_DataReceived(object sender, EventArgs e)
        {
            Entity result = (Entity)sender;
            string date   = result.GetValue("Date").ToDateTime().ToString("yyyy-MM-dd HH:mm:ss");
            string mobile = result.GetValue("Mobile").ToString();
            string text   = result.GetValue("Text").ToString();

            Entity entity = new Entity(this._PropertyCollection);

            entity.SetValue("Unique", string.Empty);
            entity.SetValue("Parent", string.Empty);
            entity.SetValue("Mobile", mobile);
            entity.SetValue("Text", text);
            entity.SetValue("Date", date);
            entity.SetValue("Remark", string.Empty);
            entity.SetValue("Status", 0);
            entity.SetValue("Operator", Program.Account);

            ExecutorClient client = new ExecutorClient();

            client.Endpoint.Behaviors.Add(new WebHttpBehavior());

            int length = text.Length;

            for (int i = 0; i < length - 1; i++)
            {
                try
                {
                    client.Execute("GsmMessage", "SaveEntity", new object[] { entity });
                    break;
                }
                catch
                {
                    if (i == length - 1)
                    {
                        entity.SetValue("Text", "(全部是乱码)");
                    }
                    else
                    {
                        entity.SetValue("Text", text.Substring(0, length - i - 1));
                    }
                }
            }
            client.Close();

            if (this.DataReceived != null)
            {
                this.DataReceived(sender, e);
            }
        }
示例#3
0
        private void Logon_Load(object sender, EventArgs e)
        {
            ExecutorClient client = new ExecutorClient();

            client.Endpoint.Behaviors.Add(new WebHttpBehavior());
            EntityCollection collection = (EntityCollection)client.Execute("Link", "GetEntities", new object[] { });

            client.Close();

            for (int i = 0; i < collection.Count; i++)
            {
                this.ddlLink.Items.Add(new ListItem(collection[i].GetValue("Name").ToString(), collection[i].GetValue("Unique").ToString()));
            }
            this.ddlLink.SelectedIndex = 0;
        }
示例#4
0
        private void btnLogon_Click(object sender, EventArgs e)
        {
            if (this.txtUsername.Text.Trim() == string.Empty)
            {
                MessageBox.Show("用户名不能为空!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                this.txtUsername.Focus();
                return;
            }

            if (this.txtPassword.Text.Trim() == string.Empty)
            {
                MessageBox.Show("密码不能为空!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                this.txtPassword.Focus();
                return;
            }

            ExecutorClient client = new ExecutorClient();

            client.Endpoint.Behaviors.Add(new WebHttpBehavior());
            Entity entity = (Entity)client.Execute("Verificate", "GetEntityByLinkAndUsernameAndPassword", new object[] { ((ListItem)this.ddlLink.SelectedItem).Value.ToInt32(), this.txtUsername.Text, this.txtPassword.Text });

            client.Close();

            if (entity.GetValue("Success").ToBoolean() == false)
            {
                MessageBox.Show(entity.GetValue("Message").ToString(), "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);

                if (entity.GetValue("Value").ToString() == "Id" || entity.GetValue("Value").ToString() == "Link")
                {
                    this.txtUsername.Text = string.Empty;
                    this.txtPassword.Text = string.Empty;
                    this.txtUsername.Focus();
                }
                else
                {
                    this.txtPassword.Text = string.Empty;
                    this.txtPassword.Focus();
                }

                return;
            }

            Entity account = (Entity)((Entity)entity.GetValue("Value")).GetValue("Account");

            Program.Account = account.GetValue("Unique").ToInt32();

            this.DialogResult = DialogResult.OK;
        }