Exemplo n.º 1
0
        private void SelectModelUser(FieldValueModel fieldValueWhereModel)
        {
            ModelUser modeluser = bllUser.GetModel(fieldValueWhereModel);

            if (CheckData.IsObjectNull(modeluser))
            {
                Print.WriteLine("没有查到 id = {0} 的数据", fieldValueWhereModel.Value);
            }
            else
            {
                Print.WriteLine("id: " + modeluser.id);
                Print.WriteLine("RealName: " + modeluser.RealName);
                Print.WriteLine("Sex: " + modeluser.Sex.GetName());
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Microsoft SQL Server SQL 操作符解析器
        /// </summary>
        public static string MSQLServer_OperChar_Parser(FieldValueModel FVm)
        {
            if (CheckData.IsObjectNull(FVm))
            {
                return(string.Empty);
            }
            switch (FVm.KeyChar)
            {
            case DataChar.OperChar.EQUAL:
                return(CreateSQL.WhereEqual(FVm.Name, FVm.Value));

            case DataChar.OperChar.EQUAL_NOT:
                return(CreateSQL.WhereEqualNot(FVm.Name, FVm.Value));

            case DataChar.OperChar.LIKE:
                return(CreateSQL.WhereLike(FVm.Name, FVm.Value));

            case DataChar.OperChar.IN:
                return(CreateSQL.WhereIn(FVm.Name, ConvertTool.ToArrayList(FVm.Value, DataChar.ARRAYLIST_INTERVAL_CHAR)));

            case DataChar.OperChar.IN_NOT:
                return(CreateSQL.WhereInNot(FVm.Name, ConvertTool.ToArrayList(FVm.Value, DataChar.ARRAYLIST_INTERVAL_CHAR)));

            case DataChar.OperChar.BigTHAN:
                return(CreateSQL.WhereBigThan(FVm.Name, FVm.Value));

            case DataChar.OperChar.BigTHAN_EQUAL:
                return(CreateSQL.WhereBigThanEqual(FVm.Name, FVm.Value));

            case DataChar.OperChar.SmallTHAN:
                return(CreateSQL.WhereSmallThan(FVm.Name, FVm.Value));

            case DataChar.OperChar.SmallTHAN_EQUAL:
                return(CreateSQL.WhereSmallThanEqual(FVm.Name, FVm.Value));

            default:
                FVm.SetKeyChar(DataChar.OperChar.EQUAL);
                return(MSQLServer_OperChar_Parser(FVm));
            }
        }
Exemplo n.º 3
0
        public void CheckModelIsCanUse()
        {
            FieldValueModel fvmodel_1 = new FieldValueModel()
            {
                Name  = "wwww",
                Value = "5468"
            };

            Print.WriteLine("FV 两个给: " + FieldValueModel.CheckIsCanUse(fvmodel_1).ToString());
            FieldValueModel fvmodel_2 = new FieldValueModel()
            {
                Value = "5468"
            };

            Print.WriteLine("FV 只给Value: " + FieldValueModel.CheckIsCanUse(fvmodel_2).ToString());
            FieldValueModel fvmodel_3 = new FieldValueModel()
            {
                Name = "wwww",
            };

            Print.WriteLine("FV 只给Name: " + FieldValueModel.CheckIsCanUse(fvmodel_3).ToString());



            WhereModel model_1 = null;

            Print.WriteLine("1: 赋值Null: " + WhereModel.CheckIsCanUse(model_1).ToString());

            WhereModel model_2 = new WhereModel();

            Print.WriteLine("2: 只new: " + WhereModel.CheckIsCanUse(model_2).ToString());

            WhereModel model_3 = new WhereModel()
            {
                Wheres = new WhereModel[] { model_2 },
            };

            Print.WriteLine("3: 只给了Where 但给的是 model_2: " + WhereModel.CheckIsCanUse(model_3).ToString());

            WhereModel model_4 = new WhereModel()
            {
                FielVals = new FieldValueModel[] { fvmodel_2 },
            };

            Print.WriteLine("4: 只给了FielVals, 但 fvmodel_2 没有name: " + WhereModel.CheckIsCanUse(model_4).ToString());

            WhereModel model_5 = new WhereModel()
            {
                FielVals = new FieldValueModel[] { fvmodel_3 },
            };

            Print.WriteLine("5: 只给了FielVals, 并且 fvmodel_3 有name: " + WhereModel.CheckIsCanUse(model_5).ToString());


            WhereModel model_6 = new WhereModel()
            {
                Wheres = new WhereModel[] { model_5 }
            };

            Print.WriteLine("6: 只给了Wheres, 并且 给的是 model_5: " + WhereModel.CheckIsCanUse(model_6).ToString());



            FieldOrderModel fomodel_1 = new FieldOrderModel()
            {
                Name  = "wwww",
                IsAsc = true,
            };

            Print.WriteLine("FO 两个给: " + FieldOrderModel.CheckIsCanUse(fomodel_1).ToString());
            FieldOrderModel fomodel_2 = new FieldOrderModel()
            {
                IsAsc = false,
            };

            Print.WriteLine("FO 只给IsAsc: " + FieldOrderModel.CheckIsCanUse(fomodel_2).ToString());
            FieldOrderModel fomodel_3 = new FieldOrderModel()
            {
                Name = "wwww",
            };

            Print.WriteLine("FO 只给Name: " + FieldOrderModel.CheckIsCanUse(fomodel_3).ToString());
        }