DataConn 的摘要说明
Inheritance: System.Web.UI.Page
Esempio n. 1
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        DataConn objcon = new DataConn();
        string SQL = "select dw_id,QQ号码,QQ_id,等级,yh_id,类型 from 用户表 where QQ号码='" + this.username.Value + "'";
        DataTable dt_yh = new DataTable();
        dt_yh = objcon.GetDataTable(SQL);
        if (dt_yh != null && dt_yh.Rows.Count > 0)
        {
            string yh_id = "";

            yh_id = dt_yh.Rows[0]["yh_id"].ToString();
            dj = dt_yh.Rows[0]["等级"].ToString();
            QQ = dt_yh.Rows[0]["QQ号码"].ToString();
            gys_id = dt_yh.Rows[0]["dw_id"].ToString();
            string lx = dt_yh.Rows[0]["类型"].ToString();

            Session["GYS_QQ_ID"] = dt_yh.Rows[0]["QQ_id"].ToString();
            Session["GYS_YH_ID"] = yh_id;//蒋,11月07号添加
            Session["QQ号码"] = QQ;
            Session["类型"] = lx;
            Session["dwid"] = gys_id;
            if (dj == "普通用户")
            {
                Response.Write("<script> window.opener.location.href='gyszym.aspx';window.close();</" + "script>");
            }
            else
            {
                Response.Write("<script> window.opener.location.href='hyyhgl.aspx?QQ=" + this.username.Value + "&dw_id=" + gys_id + "';window.close();</" + "script>");
            }
        }
        else
        {
            Response.Write("<script>alert('您的账号未注册!');</" + "script>");
        }
    }
Esempio n. 2
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     DataConn objcon = new DataConn();
     string SQL = "select yh_id,QQ_id,等级, QQ号码 from 用户表 where QQ号码='" + this.username.Value + "'";
     DataTable dt_yh = objcon.GetDataTable(SQL);
     if (dt_yh != null && dt_yh.Rows.Count > 0)
     {
         yh_id = dt_yh.Rows[0]["yh_id"].ToString();
         dj=dt_yh.Rows[0]["等级"].ToString();
         Session["CGS_QQ_ID"] = dt_yh.Rows[0]["QQ_id"].ToString();
         Session["CGS_YH_ID"] = yh_id;
         //GYS_YH_ID
         if (dj == "普通用户")
         {
             Response.Write("<script> window.opener.location.href='cgsgl_2.aspx';window.close();</" + "script>");
         }
         else
         {
             Response.Write("<script>window.opener.location.href='hyyhgl.aspx?QQ=" + this.username.Value + "';window.close();</" + "script>");
         }
     }
     else
     {
         Response.Write("<script>alert('您的账号未注册!');</" + "script>");
     }
 }
Esempio n. 3
0
        static void Main(string[] args)
        {
            DataConn conn = new DataConn();

            conn.DatabaseName = "twilson1\\inst3";
//			conn.Open();

            // create a datatable that has default values on columns
            DataTable dt = new DataTable();

            DataColumn col1 = new DataColumn("col1", typeof(Int32));

            col1.DefaultValue = -1;

            DataColumn col2 = new DataColumn("col2", typeof(string));

            col2.DefaultValue = "~^~";

            dt.Columns.Add(col1);
            dt.Columns.Add(col2);

            DataRow row = dt.NewRow();

            dt.Rows.Add(row);
        }
Esempio n. 4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     //string constr = ConfigurationManager.ConnectionStrings["DBServerName"].ConnectionString;
     objConn = new DataConn();
     dt      = objConn.GetDataTable("select distinct top 10 品牌名称 ,pp_id from 品牌字典 where 是否启用=1 ");
 }
