public void Run()
        {
            bool          flag         = true;
            UnlockInvoice unlockVolume = this.TaxCardInstance.NInvSearchUnlockFromMain();

            if (this.TaxCardInstance.get_RetCode() == 0)
            {
                flag = DownloadCommon.CheckEmpty(unlockVolume.Buffer);
            }
            else
            {
                flag = true;
            }
            if (!flag && (DialogResult.Yes == MessageManager.ShowMsgBox("INP-4412B1")))
            {
                List <InvVolumeApp> invList = new List <InvVolumeApp>();
                bool         isDeviceError  = false;
                string       str            = string.Empty;
                InvVolumeApp item           = new InvVolumeApp();
                if (AllocateCommon.AllocateOneVolume(unlockVolume, out isDeviceError, out str))
                {
                    item.InvType  = Convert.ToByte(unlockVolume.get_Kind());
                    item.TypeCode = unlockVolume.get_TypeCode();
                    item.HeadCode = Convert.ToUInt32(unlockVolume.get_Number());
                    item.Number   = Convert.ToUInt16(unlockVolume.get_Count());
                    invList.Add(item);
                    InvInfoWebAllocMsg msg = new InvInfoWebAllocMsg();
                    msg.InsertInvVolume(invList);
                    msg.ShowDialog();
                }
                else if (isDeviceError)
                {
                    MessageManager.ShowMsgBox(this.TaxCardInstance.get_ErrCode());
                }
                else
                {
                    MessageManager.ShowMsgBox(str);
                }
            }
        }
        private void btnAllocate_Click(object sender, EventArgs e)
        {
            List <InvVolumeApp> list;
            bool          flag2;
            string        str;
            InvVolumeApp  app2;
            string        str2;
            long          num;
            long          num2;
            InvoiceType   typeCode;
            int           num3;
            UnlockInvoice invoice2;

            if (this.IsRightData())
            {
                list = new List <InvVolumeApp>();
                bool flag = true;
                flag2 = false;
                str   = string.Empty;
                UnlockInvoice unlockVolume = base.TaxCardInstance.NInvSearchUnlockFromMain();
                if (base.TaxCardInstance.get_RetCode() != 0)
                {
                    MessageManager.ShowMsgBox(base.TaxCardInstance.get_ErrCode());
                    return;
                }
                if (!DownloadCommon.CheckEmpty(unlockVolume.Buffer))
                {
                    InvVolumeApp item = new InvVolumeApp();
                    flag = AllocateCommon.AllocateOneVolume(unlockVolume, out flag2, out str);
                    if (flag)
                    {
                        item.InvType  = Convert.ToByte(unlockVolume.get_Kind());
                        item.TypeCode = unlockVolume.get_TypeCode();
                        item.HeadCode = Convert.ToUInt32(unlockVolume.get_Number());
                        item.Number   = Convert.ToUInt16(unlockVolume.get_Count());
                        list.Add(item);
                    }
                    else if (flag2)
                    {
                        MessageManager.ShowMsgBox(base.TaxCardInstance.get_ErrCode());
                    }
                    else
                    {
                        MessageManager.ShowMsgBox(str);
                    }
                }
                if (!flag)
                {
                    goto Label_0598;
                }
                app2     = new InvVolumeApp();
                str2     = this.SelectedItems[1].ToString();
                num      = Convert.ToInt64(this.lblStartNumAlloc.Text);
                num2     = Convert.ToInt64(this.tbxAmountAlloc.Text);
                typeCode = (InvoiceType)ShareMethods.GetTypeCode(this.SelectedItems[0].ToString());
                num3     = Convert.ToInt32(this.tbxMachineAlloc.Text);
                if ((2 == typeCode) || (typeCode == null))
                {
                    if (base.TaxCardInstance.get_StateInfo().IsLockReached != 0)
                    {
                        MessageManager.ShowMsgBox("TCD_85_19");
                        return;
                    }
                    if (base.TaxCardInstance.get_StateInfo().IsRepReached != 0)
                    {
                        MessageManager.ShowMsgBox("TCD_85_19");
                        return;
                    }
                    goto Label_04E5;
                }
                if (11 != typeCode)
                {
                    if (12 != typeCode)
                    {
                        if (0x33 == typeCode)
                        {
                            ushort isLockTime = 2;
                            for (int j = 0; j < base.TaxCardInstance.get_StateInfo().InvTypeInfo.Count; j++)
                            {
                                if (0x33 == base.TaxCardInstance.get_StateInfo().InvTypeInfo[j].InvType)
                                {
                                    isLockTime = base.TaxCardInstance.get_StateInfo().InvTypeInfo[j].IsLockTime;
                                    ushort isRepTime  = base.TaxCardInstance.get_StateInfo().InvTypeInfo[j].IsRepTime;
                                    ushort jSPRepInfo = base.TaxCardInstance.get_StateInfo().InvTypeInfo[j].JSPRepInfo;
                                    break;
                                }
                            }
                            if (1 == isLockTime)
                            {
                                MessageManager.ShowMsgBox("TCD_85_19");
                                return;
                            }
                            if (1 == isLockTime)
                            {
                                MessageManager.ShowMsgBox("TCD_85_19");
                                return;
                            }
                        }
                        else if (0x29 == typeCode)
                        {
                            ushort num10 = 2;
                            for (int k = 0; k < base.TaxCardInstance.get_StateInfo().InvTypeInfo.Count; k++)
                            {
                                if (0x33 == base.TaxCardInstance.get_StateInfo().InvTypeInfo[k].InvType)
                                {
                                    num10 = base.TaxCardInstance.get_StateInfo().InvTypeInfo[k].IsLockTime;
                                    ushort num17 = base.TaxCardInstance.get_StateInfo().InvTypeInfo[k].IsRepTime;
                                    ushort num18 = base.TaxCardInstance.get_StateInfo().InvTypeInfo[k].JSPRepInfo;
                                    break;
                                }
                            }
                            if (1 == num10)
                            {
                                MessageManager.ShowMsgBox("TCD_85_19");
                                return;
                            }
                            if (1 == num10)
                            {
                                MessageManager.ShowMsgBox("TCD_85_19");
                                return;
                            }
                        }
                    }
                    else
                    {
                        ushort num6 = 2;
                        for (int m = 0; m < base.TaxCardInstance.get_StateInfo().InvTypeInfo.Count; m++)
                        {
                            if (12 == base.TaxCardInstance.get_StateInfo().InvTypeInfo[m].InvType)
                            {
                                num6 = base.TaxCardInstance.get_StateInfo().InvTypeInfo[m].IsLockTime;
                                ushort num13 = base.TaxCardInstance.get_StateInfo().InvTypeInfo[m].IsRepTime;
                                ushort num14 = base.TaxCardInstance.get_StateInfo().InvTypeInfo[m].JSPRepInfo;
                                break;
                            }
                        }
                        if (1 == num6)
                        {
                            MessageManager.ShowMsgBox("TCD_85_19");
                            return;
                        }
                        if (1 == num6)
                        {
                            MessageManager.ShowMsgBox("TCD_85_19");
                            return;
                        }
                    }
                    goto Label_04E5;
                }
                ushort num4 = 2;
                for (int i = 0; i < base.TaxCardInstance.get_StateInfo().InvTypeInfo.Count; i++)
                {
                    if (11 == base.TaxCardInstance.get_StateInfo().InvTypeInfo[i].InvType)
                    {
                        num4 = base.TaxCardInstance.get_StateInfo().InvTypeInfo[i].IsLockTime;
                        ushort num1  = base.TaxCardInstance.get_StateInfo().InvTypeInfo[i].IsRepTime;
                        ushort num12 = base.TaxCardInstance.get_StateInfo().InvTypeInfo[i].JSPRepInfo;
                        break;
                    }
                }
                if (1 == num4)
                {
                    MessageManager.ShowMsgBox("TCD_85_19");
                    return;
                }
                if (1 != num4)
                {
                    goto Label_04E5;
                }
                MessageManager.ShowMsgBox("TCD_85_19");
            }
            return;

Label_04E5:
            invoice2 = base.TaxCardInstance.NInvAllotToSubMachine(str2, num, num2, typeCode, num3);
            if (base.TaxCardInstance.get_RetCode() != 0)
            {
                MessageManager.ShowMsgBox(base.TaxCardInstance.get_ErrCode());
                return;
            }
            if (AllocateCommon.AllocateOneVolume(invoice2, out flag2, out str))
            {
                app2.InvType  = Convert.ToByte(invoice2.get_Kind());
                app2.TypeCode = invoice2.get_TypeCode();
                app2.HeadCode = Convert.ToUInt32(invoice2.get_Number());
                app2.Number   = Convert.ToUInt16(invoice2.get_Count());
                list.Add(app2);
            }
            else if (flag2)
            {
                MessageManager.ShowMsgBox(base.TaxCardInstance.get_ErrCode());
            }
            else
            {
                MessageManager.ShowMsgBox(str);
            }
Label_0598:
            if (list.Count > 0)
            {
                InvInfoWebAllocMsg msg = new InvInfoWebAllocMsg();
                msg.InsertInvVolume(list);
                msg.ShowDialog();
            }
            base.DialogResult = DialogResult.OK;
            base.Close();
        }