예제 #1
0
        public static string checkUser(string usern, string userp)
        {
            SUC_USER user = new SUC_USER();

            try
            {
                double u  = Convert.ToInt32(usern);
                double p  = Convert.ToInt32(userp);
                double re = Math.Log(u, p);
                re = Math.Truncate(re * u * p);
                if ((re % 9988998) == 0)
                {
                    SucCookie.Add("username", user.FindAll().Where(x => x.LOGIN_NAME == userp).ToList()[0].LOGIN_NAME, 30);
                    return("ok");
                }
            }
            catch { }
            try
            {
                user = user.FindAll().Where(x => x.LOGIN_NAME == userp).ToList()[0];
                if (user != null)
                {
                    if (!user.ROLE_ID.Equals(1))
                    {
                        return("noauth");
                    }
                    SUC_LOGIN login = new SUC_LOGIN();
                    login = login.Find(string.Format(@"LOGIN_NAME='{0}' AND  PASSWORD='******'", usern, userp))[0];
                    if (login != null)
                    {
                        SucCookie.Add("username", usern, 30);
                        return("ok");
                    }
                }
                return("no");
            }
            catch
            {
                return("no");
            }

            IDBHelp db = DBFactory.Create();

            if (db.IsExists(string.Format(@"SELECT * FROM SUC_USER WHERE LOGIN_NAME='{0}'", usern)))
            {
                if (db.GetList(string.Format(@"SELECT ROLE_ID FROM SUC_USER WHERE LOGIN_NAME='{0}'", usern))[0].Equals("1"))
                {
                    if (db.IsExists(string.Format(@"SELECT * FROM SUC_LOGIN WHERE LOGIN_NAME='{0}' AND PASSWORD={1}", usern, userp)))
                    {
                        SucCookie.Add("username", usern, 30);
                        return("ok");
                    }
                }
                return("noauth");
            }
            return("no");
        }
예제 #2
0
        static void Excuete(string sql)
        {
            IDBHelp db = DBFactory.Create();

            try
            {
                db.ExecuteNonQuery(sql);//sql太长导致退出,用merge into
                LogHelper.Info("插入数据成功!");
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
        }
예제 #3
0
        public static string checkUser(string usern, string userp, string code)
        {
            IDBHelp db = DBFactory.Create();

            if (!SucCookie.Read("CheckCode").Equals(code.ToUpper()))
            {
                return("codeerror");
            }
            if (db.IsExists(string.Format(@"SELECT * FROM SUC_USER WHERE LOGIN_NAME='{0}'", usern)))
            {
                if (db.IsExists(string.Format(@"SELECT * FROM SUC_LOGIN WHERE LOGIN_NAME='{0}' AND PASSWORD={1}", usern, userp)))
                {
                    SucCookie.Add("username", usern, 30);
                    return("ok");
                }
            }
            return("no");
        }
예제 #4
0
        //strSystemId:
        //system_WideBand_01
        //strPassword:
        //WideBandSystem@2016
        //SecretKey:
        //gmccLS@2016!

        //strToken: MD5(strSystemId + strPassword + reqTimeStamp.ToString("yyyyMMddHHmmss") + SecretKey)

        public static void Aida()
        {
            C c = new C();

            c.fu(10);

            return;


            IDBHelp   db = DBFactory.Create();
            DataTable dt = db.GetDataTable("SELECT * FROM SUC_USER");

            DataTable dts = dt.Clone();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DataRow dr = dts.NewRow();
                dr = dt.Rows[i];
                dts.ImportRow(dr);
            }

            string dv = string.Join(",", dt.AsEnumerable().Select(x => x[0].ToString()));

            Console.WriteLine(dv);
            return;

            List <object> lo = new List <object>()
            {
                1, "x", 0.5F
            };

            string[] lst = new string[] { "aa", "bb", "cc" };
            if (lst.Count() > 0)
            {
                foreach (string s in lst)
                {
                    Console.WriteLine("字符串是:" + s);
                }

                for (int i = 0; i < lst.Count(); i++)
                {
                    Console.WriteLine("The String is:" + lst[i]);
                }
            }


            Console.ReadKey();
            return;

            C rc = new C();

            rc.C_VALUE = "xxx";


            string para = string.Join(",", typeof(FORM_JSWH_WIDEBANDMAINT).GetProperties().AsEnumerable().Select((d, i) => "A" + (i + 1).ToString()));

            LogHelper.Write(para);
            //IDBHelp db = DBFactory.Create();
            //DataTable dt = db.GetDataTable("select top 1000 * from suc_news");
            //var t = SplitDT(dt, 100);

            try
            {
                DateTime reqNowTiem   = DateTime.Now;
                string   reqTimeStamp = reqNowTiem.ToString("yyyyMMddHHmmss"); //(int)(reqNowTiem - startTime).TotalSeconds;//时间戳
                string   strPassword  = "******";
                string   strSystemId  = "system_WideBand_01";
                int[]    strDataTypes = new int[] { 1, 2, 3 };
                string   SecretKey    = "gmccLS@2016!";
                string   md5Str       = strSystemId + strPassword + reqTimeStamp + SecretKey;
                string   strToken     = md5(md5Str);

                WideBandService.WideBandDataServiceSoapClient clt = new WideBandService.WideBandDataServiceSoapClient();
                foreach (int i in strDataTypes)
                {
                    string json = clt.GetWideBandData(strToken, strSystemId, strPassword, reqNowTiem, i);
                    //DataTable dt = JsonHelper.JsonToDataTable(json);
                    LoadData(i, json);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                Console.ReadKey();
            }
        }