Esempio n. 5
0
    string strRunPage; //验证成功后要跳转的页面

    #endregion Fields

    #region Methods

    protected void btnCheck_Click(object sender, ImageClickEventArgs e)
    {
        DataConn dc = new DataConn();
        string QQ = Request.Form["user_qq"];
        string gys_qq_id;
        string cgs_qq_id;
        string sql_Check_QQ;
        string sql_Update_QQ_id;
        string sql_GetData;
        string sql_Level;
        string sql_dwid;

        if (Request.Cookies["GYS_QQ_ID"]!=null)
        {
            gys_qq_id = Request.Cookies["GYS_QQ_ID"].Value.ToString();
            sql_Check_QQ = "select * from 用户表 where QQ号码='" + QQ + "'";
            sql_Update_QQ_id = "update 用户表 set QQ_id = '" + gys_qq_id + "',验证通过时间=getdate(),是否验证通过='通过' where QQ号码='" + QQ + "'";

            sql_GetData = "select 供应商,地址,电话,主页,单位类型,联系人,联系人手机 from 材料供应商信息表 where gys_id=(select dw_id from 用户表 where QQ_id='" + gys_qq_id + "')";

            sql_Level = "select 等级 from 用户表 where QQ_id='" + gys_qq_id + "'";
            sql_dwid = "select dw_id from 用户表 where QQ_id='" + gys_qq_id + "'";
        }
        else
        {
            cgs_qq_id = Request.Cookies["CGS_QQ_ID"].Value.ToString();
            sql_Check_QQ = "select * from 用户表 where QQ号码='" + QQ + "'";
            sql_Update_QQ_id = "update 用户表 set QQ_id = '" + cgs_qq_id + "',验证通过时间=getdate(),是否验证通过='通过' where QQ号码='" + QQ + "'";

            sql_GetData = "select 单位名称,地址,电话,主页,单位类型,联系人,联系人手机 from 采购商基本信息 where cgs_id=(select dw_id from 用户表 where QQ_id='" + cgs_qq_id + "')";

            sql_Level = "select 等级 from 用户表 where QQ_id='" + cgs_qq_id + "'";
            sql_dwid = "select dw_id from 用户表 where QQ_id='" + cgs_qq_id + "'";
        }

        if(dc.GetRowCount(sql_Check_QQ)>0)     //判断QQ号是否存在,即是否已经注册
        {
            //Response.Write("已经注册");
            if (dc.RunSqlTransaction(sql_Update_QQ_id))    //已经注册,则写入QQ_id
            {
                //读取数据
                dtGys = dc.GetDataTable(sql_GetData);
                if (Request.Cookies["GYS_QQ_ID"] != null)
                {
                    for (int i = 0; i < dtGys.Rows.Count; i++)
                    {
                        DataRow dr = dtGys.Rows[i];
                        this.gys_name.Value = dr["供应商"].ToString();
                        this.gys_address.Value = dr["地址"].ToString();
                        this.gys_phone.Value = dr["电话"].ToString();
                        this.gys_homepage.Value = dr["主页"].ToString();
                        this.gslx.Value = dr["单位类型"].ToString();
                        this.user_name.Value = dr["联系人"].ToString();
                        this.user_phone.Value = dr["联系人手机"].ToString();
                    }
                }
                else
                {
                    for (int i = 0; i < dtGys.Rows.Count; i++)
                    {
                        DataRow dr = dtGys.Rows[i];
                        this.gys_name.Value = dr["单位名称"].ToString();
                        this.gys_address.Value = dr["地址"].ToString();
                        this.gys_phone.Value = dr["电话"].ToString();
                        this.gys_homepage.Value = dr["主页"].ToString();
                        this.gslx.Value = dr["单位类型"].ToString();
                        this.user_name.Value = dr["联系人"].ToString();
                        this.user_phone.Value = dr["联系人手机"].ToString();
                    }
                }

                if (dc.DBLook(sql_Level) == "企业用户")
                {
                    strRunPage = "hyyhgl.aspx";
                }
                else if (dc.DBLook(sql_Level) == "普通用户")
                {
                    string dwid = dc.DBLook(sql_dwid);
                    if (Request.Cookies["GYS_QQ_ID"] != null)
                    {
                        strRunPage = "gyszym.aspx?dw_id=" + dwid;
                    }
                    else
                    {
                        strRunPage = "cgsgl_2.aspx?dw_id=" + dwid;
                    }

                }

                Response.Write(@"<script>if(confirm('验证成功,是否现在登录?')==true)
                {window.location.href='" + strRunPage + "';}else{}</script>");

            }
        }
        else
        {
            Response.Write(@"<script>if(confirm('此账户尚未注册,是否现在注册?')==true)
            {window.location.href='hyzcsf.aspx';}else{window.opener=null;window.open('','_self');
            window.close();}</script>");
        }
    }
Esempio n. 6
0
        // https://developer.apple.com/library/mac/documentation/networking/Reference/AFP_Reference/Reference/reference.html#//apple_ref/c/func/FPOpenDir

        void T2(object state) {
            Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;

            Encoding enc = Encoding.GetEncoding(932);

            ManualResetEvent evExit = new ManualResetEvent(false);

            try {
                using (TcpClient tcp = (TcpClient)state) {
                    NetworkStream st = tcp.GetStream();
                    StreamWriter wr = new StreamWriter(st, Encoding.UTF8);
                    StreamReader rr = new StreamReader(st, Encoding.UTF8, false);

                    ConDyn cd = new ConDyn(cc);
                    String syst = "";
                    using (MyDSI3 comm = new MyDSI3(afp)) {
                        TransmitRes res = comm.Transmit(new DSIGetStatus());
                        if (res.pack.IsResponse && res.pack.ErrorCode == 0) {
                            GetSrvrInfoPack pack = new GetSrvrInfoPack(res.br);
                            if (pack.AFPVersionsList.Contains("AFP2.2")) {

                            }
                            if (pack.AFPVersionsList.Contains("AFPX03")) {
                                cd.AFP30 = true;
                            }
                            if (pack.AFPVersionsList.Contains("AFP3.1")) {
                                cd.AFP31 = true;
                            }
                            syst += " Server: " + pack.ServerName + "\n";
                            syst += " AFPVer:";
                            foreach (String ver in pack.AFPVersionsList) syst += " <" + ver + ">";
                            syst += "\n";
                            syst += "    UAM:";
                            foreach (String ver in pack.UAMsList) syst += " <" + ver + ">";
                        }
                        else {
                            Ut.WriteRes(wr, 500, "AFP server failed: " + new DSIException(res.pack.ErrorCode, res.pack));
                            return;
                        }
                    }
                    String U = String.Empty;
                    String P = String.Empty;
                    IDir root = new DisconnetedRoot();
                    IDir pwd = root;
                    DataConn dc = new DataConn();
                    Int64 ftpRest = 0;
                    IEnt rnfr = null;
                    using (MyDSI3 comm = new MyDSI3(afp)) {
                        Ticker ti = new Ticker(comm, evExit);
                        Ut.WriteRes(wr, 220, "FTP4AFP in UTF-8");
                        while (true) {
                            try {
                                String row = rr.ReadLine();
                                if (row == null) break;
                                Match M;
                                M = Regex.Match(row, "^QUIT", RegexOptions.Singleline | RegexOptions.IgnoreCase);
                                if (M.Success) {
                                    Ut.WriteRes(wr, 221, "Goodbye!");
                                    break;
                                }
                                M = Regex.Match(row, "^USER\\s+(?<a>.+)\\s*$", RegexOptions.Singleline | RegexOptions.IgnoreCase);
                                if (M.Success) {
                                    U = M.Groups["a"].Value;
                                    Ut.WriteRes(wr, 331, "Proceed to password.");
                                    continue;
                                }
                                M = Regex.Match(row, "^PASS\\s+(?<a>.+)\\s*$", RegexOptions.Singleline | RegexOptions.IgnoreCase);
                                if (M.Success) {
                                    P = M.Groups["a"].Value;
                                    Uta a = new Uta();
                                    root = pwd = a.Login(comm, cd, U, P);
                                    Ut.WriteRes(wr, 230, "User logged in, proceed.");
                                    continue;
                                }
                                M = Regex.Match(row, "^SYST", RegexOptions.Singleline | RegexOptions.IgnoreCase);
                                if (M.Success) {
                                    Ut.WriteRes(wr, 215, typeof(AFPServ).AssemblyQualifiedName + "\n" + Environment.OSVersion + "\n" + "\n" + syst);
                                    continue;
                                }
                                M = Regex.Match(row, "^(XPWD|PWD)", RegexOptions.Singleline | RegexOptions.IgnoreCase);
                                if (M.Success) {
                                    MLoc m = MLoc.Ut.Get(pwd);
                                    Ut.WriteRes(wr, 257, "\"" + m.UnixPath + "\" is current directory.");
                                    continue;
                                }
                                M = Regex.Match(row, "^TYPE\\s+(?<a>A|I)\\s*$", RegexOptions.Singleline | RegexOptions.IgnoreCase);
                                if (M.Success) {
                                    String mode = M.Groups["a"].Value.ToUpperInvariant();
                                    if (mode == "I") dc.TypeI();
                                    if (mode == "A") dc.TypeA();
                                    Ut.WriteRes(wr, 200, "Ok.");
                                    continue;
                                }
                                M = Regex.Match(row, "^PASV", RegexOptions.Singleline | RegexOptions.IgnoreCase);
                                if (M.Success) {
                                    dc.Pasv(tcp.Client.LocalEndPoint);

                                    Ut.WriteRes(wr, 227, "Entering Passive Mode (" + dc.GetPasv() + ")");
                                    continue;
                                }
                                M = Regex.Match(row, "^PORT\\s+(?<a>\\d+,\\d+,\\d+,\\d+,\\d+,\\d+)\\s*$", RegexOptions.Singleline | RegexOptions.IgnoreCase);
                                if (M.Success) {
                                    dc.Port(M.Groups["a"].Value);
                                    Ut.WriteRes(wr, 200, "PORT command successful.");
                                    continue;
                                }
                                M = Regex.Match(row, "^LIST(\\s+(?<a>.+))?\\s*$", RegexOptions.Singleline | RegexOptions.IgnoreCase);
                                if (M.Success) {
                                    String cwd = M.Groups["a"].Value;
                                    try {
                                        IDir newwd = (cwd.Length == 0) ? pwd : TravUt.Cwd(pwd, cwd);

                                        StringWriter ww = new StringWriter();
                                        foreach (IEnt o in newwd.GetEnts()) {
                                            bool isDir = o is IDir;
                                            ww.WriteLine("{0}rw-r--r--    1 0        0      {1,10} {2,-12} {3}"
                                                , isDir ? "d" : "-"
                                                , isDir ? "0" : o.Size.ToString()
                                                , DUt.Format(o.Mt)
                                                , o.Name
                                                );
                                        }
                                        // http://blog.livedoor.jp/kumagai_nori/archives/51660940.html
                                        // http://ash.jp/net/ftp_command.htm
                                        // http://www.atmarkit.co.jp/ait/articles/0307/11/news001.html

                                        // http://www.atmarkit.co.jp/fnetwork/rensai/netpro10/ftp-responsecode.html

                                        // http://maruo.dyndns.org:81/hidesoft/hidesoft_2/x17565.html
                                        // http://www.nsftools.com/tips/MSFTP.htm#dir
                                        Ut.WriteRes(wr, 150, "Opening " + dc.Mode + " mode data connection for LIST");

                                        dc.SendData(wr.Encoding.GetBytes(ww.ToString()));

                                        Ut.WriteRes(wr, 226, "Transfer complete");
                                        continue;
                                    }
                                    catch (EntNotFoundException err) {
                                        Ut.WriteRes(wr, 501, err.Message);
                                        continue;
                                    }
                                }
                                M = Regex.Match(row, "^MLSD(\\s+(?<a>.+))?\\s*$", RegexOptions.Singleline | RegexOptions.IgnoreCase);
                                if (M.Success) {
                                    String cwd = M.Groups["a"].Value;
                                    try {
                                        IDir newwd = (cwd.Length == 0) ? pwd : TravUt.Cwd(pwd, cwd);

                                        StringWriter ww = new StringWriter();
                                        foreach (IEnt o in newwd.GetEnts()) {
                                            bool isDir = o is IDir;
                                            ww.WriteLine("modify={0};perm={1};size={2};type={3}; {4}"
                                                , o.Mt.HasValue ? String.Format("{0:yyyy}{0:MM}{0:dd}{0:HH}{0:mm}{0:ss}", o.Mt.Value) : ""
                                                , isDir ? "cdelmp" : "dlrw"
                                                , Math.Max(o.Size, 0)
                                                , isDir ? "dir" : "file"
                                                , o.Name
                                                );
                                        }

                                        Ut.WriteRes(wr, 150, "Opening " + dc.Mode + " mode data connection for MLSD");

                                        dc.SendData(wr.Encoding.GetBytes(ww.ToString()));

                                        Ut.WriteRes(wr, 226, "Transfer complete");
                                        continue;
                                    }
                                    catch (EntNotFoundException err) {
                                        Ut.WriteRes(wr, 501, err.Message);
                                        continue;
                                    }
                                }
                                M = Regex.Match(row, "^CWD\\s+(?<a>.+)\\s*$", RegexOptions.Singleline | RegexOptions.IgnoreCase);
                                if (M.Success) {
                                    String cwd = M.Groups["a"].Value;
                                    try {
                                        IDir newwd = TravUt.Cwd(pwd, cwd);
                                        pwd = newwd;
                                        Ut.WriteRes(wr, 250, "Directory successfully changed.");
                                        continue;
                                    }
                                    catch (EntNotFoundException err) {
                                        Ut.WriteRes(wr, 550, err.Message);
                                        continue;
                                    }
                                }
                                M = Regex.Match(row, "^CDUP", RegexOptions.Singleline | RegexOptions.IgnoreCase);
                                if (M.Success) {
                                    IDir newwd = pwd.ParentDir;
                                    if (newwd == null) {
                                        Ut.WriteRes(wr, 250, "We are already at root directory.");
                                        continue;
                                    }
                                    else {
                                        pwd = newwd;
                                        Ut.WriteRes(wr, 250, "Directory successfully changed.");
                                        continue;
                                    }
                                }
                                M = Regex.Match(row, "^OPTS\\s+UTF8\\s+ON\\s*$", RegexOptions.Singleline | RegexOptions.IgnoreCase);
                                if (M.Success) {
                                    Ut.WriteRes(wr, 200, "It is in UTF8 mode.");
                                    wr = new StreamWriter(st, Encoding.UTF8);
                                    rr = new StreamReader(st, Encoding.UTF8, false);
                                    continue;
                                }
                                M = Regex.Match(row, "^OPTS\\s+UTF8\\s+OFF\\s*$", RegexOptions.Singleline | RegexOptions.IgnoreCase);
                                if (M.Success) {
                                    Ut.WriteRes(wr, 200, "It is in " + enc.BodyName + " mode.");
                                    wr = new StreamWriter(st, enc);
                                    rr = new StreamReader(st, enc, false);
                                    continue;
                                }
                                M = Regex.Match(row, "^OPTS\\s+FORKMODE\\s+(?<a>\\d+)\\s*$", RegexOptions.Singleline | RegexOptions.IgnoreCase);
                                if (M.Success) {
                                    int i = int.Parse(M.Groups["a"].Value);
                                    cd.ForkMode = i;
                                    Ut.WriteRes(wr, 200, "It is in fork mode " + i + ".");
                                    continue;
                                }
                                M = Regex.Match(row, "^FEAT", RegexOptions.Singleline | RegexOptions.IgnoreCase);
                                if (M.Success) {
                                    Ut.WriteRes(wr, 211, "Features:| UTF8| MLST modify*;perm*;size*;type*;| FORKMODE| END".Replace("|", "\n"));
                                    continue;
                                }
                                M = Regex.Match(row, "^RETR\\s+(?<a>.+)\\s*$", RegexOptions.Singleline | RegexOptions.IgnoreCase);
                                if (M.Success) {
                                    String cwd = M.Groups["a"].Value;
                                    try {
                                        IEnt source = TravUt.Find(pwd, cwd, false);

                                        if (source is ICanDL) {
                                            using (Stream si = ((ICanDL)source).OpenRead()) {
                                                Ut.WriteRes(wr, 150, "Opening " + dc.Mode + " mode data connection for " + cwd);
                                                si.Position = ftpRest;
                                                dc.SendSt(si);
                                            }
                                        }
                                        else {
                                            Ut.WriteRes(wr, 550, "We can't get \"" + cwd + "\".");
                                            continue;
                                        }
                                        ftpRest = 0;

                                        Ut.WriteRes(wr, 226, "Transfer complete");
                                        continue;
                                    }
                                    catch (EntNotFoundException err) {
                                        Ut.WriteRes(wr, 550, err.Message);
                                        continue;
                                    }
                                }
                                M = Regex.Match(row, "^STOR\\s+(?<a>.+)\\s*$", RegexOptions.Singleline | RegexOptions.IgnoreCase);
                                if (M.Success) {
                                    String cwd = M.Groups["a"].Value;
                                    try {
                                        using (Stream os = TravUt.Createf(pwd, cwd, cd)) {
                                            Ut.WriteRes(wr, 150, "Opening " + dc.Mode + " mode data connection for " + cwd);
                                            os.SetLength(ftpRest);
                                            os.Position = ftpRest;
                                            dc.RecvSt(os);
                                        }
                                        ftpRest = 0;

                                        Ut.WriteRes(wr, 226, "Transfer complete");
                                        continue;
                                    }
                                    catch (EntNotFoundException err) {
                                        Ut.WriteRes(wr, 550, err.Message);
                                        continue;
                                    }
                                }
                                M = Regex.Match(row, "^APPE\\s+(?<a>.+)\\s*$", RegexOptions.Singleline | RegexOptions.IgnoreCase);
                                if (M.Success) {
                                    String cwd = M.Groups["a"].Value;
                                    try {
                                        using (Stream os = TravUt.Createf(pwd, cwd, cd)) {
                                            Ut.WriteRes(wr, 150, "Opening " + dc.Mode + " mode data connection for " + cwd);
                                            os.Seek(0, SeekOrigin.End);
                                            dc.RecvSt(os);
                                        }

                                        Ut.WriteRes(wr, 226, "Transfer complete");
                                        continue;
                                    }
                                    catch (EntNotFoundException err) {
                                        Ut.WriteRes(wr, 550, err.Message);
                                        continue;
                                    }
                                }
                                M = Regex.Match(row, "^MKD\\s+(?<a>.+)\\s*$", RegexOptions.Singleline | RegexOptions.IgnoreCase);
                                if (M.Success) {
                                    String cwd = M.Groups["a"].Value;
                                    try {
                                        TravUt.CreateDir(pwd, cwd);

                                        Ut.WriteRes(wr, 250, "\"" + cwd + "\" created successfully.");
                                        continue;
                                    }
                                    catch (EntNotFoundException err) {
                                        Ut.WriteRes(wr, 550, "\"" + cwd + "\": Unable to create directory. \n" + err.Message);
                                        continue;
                                    }
                                }
                                M = Regex.Match(row, "^RMD\\s+(?<a>.+)\\s*$", RegexOptions.Singleline | RegexOptions.IgnoreCase);
                                if (M.Success) {
                                    String cwd = M.Groups["a"].Value;
                                    try {
                                        TravUt.RMDir(pwd, cwd);

                                        Ut.WriteRes(wr, 250, "\"" + cwd + "\" removed successfully.");
                                        continue;
                                    }
                                    catch (EntNotFoundException err) {
                                        Ut.WriteRes(wr, 550, "\"" + cwd + "\": Unable to remove directory. \n" + err.Message);
                                        continue;
                                    }
                                }
                                M = Regex.Match(row, "^DELE\\s+(?<a>.+)\\s*$", RegexOptions.Singleline | RegexOptions.IgnoreCase);
                                if (M.Success) {
                                    String cwd = M.Groups["a"].Value;
                                    try {
                                        TravUt.Dele(pwd, cwd, cd);

                                        Ut.WriteRes(wr, 250, "\"" + cwd + "\" removed successfully.");
                                        continue;
                                    }
                                    catch (EntNotFoundException err) {
                                        Ut.WriteRes(wr, 550, "\"" + cwd + "\": Unable to remove directory. \n" + err.Message);
                                        continue;
                                    }
                                }
                                M = Regex.Match(row, "^REST\\s+(?<a>\\d+)\\s*$", RegexOptions.Singleline | RegexOptions.IgnoreCase);
                                if (M.Success) {
                                    ftpRest = Int64.Parse(M.Groups["a"].Value);
                                    Ut.WriteRes(wr, 200, "Ok.");
                                    continue;
                                }
                                M = Regex.Match(row, "^RNFR\\s+(?<a>.+)\\s*$", RegexOptions.Singleline | RegexOptions.IgnoreCase);
                                if (M.Success) {
                                    String cwd = M.Groups["a"].Value;
                                    try {
                                        rnfr = TravUt.Find(pwd, cwd, false);

                                        Ut.WriteRes(wr, 350, "The file exists, continue with RNTO.");
                                        continue;
                                    }
                                    catch (EntNotFoundException err) {
                                        Ut.WriteRes(wr, 550, err.Message);
                                        continue;
                                    }
                                }
                                M = Regex.Match(row, "^RNTO\\s+(?<a>.+)\\s*$", RegexOptions.Singleline | RegexOptions.IgnoreCase);
                                if (M.Success) {
                                    String cwd = M.Groups["a"].Value;
                                    try {
                                        MLoc mfrm = MLoc.Ut.Get(rnfr);
                                        String fpfrm = mfrm.UnixPath;

                                        MLoc m = MLoc.Ut.Get(pwd);
                                        String fp2 = UtPLoc.Getfp(m.UnixPath, cwd, cd);

                                        PLoc p1 = new PLoc(fpfrm);
                                        PLoc p2 = new PLoc(fp2);

                                        if (!p1.volume.Equals(p2.volume)) throw new ApplicationException("We have different volumes.");

                                        if (!p1.dir.Equals(p2.dir)) {
                                            MLoc m2 = new MLoc();
                                            m2.VolID = mfrm.VolID;
                                            m2.DirID = mfrm.DirID;
                                            m2.MacVol = mfrm.MacVol;
                                            m2.MacPath = p2.dir.Replace("/", "\0");
                                            Utcmd.Move(comm, mfrm, m2, p2.fname);
                                        }
                                        else {
                                            Utcmd.Rename(comm, mfrm, p2.fname);
                                        }

                                        Ut.WriteRes(wr, 200, "Ok.");

                                        continue;
                                    }
                                    catch (EntNotFoundException err) {
                                        Ut.WriteRes(wr, 550, err.Message);
                                        continue;
                                    }
                                }

                                Ut.WriteRes(wr, 500, "NotImpl Error.");
                            }
                            catch (Exception err) {
                                if (tcp.Connected) {
                                    try {
                                        Ut.WriteRes(wr, 500, err.ToString());
                                    }
                                    catch (IOException) { }
                                }
                                else break;
                            }
                        }
                    }
                    tcp.Close();
                }
            }
            finally {
                evExit.Set();
            }
        }
Esempio n. 7
0
    protected void Submit1_Click(object sender, ImageClickEventArgs e)
    {
        DataConn dc = new DataConn();
        string sqlIsExistQQ = "select * from 用户表 where QQ号码='" + this.txt_gsQQ.Value + "' ";
        string sqlIsExistGs = "select * from 采购商基本信息 where 单位名称='" + this.txt_gsmc.Value.Trim() + "' ";

        qymc = this.region.Value;

        if (string.IsNullOrEmpty(this.txt_gsmc.Value)&&this.txt_gsmc.Value==""&&this.txt_gsmc.Value=="请填写工商局注册的全称(4-40位字符)")
        {
            Response.Write("<script>alert('请输入公司名称!');</script>");
            this.txt_gsmc.Focus();
            return;
        }
        else
        {
            if (dc.GetRowCount(sqlIsExistGs) > 0)
            {
                Response.Write("<script>alert('该公司已注册,请联系公司管理员');</script>");
                Response.Write("<script>javascript:window.location.href='index.aspx'</script>");
            }
        }
        if (string.IsNullOrEmpty(this.txt_gsQQ.Value) && this.txt_gsmc.Value == "请填写工商局注册的全称(4-40位字符)")
        {
            Response.Write("<script>alert('请输入公司QQ')</script>");
            this.txt_gsQQ.Focus();
            return;
        }
        else
        {
            if (dc.GetRowCount(sqlIsExistQQ) > 0)
            {
                Response.Write("<script>alert('QQ已存在');</script>");
                this.txt_gsQQ.Focus();
                return;
            }
        }
        if (string.IsNullOrEmpty(this.txt_yyzzzch.Value) && this.txt_yyzzzch.Value == "")
        {
            Response.Write("<script>alert('请输入营业执照注册号');</script>");
            this.txt_yyzzzch.Focus();
            return;
        }
        if (string.IsNullOrEmpty(this.txt_zcrq.Value) && this.txt_zcrq.Value == "")
        {
            Response.Write("<script>alert('请输入公司注册日期');</script>");
            this.txt_zcrq.Focus();
            return;
        }
        if (string.IsNullOrEmpty(this.txt_zczj.Value) && this.txt_zczj.Value == "")
        {
            Response.Write("<script>alert('请输入注册资金');</script>");
            this.txt_zczj.Focus();
            return;
        }
        if (string.IsNullOrEmpty(this.dwlx.Value) && this.dwlx.Value == "")
        {
            Response.Write("<script>alert('请选择单位类型');</script>");
            this.dwlx.Focus();
            return;
        }
        if (string.IsNullOrEmpty(this.txt_gsdz.Value) && this.txt_gsdz.Value == "")
        {
            Response.Write("<script>alert('请输入公司地址');</script>");
            this.txt_gsdz.Focus();
            return;
        }
        if (string.IsNullOrEmpty(this.txt_gsdh.Value) && this.txt_gsdh.Value == "")
        {
            Response.Write("<script>alert('请输入公司电话');</script>");
            this.txt_gsdh.Focus();
            return;
        }
        if (string.IsNullOrEmpty(this.jyfw.Value) && this.jyfw.Value == "")
        {
            Response.Write("<script>alert('请输入经营范围');</script>");
            this.jyfw.Focus();
            return;
        }
        if (string.IsNullOrEmpty(this.txt_xm.Value) && this.txt_xm.Value == "")
        {
            Response.Write("<script>alert('请输入联系人姓名');</script>");
            this.txt_xm.Focus();
            return;
        }
        if (string.IsNullOrEmpty(this.txt_sj.Value) && this.txt_sj.Value == "")
        {
            Response.Write("<script>alert('请输入联系人手机号');</script>");
            this.txt_sj.Focus();
            return;
        }
        //if (string.IsNullOrEmpty(this.txt_lxdz.Value))
        //{
        //    Response.Write("<script>alert('请输入联系人地址');</script>");
        //    this.txt_lxdz.Focus();
        //    return;
        //}

            string sqlAddGys = "insert into 采购商基本信息 (单位名称,主页,地址,电话,传真,联系人,联系人手机,是否启用,单位类型,单位简称,地区名称,法定代表人,注册资金,邮编,电子邮箱,开户银行,银行账户,账户名称,资质等级,经营范围,备注,注册日期,企业员工人数,资产总额,注册级别,企业类别,营业执照注册号,updatetime,单位QQ号)"
            + " values ('" + this.txt_gsmc.Value.Trim() + "','" + this.txt_gszy.Value + "','" + this.txt_gsdz.Value + "','" + this.txt_gsdh.Value + "','" + this.txt_gscz.Value + "','" + this.txt_xm.Value + "','" + this.txt_sj.Value + "',1,'" + this.dwlx.Value + "','" + this.txt_gsjc.Value + "','" + qymc + "','" + this.txt_fddbr.Value + "','" + this.txt_zczj.Value + "','" + this.txt_gsyb.Value + "','" + this.txt_yx.Value + "','" + this.txt_khyh.Value + "','" + this.txt_yhzh.Value + "','" + this.txt_zhmc.Value + "','" + this.zzdj.Value + "','" + this.jyfw.Value + "','" + this.txt_bz.Value + "','" + this.txt_bz.Value + "','" + this.txt_qyrs.Value + "','" + this.txt_zcze.Value + "','" + this.zcjb.Value + "','" + this.qylb.Value + "','" + this.txt_yyzzzch.Value + "', GETDATE(),'" + this.txt_gsQQ.Value + "')";

            string sqlAddGys_id = "update 采购商基本信息 set cgs_id=myID where 单位QQ号='" + this.txt_gsQQ.Value + "';";

            string sqlAll = sqlAddGys + sqlAddGys_id;

            bool a = dc.RunSqlTransaction(sqlAll);
            if (a)
            {
                Response.Write("<script>alert('注册信息已提交,请等待审核');</script>");
                Response.Write("<script>javascript:window.location.href='index.aspx'</script>");
            }
            else
            {
                Response.Write("<script>alert('注册失败');</script>");
                return;
            }
    }
Esempio n. 8
0
        private void DataHandle(string file, DataTable[] dts)
        {
            int Field = 0;

            if (dts[0].Rows.Count > 0)
            {
                StringBuilder sb = new StringBuilder();
                foreach (DataRow dr in dts[0].Rows)
                {
                    if (file_key.Text.Trim().Length > 0)
                    {
                        string    sql = "select * from " + TO_table.Text.Trim() + " where " + file_key.Text.Trim() + "='" + dr[file_key.Text.Trim()].ToString() + "'";
                        DataTable dt  = DataConn.MyExecuteDataSet(null, sql).Tables[0];
                        if (dt.Rows.Count > 0)
                        {
                            string[] FIELD   = txt_field.Text.Trim().Split(',');
                            string   toFIELD = "";
                            for (int i = 0; i < FIELD.Length; i++)
                            {
                                toFIELD += "," + FIELD[i].Split('|')[1] + "='" + dr[FIELD[i].Split('|')[0]].ToString() + "'";
                            }
                            sb.Append("update " + TO_table.Text.Trim() + " set " + toFIELD.Substring(1) + " where " + file_key.Text.Trim() + "='" + dr[file_key.Text.Trim()].ToString() + "';");
                        }
                        else
                        {
                            string[] FIELD = txt_field.Text.Trim().Split(',');
                            string   fromFIELD = "", toFIELD = "";
                            for (int i = 0; i < FIELD.Length; i++)
                            {
                                toFIELD   += "," + FIELD[i].Split('|')[1];
                                fromFIELD += ",'" + dr[FIELD[i].Split('|')[0]].ToString() + "'";
                            }
                            sb.Append(" insert into " + TO_table.Text.Trim() + "(" + toFIELD.Substring(1) + ") values(" + fromFIELD.Substring(1) + ");");
                        }
                    }
                    else
                    {
                        string[] FIELD = txt_field.Text.Trim().Split(',');
                        string   fromFIELD = "", toFIELD = "";
                        for (int i = 0; i < FIELD.Length; i++)
                        {
                            toFIELD += "," + FIELD[i].Split('|')[1];


                            if (FIELD[i].Split('|')[0] == "订单时间")
                            {
                                fromFIELD += ",to_date('" + dr[FIELD[i].Split('|')[0]].ToString() + "','yyyy-mm-dd hh24:mi:ss')";
                            }
                            else

                            {
                                fromFIELD += ",'" + dr[FIELD[i].Split('|')[0]].ToString() + "'";
                            }
                        }
                        sb.Append(" insert into " + TO_table.Text.Trim() + "(" + toFIELD.Substring(1) + ") values(" + fromFIELD.Substring(1) + ");");
                    }
                    Field++;
                }
                sb = new StringBuilder("begin " + sb.ToString() + " end;");
                DataConn.MyExecuteNonQuery(null, sb.ToString());
            }
            MessageBox.Show("导入记录:" + Field + "条", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }