Exemple #1
0
        public static string DecryptFile(string inFileName)
        {
            string path = sysTempDir + Path.GetFileName(inFileName);

            try
            {
                FileStream stream = new FileStream(inFileName, FileMode.Open, FileAccess.Read);
                byte[]     buffer = new byte[stream.Length];
                stream.Read(buffer, 0, buffer.Length);
                DateTime time    = new DateTime(0x7dd, 9, 10, 8, 0x22, 30);
                TimeSpan span    = (TimeSpan)(DateTime.Now - time);
                byte[]   buffer2 = AES_Crypt.Encrypt(ToolUtil.GetBytes(span.TotalSeconds.ToString("F1")), new byte[] {
                    0xff, 0x42, 0xae, 0x95, 11, 0x51, 0xca, 0x15, 0x21, 140, 0x4f, 170, 220, 0x92, 170, 0xed,
                    0xfd, 0xeb, 0x4e, 13, 0xac, 0x80, 0x52, 0xff, 0x45, 0x90, 0x85, 0xca, 0xcb, 0x9f, 0xaf, 0xbd
                }, new byte[] { 0xf2, 0x1f, 0xac, 0x5b, 0x2c, 0xc0, 0xa9, 0xd0, 0xbc, 0xaf, 0x86, 0x99, 0xad, 170, 0xfb, 0x60 });
                byte[] buffer3 = AES_Crypt.Decrypt(buffer, key, vec, buffer2);
                if (buffer3 == null)
                {
                    stream.Close();
                    return("");
                }
                FileStream stream2 = new FileStream(path, FileMode.Create, FileAccess.Write)
                {
                    Position = 0L
                };
                stream2.Write(buffer3, 0, buffer3.Length);
                stream.Close();
                stream2.Close();
            }
            catch
            {
                return("");
            }
            return(path);
        }
Exemple #2
0
        public static byte[] getByte(object value)
        {
            try
            {
                if (value != null)
                {
                    switch (value.GetType().ToString())
                    {
                    case "System.String":
                        return(ToolUtil.GetBytes((string)value));

                    case "System.Int64":
                        return(ToolUtil.GetBytes(getString(value)));

                    case "System.Int32":
                        return(ToolUtil.GetBytes(getString(value)));

                    case "System.Boolean":
                        return(ToolUtil.GetBytes(getString(value)));

                    case "System.DateTime":
                        return(ToolUtil.GetBytes(getString(value)));

                    case "System.IO.MemoryStream":
                        return(ToolUtil.GetBytes(getString(value)));
                    }
                }
                return(null);
            }
            catch
            {
                return(null);
            }
        }
        public static DockForm RunCommand(byte[] value)
        {
            string str = "Aisino.Fwkp.Invoice.ActiveX.TaxCardQuery_Status";

            byte[] bytes            = ToolUtil.GetBytes(MD5_Crypt.GetHashStr(str));
            byte[] destinationArray = new byte[0x20];
            Array.Copy(bytes, 0, destinationArray, 0, 0x20);
            byte[] buffer3 = new byte[0x10];
            Array.Copy(bytes, 0x20, buffer3, 0, 0x10);
            DateTime time = DateTime.Parse(ToolUtil.GetString(AES_Crypt.Decrypt(value, destinationArray, buffer3, null)));
            DateTime now  = DateTime.Now;

            if ((time.CompareTo(now) > 0) || (time.CompareTo(now.AddSeconds(-1.0)) < 0))
            {
                return(null);
            }
            WaitForm form = new WaitForm {
                StartPosition = FormStartPosition.CenterScreen,
                ShowInTaskbar = false
            };

            form.Show();
            bool flag = form.DataCheck();

            form.Close();
            if (!flag)
            {
                return(null);
            }
            if (form.bIsNeedRepair)
            {
                MessageManager.ShowMsgBox("INP-253207", new string[] { form.strRet });
            }
            return(new InvoiceReportForm());
        }
Exemple #4
0
 private void cmbName_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (this.cmbName.Text.Trim() != "")
     {
         string str = PropertyUtil.GetValue("Login_" + BitConverter.ToString(ToolUtil.GetBytes(this.cmbName.Text.Trim())).Replace("-", ""));
         if (!string.IsNullOrEmpty(str))
         {
             string[] strArray = str.Split(new char[] { '-' });
             this.method_6(strArray[0]);
             if (string.Equals(this.taxCard_0.SoftVersion, "FWKP_V2.0_Svr_Client"))
             {
                 this.method_7(PropertyUtil.GetValue("KPS_PROXY_URL", ""));
             }
             else
             {
                 this.method_7(strArray[1]);
             }
             this.aisinoCHK_0.Checked = true;
         }
         else
         {
             this.method_6("");
             this.method_7("");
             this.aisinoCHK_0.Checked = false;
         }
     }
 }
Exemple #5
0
        public static Stream getStream(object value)
        {
            try
            {
                if (value == null)
                {
                    return(new MemoryStream(ToolUtil.GetBytes("null")));
                }
                switch (value.GetType().ToString())
                {
                case "System.String":
                    return(new MemoryStream(ToolUtil.GetBytes((string)value)));

                case "System.Int64":
                    return(new MemoryStream(ToolUtil.GetBytes(getString(value))));

                case "System.Int32":
                    return(new MemoryStream(ToolUtil.GetBytes(getString(value))));

                case "System.Boolean":
                    return(new MemoryStream(ToolUtil.GetBytes(getString(value))));

                case "System.DateTime":
                    return(new MemoryStream(ToolUtil.GetBytes(getString(value))));

                case "System.Byte[]":
                    return(new MemoryStream(ToolUtil.GetBytes(getString(value))));
                }
                return(new MemoryStream(ToolUtil.GetBytes("null")));
            }
            catch
            {
                return(new MemoryStream(ToolUtil.GetBytes("null")));
            }
        }
Exemple #6
0
        private void FormLogin_Load(object sender, EventArgs e)
        {
            Interface0 interface2 = new Class2();

            try
            {
                List <string> list = interface2.imethod_0();
                this.cmbName.Items.AddRange(list.ToArray());
                if (this.cmbName.Items.Count > 0)
                {
                    this.cmbName.SelectedIndex = 0;
                }
                object obj2 = PropertyUtil.GetValue("MAIN_VER", null);
                if (obj2 != null)
                {
                    this.lblVer.Text = obj2.ToString();
                }
                else
                {
                    this.lblVer.Text = "未知版本号";
                }
                string str  = string.Empty;
                object obj4 = PropertyUtil.GetValue("MAIN_CODE", null);
                if (obj4 != null)
                {
                    str = obj4.ToString();
                }
                object obj3 = PropertyUtil.GetValue("MAIN_MACHINE", null);
                if ((obj3 != null) && !string.IsNullOrEmpty(obj3.ToString()))
                {
                    if (obj3.ToString() == "0")
                    {
                        str = str + " 主机";
                    }
                    else
                    {
                        str = str + " 分机" + obj3.ToString();
                    }
                }
                if (!string.Empty.Equals(str))
                {
                    this.Text = "用户登录 【" + str + "】";
                }
                string str2 = PropertyUtil.GetValue("Login_" + BitConverter.ToString(ToolUtil.GetBytes(this.cmbName.Text.Trim())).Replace("-", ""));
                if (!string.IsNullOrEmpty(str2))
                {
                    string[] strArray = str2.Split(new char[] { '-' });
                    this.txtPwd.Text          = strArray[0];
                    this.txtCertPassword.Text = strArray[1];
                    this.aisinoCHK_0.Checked  = true;
                }
            }
            catch (Exception exception)
            {
                MessageBoxHelper.Show("数据库连接异常", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                ilog_0.Error(exception.Message, exception);
                this.lblStatus.Text = "";
            }
        }
 private void txtNewPwd_TextChanged(object sender, EventArgs e)
 {
     byte[] bytes = ToolUtil.GetBytes(this.textBoxNewPwd.Text);
     if (bytes.Length >= 0x10)
     {
         this.textBoxNewPwd.Text = ToolUtil.GetString(bytes, 0, 0x10);
     }
 }
 private void Pwd_TextChanged(object sender, EventArgs e)
 {
     byte[] bytes = ToolUtil.GetBytes((sender as TextBox).Text);
     if (bytes.Length >= 0x10)
     {
         (sender as TextBox).Text = ToolUtil.GetString(bytes, 0, 0x10);
     }
 }
 private void InvNumEdit_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar.ToString() == "\b")
     {
         e.Handled = false;
     }
     else if ((ToolUtil.GetBytes(this.InvNumEdit.Text).Length >= 8) && (this.InvNumEdit.SelectedText.Length <= 0))
     {
         e.Handled = true;
     }
 }
 private void com_spfmc_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar.ToString() == "\b")
     {
         e.Handled = false;
     }
     else if (ToolUtil.GetBytes(this.com_spfmc.Text).Length >= 80)
     {
         e.Handled = true;
     }
 }
