• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Model类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Model的典型用法代码示例。如果您正苦于以下问题:C# Model类的具体用法?C# Model怎么用?C# Model使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Model类属于命名空间,在下文中一共展示了Model类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Controller_MainForm

 public Controller_MainForm(int sizeField,int amountTanks,int amountApples,int speedGame)
 {
     InitializeComponent();
     model = new Model(sizeField,amountTanks,amountApples,speedGame);
     view = new View(model);
     this.Controls.Add(view);
 }
开发者ID:sunloverz,项目名称:Tanks,代码行数:7,代码来源:Controller_MainForm.cs


示例2: RandomExcursions

 /// <summary>
 /// Constructor of test, supplied with all neccessary values
 /// </summary>
 /// <param name="n">The length of the bit string</param>
 /// <param name="model">Model containing the the binary string</param>
 /// <exception cref="ArgumentException"/>
 public RandomExcursions(int n, ref Model model)
     : base(ref model) {
         if (n > model.epsilon.Count || n <= 0) {
             throw new ArgumentException("The value of n must be smaller than the size of the input data, and be greater than 0", "Frequency n");
         }
         this.n = n;
 }
开发者ID:subatta,项目名称:randomnumbertestsuite-nist,代码行数:13,代码来源:RandomExcursions.cs


示例3: Add

        /// <summary>
        /// ����һ������
        /// </summary>
        public int Add(Model.contents.article_attribute_field model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into " + databaseprefix + "article_attribute_field(");
            strSql.Append("name,title,control_type,data_type,data_length,data_place,item_option,default_value,is_required,is_password,is_html,editor_type,valid_tip_msg,valid_error_msg,valid_pattern,sort_id,is_sys)");
            strSql.Append(" values (");
            strSql.Append("@name,@title,@control_type,@data_type,@data_length,@data_place,@item_option,@default_value,@is_required,@is_password,@is_html,@editor_type,@valid_tip_msg,@valid_error_msg,@valid_pattern,@sort_id,@is_sys)");
            strSql.Append(";set @ReturnValue= @@IDENTITY");
            SqlParameter[] parameters = {
                    new SqlParameter("@name", SqlDbType.NVarChar,100),
                    new SqlParameter("@title", SqlDbType.NVarChar,100),
                    new SqlParameter("@control_type", SqlDbType.NVarChar,50),
                    new SqlParameter("@data_type", SqlDbType.NVarChar,50),
                    new SqlParameter("@data_length", SqlDbType.Int,4),
                    new SqlParameter("@data_place", SqlDbType.TinyInt,1),
                    new SqlParameter("@item_option", SqlDbType.NText),
                    new SqlParameter("@default_value", SqlDbType.NText),
                    new SqlParameter("@is_required", SqlDbType.TinyInt,1),
                    new SqlParameter("@is_password", SqlDbType.TinyInt,1),
                    new SqlParameter("@is_html", SqlDbType.TinyInt,1),
                    new SqlParameter("@editor_type", SqlDbType.TinyInt,1),
                    new SqlParameter("@valid_tip_msg", SqlDbType.NVarChar,255),
                    new SqlParameter("@valid_error_msg", SqlDbType.NVarChar,255),
                    new SqlParameter("@valid_pattern", SqlDbType.NVarChar,500),
                    new SqlParameter("@sort_id", SqlDbType.Int,4),
                    new SqlParameter("@is_sys", SqlDbType.TinyInt,1),
                    new SqlParameter("@ReturnValue",SqlDbType.Int)};
            parameters[0].Value = model.name;
            parameters[1].Value = model.title;
            parameters[2].Value = model.control_type;
            parameters[3].Value = model.data_type;
            parameters[4].Value = model.data_length;
            parameters[5].Value = model.data_place;
            parameters[6].Value = model.item_option;
            parameters[7].Value = model.default_value;
            parameters[8].Value = model.is_required;
            parameters[9].Value = model.is_password;
            parameters[10].Value = model.is_html;
            parameters[11].Value = model.editor_type;
            parameters[12].Value = model.valid_tip_msg;
            parameters[13].Value = model.valid_error_msg;
            parameters[14].Value = model.valid_pattern;
            parameters[15].Value = model.sort_id;
            parameters[16].Value = model.is_sys;
            parameters[17].Direction = ParameterDirection.Output;

            List<CommandInfo> sqllist = new List<CommandInfo>();
            CommandInfo cmd = new CommandInfo(strSql.ToString(), parameters);
            sqllist.Add(cmd);

            //������չ�ֶα���һ��
            StringBuilder strSql2 = new StringBuilder();
            strSql2.Append("alter table " + databaseprefix + "article_attribute_value add " + model.name + " " + model.data_type);
            SqlParameter[] parameters2 = { };
            cmd = new CommandInfo(strSql2.ToString(), parameters2);
            sqllist.Add(cmd);

            DbHelperSQL.ExecuteSqlTranWithIndentity(sqllist);
            return (int)parameters[17].Value;
        }
开发者ID:eyren,项目名称:OScms,代码行数:63,代码来源:article_attribute_field.cs


示例4: Add

        /// <summary>
        /// ����һ������
        /// </summary>
        public int Add(Model.distribution model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into dt_distribution(");
            strSql.Append("title,remark,type,amount,sort_id,is_lock)");
            strSql.Append(" values (");
            strSql.Append("@title,@remark,@type,@amount,@sort_id,@is_lock)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
                    new SqlParameter("@title", SqlDbType.NVarChar,100),
                    new SqlParameter("@remark", SqlDbType.NText),
                    new SqlParameter("@type", SqlDbType.TinyInt,1),
                    new SqlParameter("@amount", SqlDbType.Decimal,5),
                    new SqlParameter("@sort_id", SqlDbType.Int,4),
                    new SqlParameter("@is_lock", SqlDbType.TinyInt,1)};
            parameters[0].Value = model.title;
            parameters[1].Value = model.remark;
            parameters[2].Value = model.type;
            parameters[3].Value = model.amount;
            parameters[4].Value = model.sort_id;
            parameters[5].Value = model.is_lock;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
开发者ID:egojit,项目名称:B2C,代码行数:35,代码来源:distribution.cs


示例5: Add

        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Model.Regional model)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("insert into regional(");
            strSql.Append("RegionalID,RegionalName,RegionalCode,SubRegionalID,RegionalLevel,Orders,LastModifyTime,IsValid,Memo)");
            strSql.Append(" values (");
            strSql.Append("@RegionalID,@RegionalName,@RegionalCode,@SubRegionalID,@RegionalLevel,@Orders,@LastModifyTime,@IsValid,@Memo)");
            MySqlParameter[] parameters = {
                    new MySqlParameter("@RegionalID", MySqlDbType.VarChar,50),
                    new MySqlParameter("@RegionalName", MySqlDbType.VarChar,50),
                    new MySqlParameter("@RegionalCode", MySqlDbType.VarChar,50),
                    new MySqlParameter("@SubRegionalID", MySqlDbType.VarChar,50),
                    new MySqlParameter("@RegionalLevel", MySqlDbType.VarChar,50),
                    new MySqlParameter("@LastModifyTime", MySqlDbType.DateTime),
                    new MySqlParameter("@IsValid", MySqlDbType.Bit),
                    new MySqlParameter("@Memo", MySqlDbType.VarChar,50),
                    new MySqlParameter("@Orders", MySqlDbType.Int32)};
            parameters[0].Value = model.RegionalID;
            parameters[1].Value = model.RegionalName;
            parameters[2].Value = model.RegionalCode;
            parameters[3].Value = model.SubRegionalID;
            parameters[4].Value = model.RegionalLevel;
            parameters[5].Value = model.LastModifyTime;
            parameters[6].Value = model.IsValid;
            parameters[7].Value = model.Memo;
            parameters[8].Value = model.Orders;

            StringBuilder strSql1 = new StringBuilder();
            strSql1.Append("insert into T_SYSCODEDETIAL(");
            strSql1.Append("SYSCodeID,SYSCodeDetialID,SYSCodeDetialContext,LastModifyTime,IsValid,Memo)");
            strSql1.Append(" values (");
            strSql1.Append("@SYSCodeID,@SYSCodeDetialID,@SYSCodeDetialContext,@LastModifyTime,@IsValid,@Memo)");
            MySqlParameter[] parameters1 = {
                    new MySqlParameter("@SYSCodeID", MySqlDbType.VarChar,50),
                    new MySqlParameter("@SYSCodeDetialID", MySqlDbType.VarChar,50),
                    new MySqlParameter("@SYSCodeDetialContext", MySqlDbType.VarChar,50),
                    new MySqlParameter("@LastModifyTime", MySqlDbType.DateTime),
                    new MySqlParameter("@IsValid", MySqlDbType.Bit,1),
                    new MySqlParameter("@Memo", MySqlDbType.VarChar,50)};
            parameters1[0].Value = "Region";
            parameters1[1].Value = model.RegionalID;
            parameters1[2].Value = model.RegionalName;
            parameters1[3].Value = DateTime.Now;
            parameters1[4].Value = model.IsValid;
            parameters1[5].Value = model.Memo;

            System.Collections.Hashtable sqlStringList = new System.Collections.Hashtable();
            sqlStringList.Add(strSql, parameters);
            sqlStringList.Add(strSql1, parameters1);

            try
            {
                DbHelperMySQL.ExecuteSqlTran(sqlStringList);
                return true;
            }
            catch
            {
                return false;
            }
        }
开发者ID:454240357,项目名称:QuZhouCivilAffairs,代码行数:63,代码来源:MySqlRegional.cs


示例6: throw_when_no_httpcontext_is_available

        public void throw_when_no_httpcontext_is_available()
        {
            HttpContext.Current = null;

            var model = new Model();
            var assertAttribute = new AssertThatAttribute("true");
            var requirAttribute = new RequiredIfAttribute("true");

            var metadata = GetModelMetadata(model, m => m.Value);
            var controllerContext = GetControllerContext();

            var e = Assert.Throws<ValidationException>(() => new AssertThatValidator(metadata, controllerContext, assertAttribute).GetClientValidationRules().Single());
            Assert.Equal(
                "AssertThatValidator: collecting of client validation rules for Value field failed.",
                e.Message);
            Assert.IsType<ApplicationException>(e.InnerException);
            Assert.Equal(
                "HttpContext not available.",
                e.InnerException.Message);

            e = Assert.Throws<ValidationException>(() => new RequiredIfValidator(metadata, controllerContext, requirAttribute).GetClientValidationRules().Single());
            Assert.Equal(
                "RequiredIfValidator: collecting of client validation rules for Value field failed.",
                e.Message);
            Assert.IsType<ApplicationException>(e.InnerException);
            Assert.Equal(
                "HttpContext not available.",
                e.InnerException.Message);
        }
开发者ID:kosioreka,项目名称:ExpressiveAnnotations,代码行数:29,代码来源:ValidatorsTest.cs


示例7: AddFixture

 public Model.Fixture AddFixture(Model.Fixture fixture)
 {
     return this.restServiceAsync.AddFixtureAsync(fixture)
         .ConfigureAwait(false)
         .GetAwaiter()
         .GetResult();
 }
开发者ID:ewan-sportingsolutions,项目名称:VersioningSample,代码行数:7,代码来源:FixtureService_RestSharp.cs


示例8: AddMaintenance

 public static string AddMaintenance(Model.MyLog.DL_Maintenance DL_MainItem)
 {
     DataBase db = new DataBase();
     DataBaseVisitor visitor = new WSV.DAL.MyLog.OperData();
     bool bSuc = false;
     int nEffectRows = 0;
     SqlParameter[] prams ={
         db.MakeInParam("@ID", SqlDbType.Float,50, DL_MainItem.ID),
         db.MakeInParam("@TableNum", SqlDbType.VarChar,50,DL_MainItem.TableNum),
         db.MakeInParam("@SaverCode", SqlDbType.VarChar,50, DL_MainItem.SaverCode),
         db.MakeInParam("@WorkCode", SqlDbType.VarChar,50, DL_MainItem.WorkCode),
         db.MakeInParam("@OperCode", SqlDbType.VarChar,50, DL_MainItem.OperCode),
     };
     try
     {
         bSuc = db.TransactSql(visitor, "AddMaintenance", prams, out nEffectRows);
     }
     catch (Exception ex) { throw new Exception(ex.Message); }
     finally
     {
         db.Dispose();
     }
     if (bSuc && nEffectRows > 0)
         return "0101";
     else
         return "0";
 }
开发者ID:wuyanqing,项目名称:wc001,代码行数:27,代码来源:OperData.cs


示例9: Vehicle

        public Vehicle(Model model, ObjectStats.VehicleStats vehicleStats)
            : base(model, vehicleStats)
        {
            rearWheelsCount = vehicleStats.RearWheelCount;
            frontWheelsCount = vehicleStats.FrontWheelCount;
            doorCount = vehicleStats.DoorCount;
            hasTurret = vehicleStats.HasTurret;
            waterSourceCount = vehicleStats.WaterSourceCount;

            leftDoorAngle = 0;
            rightDoorAngle = 0;
            leftDoorState = DoorState.Closed;
            rightDoorState = DoorState.Closed;

            wheelAngle = 0;
            wheelState = WheelState.Straight;

            NextStep = new Vector2(Position.X,Position.Z);

            //TEMP
            //leftDoorState = DoorState.Opening;
            //rightDoorState = DoorState.Opening;
            //wheelState = WheelState.StraightLeft;
            //gi = new GameInfo();
        }
开发者ID:smarthaert,项目名称:icgame,代码行数:25,代码来源:Vehicle.cs


示例10: Add

        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Model.express model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into " + databaseprefix + "express(");
            strSql.Append("title,express_code,express_fee,website,remark,sort_id,is_lock)");
            strSql.Append(" values (");
            strSql.Append("@title,@express_code,@express_fee,@website,@remark,@sort_id,@is_lock)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
                    new SqlParameter("@title", SqlDbType.NVarChar,100),
                    new SqlParameter("@express_code", SqlDbType.NVarChar,100),
                    new SqlParameter("@express_fee", SqlDbType.Decimal,5),
                    new SqlParameter("@website", SqlDbType.NVarChar,255),
                    new SqlParameter("@remark", SqlDbType.NText),
                    new SqlParameter("@sort_id", SqlDbType.Int,4),
                    new SqlParameter("@is_lock", SqlDbType.TinyInt,1)};
            parameters[0].Value = model.title;
            parameters[1].Value = model.express_code;
            parameters[2].Value = model.express_fee;
            parameters[3].Value = model.website;
            parameters[4].Value = model.remark;
            parameters[5].Value = model.sort_id;
            parameters[6].Value = model.is_lock;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
开发者ID:rockhe168,项目名称:CMS,代码行数:37,代码来源:express.cs


示例11: Add

 public int Add(Model.TaskLog obj)
 {
     string cmd = @"insert into tb_log(Content,LogType,CreateTime,Task_Id,Node_Id)
                    values(@Content,@LogType,@CreateTime,@Task_Id,@Node_Id)";
     IDataParameter[] param = {
         new SqlParameter("@Content", SqlDbType.NVarChar, 8000),
         new SqlParameter("@LogType", SqlDbType.Int, 4),
         new SqlParameter("@CreateTime", SqlDbType.DateTime),
         new SqlParameter("@Task_Id", SqlDbType.Int, 4),
         new SqlParameter("@Node_Id",SqlDbType.Int,4)
     };
     param[0].Value = obj.Content;
     param[1].Value = obj.LogType;
     param[2].Value = obj.CreateTime;
     param[3].Value = obj.Task_Id;
     param[4].Value = obj.Node_Id;
     try
     {
         return dbHelper.ExecuteSql(cmd, param);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
开发者ID:cnquan,项目名称:tasker,代码行数:25,代码来源:TaskLogDAL.cs


示例12: Add

        /// <summary>
        /// 增加一条数据
        /// </summary>
        public long Add(Model.Category model)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("insert into Category(");
            strSql.Append("CategoryName,ParentCategoryID,Orders,LastModifyTime,IsValid,Memo)");
            strSql.Append(" values (");
            strSql.Append("@CategoryName,@ParentCategoryID,@Orders,@LastModifyTime,@IsValid,@Memo)");
            strSql.Append(";select @@IDENTITY");
            MySqlParameter[] parameters = {
                    new MySqlParameter("@CategoryName", MySqlDbType.VarChar,50),
                    new MySqlParameter("@ParentCategoryID", MySqlDbType.Int64),
                    new MySqlParameter("@Orders", MySqlDbType.Int32),
                    new MySqlParameter("@LastModifyTime", MySqlDbType.DateTime),
                    new MySqlParameter("@IsValid", MySqlDbType.Bit,1),
                    new MySqlParameter("@Memo", MySqlDbType.VarChar,50)};
            parameters[0].Value = model.CategoryName;
            parameters[1].Value = model.ParentCategoryID;
            parameters[2].Value = model.Orders;
            parameters[3].Value = model.LastModifyTime;
            parameters[4].Value = model.IsValid;
            parameters[5].Value = model.Memo;

            object obj = DbHelperMySQL.GetSingle(strSql.ToString(),parameters);
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt64(obj);
            }
        }
开发者ID:454240357,项目名称:QuZhouCivilAffairs,代码行数:35,代码来源:MySqlCategory.cs


示例13: Build

 public override RuleBase Build(Model.CoverageRulesContainer request)
 {
     NoneAreCarried.Build(request);
     TOWIsCarried.Build(request);
     ERSIsCarried.Build(request);
     return this;
 }
开发者ID:ssuing8825,项目名称:CoverageValiation,代码行数:7,代码来源:Coverage007.cs


示例14: PerformSearch

        public override List<EpisodeParseResult> PerformSearch(Repository.Series series, dynamic options, Model.Notification.ProgressNotification notification)
        {
            if (options.Episode == null)
                throw new ArgumentException("Episode is invalid");

            notification.CurrentMessage = "Looking for " + options.Episode;

            var reports = new List<EpisodeParseResult>();
            var title = GetSearchTitle(series);

            var seasonNumber = options.Episode.SeasonNumber;
            var episodeNumber = options.Episode.EpisodeNumber;

            Parallel.ForEach(_indexerProvider.GetEnabledIndexers(), indexer =>
            {
                try
                {
                    reports.AddRange(indexer.FetchEpisode(title, seasonNumber, episodeNumber));
                }

                catch (Exception e)
                {
                    logger.ErrorException(String.Format("An error has occurred while searching for {0}-S{1:00}E{2:00} from: {3}",
                                                         series.Title, options.SeasonNumber, options.EpisodeNumber, indexer.Name), e);
                }
            });

            return reports;
        }
开发者ID:realpatriot,项目名称:NzbDrone,代码行数:29,代码来源:TestSearch.cs


示例15: PresentationModel

        public PresentationModel(Model model)
        {
            _model = model;
            List<Tuple<string, string>> imageList = new List<Tuple<string, string>>
            {
                new Tuple<string, string>("fingersSpread", "Image/fingersSpread.png"),
                new Tuple<string, string>("waveOut", "Image/waveOut.png"),
                new Tuple<string, string>("waveIn", "Image/waveIn.png"),
                new Tuple<string, string>("fist", "Image/fist.png"),
                new Tuple<string, string>("rightArrow", "Image/rightArrow.png"),
                new Tuple<string, string>("downArrow", "Image/downArrow.png"),
                new Tuple<string, string>("keyboard", "Image/keyboard.png"),
            };

            foreach (Tuple<string, string> item in imageList)
            {
                AddImage(item.Item1, Image.FromFile(item.Item2));
            }

            Bitmap source = new Bitmap("Image/arm-device.png");
            List<Tuple<string, Rectangle>> sectionList = new List<Tuple<string, Rectangle>>
            {
                new Tuple<string, Rectangle>("rollUp", new Rectangle(0, 0, 230, 230)),
                new Tuple<string, Rectangle>("rollDown", new Rectangle(182, 0, 230, 230)),
                new Tuple<string, Rectangle>("pitchUp", new Rectangle(0, 182, 230, 230)),
                new Tuple<string, Rectangle>("pitchDown", new Rectangle(180, 180, 230, 230)),
                new Tuple<string, Rectangle>("yawUp", new Rectangle(0, 360, 230, 230)),
                new Tuple<string, Rectangle>("yawDown", new Rectangle(182, 360, 230, 230)),
            };

            foreach (Tuple<string, Rectangle> item in sectionList)
            {
                CutImage(item.Item1, source, item.Item2);
            }
        }
开发者ID:LuJoker,项目名称:easy-control-UI-retry,代码行数:35,代码来源:PresentationModel.cs


示例16: Add

        public int Add(Model.Manager model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into Manager(");
            strSql.Append("username,isAdmin,repair,phonenum,works,states )");
            strSql.Append(" values(");
            strSql.Append("@username,@isAdmin,@repair,@phonenum,@works,@states )");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters ={
                new SqlParameter("@username",SqlDbType.NVarChar,50),
                new SqlParameter("@isAdmin",SqlDbType.Int,4),
                new SqlParameter("@repair",SqlDbType.NVarChar,50),
                new SqlParameter("@phonenum",SqlDbType.NChar,20),
                new SqlParameter("@works",SqlDbType.Int,4),
                new SqlParameter("@states",SqlDbType.Int,4)};
            parameters[0].Value = model.UserName;
            parameters[1].Value = model.isAdmin;
            parameters[2].Value = model.repair;
            parameters[3].Value = model.phonenum;
            parameters[4].Value = 0;
            parameters[5].Value = 1;


            object obj = DbHelper.ExecuteNonQuery(CommandType.Text, strSql.ToString(), parameters);
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
开发者ID:huaminglee,项目名称:Code,代码行数:33,代码来源:Manager.cs


示例17: Window1_Loaded

        void Window1_Loaded(object sender, RoutedEventArgs e)
        {
            Logging.Setup();
            Logging.AddToAuthorun();
            ShowInTaskbar = false;
            RegisterHotkey();
            
            _Model = new Model();
            this.DataContext = _Model;
            foreach (string s in Environment.GetCommandLineArgs())
            {
                if (File.Exists(s) && System.IO.Path.GetExtension(s) != ".exe")
                {
                    _Model.Open(s);
                }
            }
            if (!_Model._Loaded) _Model.Load();
            KeyDown += new KeyEventHandler(Window1_KeyDown);
            Closed += new EventHandler(Window1_Closed);
            
            Closing += new System.ComponentModel.CancelEventHandler(Window1_Closing);
            App.Current.Deactivated += new EventHandler(Current_Deactivated);
            _RitchTextBox.Focus();
            _RitchTextBox.TextChanged += new TextChangedEventHandler(RitchTextBox_TextChanged);

            new DispatcherTimer().StartRepeatMethod(60 * 10, Update);
            this.Show(); 
           
            
        }
开发者ID:ConnectDeveloper01,项目名称:dorumon,代码行数:30,代码来源:Window1.xaml.cs


示例18: Add

        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(Model.city model)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("insert into td_city(");
            strSql.Append("CityID,CityName,ZipCode,ProvinceID,DateCreated,DateUpdated");
            strSql.Append(") values (");
            strSql.Append("@CityID,@CityName,@ZipCode,@ProvinceID,@DateCreated,@DateUpdated");
            strSql.Append(") ");

            SqlParameter[] parameters = {
                        new SqlParameter("@CityID", SqlDbType.BigInt,8) ,
                        new SqlParameter("@CityName", SqlDbType.VarChar,50) ,
                        new SqlParameter("@ZipCode", SqlDbType.VarChar,50) ,
                        new SqlParameter("@ProvinceID", SqlDbType.BigInt,8) ,
                        new SqlParameter("@DateCreated", SqlDbType.DateTime) ,
                        new SqlParameter("@DateUpdated", SqlDbType.DateTime)

            };

            parameters[0].Value = model.CityID;
            parameters[1].Value = model.CityName;
            parameters[2].Value = model.ZipCode;
            parameters[3].Value = model.ProvinceID;
            parameters[4].Value = model.DateCreated;
            parameters[5].Value = model.DateUpdated;
                        DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
        }
开发者ID:wangjinfang,项目名称:DTCMS,代码行数:30,代码来源:td_city.cs


示例19: RunImpl

        protected internal override TestResult RunImpl(ITestCommand rootTestCommand, Model.Tree.TestStep parentTestStep, TestExecutionOptions options, IProgressMonitor progressMonitor)
        {
            using (progressMonitor.BeginTask("Running tests.", rootTestCommand.TestCount))
            {
                // Note: We do not check options.SkipTestExecution here because we want to build up
                // the tree of data-driven test steps.  So we actually check it later on in the
                // PatternTestExecutor.  This is different from framework adapters
                // at this time (because they do not generally support dynamically generated data-driven tests).
                Sandbox sandbox = new Sandbox();
                EventHandler canceledHandler = delegate { sandbox.Abort(TestOutcome.Canceled, "The user canceled the test run."); };
                try
                {
                    progressMonitor.Canceled += canceledHandler;

                    TestAssemblyExecutionParameters.Reset();

                    PatternTestExecutor executor = new PatternTestExecutor(options, progressMonitor, formatter, converter, environmentManager);

                    // Inlined to minimize stack depth.
                    var action = executor.CreateActionToRunTest(rootTestCommand, parentTestStep, sandbox, null);
                    action.Run();
                    return action.Result;
                }
                finally
                {
                    progressMonitor.Canceled -= canceledHandler;
                    sandbox.Dispose();
                }
            }
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:30,代码来源:PatternTestController.cs


示例20: Insert

 public int Insert(Model.WebContentType1 model)
 {
     model.Replace4MySQL();
     StringBuilder sb = new StringBuilder();
     try
     {
             if (model.content_status == 1)//啟用
             {
                 WebContentTypeSetupDao _setDao = new WebContentTypeSetupDao(_connStr);
                 WebContentTypeSetup smodel = new WebContentTypeSetup();
                 smodel.site_id = model.site_id;
                 smodel.page_id = model.page_id;
                 smodel.area_id = model.area_id;
                 smodel.web_content_type = "web_content_type1";
                 _setDao.UpdateLimitStatus(smodel);////當前已啟用的個數超過5筆時,使最舊的不啟用,
             }
           
             sb.AppendFormat(@"insert into web_content_type1(site_id,page_id,area_id,type_id,content_title,content_image,content_default,content_status,link_url,link_page,link_mode,update_on,created_on) 
         values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}')", model.site_id, model.page_id, model.area_id, model.type_id, model.content_title, model.content_image, model.content_default, model.content_status, model.link_url, model.link_page, model.link_mode, CommonFunction.DateTimeToString(model.update_on), CommonFunction.DateTimeToString(model.created_on));
             return _access.execCommand(sb.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception("WebContentType1Dao.Insert-->" + ex.Message + sb.ToString(), ex);
     }
    
 }
开发者ID:lxh2014,项目名称:gigade-net,代码行数:27,代码来源:WebContentType1Dao.cs



注:本文中的Model类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ModelApplicationBase类代码示例发布时间:2022-05-24
下一篇:
C# Mode类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap