コード例 #1
0
ファイル: ToolBox.cs プロジェクト: betairylia/StorageIO
        public static bool CheckServerResponse(ServerResponseWithoutBody res)
        {
            if (res.user.userName != "Server" || res.state == networkState.SERVER_FAIL_UNKNOWN)
            {
                MessageBox.Show("发生未知错误!");
                return(false);
            }

            switch (res.state)
            {
            case networkState.SERVER_SUCCESS:
                MessageBox.Show("操作成功!");
                return(true);

            case networkState.SERVER_FAIL_AUTHORISING:
                MessageBox.Show("无权限或用户认证失败,请重新登录!\r\n");
                return(false);

            case networkState.SERVER_FAIL_OPERATION:
                MessageBox.Show("操作失败!请仔细检查并重新尝试!");
                return(false);

            default:
                return(false);
            }
        }
コード例 #2
0
        //入库
        private void BtnImport_Click(object sender, EventArgs e)
        {
            ImportToStore importToStore = new ImportToStore();

            importToStore.user = m_user;

            if (storeManagementTab_onBack)
            {
                //追加退换货信息
                importToStore.comments    = "(退换货 - 联系方式:" + 请输入联系方式.Text + ")[ " + 请输入退换货备注.Text + " ] ";
                storeManagementTab_onBack = false;

                if (!(storeManagementTab_onBack || storeManagementTab_onChange))
                {
                    BtnBack.Enabled     = true;
                    BtnExchange.Enabled = true;
                }

                _UpdateColor00();
            }
            else
            {
                importToStore.comments = "";
            }

            Product tmpProductForImport = new Product();

            tmpProductForImport.productType  = 请选择产品种类.Text;
            tmpProductForImport.productClass = 请选择产品型号.Text;
            tmpProductForImport.hasMNo       = ProductTypeClassManager.CheckIfHasMNo(请选择产品种类.Text);
            tmpProductForImport.MNo          = 请输入产品机号.Text;

            if (请输入入库备注.Text != "请输入入库备注")
            {
                importToStore.comments += 请输入入库备注.Text;
            }

            importToStore.product = tmpProductForImport;
            importToStore.cost    = new Money(double.Parse(请输入进货价格.Text));

            //向服务器发送入库请求
            ServerResponseWithoutBody simpleRes = JsonHelper.DeserializeJsonToObject <ServerResponseWithoutBody>(
                client.SendToServerAndWait(JsonHelper.SerializeObject(importToStore)));

            if (ToolBox.CheckServerResponse(simpleRes))
            {
                StoreManagementTab_GetStoreDataFromServer();
            }
        }
コード例 #3
0
        //出库
        private void BtnExport_Click(object sender, EventArgs e)
        {
            ExportFromStore exportFromStore = new ExportFromStore();

            if (storeManagementTab_onChange)
            {
                //追加退换货信息
                exportFromStore.comments    = "(退换货 - 联系方式:" + 请输入联系方式.Text + ")[ " + 请输入退换货备注.Text + " ] ";
                storeManagementTab_onChange = false;

                if (!(storeManagementTab_onBack || storeManagementTab_onChange))
                {
                    BtnBack.Enabled     = true;
                    BtnExchange.Enabled = true;
                }

                _UpdateColor00();
            }
            else
            {
                exportFromStore.comments = "";
            }

            if (请输入出库备注.Text != "请输入出库备注")
            {
                exportFromStore.comments += 请输入出库备注.Text;
            }
            exportFromStore.user    = m_user;
            exportFromStore.product = storeManagementTab_selectedProductStorage;

            //向服务器发送出库请求
            ServerResponseWithoutBody simpleRes = JsonHelper.DeserializeJsonToObject <ServerResponseWithoutBody>(
                client.SendToServerAndWait(JsonHelper.SerializeObject(exportFromStore)));

            if (ToolBox.CheckServerResponse(simpleRes))
            {
                StoreManagementTab_GetStoreDataFromServer();
            }
        }