seecord

来源:互联网 发布:专业开淘宝店 编辑:程序博客网 时间:2024/05/21 22:26

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

using SEE.common;
using SEE.service;
using SEE.AppClass;
using System.Text.RegularExpressions;
using System.IO;

namespace SEE
{
    public partial class frmRegist : DevComponents.DotNetBar.Office2007Form
    {
        public frmRegist()
        {
            InitializeComponent();
        }
        public frmRegist(string number)
        {
            InitializeComponent();
            this.m_objCommonService = new CommonService();
            this.textBoxID.Text = number;
        }

        private CommonService m_objCommonService;
       
        private void buttonX2_Click(object sender, EventArgs e)
        {
            this.Close();
            this.Dispose();
        }

        private void frmRegist_Load(object sender, EventArgs e)
        {
           
        }

        private void buttonCreateID_Click(object sender, EventArgs e)
        {
            string[] mocs = clsSystemParam.GetMoc();

            this.textBoxID.Text = mocs[1];
        }

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            System.Diagnostics.Process.Start("IEXPLORE.EXE", AppDomain.CurrentDomain.BaseDirectory+"registerdemo.html");  
        }
       
        private string GetStrAToZAndNumber(string sourceStr)
        {
            string str20 = sourceStr;
            string strSplit1;
            strSplit1 = Regex.Replace(str20, "![a-z0-9]", "", RegexOptions.IgnoreCase);
            if (strSplit1.Length > 8)
            {
                return strSplit1.Substring(0, 7);
            }
            else
                return strSplit1.PadRight(8, 'a');
        }
        private void buttonRegist_Click(object sender, EventArgs e)
        {
            if (this.textBoxID.Text.Trim() != "" && this.textBoxRegistMark.Text.Trim() != "" && this.textBox1.Text.Trim() != "" &&

this.textBox3.Text.Trim()!="" && this.textBox4.Text.Trim()!="" && this.textBox5.Text.Trim()!="" && this.textBox6.Text.Trim()!="")
            {
                string registMark = "";
                registMark = this.textBoxRegistMark.Text.Trim() + this.textBox3.Text.Trim() + this.textBox4.Text.Trim() +

this.textBox5.Text.Trim() + this.textBox6.Text.Trim();
                //GetStrAToZAndNumber(SEE.common.DES.Encrypt(this.textBoxID.Text.Trim(), this.textBoxID.Text.Trim().ToLower() +

"abc"))
                SEE.RegCenter.Service1 regcenter = new SEE.RegCenter.Service1();
                string returnstring ="0,请稍后注册。";
                try{
                returnstring  = regcenter.CheckReg(this.textBoxRegistMark.Text.Trim(), this.textBox3.Text.Trim(),

this.textBox4.Text.Trim(), this.textBox5.Text.Trim(), this.textBox6.Text.Trim(), this.textBox1.Text.Trim(), this.textBoxID.Text.Trim(),

SEE.common.Config.GetConfigsNode("seesoft", "industry"));
                }
                catch(Exception ex)
                {
                    System.Windows.Forms.MessageBox.Show("注册过程中网络出现异常,请稍候再进行注册。","SeeSoft提示信息");
                    return;
                }
                //System.Windows.Forms.MessageBox.Show(returnstring, "SeeSoft提示信息");
                string[] restringarray = returnstring.Split(',');
                if (restringarray[0] == "1000")
                {
                    this.m_objCommonService.InsertRegInfomation(this.textBoxID.Text.Trim(), restringarray[1].Substring(0, 100));
                    this.m_objCommonService.InsertRegCompany(this.textBox1.Text.Trim(), "1");
                    System.IO.File.Delete(AppDomain.CurrentDomain.BaseDirectory + "//see.ini");
                    StreamWriter M_Writer = File.AppendText(AppDomain.CurrentDomain.BaseDirectory + "//see.ini");
                    lock (M_Writer)
                    {
                        try
                        {
                            M_Writer.WriteLine(registMark + this.textBox1.Text + this.textBoxID.Text + SEE.common.Config.GetConfigsNode

("seesoft", "industry"));
                            M_Writer.Flush();
                        }
                        finally
                        {
                            M_Writer.Close();
                        }
                    }
                    System.Windows.Forms.MessageBox.Show( "软件注册完毕,请重新启动本软件","SeeSoft提示信息");
                    this.Close();
                    this.Dispose();
                }
                else
                {
                        System.Windows.Forms.MessageBox.Show(restringarray[1].Replace("行业,",""),"SeeSoft提示信息");
                        return;
                }
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("请正确输入信息");
            }
        }
    }
}
//author:raytine
 

原创粉丝点击