コード例 #1
0
 private void txtassistance_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == 27)
     {
         this.txtassistance.Enabled = false;
         this.txtslname.Enabled     = true;;
         this.txtassistance.Text    = "";
         this.txtslname.Text        = "";
         this.txtslname.Focus();
         return;
     }
     if (e.KeyChar != 13)
     {
         return;
     }
     Model.MUserInfo mu = null;
     try
     {
         Cursor.Current = Cursors.WaitCursor;
         string x = HttpHelper.HttpPost("getUserInfo", @"lcCode=" + Comm.lcCode + "&account=" + this.txtassistance.Text);
         msg = (Model.Mmsg)JsonConvert.DeserializeObject(x, typeof(Model.Mmsg));
         if (msg == null)
         {
             throw new Exception("错误信息捕捉失败");
         }
         if (!msg.success)
         {
             throw new Exception(msg.msg);
         }
         mu = (Model.MUserInfo)JsonConvert.DeserializeObject(x, typeof(Model.MUserInfo));
         if (mu == null || mu.data == null || mu.data.userCode == "")
         {
             throw new Exception("错误信息捕捉失败");
         }
         this.labassistance.Text = mu.data.userCode;
         Cursor.Current          = Cursors.Default;
     }
     catch (Exception ex)
     {
         Cursor.Current = Cursors.Default;
         MessageBox.Show(ex.Message);
         return;
     }
     this.txtassistance.Enabled = false;
     this.txtcommonqty.Enabled  = true;
     this.txtcommonqty.Focus();
 }
コード例 #2
0
        private void txtassistance_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar != 13)
            {
                return;
            }
            Model.Mmsg      msg = null;
            Model.MUserInfo mu  = null;
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                string x = HttpHelper.HttpPost("getUserInfo", @"lcCode=" + Comm.lcCode + "&account=" + this.txtassistance.Text);
                msg = (Model.Mmsg)JsonConvert.DeserializeObject(x, typeof(Model.Mmsg));
                if (msg == null)
                {
                    throw new Exception("错误信息捕捉失败");
                }
                if (!msg.success)
                {
                    throw new Exception(msg.msg);
                }
                mu = (Model.MUserInfo)JsonConvert.DeserializeObject(x, typeof(Model.MUserInfo));
                if (mu == null || mu.data == null || mu.data.userCode == "")
                {
                    throw new Exception("错误信息捕捉失败");
                }
                Cursor.Current = Cursors.Default;
            }
            catch (Exception ex)
            {
                Cursor.Current = Cursors.Default;
                this.txtassistance.SelectAll();
                MessageBox.Show(ex.Message);
                return;
            }


            try
            {
                Cursor.Current = Cursors.WaitCursor;
                string x = HttpHelper.HttpPost(fun, @"lcCode=" + Comm.lcCode + "&orderId=" + orderid + "&assistance=" + mu.data.userCode + "&whId=" + Comm.warehousecode + "&updater=" + Comm.usercode);
                msg = (Model.Mmsg)JsonConvert.DeserializeObject(x, typeof(Model.Mmsg));
                if (msg == null)
                {
                    throw new Exception("错误信息捕捉失败");
                }
                if (!msg.success)
                {
                    throw new Exception(msg.msg);
                }
                Cursor.Current = Cursors.Default;
            }
            catch (Exception ex)
            {
                Cursor.Current = Cursors.Default;
                MessageBox.Show(ex.Message);
                return;
            }
            MessageBox.Show("完成");
            //assistance = mu.data.userCode;
            assistance = mu.data.assistanceName;
            //assistance = mu.data.userName;
            this.Close();
        }