Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DBManipulator dhelper = DBConfigurator.OpenDBManipulator();


            //List<CModel> models1 = dhelper.GetModels();


            //ModelFilter filter = new ModelFilter(typeof(C_ACCOUNT));
            //filter.AndParam("ROW_ID", 40);

            //CModel jsonmode = dhelper.GetModel(filter);


            //C_ACCOUNT s = JsonConverter.CModelToModel<C_ACCOUNT>(jsonmode);

            //string getdata = jsonmode.GetValue("USER_NAME");


            //C_ACCOUNT c = dhelper.GetModel<C_ACCOUNT>(filter);   //实体获取日期时间出错了,导致转换json数据的日期格式错误

            //c.CREATE_DATE = DateTime.Now;
            //c.DELETE_DATE = DateTime.Now;
            //c.UPDATE_DATE = DateTime.Now;



            //List<C_ACCOUNT> models2 = dhelper.GetModels<C_ACCOUNT>(filter);

            //CModel jsonmodel = dhelper.GetModel(filter);

            //string json1 = JsonConverter.CModelToJson(jsonmodel);

            //string json2 = JsonConverter.JsonSerializer(c);

            //CModel md = new CModel();

            //md = JsonConverter.JsonToCModel(json2);

            ////dhelper.DeleteModel(filter);

            ////dhelper.DeleteModels(models2);

            ////filter.AndParam("USER_ID", "C22");

            //ModelFilter filter1 = new ModelFilter(typeof(C_ACCOUNT));

            ////filter1.AndParam("ROW_ID", 1);

            //C_ACCOUNT model = dhelper.GetModel<C_ACCOUNT>(filter1);


            //dhelper.InsertModel(model);



            //List<C_ACCOUNT> c_accounts = dhelper.GetModels<C_ACCOUNT>();


            //dhelper.InsertModels(c_accounts);


            //ModelFilter filter2 = new ModelFilter("C_ACCOUNT");


            //CModel cm = dhelper.GetModel(filter1);



            ////model.SEX = "女";

            //cm["SEX"] = "女";

            //dhelper.UpdateModel(cm);

            CModel modela = new CModel(typeof(C_ACCOUNT));

            modela["USER_ID"]     = "C21";
            modela["USER_NAME"]   = "詹姆斯";
            modela["USER_PWD"]    = "15768091384";
            modela["SEX"]         = "男";
            modela["AGE"]         = 34;
            modela["PHONE"]       = "13232138056";
            modela["CREATE_DATE"] = DateTime.Now;
            modela["UPDATE_DATE"] = DateTime.Now;
            modela["DELETE_DATE"] = DateTime.Now;

            dhelper.InsertModel(modela);



            List <CModel> modess = new List <CModel>();

            modela                = new CModel(typeof(C_ACCOUNT));
            modela["USER_ID"]     = "C22";
            modela["USER_NAME"]   = "詹姆斯";
            modela["USER_PWD"]    = "15768091384";
            modela["SEX"]         = "男";
            modela["AGE"]         = 34;
            modela["PHONE"]       = "13232138056";
            modela["CREATE_DATE"] = DateTime.Now;
            modela["UPDATE_DATE"] = DateTime.Now;
            modela["DELETE_DATE"] = DateTime.Now;

            modess.Add(modela);


            modela                = new CModel(typeof(C_ACCOUNT));
            modela["USER_ID"]     = "C23";
            modela["USER_NAME"]   = "詹姆斯";
            modela["USER_PWD"]    = "15768091384";
            modela["SEX"]         = "男";
            modela["AGE"]         = 34;
            modela["PHONE"]       = "13232138056";
            modela["CREATE_DATE"] = DateTime.Now;
            modela["UPDATE_DATE"] = DateTime.Now;
            modela["DELETE_DATE"] = DateTime.Now;

            modess.Add(modela);



            modela                = new CModel(typeof(C_ACCOUNT));
            modela["USER_ID"]     = "C24";
            modela["USER_NAME"]   = "詹姆斯";
            modela["USER_PWD"]    = "15768091384";
            modela["SEX"]         = "男";
            modela["AGE"]         = 34;
            modela["PHONE"]       = "13232138056";
            modela["CREATE_DATE"] = DateTime.Now;
            modela["UPDATE_DATE"] = DateTime.Now;
            modela["DELETE_DATE"] = DateTime.Now;

            modess.Add(modela);


            modela                = new CModel(typeof(C_ACCOUNT));
            modela["USER_ID"]     = "C25";
            modela["USER_NAME"]   = "詹姆斯";
            modela["USER_PWD"]    = "15768091384";
            modela["SEX"]         = "男";
            modela["AGE"]         = 34;
            modela["PHONE"]       = "13232138056";
            modela["CREATE_DATE"] = DateTime.Now;
            modela["UPDATE_DATE"] = DateTime.Now;
            modela["DELETE_DATE"] = DateTime.Now;

            modess.Add(modela);


            modela                = new CModel("C_ACCOUNT");
            modela["USER_ID"]     = "C26";
            modela["USER_NAME"]   = "詹姆斯";
            modela["USER_PWD"]    = "15768091384";
            modela["SEX"]         = "男";
            modela["AGE"]         = 34;
            modela["PHONE"]       = "13232138056";
            modela["CREATE_DATE"] = DateTime.Now;
            modela["UPDATE_DATE"] = DateTime.Now;
            modela["DELETE_DATE"] = DateTime.Now;

            modess.Add(modela);

            dhelper.InsertModels(modess);
        }
        /// <summary>
        /// 登录
        /// </summary>
        public HttpResult Login()
        {
            string name = HttpRequestData.FormString("user_name");
            string pwd  = HttpRequestData.Form <string>("user_pwd");

            DBManipulator manipulator = DBConfigurator.OpenDBManipulator();

            ModelFilter filter = new ModelFilter(typeof(C_ACCOUNT));

            filter.PageQuery = new PagingQuery(5, 0);


            //int count = manipulator.SelectCount(typeof(C_ACCOUNT));


            //filter.AndParam("USER_NAME", name);
            //filter.AndParam("USER_PWD", pwd);
            //filter.PageQuery = new PagingQuery() { PageCount = 5, PageIndex = 0 };

            //CModel cm = new CModel(typeof(C_ACCOUNT));


            //C_ACCOUNT xincm = manipulator.GetModelByKey<C_ACCOUNT>(43);


            //DateTime st = xincm.CREATE_DATE;

            List <CModel> cs = manipulator.GetModels(filter);

            //C_ACCOUNT model = manipulator.GetModel<C_ACCOUNT>(filter);


            //string c_json1 = JsonConverter.JsonSerializer<C_ACCOUNT>(model);

            //C_ACCOUNT c_json2 = JsonConverter.JsonDeserialize<C_ACCOUNT>(c_json1);


            //CModel cmodel = manipulator.GetModel(filter);

            //string c_json3 = JsonConverter.CModelToJson(cmodel);

            //CModel c_json4 = JsonConverter.JsonToCModel(c_json3);


            //C_ACCOUNT dsa = JsonConverter.CModelToModel<C_ACCOUNT>(c_json4);

            //CModel cmode = manipulator.GetModelByKey("C_ACCOUNT", 43);


            //CModel cmodel = manipulator.GetModel(filter);

            //CModel col = new CModel();
            //col["user"] = "******";
            //col["pwd"] = "123";

            //List<CModel> firends = new List<CModel>();
            //firends.Add(cmodel);
            //firends.Add(cmodel);
            //col["firends"] = firends;

            //List<string> familys = new List<string>();
            //familys.Add("aa");
            //familys.Add("bb");
            //familys.Add("dd");
            //col["familys"] = familys;

            //CModel col1 = new CModel();
            //col1["user"] = "******";
            //col1["pwd"] = "123";
            //col1["firends"] = firends;
            //col1["familys"] = familys;
            //col1["col"] = col;
            //col1["col1"] = col;

            //CModelList<C_ACCOUNT> models = new CModelList<C_ACCOUNT>();

            //foreach (var item in models)
            //{

            //}


            return(WebResponse.Result(""));
        }