Example #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddDbContext <RestApiContext>(options =>
            {
                //options.UseInMemoryDatabase("Test");
                options.UseSqlServer(Configuration.GetConnectionString("RestApiTest"));
            });

            // Register the Swagger generator, defining 1 or more Swagger documents
            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new Info {
                    Title = "My API", Version = "v1"
                });
                // Set the comments path for the Swagger JSON and UI.
                var xmlFile = $"Sdt.Practice.xml";
                var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
                c.IncludeXmlComments(xmlPath);
            });

            services.AddAutoMapper();

            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

            services.Configure <MvcOptions>(mvcOptions => { mvcOptions.Filters.Add(new ApiExceptionFilter()); });

            ApplicationModule.Register(services);
            DataModule.Register(services);
        }
Example #2
0
        public static IUnityContainer RegisterTypes(IUnityContainerWrapper containerWrapper)
        {
            DataModule.Initialize(containerWrapper);
            ApplicationServiceModule.Initialize(containerWrapper);

            return(containerWrapper.Container);
        }
Example #3
0
        private void getEstacionAutoAbasto()
        {
            Params.Clear();
            Data.DataModule.ParamByName(Params, "Datos", DataModule.Seguridad.Attributes[0].ToString());
            spCatEstacionDS ds = new spCatEstacionDS();

            DataModule.FillDataSet(ds, "spCatEstacion", Params.ToArray());
            DataTable dt = new DataTable();

            dt = ds.Tables["spCatEstacion"];
            IEnumerable <DataRow> query = from dts in dt.AsEnumerable() select dts;

            foreach (DataRow dr in query)
            {
                if (dr.Field <bool>("AutoAbasto"))
                {
                    ASPxChkAutoAbasto.Checked = dr.Field <bool>("AutoAbasto");
                    getTransportistaVehiculo(dr.Field <int>("TransportistaID"));
                    mostrarCampos(true);
                }
                else
                {
                    ASPxChkAutoAbasto.Checked = dr.Field <bool>("AutoAbasto");
                    mostrarCampos(false);
                }
            }
        }
Example #4
0
        private void FillComboEstacion()
        {
            List <ValuesCombo> lista = new List <ValuesCombo>();
            spCatEstacionDS    ds    = new spCatEstacionDS();

            DataModule.FillDataSet(ds, "spCatEstacion", null);
            DataTable dt = new DataTable();

            dt = ds.Tables["spCatEstacion"];

            IEnumerable <DataRow> query = from dts in dt.AsEnumerable() select dts;

            foreach (DataRow dr in query)
            {
                lista.Add(new ValuesCombo()
                {
                    id = dr.Field <int>("EstacionID").ToString(), nombre = dr.Field <int>("EstacionID").ToString() + "-" + dr.Field <string>("Nombre")
                });
            }

            cmbLimitarEstacion.DataSource = lista;
            cmbLimitarEstacion.ValueField = "id";
            cmbLimitarEstacion.TextField  = "nombre";
            cmbLimitarEstacion.DataBind();
            chProductos.Items.Add("PREMIUM");
            chProductos.Items.Add("MAGNA");
            chProductos.Items.Add("DIESEL");
            chProductos.Items.Add("OTRO");
        }
