コード例 #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            int  num   = 0;
            long value = 0L;

            int.TryParse(this.txtNumber.Text, out num);
            long.TryParse(this.ddlStores.SelectedValue, out value);
            string text  = this.txtRemark.Text.Trim();
            string text2 = this.ddlStores.SelectedItem.Text;

            if (num <= 0)
            {
                this.ShowMsg("设备数量不能为空,设备数量只能输入正整数型数值!", false);
            }
            else if (this.ddlStores.SelectedIndex == 0)
            {
                this.ShowMsg("请选择放置的门店!", false);
            }
            else if (string.IsNullOrEmpty(text) || text.Length > 15)
            {
                this.ShowMsg("备注不能为空,长度必须小于或等于15个字符", false);
            }
            else
            {
                DeviceApplyResultJson deviceApplyResultJson = WXStoreHelper.ApplyEquipment(num, text, text, value);
                if (deviceApplyResultJson.errcode.Equals(ReturnCode.请求成功))
                {
                    HiCache.Remove("Devices");
                    this.ShowMsg("新增设备成功", true);
                }
            }
        }