Exemple #11
0
 public static string GetCRC(string string_0)
 {
     try
     {
         return(Convert.ToString(smethod_3(ToolUtil.GetBytes(string_0)), 0x10).ToUpper());
     }
     catch (Exception)
     {
         return("");
     }
 }
Exemple #12
0
        public static void textBoxYHZH_DZDH_TextChanged(object sender, EventArgs e)
        {
            string[]   lines          = (sender as AisinoTXT).Lines;
            int        selectionStart = (sender as AisinoTXT).SelectionStart;
            string     str            = string.Empty;
            bool       flag           = false;
            List <int> list           = new List <int>();

            for (int i = 0; i < (sender as AisinoTXT).Lines.Length; i++)
            {
                if (ToolUtil.GetBytes((sender as AisinoTXT).Lines[i]).Length > 100)
                {
                    list.Add(i);
                    flag     = true;
                    lines[i] = GetSubString((sender as AisinoTXT).Lines[i], 100).Trim();
                }
            }
            (sender as AisinoTXT).Lines = lines;
            if (flag)
            {
                (sender as AisinoTXT).SelectionStart = selectionStart - 1;
            }
            else
            {
                (sender as AisinoTXT).SelectionStart = selectionStart;
            }
            (sender as AisinoTXT).ScrollToCaret();
            if (list.Count == 1)
            {
                string name = (sender as AisinoTXT).Name;
                string str3 = string.Empty;
                if (name == "textBoxYHZH")
                {
                    str3 = "单条银行账号不能超过100个字符!";
                }
                else if (name == "textBoxDZDH")
                {
                    str3 = "单条地址电话不能超过100个字符!";
                }
                else
                {
                    str3 = "未知控件单条不能超过100个字符!";
                }
                MessageBoxHelper.Show(str3, "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else if (list.Count > 1)
            {
                foreach (int num4 in list)
                {
                    str = str + "第" + ((num4 + 1)).ToString() + "行,";
                }
                MessageBoxHelper.Show(str.Substring(0, str.Length - 1) + "超过100个字符,已自动截取!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Exemple #13
0
 private void qshm_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar.ToString().Equals("\b"))
     {
         e.Handled = false;
     }
     else if ((ToolUtil.GetBytes(this.qshm.Text).Length >= 8) && (this.qshm.SelectedText.Length <= 0))
     {
         e.Handled = true;
     }
 }
Exemple #14
0
 public static void SetCryptoKey(byte[] byte_0)
 {
     byte[] bytes            = ToolUtil.GetBytes("1234567890123456");
     byte[] destinationArray = new byte[byte_0.Length + bytes.Length];
     Array.Copy(byte_0, 0, destinationArray, 0, byte_0.Length);
     Array.Copy(bytes, 0, destinationArray, byte_0.Length, bytes.Length);
     for (int i = 0x10; i < (destinationArray.Length - 1); i++)
     {
         destinationArray[i - 0x10] = (byte)(destinationArray[i - 0x10] + destinationArray[i]);
     }
     smethod_0(destinationArray);
 }
Exemple #15
0
        public static BaseForm RunCommand(byte[] value)
        {
            string str = "Aisino.Fwkp.Invoice.ActiveX.TaxCardQuery_Year";

            byte[] bytes            = ToolUtil.GetBytes(MD5_Crypt.GetHashStr(str));
            byte[] destinationArray = new byte[0x20];
            Array.Copy(bytes, 0, destinationArray, 0, 0x20);
            byte[] buffer3 = new byte[0x10];
            Array.Copy(bytes, 0x20, buffer3, 0, 0x10);
            DateTime time = DateTime.Parse(ToolUtil.GetString(AES_Crypt.Decrypt(value, destinationArray, buffer3, null)));
            DateTime now  = DateTime.Now;

            if ((time.CompareTo(now) <= 0) && (time.CompareTo(now.AddSeconds(-1.0)) >= 0))
            {
                if (taxcardEntityBLL.IsLocked())
                {
                    MessageManager.ShowMsgBox("INP-253109");
                    return(null);
                }
                DataSumForm form = new DataSumForm(false)
                {
                    StartPosition            = FormStartPosition.CenterScreen,
                    ShowInTaskbar            = false,
                    strLabelYearOrStartMonth = "起始月份",
                    strLabelEndMonth         = "结束月份",
                    bLabelTaxPeriod          = false,
                    bComboxTaxPeriod         = false
                };
                if (form.ShowDialog() == DialogResult.OK)
                {
                    TaxDateSegment segment = new TaxDateSegment();
                    try
                    {
                        segment.m_nYear       = form.nTaxYear;
                        segment.m_nStartMonth = form.nStartMonth;
                        segment.m_nEndMonth   = form.nEndMonth;
                        segment.m_nTaxPeriod  = Convert.ToInt32(form.strTaxPeriod);
                        return(new InvStatForm(segment, true)
                        {
                            Text = form.strDlgTitle, m_strTitle = form.strLabelTitle
                        });
                    }
                    catch (Exception exception)
                    {
                        MessageManager.ShowMsgBox("INP-253107", new string[] { exception.Message });
                        return(null);
                    }
                }
            }
            return(null);
        }
Exemple #16
0
 private void btn_FindPath_Click(object sender, EventArgs e)
 {
     try
     {
         string str = this.textBox_PathName.Text.Trim();
         FolderBrowserDialog dialog = new FolderBrowserDialog {
             ShowNewFolderButton = true
         };
         string selectedPath = PropertyUtil.GetValue(ZhiFuChuan.strPathCopy);
         if (!string.IsNullOrEmpty(selectedPath))
         {
             if (Directory.Exists(selectedPath))
             {
                 dialog.SelectedPath = selectedPath;
             }
         }
         else
         {
             dialog.SelectedPath = Application.StartupPath;
         }
         if (dialog.ShowDialog() == DialogResult.OK)
         {
             selectedPath = dialog.SelectedPath;
             DriveInfo info = new DriveInfo(selectedPath.Substring(0, 1));
             if (DriveType.Fixed != info.DriveType)
             {
                 MessageBoxHelper.Show("请选择一个固定磁盘!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             }
             else if (ToolUtil.GetBytes(selectedPath).Length > 200)
             {
                 MessageBoxHelper.Show("完全路径长度不能超过189字符!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                 this.textBox_PathName.Text = str;
             }
             else
             {
                 this.textBox_PathName.Text = selectedPath;
             }
         }
     }
     catch (BaseException exception)
     {
         _Loger.Error(exception.Message);
         ExceptionHandler.HandleError(exception);
     }
     catch (Exception exception2)
     {
         _Loger.Error(exception2.Message);
         ExceptionHandler.HandleError(exception2);
     }
 }
Exemple #17
0
 private void txtPhone_TextChanged(object sender, EventArgs e)
 {
     if (this.HasNonValidChar(this.txtPhone.Text))
     {
         this.txtPhone.Text = this.orgPhoneText;
     }
     else
     {
         byte[] bytes = ToolUtil.GetBytes(this.txtPhone.Text);
         if (bytes.Length >= 50)
         {
             this.txtPhone.Text = ToolUtil.GetString(bytes, 0, 50);
         }
     }
 }
Exemple #18
0
 public static bool SendMail(string string_3, string string_4, string[] string_5, string string_6, string string_7, string string_8, string string_9, string string_10, int int_1, string[] string_11, out string string_12)
 {
     try
     {
         MailMessage message = new MailMessage {
             From = new MailAddress(string_3, string_4)
         };
         foreach (string str2 in string_5)
         {
             message.To.Add(str2);
         }
         message.SubjectEncoding = Encoding.GetEncoding("UTF-8");
         message.Subject         = string_2 + string_6;
         message.BodyEncoding    = ToolUtil.GetEncoding();
         message.Priority        = MailPriority.High;
         message.Body            = Convert.ToBase64String(AES_Crypt.Encrypt(ToolUtil.GetBytes(string_7), byte_0, byte_1));
         message.IsBodyHtml      = false;
         if ((string_11 != null) && (string_11.Length > 0))
         {
             foreach (string str in string_11)
             {
                 message.Attachments.Add(new Attachment(str));
             }
         }
         SmtpClient client = new SmtpClient(string_10, int_1)
         {
             UseDefaultCredentials = true,
             DeliveryMethod        = SmtpDeliveryMethod.Network
         };
         if (string_8 != null)
         {
             client.Credentials = new NetworkCredential(string_8, string_9);
         }
         client.Timeout = 0x2710;
         client.Send(message);
         client.Dispose();
         string_12 = "OK";
         return(true);
     }
     catch (Exception exception)
     {
         string_12 = exception.Message;
         return(false);
     }
 }
        private bool testConnect(bool isSave)
        {
            bool flag = false;

            try
            {
                if ((this.txtFwqdz.Text.Length <= 0) || (this.txtDk.Text.Length <= 0))
                {
                    MessageManager.ShowMsgBox("SWDK-0012");
                    return(flag);
                }
                int    num   = 0;
                string str   = this.txtFwqdz.Text + ":" + this.txtDk.Text + "/ReceiveWlbpServlet";
                string xml   = "";
                string str3  = "";
                byte[] bytes = ToolUtil.GetBytes(this.genTestXml());
                if ((bytes != null) && (bytes.Length != 0))
                {
                    str3 = Convert.ToBase64String(bytes);
                }
                string s = new WebClient().Post(str, str3, out num);
                if ((s != null) && (s.Length > 0))
                {
                    xml = ToolUtil.GetString(Convert.FromBase64String(s));
                }
                XmlDocument document = new XmlDocument();
                document.LoadXml(xml);
                if (this.parseXML(document) == "1")
                {
                    if (!isSave)
                    {
                        MessageManager.ShowMsgBox("SWDK-0013");
                    }
                    return(true);
                }
                MessageManager.ShowMsgBox("SWDK-0014");
            }
            catch (Exception exception)
            {
                MessageManager.ShowMsgBox("SWDK-0014");
                this.loger.Error(exception.Message);
            }
            return(flag);
        }
Exemple #20
0
 private void cmbName_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (this.cmbName.Text.Trim() != "")
     {
         string str = PropertyUtil.GetValue("Login_" + BitConverter.ToString(ToolUtil.GetBytes(this.cmbName.Text.Trim())).Replace("-", ""));
         if (!string.IsNullOrEmpty(str))
         {
             string[] strArray = str.Split(new char[] { '-' });
             this.txtPwd.Text          = strArray[0];
             this.txtCertPassword.Text = strArray[1];
             this.aisinoCHK_0.Checked  = true;
         }
         else
         {
             this.txtPwd.Text          = string.Empty;
             this.txtCertPassword.Text = string.Empty;
             this.aisinoCHK_0.Checked  = false;
         }
     }
 }
Exemple #21
0
        public bool Login(bool bool_1, string string_2)
        {
            //逻辑修改:无Key调试时需要把TaxCard登录校验屏蔽掉
            if (InternetWare.Config.Constants.IsTest)
            {
                string_2 = "管理员";
                this.method_1(string_2);
            }
            else
            {
                #region
                bool      flag = false;
                LoginForm form = new LoginForm();
                if (bool_1)
                {
                    flag = false;
                    return(true);
                }
                if (form.ShowDialog() == DialogResult.OK)
                {
                    flag     = true;
                    string_2 = form.method_1();
                }
                if (!bool_1 && !flag)
                {
                    return(false);
                }
                TaxCardFactory.CardType = CTaxCardType.const_7;
                TaxCard card = TaxCardFactory.CreateTaxCard();
                card.CustomMessageBox += new TaxCard.CustomMsgBox(this.method_0);
Label_010F:
                if (!card.TaxCardOpen(form.method_4()) && (card.RetCode != 0))
                {
                    if (card.RetCode == -1111)
                    {
                        ChangeCertPass pass = new ChangeCertPass();
                        pass.method_2(form.method_4());
                        pass.method_3().Enabled = false;
                        pass.method_4(form.method_1());
                        if (pass.ShowDialog() != DialogResult.OK)
                        {
                            MessageBoxHelper.Show("取消证书默认口令修改,退出系统!", "系统登录", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                            return(false);
                        }
                        if (form.method_3())
                        {
                            PropertyUtil.SetValue("Login_" + BitConverter.ToString(ToolUtil.GetBytes(form.method_1())).Replace("-", ""), form.method_2() + "-" + pass.method_5());
                        }
                        else
                        {
                            PropertyUtil.SetValue("Login_" + BitConverter.ToString(ToolUtil.GetBytes(form.method_1())).Replace("-", ""), string.Empty);
                        }
                        MessageBoxHelper.Show("证书口令修改成功,请重新登录系统!", "系统登录", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        card.CloseDevice();
                        Process.Start(Assembly.GetExecutingAssembly().Location);
                        return(false);
                    }
                    if (!card.ErrCode.StartsWith("CA_"))
                    {
                        MessageManager.ShowMsgBox(card.ErrCode);
                        return(false);
                    }
                    int num4 = Convert.ToInt32(card.ErrCode.Split(new char[] { '_' })[1]);
                    switch (num4)
                    {
                    case 0x3810002a:
                        MessageBoxHelper.Show("证书口令长度不足8个字符", "证书登录错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                        return(false);

                    case 0x381063c0:
                        MessageBoxHelper.Show("证书密码被锁死,请解锁后重新登录", "证书登录错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                        return(false);

                    default:
                    {
                        if ((num4 >= 0x381063cf) || (num4 <= 0x381063c0))
                        {
                            MessageManager.ShowMsgBox(card.ErrCode);
                            return(false);
                        }
                        int       num5  = num4 - 0x381063c0;
                        CertLogin login = new CertLogin(num5);
                        if (login.ShowDialog() != DialogResult.OK)
                        {
                            MessageBoxHelper.Show("取消证书登录,退出系统!", "系统登录", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                            return(false);
                        }
                        card.CloseDevice();
                        form.method_5(login.method_1());
                        goto Label_010F;
                    }
                    }
                }
                MessageHelper.MsgWait("正在更新发票上传标志,不要插拔金税盘或关闭电源,请耐心等待...");
                ilog_0.Error("开始更新上传标志##########...");
                List <ClearCardInfo> list = card.UpdateUpLoadFlag();
                if (list != null)
                {
                    ilog_0.Error("UpdateUpLoadFlag返回结果个数#############:" + list.Count);
                }
                if ((list != null) && (list.Count > 0))
                {
                    foreach (ClearCardInfo info in list)
                    {
                        try
                        {
                            ilog_0.Error("金税盘RetCode##########:" + info.CSTime.ToString());
                            if (info.CSTime != "")
                            {
                                string str2 = string.Format("【{0}】 抄报清卡", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                                string str  = "update XXFP set BSZT = 1, BSBZ = 1, BSRZ = '" + str2 + "' where BSQ = " + info.InvPeriod.ToString() + " and SSYF = " + info.CSTime.ToString();
                                if (card.SubSoftVersion == "Linux")
                                {
                                    str = "update XXFP set BSBZ = 1, BSRZ = '" + str2 + "' where BSQ = " + info.InvPeriod.ToString() + " and SSYF = " + info.CSTime.ToString();
                                }
                                switch (info.InvKind)
                                {
                                case 0x29:
                                case 0x33:
                                case 12:
                                    str = str + " and (FPZL = 'j' or FPZL = 'p' or FPZL = 'q')";
                                    if (card.QYLX.ISJDC || card.QYLX.ISPTFPDZ)
                                    {
                                        PropertyUtil.SetValue(AttributeName.JDCQKDateName, this.method_2(12, info.CSTime));
                                    }
                                    if (card.QYLX.ISPTFPJSP)
                                    {
                                        PropertyUtil.SetValue(AttributeName.JSPQKDateName, this.method_2(0x29, info.CSTime));
                                    }
                                    break;

                                case 0:
                                case 2:
                                    str = str + " and (FPZL = 's' or FPZL = 'c')";
                                    if (card.QYLX.ISPTFP || card.QYLX.ISZYFP)
                                    {
                                        PropertyUtil.SetValue(AttributeName.ZPQKDateName, this.method_2(0, info.CSTime));
                                    }
                                    break;

                                case 11:
                                    str = str + " and FPZL = 'f'";
                                    if (card.QYLX.ISHY)
                                    {
                                        PropertyUtil.SetValue(AttributeName.HYQKDateName, this.method_2(11, info.CSTime));
                                    }
                                    break;
                                }
                                BaseDAOSQLite baseDAOSQLite = BaseDAOFactory.GetBaseDAOSQLite() as BaseDAOSQLite;
                                if (baseDAOSQLite != null)
                                {
                                    baseDAOSQLite.method_1(str);
                                }
                                else
                                {
                                    MessageBoxHelper.Show("获取数据库实例失败。");
                                }
                                continue;
                            }
                            ilog_0.Error("更新发票上传标志接口返回时间错误:" + info.CSTime);
                        }
                        catch (Exception exception)
                        {
                            MessageBoxHelper.Show(exception.Message);
                            ilog_0.Error(exception.ToString());
                        }
                    }
                }
                ilog_0.Error("结束更新上传标志##########...");
                MessageHelper.MsgWait();
                string regionCode = card.RegionCode;
                if (string.Equals(card.SoftVersion, "FWKP_V2.0_Svr_Client"))
                {
                    PropertyUtil.SetValue("MAIN_CODE", card.TaxCode);
                    PropertyUtil.SetValue("MAIN_MACHINE", card.Machine.ToString());
                    PropertyUtil.SetValue("MAIN_ORGCODE", card.CorpCode.Substring(0, 6));
                }
                if (!string.Equals(card.SoftVersion, "FWKP_V2.0_Svr_Client"))
                {
                    if ((regionCode != null) && (regionCode.Length > 2))
                    {
                        string str4 = regionCode.Substring(0, 2);
                        if (str4 == "91")
                        {
                            str4 = "50";
                        }
                        regionCode = str4 + regionCode.Substring(2);
                    }
                    if (((card.TaxMode == CTaxCardMode.tcmHave) && (card.TaxCode.Length > 15)) && (RegisterManager.SetupOrgCode != regionCode))
                    {
                        ilog_0.Info("注册表中地区编号:" + RegisterManager.SetupOrgCode);
                        ilog_0.Info("金税设备中地区编号:" + regionCode);
                        MessageBoxHelper.Show("安装时输入的地区编号和金税设备中不一致,请重新安装!");
                        return(false);
                    }
                    if (RegisterManager.SetupTaxCode != card.TaxCode)
                    {
                        MessageBoxHelper.Show("安装时输入的税号和金税设备中不一致,请重新安装!");
                        return(false);
                    }
                    if (RegisterManager.SetupMachine != card.Machine)
                    {
                        MessageBoxHelper.Show("安装时输入的开票机号和金税设备中不一致,请重新安装!");
                        return(false);
                    }
                    if (!RegisterManager.PreMakeInvoice())
                    {
                        MessageBoxHelper.Show("开票注册文件验证失败!");
                    }
                }
                #endregion
            }
            return(true);
        }
Exemple #22
0
 internal void method_1(Fpxx fpxx_0)
 {
     if (RegisterManager.CheckRegFile("JCST") || RegisterManager.CheckRegFile("JCJS"))
     {
         string str12    = PropertyUtil.GetValue("MAIN_PATH");
         string xfsh     = fpxx_0.xfsh;
         string fpdm     = fpxx_0.fpdm;
         string fphm     = fpxx_0.fphm;
         string str16    = xfsh + "_" + fpdm + "_" + fphm + ".xml";
         string path     = str12 + @"\OutPutFile\" + str16;
         string filename = str12 + @"\OutPutFile\JdcBZGSFile\" + str16;
         path.Remove(path.LastIndexOf(@"\"));
         string str10 = filename.Remove(filename.LastIndexOf(@"\"));
         if (!Directory.Exists(str10))
         {
             Directory.CreateDirectory(str10);
         }
         double num  = Convert.ToDouble(fpxx_0.je);
         double num2 = Convert.ToDouble(fpxx_0.se);
         string str3 = (num + num2).ToString("F2");
         string kprq = fpxx_0.kprq;
         string str4 = "";
         string str5 = "";
         if ((kprq != null) && (kprq.Length >= 0x13))
         {
             str4 = kprq.Substring(0, 10);
             str5 = kprq.Substring(11, 8);
         }
         XmlDocument    document2 = new XmlDocument();
         XmlDeclaration newChild  = document2.CreateXmlDeclaration("1.0", "GBK", null);
         document2.AppendChild(newChild);
         XmlElement element50 = document2.CreateElement("business");
         document2.AppendChild(element50);
         XmlElement element2 = document2.CreateElement("body");
         element50.AppendChild(element2);
         XmlElement element51 = document2.CreateElement("fplx");
         element51.InnerText = "1";
         element2.AppendChild(element51);
         XmlElement element52 = document2.CreateElement("fpdm");
         element52.InnerText = fpxx_0.fpdm;
         element2.AppendChild(element52);
         XmlElement element53 = document2.CreateElement("fphm");
         element53.InnerText = fpxx_0.fphm;
         element2.AppendChild(element53);
         XmlElement element54 = document2.CreateElement("zfbz");
         element54.InnerText = fpxx_0.zfbz ? "1" : "0";
         element2.AppendChild(element54);
         XmlElement element55 = document2.CreateElement("kprq");
         element55.InnerText = str4;
         element2.AppendChild(element55);
         XmlElement element56 = document2.CreateElement("ghdw");
         element56.InnerText = fpxx_0.gfmc;
         element2.AppendChild(element56);
         XmlElement element57 = document2.CreateElement("gfsbh");
         element57.InnerText = "";
         element2.AppendChild(element57);
         XmlElement element58 = document2.CreateElement("sfzhm");
         element58.InnerText = fpxx_0.sfzhm;
         element2.AppendChild(element58);
         XmlElement element59 = document2.CreateElement("scqymc");
         element59.InnerText = fpxx_0.sccjmc;
         element2.AppendChild(element59);
         XmlElement element60 = document2.CreateElement("cllx");
         element60.InnerText = fpxx_0.cllx;
         element2.AppendChild(element60);
         XmlElement element61 = document2.CreateElement("cpxh");
         element61.InnerText = fpxx_0.cpxh;
         element2.AppendChild(element61);
         XmlElement element62 = document2.CreateElement("cd");
         element62.InnerText = fpxx_0.cd;
         element2.AppendChild(element62);
         XmlElement element63 = document2.CreateElement("hgzh");
         element63.InnerText = fpxx_0.hgzh;
         element2.AppendChild(element63);
         XmlElement element64 = document2.CreateElement("jkzmsh");
         element64.InnerText = fpxx_0.jkzmsh;
         element2.AppendChild(element64);
         XmlElement element65 = document2.CreateElement("sjdh");
         element65.InnerText = fpxx_0.sjdh;
         element2.AppendChild(element65);
         XmlElement element66 = document2.CreateElement("fdjhm");
         element66.InnerText = fpxx_0.fdjhm;
         element2.AppendChild(element66);
         XmlElement element67 = document2.CreateElement("cjhm");
         element67.InnerText = fpxx_0.clsbdh;
         element2.AppendChild(element67);
         XmlElement element68 = document2.CreateElement("je");
         element68.InnerText = fpxx_0.je;
         element2.AppendChild(element68);
         XmlElement element69 = document2.CreateElement("sl");
         element69.InnerText = fpxx_0.sLv;
         element2.AppendChild(element69);
         XmlElement element70 = document2.CreateElement("se");
         element70.InnerText = fpxx_0.se;
         element2.AppendChild(element70);
         XmlElement element71 = document2.CreateElement("jshj");
         element71.InnerText = str3;
         element2.AppendChild(element71);
         XmlElement element72 = document2.CreateElement("xfmc");
         element72.InnerText = fpxx_0.xfmc;
         element2.AppendChild(element72);
         XmlElement element73 = document2.CreateElement("xfsh");
         element73.InnerText = fpxx_0.xfsh;
         element2.AppendChild(element73);
         XmlElement element74 = document2.CreateElement("xfdz");
         element74.InnerText = fpxx_0.xfdz;
         element2.AppendChild(element74);
         XmlElement element75 = document2.CreateElement("xfdh");
         element75.InnerText = fpxx_0.xfdh;
         element2.AppendChild(element75);
         XmlElement element76 = document2.CreateElement("jxsswjgdm");
         element76.InnerText = fpxx_0.zgswjgdm;
         element2.AppendChild(element76);
         XmlElement element = document2.CreateElement("dw");
         if ((fpxx_0.dw != null) && (fpxx_0.dw.Length > 0))
         {
             element.InnerText = fpxx_0.dw;
         }
         element2.AppendChild(element);
         if (RegisterManager.CheckRegFile("JCJS"))
         {
             string str9  = "";
             byte[] bytes = ToolUtil.GetBytes(document2.InnerXml.ToString());
             if ((bytes != null) && (bytes.Length > 0))
             {
                 str9 = Convert.ToBase64String(bytes);
             }
             string[] contents = new string[] { str9 };
             File.WriteAllLines(path, contents, Encoding.Unicode);
         }
         string zfsj  = fpxx_0.zfsj;
         string str17 = "";
         string str18 = "";
         if ((zfsj != null) && (zfsj.Length >= 0x13))
         {
             str17 = zfsj.Substring(0, 10);
             str18 = zfsj.Substring(11, 8);
         }
         string str8 = "0";
         if (fpxx_0.zfbz)
         {
             str8 = "1";
         }
         else if (num < 0.0)
         {
             str8 = "2";
         }
         XmlDocument    document    = new XmlDocument();
         XmlDeclaration declaration = document.CreateXmlDeclaration("1.0", "GBK", null);
         document.AppendChild(declaration);
         XmlElement element8 = document.CreateElement("taxML");
         document.AppendChild(element8);
         XmlElement element3 = document.CreateElement("jdcxsfpMxxx");
         element8.AppendChild(element3);
         XmlElement element9 = document.CreateElement("fpdm");
         element9.InnerText = fpxx_0.fpdm;
         element3.AppendChild(element9);
         XmlElement element10 = document.CreateElement("fphm");
         element10.InnerText = fpxx_0.fphm;
         element3.AppendChild(element10);
         XmlElement element11 = document.CreateElement("jqbh");
         element11.InnerText = fpxx_0.jqbh;
         element3.AppendChild(element11);
         XmlElement element12 = document.CreateElement("kprq");
         element12.InnerText = str4;
         element3.AppendChild(element12);
         XmlElement element13 = document.CreateElement("kpsj");
         element13.InnerText = str5;
         element3.AppendChild(element13);
         XmlElement element14 = document.CreateElement("skm");
         element14.InnerText = "";
         element3.AppendChild(element14);
         XmlElement element15 = document.CreateElement("ghdw");
         element15.InnerText = fpxx_0.gfmc;
         element3.AppendChild(element15);
         XmlElement element16 = document.CreateElement("ghdwdm");
         element16.InnerText = "";
         element3.AppendChild(element16);
         XmlElement element17 = document.CreateElement("sfzhm");
         element17.InnerText = fpxx_0.sfzhm;
         element3.AppendChild(element17);
         XmlElement element18 = document.CreateElement("scqymc");
         element18.InnerText = fpxx_0.sccjmc;
         element3.AppendChild(element18);
         XmlElement element19 = document.CreateElement("cllx");
         element19.InnerText = fpxx_0.cllx;
         element3.AppendChild(element19);
         XmlElement element20 = document.CreateElement("cpxh");
         element20.InnerText = fpxx_0.cpxh;
         element3.AppendChild(element20);
         XmlElement element21 = document.CreateElement("cd");
         element21.InnerText = fpxx_0.cd;
         element3.AppendChild(element21);
         XmlElement element22 = document.CreateElement("hgzs");
         element22.InnerText = fpxx_0.hgzh;
         element3.AppendChild(element22);
         XmlElement element23 = document.CreateElement("jkzmsh");
         element23.InnerText = fpxx_0.jkzmsh;
         element3.AppendChild(element23);
         XmlElement element24 = document.CreateElement("sjdh");
         element24.InnerText = fpxx_0.sjdh;
         element3.AppendChild(element24);
         XmlElement element25 = document.CreateElement("fdjhm");
         element25.InnerText = fpxx_0.fdjhm;
         element3.AppendChild(element25);
         XmlElement element26 = document.CreateElement("clsbdh");
         element26.InnerText = fpxx_0.clsbdh;
         element3.AppendChild(element26);
         XmlElement element27 = document.CreateElement("jshj");
         element27.InnerText = str3;
         element3.AppendChild(element27);
         XmlElement element28 = document.CreateElement("xhdwmc");
         element28.InnerText = fpxx_0.xfmc;
         element3.AppendChild(element28);
         XmlElement element29 = document.CreateElement("nsrsbh");
         element29.InnerText = fpxx_0.xfsh;
         element3.AppendChild(element29);
         XmlElement element30 = document.CreateElement("dh");
         element30.InnerText = fpxx_0.xfdh;
         element3.AppendChild(element30);
         XmlElement element31 = document.CreateElement("zh");
         element31.InnerText = fpxx_0.xfzh;
         element3.AppendChild(element31);
         XmlElement element32 = document.CreateElement("dz");
         element32.InnerText = fpxx_0.xfdz;
         element3.AppendChild(element32);
         XmlElement element33 = document.CreateElement("khyh");
         element33.InnerText = fpxx_0.xfyh;
         element3.AppendChild(element33);
         XmlElement element34 = document.CreateElement("zzssl");
         element34.InnerText = fpxx_0.sLv;
         element3.AppendChild(element34);
         XmlElement element35 = document.CreateElement("zzsse");
         element35.InnerText = fpxx_0.se;
         element3.AppendChild(element35);
         XmlElement element36 = document.CreateElement("dkdw_mc");
         element36.InnerText = "";
         element3.AppendChild(element36);
         XmlElement element37 = document.CreateElement("dkdw_dm");
         element37.InnerText = "";
         element3.AppendChild(element37);
         XmlElement element38 = document.CreateElement("zgswjg_mc");
         element38.InnerText = fpxx_0.zgswjgmc;
         element3.AppendChild(element38);
         XmlElement element39 = document.CreateElement("zgswjg_dm");
         element39.InnerText = fpxx_0.zgswjgdm;
         element3.AppendChild(element39);
         XmlElement element40 = document.CreateElement("bhsj");
         element40.InnerText = fpxx_0.je;
         element3.AppendChild(element40);
         XmlElement element41 = document.CreateElement("dw");
         element41.InnerText = fpxx_0.dw;
         element3.AppendChild(element41);
         XmlElement element42 = document.CreateElement("xcrs");
         element42.InnerText = fpxx_0.xcrs;
         element3.AppendChild(element42);
         XmlElement element43 = document.CreateElement("bz");
         element43.InnerText = "一车一票";
         element3.AppendChild(element43);
         XmlElement element44 = document.CreateElement("kpr");
         element44.InnerText = fpxx_0.kpr;
         element3.AppendChild(element44);
         XmlElement element45 = document.CreateElement("kplx");
         element45.InnerText = "1";
         element3.AppendChild(element45);
         XmlElement element46 = document.CreateElement("dkbz");
         element46.InnerText = "0";
         element3.AppendChild(element46);
         XmlElement element47 = document.CreateElement("fpbz");
         element47.InnerText = str8;
         element3.AppendChild(element47);
         XmlElement element48 = document.CreateElement("zfrq");
         element48.InnerText = str17;
         element3.AppendChild(element48);
         XmlElement element49 = document.CreateElement("zfsj");
         element49.InnerText = str18;
         element3.AppendChild(element49);
         XmlElement element4 = document.CreateElement("zfr");
         element4.InnerText = fpxx_0.zfbz ? UserInfo.Yhmc : "";
         element3.AppendChild(element4);
         XmlElement element5 = document.CreateElement("tpdm");
         element5.InnerText = fpxx_0.blueFpdm;
         element3.AppendChild(element5);
         XmlElement element6 = document.CreateElement("tphm");
         element6.InnerText = fpxx_0.blueFphm;
         element3.AppendChild(element6);
         XmlElement element7 = document.CreateElement("lgrq");
         element7.InnerText = "";
         element3.AppendChild(element7);
         if (RegisterManager.CheckRegFile("JCST"))
         {
             TaxCard card    = TaxCardFactory.CreateTaxCard();
             byte[]  buffer2 = ToolUtil.GetBytes(fpxx_0.xfsh + card.Machine.ToString());
             document.Save(filename);
             byte[] buffer3 = ToolUtil.GetBytes(filename);
             byte[] buffer4 = new byte[0x400];
             byte[] buffer5 = new byte[100];
             EncodeFile(buffer3, buffer2, buffer4, buffer5);
             File.Delete(filename);
         }
     }
 }
Exemple #23
0
        private void LoginForm_Load(object sender, EventArgs e)
        {
            Interface0 interface2 = new Class11();

            try
            {
                List <string> list = interface2.imethod_0();
                this.cmbName.Items.AddRange(list.ToArray());
                if (this.cmbName.Items.Count > 0)
                {
                    this.cmbName.SelectedIndex = 0;
                }
                object obj3 = PropertyUtil.GetValue("MAIN_VER", null);
                if (obj3 != null)
                {
                    this.lblVer.Text = obj3.ToString();
                }
                else
                {
                    this.lblVer.Text = "未知版本号";
                }
                string str2 = string.Empty;
                object obj2 = PropertyUtil.GetValue("MAIN_CODE", null);
                if (obj2 != null)
                {
                    str2 = obj2.ToString();
                }
                if (!string.Empty.Equals(str2))
                {
                    base.lblTitle.Text = ProductName + str2;
                }
                string str = PropertyUtil.GetValue("Login_" + BitConverter.ToString(ToolUtil.GetBytes(this.cmbName.Text.Trim())).Replace("-", ""));
                if (!string.IsNullOrEmpty(str))
                {
                    string[] strArray = str.Split(new char[] { '-' });
                    this.method_6(strArray[0]);
                    if (string.Equals(this.taxCard_0.SoftVersion, "FWKP_V2.0_Svr_Client"))
                    {
                        this.method_7(PropertyUtil.GetValue("KPS_PROXY_URL", ""));
                    }
                    else
                    {
                        this.method_7(strArray[1]);
                    }
                    this.aisinoCHK_0.Checked = true;
                }
                if (string.Equals(this.taxCard_0.SoftVersion, "FWKP_V2.0_Svr_Client"))
                {
                    this.method_7(PropertyUtil.GetValue("KPS_PROXY_URL", ""));
                }
                this.lblSoftName.Text = ProductName;
                if (this.lblSoftName.Text.Contains("代开"))
                {
                    this.lblSoftName.Location = new Point(60, 4);
                }
            }
            catch (Exception exception)
            {
                MessageBoxHelper.Show("数据库连接异常", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                ilog_0.Error(exception.Message, exception);
            }
        }
Exemple #24
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     if (this.txtPwd.Text.Trim().Length > 0x10)
     {
         MessageBoxHelper.Show("用户密码长度不能超过16位,请重新输入!", "系统登录", MessageBoxButtons.OK, MessageBoxIcon.Hand);
         this.txtPwd.Focus();
     }
     else
     {
         bool   flag = false;
         string str3 = this.cmbName.SelectedItem.ToString();
         string str  = this.txtPwd.Text.Trim();
         if (str == this.string_3)
         {
             str = "";
         }
         this.string_1 = this.txtCertPassword.Text.Trim();
         if (this.taxCard_0.SoftVersion != "FWKP_V2.0_Svr_Client")
         {
             if (this.string_1 == this.string_4)
             {
                 this.string_1 = "";
             }
             if (string.IsNullOrEmpty(this.string_1))
             {
                 MessageBoxHelper.Show("证书口令不能为空,请输入!", "登录错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                 return;
             }
             if (this.string_1.Length < 8)
             {
                 MessageBoxHelper.Show("证书口令长度不足8位,请重新输入!", "登录错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                 return;
             }
             if (this.string_1.Length > 0x10)
             {
                 MessageBoxHelper.Show("证书口令长度不能大于16位,请重新输入!", "登录错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                 return;
             }
         }
         string     hashStr    = MD5_Crypt.GetHashStr(str);
         Interface0 interface2 = new Class11();
         try
         {
             flag = interface2.imethod_1(str3, hashStr);
         }
         catch (Exception exception)
         {
             MessageBoxHelper.Show("数据库连接异常", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
             ilog_0.Error(exception.ToString());
             return;
         }
         if (flag)
         {
             this.string_0           = str3;
             this.string_2           = str;
             this.taxCard_0.String_0 = this.string_1;
             if (this.aisinoCHK_0.Checked)
             {
                 this.bool_1 = true;
                 PropertyUtil.SetValue("Login_" + BitConverter.ToString(ToolUtil.GetBytes(str3)).Replace("-", ""), str + "-" + this.string_1);
             }
             else
             {
                 PropertyUtil.SetValue("Login_" + BitConverter.ToString(ToolUtil.GetBytes(str3)).Replace("-", ""), string.Empty);
             }
             if (string.Equals(this.taxCard_0.SoftVersion, "FWKP_V2.0_Svr_Client"))
             {
                 PropertyUtil.SetValue("KPS_PROXY_URL", this.string_1);
             }
             base.DialogResult = DialogResult.OK;
             base.Dispose();
         }
         else
         {
             ilog_0.Error("用户/密码错误!");
             MessageBoxHelper.Show("密码错误,请重新输入!", "登录错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
             this.method_6("");
             this.txtPwd.Focus();
         }
     }
 }
Exemple #25
0
        private static bool smethod_5(RegFileInfo regFileInfo_0, TaxCard taxCard_1, bool bool_0)
        {
            bool flag;

            try
            {
                if ((regFileInfo_0 == null) || !regFileInfo_0.CheckedOk)
                {
                    goto Label_02BA;
                }
                if (taxCard_1 == null)
                {
                    taxCard_1 = taxCard_0;
                }
                else
                {
                    taxCard_0 = taxCard_1;
                }
                if (regFileInfo_0.VerFlag != "KP")
                {
                    DateTime time;
                    string   strA = new string(regFileInfo_0.FileContent.StopDate);
                    taxCard_1.GetCardClock(out time, 0);
                    if (string.Compare(strA, time.ToString("yyyyMMdd")) < 0)
                    {
                        regFileInfo_0.ErrCode = "910105";
                        return(false);
                    }
                    if ((taxCard_1.TaxMode != CTaxCardMode.tcmHave) || !bool_0)
                    {
                        return(true);
                    }
                    if (regFileInfo_0.FileContent.SoftwareType == 1)
                    {
                        byte[] buffer = smethod_9(regFileInfo_0, taxCard_1);
                        if (((buffer != null) && (buffer.Length > 3)) && (buffer[2] == 1))
                        {
                            return(true);
                        }
                    }
                    byte[] buffer2 = new byte[0x10];
                    for (int i = 0; i < buffer2.Length; i++)
                    {
                        buffer2[i] = (byte)(i ^ regFileInfo_0.FileContent.Transfer[i]);
                    }
                    byte[] buffer3 = smethod_11(regFileInfo_0, buffer2, taxCard_1);
                    if ((buffer3 == null) || (buffer3.Length < 0x10))
                    {
                        goto Label_02A7;
                    }
                    for (int j = 0; j < 0x10; j++)
                    {
                        if (buffer3[j] != j)
                        {
                            goto Label_0298;
                        }
                    }
                    FileStream stream = new FileStream(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "verflag.dat"), FileMode.OpenOrCreate);
                    try
                    {
                        string       str4   = "<RSAKeyValue><Modulus>ghCLpZiwHiZIDYve7yGZusVydX406Qd4JqIYFsl/wUK/y1xjEsT3zQvCfpwASRwpHg0bi8XZ4EILPJt4NXVXftRlD7ZlG17sAIDp3OUSSGxI5hkXB7BJPrw2wbqs/6hfZr6vmYnwpDb8IAZmt8xlJucIUWjEVuu4NnOx1/iiqlM=</Modulus><Exponent>AQAB</Exponent><P>tvY6Rtiwahg6keaITiLw42GCjXLK3BDjtHfa2uMSndK5qBhQQ+7bMM11H/7spU+25SgXBdSHVWy/y8KFvT5ISw==</P><Q>tfx+BCB6dw/4ShgTqbxX3X8xoRapWr4XMvVrdLnc/txHpHhn9pNjtM2Xb3GVlltzCEQkzBcXnk0SeBYjIR3xGQ==</Q><DP>T6PIZDRIPjZDsGSHqnNdJay5NjbkhHw5kcGmGydCYD5sn/XNYnSjJpAYTpAZlC+prgAQXXJQYmfO6LPIoUJuFw==</DP><DQ>n891ngwjXxDgGbjg84oYosLCg1KSL8SEPNS1o1BgWFJ6e1zc9vRhd3GfTVcyZFI0RwsIQUz6CaJm2JugB8HyaQ==</DQ><InverseQ>oxe42fx2yLATcCG4lbQ5f8Qo8c8ACkT4NxqYl3GXdrojBorBzbvht2+KHq2bJorWtcPNnsmumhV6BIV7zCW0kw==</InverseQ><D>E92nFsH9lH1QYBFPGcNOEcL6uotuVXF4np3/g+t/AevKE6umzkUbfEwhhukY+hG9DgP+gxjTMHel87njYHbtyA+23TdhIzhyYcSg0ifotDhgD8+9lBrn29hyddFigLDoXnZR1SQmvn7xjuGKtZ/HaKZPetSxgVf1mSPdzl37CGE=</D></RSAKeyValue>";
                        StreamReader reader = new StreamReader(stream);
                        string       str5   = reader.ReadToEnd();
                        bool         flag2  = false;
                        string       input  = string.Empty;
                        if (!string.IsNullOrEmpty(str5))
                        {
                            byte[] buffer4 = Convert.FromBase64String(str5);
                            byte[] buffer5 = RSA_Crypt.Decrypt(str4, buffer4);
                            if (buffer5 == null)
                            {
                                goto Label_01F5;
                            }
                            input = ToolUtil.GetString(buffer5);
                            foreach (string str7 in Regex.Split(input, ";"))
                            {
                                if (str7 == regFileInfo_0.VerFlag)
                                {
                                    goto Label_01E2;
                                }
                            }
                        }
                        goto Label_0204;
Label_01E2:
                        reader.Close();
                        stream.Close();
                        flag2 = true;
                        goto Label_0204;
Label_01F5:
                        ilog_0.Error("[CheckRegFile] 读取已注册版本信息失败,解密失败");
Label_0204:
                        if (!flag2)
                        {
                            stream.SetLength(0L);
                            StreamWriter writer = new StreamWriter(stream);
                            string       str8   = input + regFileInfo_0.VerFlag + ";";
                            string       str9   = Convert.ToBase64String(RSA_Crypt.Encrypt(str4, ToolUtil.GetBytes(str8)));
                            writer.Write(str9);
                            writer.Flush();
                            writer.Close();
                        }
                        stream.Close();
                    }
                    catch (Exception exception)
                    {
                        ilog_0.Error("[CheckRegFile] 出现异常:" + exception.Message);
                        stream.Close();
                    }
                }
                return(true);

Label_0298:
                regFileInfo_0.ErrCode = "910107";
                return(false);

Label_02A7:
                regFileInfo_0.ErrCode = "910106";
                return(false);

Label_02BA:
                flag = false;
            }
            catch (Exception exception2)
            {
                ilog_0.Error(exception2.Message);
                flag = false;
            }
            return(flag);
        }
Exemple #26
0
        public object[] DaiKaiFpUpload_Old(List <Fpxx> fpList)
        {
            if ((fpList == null) || (fpList.Count == 0))
            {
                return(null);
            }
            int num  = 0;
            int num2 = 0;
            int num3 = 0;
            int num4 = 0;

            try
            {
                List <XmlDocument> list = this.DaiKaiFpCreateXml(fpList);
                if ((list == null) || (list.Count <= 0))
                {
                    this.loger.Error("[DaiKaiFpUpload函数]:税务代开发票遍历构造XML异常");
                    return(new object[] { "2222" });
                }
                this.swdkUrl = PropertyUtil.GetValue("SWDK_SERVER");
                if ((this.swdkUrl == null) || (this.swdkUrl == ""))
                {
                    this.loger.Error("[DaiKaiFpUpload函数]:税务代开发票的回传IP地址错误");
                    this.swdkUrl = "http://127.0.0.1:80";
                    MessageManager.ShowMsgBox("FPCX-000012");
                    return(new object[] { num3 });
                }
                for (int i = 0; i < list.Count; i++)
                {
                    byte[] bytes = ToolUtil.GetBytes(list[i].OuterXml);
                    if ((bytes != null) && (bytes.Length > 0))
                    {
                        string str = Convert.ToBase64String(bytes);
                        string s   = this.swdkClient.Post(this.swdkUrl, str, out num);
                        num2 = 0;
                        if ((s != null) && (s.Length > 0))
                        {
                            num2 = Tool.ObjectToInt(ToolUtil.GetString(Convert.FromBase64String(s)));
                        }
                        if ((num == 0) && (num2 >= 1))
                        {
                            if (i < fpList.Count)
                            {
                                this.loger.Error("回传第" + i.ToString() + "条记录成功发票代码:" + fpList[i].fpdm + "发票号码:" + fpList[i].fphm);
                            }
                            num3++;
                        }
                        else
                        {
                            if (i < fpList.Count)
                            {
                                this.loger.Error("回传第" + i.ToString() + "条记录失败:发票代码:" + fpList[i].fpdm + "发票号码:" + fpList[i].fphm);
                            }
                            MessageManager.ShowMsgBox("FPCX-000010", "提示", new string[] { fpList[i].fpdm, fpList[i].fphm });
                        }
                    }
                }
                num4 = list.Count - num3;
                if (num4 < 0)
                {
                    num4 = 0;
                }
                MessageManager.ShowMsgBox("FPCX-000011", "提示", new string[] { list.Count.ToString(), num3.ToString(), num4.ToString() });
                fpList = null;
                return(new object[] { num3 });
            }
            catch (Exception exception)
            {
                this.loger.Error("税务代开发票遍历构造XML异常:" + exception.ToString());
                return(new object[] { "1111" });
            }
        }
Exemple #27
0
        public object[] DaiKaiFpZuoFeiUpload(List <SWDKDMHM> ZyfpList, List <SWDKDMHM> PtfpList)
        {
            int num  = 0;
            int num2 = 0;

            try
            {
                XmlDocument document = this.DaiKaiZYFPZuofeiCreateXml(ZyfpList);
                this.swdkUrl = PropertyUtil.GetValue("SWDK_SERVER");
                if (document != null)
                {
                    if ((this.swdkUrl == null) || (this.swdkUrl == ""))
                    {
                        this.loger.Error("[DaiKaiFpZuoFeiUpload函数]:税务代开专用发票的回传IP地址错误");
                        this.swdkUrl = "http://127.0.0.1:80";
                    }
                    byte[] bytes = ToolUtil.GetBytes(document.OuterXml);
                    if ((bytes != null) && (bytes.Length > 0))
                    {
                        string str = Convert.ToBase64String(bytes);
                        string s   = this.swdkClient.Post(this.swdkUrl, str, out num);
                        num2 = 0;
                        if ((s != null) && (s.Length > 0))
                        {
                            num2 = Tool.ObjectToInt(ToolUtil.GetString(Convert.FromBase64String(s)));
                        }
                        if ((num == 0) && (num2 >= 1))
                        {
                            int num3 = ZyfpList.Count - num;
                            if (num3 < 0)
                            {
                                num3 = 0;
                            }
                            this.loger.Error("[DaiKaiFpZuoFeiUpload函数]:税务代开专用发票作废回传服务器成功" + num.ToString() + "条,失败" + num3.ToString() + "条");
                        }
                        else
                        {
                            this.loger.Error("[DaiKaiFpZuoFeiUpload函数]:税务代开专用发票作废回传服务器成功0条,失败:" + ZyfpList.Count.ToString() + "条");
                        }
                    }
                }
                else
                {
                    this.loger.Error("税务代开专票构建XML失败");
                }
                XmlDocument document2 = this.DaiKaiPTFPZuofeiCreateXml(PtfpList);
                if (document2 != null)
                {
                    if ((this.swdkUrl == null) || (this.swdkUrl == ""))
                    {
                        this.loger.Error("[DaiKaiFpZuoFeiUpload函数]:税务代开普通发票的回传IP地址错误");
                        this.swdkUrl = "http://127.0.0.1:80";
                    }
                    byte[] inArray = ToolUtil.GetBytes(document2.OuterXml);
                    if ((inArray != null) && (inArray.Length > 0))
                    {
                        string str3 = Convert.ToBase64String(inArray);
                        string str4 = this.swdkClient.Post(this.swdkUrl, str3, out num);
                        num2 = 0;
                        if ((str4 != null) && (str4.Length > 0))
                        {
                            num2 = Tool.ObjectToInt(ToolUtil.GetString(Convert.FromBase64String(str4)));
                        }
                        if ((num == 0) && (num2 >= 1))
                        {
                            int num4 = PtfpList.Count - num;
                            if (num4 < 0)
                            {
                                num4 = 0;
                            }
                            this.loger.Error("[DaiKaiFpZuoFeiUpload函数]:税务代开普通发票作废回传服务器成功" + num.ToString() + "条,失败" + num4.ToString() + "条");
                        }
                        else
                        {
                            this.loger.Error("[DaiKaiFpZuoFeiUpload函数]:税务代开普通发票作废回传服务器成功0条,失败:" + PtfpList.Count.ToString() + "条");
                        }
                    }
                }
                else
                {
                    this.loger.Error("[DaiKaiFpZuoFeiUpload函数]:税务代开普通发票作废遍历构造XML异常");
                    return(new object[] { "1111" });
                }
                return(new object[] { "0000" });
            }
            catch (Exception exception)
            {
                this.loger.Error("税务代开发票作废构造XML异常:" + exception.ToString());
                return(new object[] { "1111" });
            }
        }
Exemple #28
0
        public object[] DaiKaiFpUpload_New(List <Fpxx> fpList)
        {
            if ((fpList == null) || (fpList.Count == 0))
            {
                return(null);
            }
            List <SWDKDMHM> zyfpList = new List <SWDKDMHM>();
            List <SWDKDMHM> ptfpList = new List <SWDKDMHM>();
            int             num      = 0;
            int             num2     = 0;
            int             num3     = 0;
            int             num4     = 0;

            try
            {
                this.swdkUrl = PropertyUtil.GetValue("SWDK_SERVER");
                if ((this.swdkUrl == null) || (this.swdkUrl == ""))
                {
                    this.loger.Error("[DaiKaiFpUpload函数]:税务代开发票的回传IP地址错误");
                    this.swdkUrl = "http://127.0.0.1:80";
                    MessageManager.ShowMsgBox("FPCX-000012");
                    return(new object[] { num3 });
                }
                for (int i = 0; i < fpList.Count; i++)
                {
                    try
                    {
                        object[] objArray = ServiceFactory.InvokePubService("Aisino.Fwkp.UploadSWDKFP", new object[] { fpList[i] });
                        if (objArray == null)
                        {
                            MessageManager.ShowMsgBox("FPCX-000010", "提示", new string[] { fpList[i].fpdm, fpList[i].fphm });
                            this.loger.Error("Aisino.Fwkp.UploadSWDKFP接口错误");
                            continue;
                        }
                        XmlDocument document = objArray[0] as XmlDocument;
                        byte[]      bytes    = ToolUtil.GetBytes(document.OuterXml);
                        if ((bytes != null) && (bytes.Length > 0))
                        {
                            string str = Convert.ToBase64String(bytes);
                            string s   = this.swdkClient.Post(this.swdkUrl, str, out num);
                            num2 = 0;
                            if ((s != null) && (s.Length > 0))
                            {
                                s    = ToolUtil.GetString(Convert.FromBase64String(s));
                                num2 = Tool.ObjectToInt(s);
                            }
                            if ((num == 0) && (num2 >= 1))
                            {
                                if (i < fpList.Count)
                                {
                                    this.loger.Error("回传第" + i.ToString() + "条记录成功发票代码:" + fpList[i].fpdm + "发票号码:" + fpList[i].fphm);
                                }
                                num3++;
                            }
                            else
                            {
                                if (i < fpList.Count)
                                {
                                    this.loger.Error("回传第" + i.ToString() + "条记录失败:发票代码:" + fpList[i].fpdm + "发票号码:" + fpList[i].fphm + " 错误信息:" + s);
                                }
                                MessageManager.ShowMsgBox("FPCX-000010", "提示", new string[] { fpList[i].fpdm, fpList[i].fphm });
                            }
                        }
                        else
                        {
                            MessageManager.ShowMsgBox("FPCX-000010", "提示", new string[] { fpList[i].fpdm, fpList[i].fphm });
                            if (i < fpList.Count)
                            {
                                this.loger.Error("回传第" + i.ToString() + "条记录失败:发票代码:" + fpList[i].fpdm + "发票号码:" + fpList[i].fphm);
                            }
                        }
                    }
                    catch (Exception exception)
                    {
                        this.loger.Error(exception.ToString());
                        MessageManager.ShowMsgBox("FPCX-000010", "提示", new string[] { fpList[i].fpdm, fpList[i].fphm });
                    }
                    try
                    {
                        if (fpList[i].zfbz)
                        {
                            SWDKDMHM item = new SWDKDMHM {
                                fpdm = fpList[i].fpdm,
                                fphm = fpList[i].fphm
                            };
                            if (fpList[i].fplx == 0)
                            {
                                zyfpList.Add(item);
                                this.DaiKaiFpZuoFeiUpload(zyfpList, null);
                                zyfpList.Clear();
                            }
                            else if (fpList[i].fplx == FPLX.PTFP)
                            {
                                ptfpList.Add(item);
                                this.DaiKaiFpZuoFeiUpload(null, ptfpList);
                                ptfpList.Clear();
                            }
                        }
                    }
                    catch (Exception exception2)
                    {
                        this.loger.Error(exception2.ToString());
                        this.loger.Error("[DaiKaiFpUpload_New函数异常]:本张发票的作废标志已经上传或者网络原因导致上传失败");
                    }
                    finally
                    {
                        zyfpList.Clear();
                        ptfpList.Clear();
                    }
                }
                num4 = fpList.Count - num3;
                if (num4 < 0)
                {
                    num4 = 0;
                }
                MessageManager.ShowMsgBox("FPCX-000011", "提示", new string[] { fpList.Count.ToString(), num3.ToString(), num4.ToString() });
                fpList = null;
                return(new object[] { num3 });
            }
            catch (Exception exception3)
            {
                this.loger.Error("税务代开发票遍历构造XML异常:" + exception3.ToString());
                return(new object[] { "1111" });
            }
        }
Exemple #29
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     if (this.txtPwd.Text.Trim().Length > 0x10)
     {
         MessageBoxHelper.Show("口令长度不能超过16位,请重新输入!", "系统登录", MessageBoxButtons.OK, MessageBoxIcon.Hand);
         this.txtPwd.Focus();
     }
     else
     {
         bool flag = false;
         this.lblStatus.Text = "正在校验用户名/密码...";
         this.lblStatus.Refresh();
         string str  = this.cmbName.SelectedItem.ToString();
         string str2 = this.txtPwd.Text.Trim();
         if (string.IsNullOrEmpty(this.txtCertPassword.Text.Trim()))
         {
             MessageBoxHelper.Show("证书口令不能为空,请输入!", "登录错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
         }
         else
         {
             string     hashStr    = MD5_Crypt.GetHashStr(str2);
             Interface0 interface2 = new Class2();
             try
             {
                 flag = interface2.imethod_1(str, hashStr);
             }
             catch (Exception exception)
             {
                 MessageBoxHelper.Show("数据库连接异常", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                 ilog_0.Error(exception.ToString());
                 this.lblStatus.Text = "";
                 return;
             }
             if (flag)
             {
                 this.string_0 = str;
                 this.string_2 = str2;
                 this.string_1 = this.txtCertPassword.Text.Trim();
                 if (this.aisinoCHK_0.Checked)
                 {
                     this.bool_0 = true;
                     PropertyUtil.SetValue("Login_" + BitConverter.ToString(ToolUtil.GetBytes(str)).Replace("-", ""), str2 + "-" + this.string_1);
                 }
                 else
                 {
                     PropertyUtil.SetValue("Login_" + BitConverter.ToString(ToolUtil.GetBytes(str)).Replace("-", ""), string.Empty);
                 }
                 base.DialogResult = DialogResult.OK;
                 base.Dispose();
             }
             else
             {
                 ilog_0.Error("用户/密码错误!");
                 MessageBoxHelper.Show("密码错误,请重新输入!", "登录错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                 this.txtPwd.Text = "";
                 this.txtPwd.Focus();
                 this.lblStatus.Text = "";
                 this.lblStatus.Refresh();
             }
         }
     }
 }
Exemple #30
0
 public static string ToBase64(string text)
 {
     return(Convert.ToBase64String(ToolUtil.GetBytes(text)));
 }