Example #5
0
        private void getProductos()
        {
            try
            {
                spCatProductoDS prd = new spCatProductoDS();
                Params.Clear();
                Data.DataModule.ParamByName(Params, "Datos", "");
                DataModule.FillDataSet(prd, "spCatProducto", Params.ToArray());
                DataTable dt = new DataTable();
                dt = prd.Tables["spCatProducto"];
                IEnumerable <DataRow> query = from dts in dt.AsEnumerable() select dts;
                foreach (DataRow dr in query)
                {
                    switch (dr.Field <int>("ProductoID"))
                    {
                    case 1:
                        lbl87oct.Text = "Producto: " + dr.Field <string>("Descripcion") + " Precio: $" + dr.Field <double>("Precio").ToString();
                        break;

                    case 2:
                        lbl92oct.Text = "Producto: " + dr.Field <string>("Descripcion") + " Precio: $" + dr.Field <double>("Precio").ToString();
                        break;

                    case 3:
                        lbldiesel.Text = "Producto: " + dr.Field <string>("Descripcion") + " Precio: $" + dr.Field <double>("Precio").ToString();
                        break;
                    }
                }
                lblFecha.Text = "Precio de los combustibles a la fecha: " + DateTime.Today.ToString();
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Example #6
0
        /// <summary>
        /// 下载一门课程 包括显示进度条等界面操作
        /// </summary>
        /// <param name="kkno"></param>
        ///
        public static void DownloadOneCourse(long kkno)
        {
            var fDataModule = new DataModule();                        //新建一个datamodule

            var jsandkkview = from c in fDataModule.GetJsandkkviewro() //传进来kkno 将对应课程的信息拉出来
                              where c.KKNO == kkno
                              select c;

            var kkrecord = jsandkkview.First();                               //取第一条记录

            var courseBriefcase = BriefcaseControl.CreateBriefcase(kkrecord); //根据开课表的一行记录建立briefcase

            if (courseBriefcase == null)
            {
                return;
            }

            _waitform = new WaitForm("初始化下载进程");

            new Thread(() => DownloadData(kkno, courseBriefcase)).Start();    //将费时的操作放在一个线程中



            _waitform.ShowDialog();

            MsgBox.ShowMsgBoxDialog("选定的课程下载完毕.");
        }
Example #7
0
        private void LlenarDetallePedido(int PedidoID)
        {
            try
            {
                DataSet       cdsDatos      = detallePedidoDS1;
                BindingSource cbsDataSource = spDetallePedidoBindingSource;
                string        cDataSetDatos = "spDetallePedido";
                cdsDatos.Clear();

                //Lenamos el DS de Categorias

                Params.Clear();

                DataModule.ParamByName(Params, "PedidoID", PedidoID);
                DataModule.FillDataSet(cdsDatos, cDataSetDatos, Params.ToArray());
                gvDetallePedido.BestFitColumns(false);
                //if (gvDetallePedido.DataRowCount > 0)
                //{
                //    IEnumerable<DataRow> query = from dts in detallePedidoDS1.Tables["spDetallePedido"].AsEnumerable() select dts;
                //    foreach (DataRow dr in query)
                //    {
                //        CalcularTotales(dr.Field<int>("ProductoID"));
                //    }
                //    gvDetallePedido.UpdateTotalSummary();

                //}
                gvDetallePedido.UpdateTotalSummary();
                ButtonGenerarRecibo();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void SaveSettings(object sender, RoutedEventArgs e)
        {
            try
            {
                string[] pairs = Settings.Text.Split(',');

                Dictionary <string, string> temp = new Dictionary <string, string>();

                foreach (string pair in pairs)
                {
                    string data = pair.Trim();
                    string key = data.Split(':')[0], value = data.Split(':')[1];
                    temp[key] = value;
                }

                foreach (var data in temp)
                {
                    DataModule.data[data.Key] = data.Value;
                }

                MessageBox.Show("Настройки сохранены", "Успешно");
                DataModule.Save();
                Settings.Text = "";
            }
            catch (Exception)
            {
                MessageBox.Show("Неверный формат", "Ошибка");
            }
        }
Example #9
0
 public static IServiceCollection ConfigureContainer(this IServiceCollection services, IConfiguration configuration)
 {
     DataModule.Register(services, configuration);
     DomainModule.Register(services);
     InfrastructureModule.Register(services, configuration);
     return(services);
 }
        //显示隐藏的学生列表
        //选择标签页的时候弹出toast提示
        //标签页侧边栏需要背景
        public MainForm( )
        {
            SplashForm.ShowSplashForm();

            var d = DateTime.Now;

            InitializeComponent();

            _rollCalling = false;                    //标记是否正在进行考勤工作

            _fDataModule = new DataModule();         //datamodule 用于查看数据(好像没什么用耶)。

            dp_ResetMainForm();                      // 重置窗口的显示

            dp_BindDataSourceForFirstClassListBox(); // 为第一个标签页中的左上角ListBox绑定数据源

            dp_BindDataSourceForThirdClassListBox(); //为第三个标签页中的左上角Listbox绑定数据源

            Settings.Default.UserId = "";            // 清空密码用户名信息

            Settings.Default.Password = "";

            Settings.Default.Save();  // 保存

            dp_DisableRollCallButtons();

            mainPageView.SelectedPage = downloadDataPage;

            SplashForm.CloseSplashForm();

            radLabelElement1.Text = System.Reflection.Assembly.GetExecutingAssembly().ToString();
        }
        public static void InitIoC(IServiceCollection services, string connectionString)
        {
            //init ioc module for DAL
            DataModule.InitIoc(services, connectionString);

            services.AddTransient <IBaseRepository <int, Account>, Repository <int, Account> >();
            services.AddTransient <IBaseRepository <int, TransactionHistory>, Repository <int, TransactionHistory> >();
        }
Example #12
0
        private DataTable fillComboDataset(DataSet ds, string dstring)
        {
            DataTable dt = new DataTable();

            DataModule.FillDataSet(ds, dstring, null);
            dt = ds.Tables[dstring];
            return(dt);
        }
Example #13
0
        private void button8_Click(object sender, EventArgs e)
        {
            // Dit is het toppunt van SQL Injection!
            // Don't try this at home
            var dbc = new DataModule();

            dataGridView1.DataSource = dbc.GetData(textBox1.Text);
        }
Example #14
0
        public Rates CalculateRates(DataModule tariff, string originZip, string classCode, string discount, string floorMin, string[] destinationZips)
        {
            //Calcualate rates
            string[] WEIGHT_RANGES = { "1", "501", "1001", "2001", "5001", "10001", "20001" };
            Rates    rates         = new Rates();

            try {
                for (int i = 0; i < destinationZips.Length; i++)
                {
                    LTLRateShipmentRequest[] requests = new LTLRateShipmentRequest[WEIGHT_RANGES.Length];
                    for (int j = 0; j < WEIGHT_RANGES.Length; j++)
                    {
                        LTLRateShipmentRequest request = new LTLRateShipmentRequest();
                        request.tariffName               = tariff != null ? tariff.tariffName : "";
                        request.shipmentDateCCYYMMDD     = tariff != null ? tariff.effectiveDate : "";
                        request.originPostalCode         = originZip;
                        request.destinationPostalCode    = destinationZips[i];
                        request.destinationCountry       = request.originCountry = "USA";
                        request.useSingleShipmentCharges = "N";
                        request.rateAdjustmentFactor     = "1.0000";
                        request.useDiscounts             = "Y";
                        request.discountApplication      = "R";     //Apply discount to R=Rates, C=Charges
                        request.mcDiscount               = discount;
                        request.userMinimumChargeFloor   = floorMin;
                        request.LTL_Surcharge            = "0";
                        request.TL_Surcharge             = "0";
                        request.surchargeApplication     = "G";     //Apply surcharge to G=Gross, N=Net

                        LTLRequestDetail detail = new LTLRequestDetail();
                        detail.nmfcClass = classCode;
                        detail.weight    = WEIGHT_RANGES[j].ToString();
                        request.details  = new LTLRequestDetail[] { detail };
                        requests[j]      = request;
                    }
                    LTLRateShipmentResponse[] responses = new RateWareGateway().CalculateLTLRates(requests);

                    ////Take lesser of min charge from rate ware or set floor min
                    //double minCharge = Convert.ToDouble(responses[0].minimumCharge);
                    //if (minCharge < floorMin) minCharge = floorMin;

                    //Add rates to the grid
                    RateQuoteDataset.RateTableRow _rate = new RateQuoteDataset().RateTable.NewRateTableRow();
                    _rate.OrgZip    = responses[0].originPostalCode;
                    _rate.DestZip   = responses[0].destinationPostalCode.Substring(0, 3);
                    _rate.MinCharge = responses[0].minimumCharge;
                    _rate.Rate1     = responses[0].details[0].rate;
                    _rate.Rate501   = responses[1].details[0].rate;
                    _rate.Rate1001  = responses[2].details[0].rate;
                    _rate.Rate2001  = responses[3].details[0].rate;
                    _rate.Rate5001  = responses[4].details[0].rate;
                    _rate.Rate10001 = responses[5].details[0].rate;
                    _rate.Rate20001 = responses[6].details[0].rate;
                    rates.Add(new Rate(_rate));
                }
            }
            catch (Exception ex) { throw new FaultException <RateQuoteFault>(new RateQuoteFault(ex.Message), "Service Error"); }
            return(rates);
        }
Example #15
0
        private void getSaldo(string EstacionID)
        {
            Params.Clear();
            Data.DataModule.ParamByName(Params, "Datos", EstacionID);
            DataModule.FillDataSet(saldo, "spCatSaldo", Params.ToArray());

            bgvSaldo.DataSource = saldo;
            bgvSaldo.DataBind();
        }
Example #16
0
 public Modules()
 {
     SaveModule       = new SaveModule(this, "UserData.json");
     DataModule       = new DataModule(this);
     PunishmentModule = new PunishmentModule(this);
     TokenModule      = new TokenModule(this);
     UserModule       = new UserModule(this);
     XPModule         = new XPModule(this);
 }
Example #17
0
        private DataTable fillComboDataset(DataSet ds, string dstring)
        {
            DataTable dt = new DataTable();

            Params.Clear();
            Data.DataModule.ParamByName(Params, "Datos", DataModule.Seguridad.UserID);
            DataModule.FillDataSet(ds, dstring, Params.ToArray());
            dt = ds.Tables[dstring];
            return(dt);
        }
Example #18
0
        static void Main(string[] args)
        {
            var nodeConfig = NodeConfiguration.GetDefault();


            using (var core = new CrossStitchCore(nodeConfig))
            {
                var httpServer = new NancyHttpModule(core.MessageBus);
                core.AddModule(httpServer);

                var dataStorage = new InMemoryDataStorage();
                var data        = new DataModule(core.MessageBus, dataStorage);
                core.AddModule(data);

                var stitchesConfiguration = StitchesConfiguration.GetDefault();
                var stitches = new StitchesModule(core, stitchesConfiguration);
                core.AddModule(stitches);

                var groupName = new StitchGroupName("HttpTest", "Stitch", "1");

                var packageFile = new PackageFile
                {
                    Id        = groupName.ToString(),
                    GroupName = groupName,
                    Adaptor   = new InstanceAdaptorDetails
                    {
                        Type       = AdaptorType.ProcessV1,
                        Parameters = new Dictionary <string, string>
                        {
                            { Parameters.RunningDirectory, "." },
                            { Parameters.ExecutableName, "HttpTest.Stitch.exe" },
                            //{ Parameters.ArgumentsFormat, "{ExecutableName} {CoreArgs} -- {CustomArgs}" },
                            //{ Parameters.ExecutableFormat, "dotnet" },
                        }
                    },
                };
                dataStorage.Save(packageFile, true);
                var stitch = new StitchInstance
                {
                    Name      = "HttpTest.Stitch",
                    GroupName = groupName,

                    State = InstanceStateType.Running
                };
                dataStorage.Save(stitch, true);

                var logger = new LoggerFactory().AddConsole(LogLevel.Debug).CreateLogger <Program>();
                core.AddModule(new LoggingModule(core, logger));

                core.Log.LogInformation("Started");
                core.Start();
                Console.ReadKey();
                core.Stop();
            }
        }
Example #19
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            NinjectModule dataModule    = new DataModule();
            NinjectModule serviceModule = ServiceModule.GetInstance("DefaultConnection");
            var           kernel        = new StandardKernel(dataModule, serviceModule);

            DependencyResolver.SetResolver(new NinjectDependencyResolver(kernel));
        }
Example #20
0
        private void ComfigureModules(IServiceCollection serviceCollection)
        {
            serviceCollection.AddDbContext <AppDbContext>(options =>
                                                          options.UseSqlServer(this.Configuration.GetConnectionString("DefaultConnection")));

            serviceCollection.AddTransient <IConfigurationService, ConfigurationService>();

            DataModule.ConfigureServices(serviceCollection);
            InfrastractureModule.ConfigureServices(serviceCollection);
            ApplicationModule.ConfigureServices(serviceCollection);
        }
Example #21
0
        private void button7_Click(object sender, EventArgs e)
        {
            var     dbc = new DataModule();
            DataRow row = dbc.GetProductById(1036);

            // Toon de naam en de listprice!
            MessageBox.Show(string.Format("De prijs van {0} is $ {1}.", row["Name"], row["ListPrice"]));

            // Zonder Entity Framework is alles weakly typed.
            // Er is geen intellisense dus veldnamen moet je zelf weten
        }
Example #22
0
        private void getDetallePedido(string pedidoid)
        {
            Params.Clear();
            Data.DataModule.ParamByName(Params, "Pedido", pedidoid);
            spCatDetallePedidoDS ds = new spCatDetallePedidoDS();

            DataModule.FillDataSet(ds, "spCatDetallePedido", Params.ToArray());

            GridDetallePedido.DataSource = ds;
            GridDetallePedido.DataBind();
        }
Example #23
0
        private void getPedido(string UsuarioID)
        {
            Params.Clear();
            Data.DataModule.ParamByName(Params, "Datos", UsuarioID);
            spCatPedidoDS ds = new spCatPedidoDS();

            DataModule.FillDataSet(ds, "spCatPedido", Params.ToArray());

            gvPedido.DataSource = ds;
            gvPedido.DataBind();
        }
Example #24
0
 private static void InitializeContainer(Container container)
 {
     AppServiceModule.Register(container);
     ServiceModule.Register(container);
     RepositoryModule.Register(container);
     DataModule.Register(container);
     ValidatorModule.Register(container);
     //FluentValidationModelValidatorProvider.Configure(GlobalConfiguration.Configuration, provider =>
     //{
     //    provider.ValidatorFactory = new ApplicationValidatorFactory(container);
     //});
 }
Example #25
0
        /// <summary>
        /// Starts the execution of the bot.
        /// </summary>
        public async Task Start()
        {
            _client = new DiscordSocketClient();

            Data = new DataModule();
            Data.InitializeDataFiles();

            Commands = new CommandHandler(Data, Configuration["prefix"]);

            _leaderboardNavigator = new EventPointCommand.LeaderboardNavigator(Data.EventPoints, Data.Settings);

            _services = new ServiceCollection()

                        // Add the command service
                        .AddSingleton(Commands.Service)

                        // Add the singletons for the databases
                        .AddSingleton(Data.EventPoints)
                        .AddSingleton(Data.Settings)
                        .AddSingleton(Data.Statistics)
                        .AddSingleton(Data.CustomCommands)
                        .AddSingleton(Data.Cooldowns)
                        .AddSingleton(Data.Rules)
                        .AddSingleton(Data.UnityDocs)
                        .AddSingleton(Data.Mutes)
                        .AddSingleton(Data.Bans)

                        .AddSingleton(_leaderboardNavigator)

                        // Finally, build the provider
                        .BuildServiceProvider();

            UserHelper.Data = Data;

            Commands.ServiceProvider = _services;
            await Commands.InstallCommands(_client);

            RegisterMuteOnJoin();
            RegisterMassiveCodeblockHandle();
            RegisterMentionMessage();
            RegisterStaffPingLogging();
            RegisterLeaderboardNavigationHandle();

            _ = PeriodicCheckMute(new TimeSpan(TimeSpan.TicksPerMinute * 2), System.Threading.CancellationToken.None);
            _ = PeriodicCheckBan(new TimeSpan(TimeSpan.TicksPerMinute * 3), System.Threading.CancellationToken.None);

            await _client.LoginAsync(TokenType.Bot, Configuration["token"]);

            await _client.SetGameAsync($"{ Configuration["prefix"] }help");

            await _client.StartAsync();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Params.Clear();
            Data.DataModule.ParamByName(Params, "ClienteID", DataModule.Seguridad.UserID);
            spVehiculoDS ds = new spVehiculoDS();

            DataModule.FillDataSet(ds, "spVehiculo", Params.ToArray());
            DataTable dt = new DataTable();

            dt = ds.Tables["spVehiculo"];
            bgvVehiculo.DataSource = dt;
            bgvVehiculo.DataBind();
        }
Example #27
0
        static void Main(string[] args)
        {
            var nodeConfig = NodeConfiguration.GetDefault();

            using (var core = new CrossStitchCore(nodeConfig))
            {
                var httpServer = new NancyHttpModule(core.MessageBus);
                core.AddModule(httpServer);

                var dataStorage = new InMemoryDataStorage();
                var data        = new DataModule(core.MessageBus, dataStorage);
                core.AddModule(data);

                var stitchesConfiguration = StitchesConfiguration.GetDefault();
                var stitches = new StitchesModule(core, stitchesConfiguration);
                core.AddModule(stitches);

                var groupName = new StitchGroupName("HttpTest", "Stitch", "1");

                var packageFile = new PackageFile
                {
                    Id        = groupName.ToString(),
                    GroupName = groupName,
                    Adaptor   = new InstanceAdaptorDetails
                    {
                        Type       = AdaptorType.ProcessV1,
                        Parameters = new Dictionary <string, string>
                        {
                            { CrossStitch.Stitch.ProcessV1.Parameters.DirectoryPath, "." },
                            { CrossStitch.Stitch.ProcessV1.Parameters.ExecutableName, "HttpTest.Stitch.exe" }
                        }
                    },
                };
                dataStorage.Save(packageFile, true);
                var stitch = new StitchInstance
                {
                    Name      = "HttpTest.Stitch",
                    GroupName = groupName,

                    State = InstanceStateType.Running,
                    LastHeartbeatReceived = 0
                };
                dataStorage.Save(stitch, true);

                core.AddModule(new LoggingModule(core, Common.Logging.LogManager.GetLogger("CrossStitch")));

                core.Start();
                Console.ReadKey();
                core.Stop();
            }
        }
        public void ModuleRegistered_ServicesRegistered()
        {
            var dataModule = new DataModule(() => string.Empty);
            var builder    = new ContainerBuilder();

            builder.RegisterModule(dataModule);
            var container = builder.Build();

            var contextService          = container.Resolve <ContextService>();
            var ambientDbContextLocator = container.Resolve <IAmbientDbContextLocator>();

            Assert.That(contextService, Is.Not.Null);
            Assert.That(ambientDbContextLocator, Is.Not.Null);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Params.Clear();
            Data.DataModule.ParamByName(Params, "Datos", DataModule.Seguridad.UserID);
            spCatPedidoDS ds = new spCatPedidoDS();

            DataModule.FillDataSet(ds, "spCatPedido", Params.ToArray());
            DataTable dt = new DataTable();

            dt = ds.Tables[0];

            gvPedidos.DataSource = dt.Select("StatusID=" + 1 + " or StatusID =" + 3);
            gvPedidos.DataBind();
        }
 public LoginForm(DataModule fDataModule, string username = "******")
 {
     InitializeComponent();
     _fDataModule = fDataModule;
     if ("NotSpecificatedYet" != username)
     {
         tboxUsername.Text    = username;
         tboxUsername.Enabled = false;
     }
     else
     {
         tboxUsername.Enabled = true;
     }
 }
Example #31
0
        public void InsertUserInfo(DataModule.UserInfo userInfo)
        {
            string sql = "INSERT INTO Tb_UserInfo (UserID, Email, NickName, Sex, BirthDay, Age) values (@UserID, @Email, @NickName, @Sex, @BirthDay, @Age)";
            SqlParameter[] parms = SqlHelperParameterCache.GetCachedParameterSet(sql);
            if (parms == null)
            {
                parms = new SqlParameter[] {
                    new SqlParameter("@UserID",SqlDbType.BigInt),
                    new SqlParameter("@Email",SqlDbType.NVarChar,50),
                    new SqlParameter("@NickName",SqlDbType.NVarChar,20),
                    new SqlParameter("@Sex",SqlDbType.SmallInt),
                    new SqlParameter("@BirthDay",SqlDbType.Date),
                    new SqlParameter("@Age",SqlDbType.Int)
                };
                SqlHelperParameterCache.CacheParameterSet(sql, parms);
            }

            SqlHelper.ExecuteNonQuery(connString, CommandType.Text, sql, parms);
        }
Example #32
0
        public void UpdateUserInfo(DataModule.UserInfo userInfo)
        {
            string sql = "UPDATE Tb_UserInfo set Email=@Email, NickName=@NickName, Sex=@Sex, BirthDay=@BirthDay, Age=@Age where UserID=@UserID";
            SqlParameter[] parms = SqlHelperParameterCache.GetCachedParameterSet(sql);
            if (parms == null)
            {
                parms = new SqlParameter[] {
                    new SqlParameter("@Email",SqlDbType.NVarChar,50),
                    new SqlParameter("@NickName",SqlDbType.NVarChar,20),
                    new SqlParameter("@Sex",SqlDbType.SmallInt),
                    new SqlParameter("@BirthDay",SqlDbType.Date),
                    new SqlParameter("@Age",SqlDbType.Int),
                    new SqlParameter("@UserID",SqlDbType.BigInt)
                };
                SqlHelperParameterCache.CacheParameterSet(sql, parms);
            }

            parms[0].Value = userInfo.Email;
            parms[1].Value = userInfo.NickName;
            parms[2].Value = userInfo.Sex;
            parms[3].Value = userInfo.BirthDay;
            parms[4].Value = userInfo.Age;
            parms[5].Value = userInfo.UserID;

            SqlHelper.ExecuteNonQuery(connString, CommandType.Text, sql, parms);
        }