public void UpdateJobStatus(Model.JobInfo jobInfo, Model.JobProcessStatus status) { if (!Active) return; Logger.Log.Instance.Info(string.Format("DefaultJobHistoryUpdater. Update Job status. JobId: {0}, Status: {1}", jobInfo.JobId, status.ToString())); using (var connection = new SqlConnection(RoleSettings.DbConnectionString)) { connection.Open(); var commandText = "INSERT INTO JobHistory (JobId,Status,UpdateDate,ProcessingRole) VALUES (@JobId,@Status, GETDATE(),@RoleId)"; using (var command = new SqlCommand(commandText, connection)) { command.Parameters.Add("@JobId", SqlDbType.NVarChar); command.Parameters["@JobId"].Value = jobInfo.JobId; command.Parameters.Add("@Status", SqlDbType.NVarChar); command.Parameters["@Status"].Value = status.ToString(); command.Parameters.Add("@RoleId", SqlDbType.NVarChar); command.Parameters["@RoleId"].Value = RoleSettings.RoleId; command.ExecuteNonQuery(); } connection.Close(); } }
#pragma warning disable 1998 public async override global::System.Threading.Tasks.Task ExecuteAsync() { #line 1 "C:\Users\César\source\repos\TestMVC\TestMVC\Views\Home\Privacy.cshtml" ViewData["Title"] = "Privacy Policy"; #line default #line hidden BeginContext(50, 2, true); WriteLiteral("\r\n"); EndContext(); BeginContext(64, 18, true); WriteLiteral("\r\n<h1>Resultado = "); EndContext(); BeginContext(83, 16, false); #line 7 "C:\Users\César\source\repos\TestMVC\TestMVC\Views\Home\Privacy.cshtml" Write(Model.ToString()); #line default #line hidden EndContext(); BeginContext(99, 11, true); WriteLiteral("</h1>\r\n<h2>"); EndContext(); BeginContext(111, 17, false); #line 8 "C:\Users\César\source\repos\TestMVC\TestMVC\Views\Home\Privacy.cshtml" Write(ViewData["Title"]); #line default #line hidden EndContext(); BeginContext(128, 69, true); WriteLiteral("</h2>\r\n\r\n<p>Use this page to detail your site\'s privacy policy.</p>\r\n"); EndContext(); }
private FWInputElement CreateInput() { var input = new FWInputElement(Name, FWInputType.Textbox); input.AddCssClass("form-control"); input.Attributes.Add("data-thousands", CultureInfo.CurrentCulture.NumberFormat.NumberGroupSeparator); input.Attributes.Add("data-decimal", CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator); input.Attributes.Add("data-allownegative", _allowNegative ? "true" : "false"); input.Attributes.Add("data-rule-required", IsRequired.ToString().ToLower()); input.Attributes.Add("data-msg-required", string.Format(ViewResources.Validation_Required, DisplayName)); if (IsReadOnly) { input.Attributes.Add("readonly", "readonly"); } if (_displayCurrency) { input.Attributes.Add("data-prefix", CultureInfo.CurrentUICulture.NumberFormat.CurrencySymbol); } if (DataBind) { DataBind.AddMainBind(FWBindConfiguration.CURRENCY); input.DataBind = DataBind.CreateBind(); } else if (Model != null) { input.Value = Model.ToString(); } return(input); }
/// <summary> /// Create an YnMeshModel with a model loaded from content manager and a material. /// </summary> /// <param name="model">A Model instance</param> /// <param name="material">A material</param> public YnMeshModel(Model model, BaseMaterial material) : this() { _model = model; _material = material; _modelName = _model.ToString(); }
public Model.PagedList<Model.Remark> GetRemarks(string employeeId, int pageNumber = 1, int pageSize = 20, string orderBy = "Id", Model.SortingOrder sortingOrder = Model.SortingOrder.DESC) { using (var connection = new SqlConnection(Configurations.EmployeeDbConnectionString)) { var addRemarkCommand = new SqlCommand("spGetRemarksForEmployee", connection); addRemarkCommand.CommandType = System.Data.CommandType.StoredProcedure; addRemarkCommand.Parameters.Add(new SqlParameter("@EmployeeId", long.Parse(employeeId))); addRemarkCommand.Parameters.Add(new SqlParameter("@PageNumber", pageNumber)); addRemarkCommand.Parameters.Add(new SqlParameter("@PageSize", pageSize)); addRemarkCommand.Parameters.Add(new SqlParameter("@OrderBy", orderBy)); addRemarkCommand.Parameters.Add(new SqlParameter("@SortingOrder", sortingOrder.ToString())); var resultReader = addRemarkCommand.ExecuteReader(); int totalRecords = 0; var pagedList = new Model.PagedList<Model.Remark>(); if (resultReader.HasRows) { while (resultReader.Read()) { pagedList.Add(new Model.Remark() { Text = (string)resultReader["RemarkText"], CreateTimeStamp = (DateTime)resultReader["CreateTimestamp"] }); totalRecords = (int)resultReader["TotalResults"]; } } pagedList.PageSize = pageSize; pagedList.PageNumber = pageNumber; pagedList.TotalRecords = totalRecords; return pagedList; } }
// This method requests the home page content for the specified server. public static string SendToServer(Model model) { /*string request = "GET / HTTP/1.1\r\nHost: " + server + * "\r\nConnection: Close\r\n\r\n {\"key\": \"value\"}";*/ Byte[] bytesSent = Encoding.ASCII.GetBytes(model.ToString()); Byte[] bytesReceived = new Byte[256]; string serverResponse = string.Empty; // Create a socket connection with the specified server and port. using (Socket s = ConnectSocket()) { if (s == null) { return("Connection failed"); } // Send request to the server. s.Send(bytesSent, bytesSent.Length, 0); do { int receivedBytesCount = s.Receive(bytesReceived, bytesReceived.Length, 0); serverResponse += Encoding.ASCII.GetString(bytesReceived, 0, receivedBytesCount); }while (s.Available > 0); } return(serverResponse); }
public string Render() { string header = File.ReadAllText(Constants.Header); string navigation; string currentUser = ViewBag.GetUserName(); if (currentUser != null) { navigation = File.ReadAllText(Constants.NavLogged); } else { navigation = File.ReadAllText(Constants.NavNotLogged); } string game = Model.ToString(); string mainBody = string.Format(File.ReadAllText(Constants.GameDetails), game); string footer = File.ReadAllText(Constants.Footer); StringBuilder builder = new StringBuilder(); builder.Append(header); builder.Append(navigation); builder.Append(mainBody); builder.Append(footer); return(builder.ToString()); }
/// <summary> /// Creates the control main element. /// </summary> /// <returns>The control IFWHtmlElement interface.</returns> protected override IFWHtmlElement CreateControl() { var input = new FWInputElement(Name, FWInputType.Hidden); input.MergeAttributes(Attributes); if (!string.IsNullOrWhiteSpace(CustomCss)) { input.AddCssClass(CustomCss); } input.Id = Id; input.DataType = "fw-hidden"; if (DataBind) { DataBind.AddMainBind(FWBindConfiguration.VALUE); input.DataBind = DataBind.CreateBind(); } else if (Model != null) { input.Value = Model.ToString(); } else if (FWReflectionHelper.IsNumeric(ModelType)) { // If the property is a number, but the model is null, the value defaults to 0. input.Value = "0"; } return(input); }
private Hashtable GetXmlData(string type) { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load("CamSettingsConfig.xml"); var camsElements = xmlDoc.SelectNodes("/SettingItem/" + type + "/illumination"); Hashtable listStr = new Hashtable(); foreach (XmlNode xn in camsElements) { if (type.Equals("Infrared")) { } else { CameraParam cp = new CameraParam() { iris = Convert.ToInt32(xn.Attributes["iris"].Value), shutter = Convert.ToInt32(xn.Attributes["shutter"].Value), agc = Convert.ToInt32(xn.Attributes["agc"].Value) }; listStr.Add(Model.ToString() + xn.Attributes["value"].Value, cp); } } return(listStr); }
private FWTextareaElement CreateInput() { var input = new FWTextareaElement(Name); input.AddCssClass("form-control"); if (!_resizable) { input.AddCssClass("textarea-fixed"); } if (Rows.HasValue) { input.Attributes.Add("rows", Rows.Value.ToString()); } if (DataBind != null) { DataBind.AddMainBind(FWBindConfiguration.VALUE); input.DataBind = DataBind.CreateBind(); } else if (Model != null) { input.Value = Model.ToString(); } return(input); }
public Model.PagedList<Model.Employee> GetEmployees(int pageNumber = 1, int pageSize = 20, string orderBy = "Id", Model.SortingOrder sortingOrder = Model.SortingOrder.DESC) { using (var connection = new SqlConnection(Configurations.EmployeeDbConnectionString)) { var addRemarkCommand = new SqlCommand("spGetEmployees", connection); addRemarkCommand.CommandType = System.Data.CommandType.StoredProcedure; addRemarkCommand.Parameters.Add(new SqlParameter("@PageNumber", pageNumber)); addRemarkCommand.Parameters.Add(new SqlParameter("@PageSize", pageSize)); addRemarkCommand.Parameters.Add(new SqlParameter("@OrderBy", orderBy)); addRemarkCommand.Parameters.Add(new SqlParameter("@SortingOrder", sortingOrder.ToString())); var resultReader = addRemarkCommand.ExecuteReader(); int totalRecords = 0; var pagedList = new Model.PagedList<Model.Employee>(); if (resultReader.HasRows) { while (resultReader.Read()) { pagedList.Add(ParseEmployee(resultReader)); totalRecords = (int)resultReader["TotalResults"]; } } pagedList.PageSize = pageSize; pagedList.PageNumber = pageNumber; pagedList.TotalRecords = totalRecords; return pagedList; } }
public void Load() { if (m_IsDummy) { return; } if (Member == null) { Debug.LogError("Cannot load member since it is null."); return; } Member.LoadDoc(Language); if (Language == LanguageUtil.ELanguage.English) { Model.EnforcePunctuation(); } Model.SanitizeForEditing(); TextOrig = Model.ToString(); TextCurrent = TextOrig; if (Diff == null) { Diff = new StringDiff(); } Diff.Compare(TextOrig, TextCurrent); Dirty = false; DirtyAutoChanges = false; }
private FWInputElement CreateInput() { var input = new FWInputElement(Name, (!_isPassword) ? FWInputType.Textbox : FWInputType.Password); input.AddCssClass("form-control"); if (!string.IsNullOrWhiteSpace(_placeholder)) { input.Attributes.Add("placeholder", _placeholder); } input.Attributes.Add("data-rule-required", IsRequired.ToString().ToLower()); input.Attributes.Add("data-msg-required", string.Format(ViewResources.Validation_Required, DisplayName)); if (IsReadOnly) { input.Attributes.Add("readonly", "readonly"); } if (IsDisabled) { input.Attributes.Add("disabled", "disabled"); } if (_maxLength > 0) { input.Attributes.Add("maxlength", _maxLength.ToString()); } if (_minLength > 0) { input.Attributes.Add("data-rule-minlength", _minLength.ToString()); input.Attributes.Add("data-msg-minlength", string.Format(ViewResources.Validation_MinLength, DisplayName, _minLength)); } if (_regexPattern != null) { input.Attributes.Add("data-rule-pattern", _regexPattern); input.Attributes.Add("data-msg-pattern", string.Format(ViewResources.Validation_Regex, DisplayName)); } if (_targetValidationField != null) { input.Attributes.Add("data-rule-passwordmatch", _targetValidationField); input.Attributes.Add("data-msg-passwordmatch", ViewResources.Validation_PasswordMismatch); } if (DataBind) { DataBind.AddMainBind(FWBindConfiguration.VALUE); input.DataBind = DataBind.CreateBind(); } else if (Model != null) { input.Value = Model.ToString(); } return(input); }
//Methods /* 4 */ public override string ToString() { return(string.Format("Model: {0}, IdleHours: {1}, TalkHours: {2}, BatteryType: {3}", Model == null ? "null" : Model.ToString(), IdleHours == null ? "null" : IdleHours.ToString() + "h", TalkHours == null ? "null" : TalkHours.ToString() + "h", BatteryType == null ? "null" : BatteryType.ToString())); }
public string ToInstString() { if (Model == null) { return(String.Empty); } return(Model.ToString()); }
public override void Execute() { #line 2 "..\..\Views\ErrorLog\DisplayTemplates\StackTrace.cshtml" Write(Html.Raw(Model.ToString())); #line default #line hidden }
public void TestModelOverrideToString() { var c = new Car("abc"); var expected = "Car: abc, Model: abc, Year: 1984, Price: 1500, Discount: 0"; var m = new Model(c, "abc", 1984, 1500); Assert.AreEqual(expected, m.ToString()); }
private void load() { Height = 25; RelativeSizeAxes = Axes.X; InternalChild = new GridContainer { RelativeSizeAxes = Axes.Both, Content = new[] { new[] { dragHandle = new Button(FontAwesome.Solid.Bars) { RelativeSizeAxes = Axes.Y, Width = 25, }, new Container { RelativeSizeAxes = Axes.Both, CornerRadius = 2, Masking = true, Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = Color4.DarkSlateGray, }, new SpriteText { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, AllowMultiline = false, Padding = new MarginPadding(5), Text = Model.ToString(), } }, }, new Button(FontAwesome.Solid.Times) { RelativeSizeAxes = Axes.Y, Width = removable ? 25 : 0, // https://github.com/ppy/osu-framework/issues/3214 Colour = Color4.DarkRed, Alpha = removable ? 1 : 0, Action = () => RequestRemoval?.Invoke(this), }, }, }, ColumnDimensions = new[] { new Dimension(GridSizeMode.AutoSize), new Dimension(GridSizeMode.Distributed), new Dimension(GridSizeMode.AutoSize), } }; }
public override string ToString() { string model = Model.ToString(); string manufacturer = Manufacturer.ToString(); string price = Price.ToString(); string owner = Owner.ToString(); return("Model: " + model + "\r\nManufacturer: " + manufacturer + "\r\nPrice: " + price + "\r\nOwner: " + owner); }
/// <summary> /// Summarizes the distribution in the form of a string /// </summary> /// <returns>String based on the preferred display mode for distributions</returns> public override string ToString() { if (FakeNull) { return("NULL"); } return(Model.ToString() + " [z = " + CenterZScore.ToString() + "]"); }
public override string ToString() { if (AllowsEveryCaller) { return(String.Format(CultureInfo.InvariantCulture, "{0} | AllowEveryCaller", Model)); } return(Model.ToString()); }
public override void Execute() { WriteLiteral("\r\n"); WriteLiteral(@"<!DOCTYPE html> <html lang=""en"" xmlns=""http://www.w3.org/1999/xhtml""> <head> <meta charset=""utf-8"" /> <title>React OWIN Sample</title> <script src=""//cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-beta1/jquery.min.js"" type=""text/javascript""></script> <script src=""//cdnjs.cloudflare.com/ajax/libs/react/15.0.1/react-with-addons.js"" type=""text/javascript""></script> <script src=""//cdnjs.cloudflare.com/ajax/libs/react/15.0.1/react-dom.js"" type=""text/javascript""></script> <script src=""//cdn.jsdelivr.net/form2js/2.0/form2js.min.js"" type=""text/javascript""></script> <script src=""/Content/Siren.js""></script> </head> <body> <h1>React demo app</h1> <div id=""container""></div> <script type=""text/javascript""> var model = "); #line 20 "..\..\Index.cshtml" Write(Model.ToString(Newtonsoft.Json.Formatting.Indented)); #line default #line hidden WriteLiteral(@"; var component = ReactDOM.render( React.createElement(Siren, model), document.getElementById('container') ); //$(document).on('submit', 'form', function (e) { // e.preventDefault(); // var $form = $(this).closest(""form""); // $.ajax({ // url: $form.attr(""action""), // cache: false, // type: 'POST', // data: (form2js($form[0])), // dataType: 'json', // accepts: ""application/vnd.siren+json; charset=utf-8"", // success: function(data) { // component.setState(data); // }, // }); //}); </script> </body> </html>"); }
public override List <IHtml> CreateDom() { Layout = LayoutMutatorView.EmptyLayout; return(new List <IHtml> { new Div { Class = "test" }.Add(Model.ToString()) }); }
public void OnModelEdited(bool reload = false) { TextCurrent = Model.ToString(); Dirty = true; if (reload) { Member.LoadDoc(TextCurrent, Language); } Diff.Compare(TextOrig, TextCurrent); }
public void Adding_duplicate_runtime_annotation_throws() { var annotatable = new Model().FinalizeModel(); annotatable.AddRuntimeAnnotation("Foo", "Bar"); Assert.Equal( CoreStrings.DuplicateAnnotation("Foo", annotatable.ToString()), Assert.Throws <InvalidOperationException>(() => annotatable.AddRuntimeAnnotation("Foo", "Bar")).Message); }
//Methods public override string ToString() { return(string.Format("Model: {0}, Manufacturer: {1}, Price: {2}, Owner: {3}, Battery: [{4}], Display: [{5}]", Model == null ? "null" : Model.ToString(), Manufacturer == null ? "null" : Manufacturer.ToString(), Price == null ? "null" : "$" + Price.ToString(), Owner == null ? "null" : Owner.ToString(), Battery == null ? "null" : Battery.ToString(), Display == null ? "null" : Display.ToString())); }
/// <summary> /// Exports a legend. /// </summary> /// <param name="Output">Markdown output</param> /// <param name="Labels">Labels to add to legend.</param> /// <param name="Palette">Palette to use</param> public static void ExportLegend(StreamWriter Output, string[] Labels, params SKColor[] Palette) { int i = 0; if (Palette is null || Palette.Length < Labels.Length) { Palette = Model.CreatePalette(Labels.Length); } Output.WriteLine("```layout: Legend"); Output.WriteLine("<Layout2D xmlns=\"http://waher.se/Layout/Layout2D.xsd\""); Output.WriteLine(" background=\"WhiteBackground\" pen=\"BlackPen\""); Output.WriteLine(" font=\"Text\" textColor=\"Black\">"); Output.WriteLine(" <SolidPen id=\"BlackPen\" color=\"Black\" width=\"1px\"/>"); Output.WriteLine(" <SolidBackground id=\"WhiteBackground\" color=\"WhiteSmoke\"/>"); foreach (string Label in Labels) { SKColor Color = Palette[i++]; Output.Write(" <SolidBackground id=\""); Output.Write(Label); Output.Write("Bg\" color=\""); Output.Write(Model.ToString(Color)); Output.WriteLine("\"/>"); } Output.WriteLine(" <Font id=\"Text\" name=\"Arial\" size=\"8pt\" color=\"Black\"/>"); Output.WriteLine(" <Grid columns=\"2\">"); foreach (string Label in Labels) { Output.WriteLine(" <Cell>"); Output.WriteLine(" <Margins left=\"1mm\" top=\"1mm\" bottom=\"1mm\" right=\"1mm\">"); Output.Write(" <RoundedRectangle radiusX=\"1mm\" radiusY=\"1mm\" width=\"5mm\" height=\"5mm\" fill=\""); Output.Write(Label); Output.Write("Bg"); Output.WriteLine("\"/>"); Output.WriteLine(" </Margins>"); Output.WriteLine(" </Cell>"); Output.WriteLine(" <Cell>"); Output.WriteLine(" <Margins left=\"0.5em\" right=\"0.5em\">"); Output.Write(" <Label text=\""); Output.Write(Label); Output.WriteLine("\" x=\"0%\" y=\"50%\" halign=\"Left\" valign=\"Center\" font=\"Text\"/>"); Output.WriteLine(" </Margins>"); Output.WriteLine(" </Cell>"); } Output.WriteLine(" </Grid>"); Output.WriteLine("</Layout2D>"); Output.WriteLine("```"); Output.WriteLine(); }
public virtual void DebugInfo() { Debug.Log("Context : " + Context); Debug.Log("Model : " + (Model == null ? "null" : Model.ToString())); Debug.Log("Bindings"); foreach (var info in GetBindingInfos()) { Debug.Log("Member : " + info.MemberName + ", " + info.BindingName); } }
public void testMinimalModelWithProperty() { // e.g. rule ::= StringProperty @ "a" Property property = new Property() { Name = "StringProperty" }; ParseAction consume = new ConsumeString() { Property = property, String = "a" }; property.Source = consume; Model model = new Model() { Entities = new List <Entity> { new Entity() { Name = "rule", Properties = (new List <Property> { property }).AsReadOnly(), ParseAction = consume } } }; Assert.AreEqual( @"new Model() { Entities = new List<Entity>() { new Entity() { Rule = null, Name = ""rule"", Properties = new List<Property>() { new Property() { Name = ""StringProperty"", Source = new ConsumeString() { String = ""a"" } } }.AsReadOnly(), ParseAction = new ConsumeString() { String = ""a"" }, Supers = new HashSet<string>(), Subs = new HashSet<string>() } }, RootName = ""rule"" }", model.ToString() ); }
public string IspisiAutomobil() { return("Automobil je marke: " + Marka.ToString() + Environment.NewLine + "Model: " + Model.ToString() + Environment.NewLine + "Godiste: " + God_proizvodnje.ToString() + Environment.NewLine + "Pogon: " + Pogon.ToString() + Environment.NewLine + "Menjac: " + Menjac.ToString() + Environment.NewLine + "Karoserija: " + Karoserija.ToString() + Environment.NewLine + "Gorivo: " + Gorivo.ToString() + Environment.NewLine + "Broj vrata: " + Broj_vrata.ToString()); }
public void Validate() { AddNotifications( new Contract() .Requires() .IsNotNullOrEmpty(Description, "Description", "Description not be null.") .IsNotNullOrEmpty(Model.ToString(), "Model", "Model not be null.") .IsBetween(Model, 1, 2, "Model", "Model not valid.") .IsBetween(ModelYear, DateTime.Now.Year, (DateTime.Now.Year + 1), "ModelYear", "The model year must be the current year or the year after.") ); }
public PriceTask(ProductBlock block, IEnumerable <Specification> specifications, IEnumerable <Offer> offers, IEnumerable <ProjectItem> projects) : base(block) { _specifications = specifications.ToList(); _offers = offers.ToList(); _projects = projects.ToList(); this.Prices.CollectionChanged += (sender, args) => { RefreshProperties(); }; this.Prices.PropertyChanged += (sender, args) => { RefreshProperties(); }; BlockName = Model.ToString(); }
public string AddForce(string name, string giverName, ForceType type) { Model model = new Model(); GetObject(name, out model); string _name = type + "_f_" + giverName + "_to_" + name; model.AddForce(giverName, type, _name); Debug.Log(model.ToString()); return(_name); }
public static string Render(Model.CSSDocument css) { StringBuilder txt = new StringBuilder(); //foreach (Import imp in css.Imports) { // txt.AppendFormat("{0}\r\n", imp.ToString()); //} //foreach (Media mtg in css.Medias) { // txt.AppendFormat("@media{0} {{\r\n", mtg.Media != Media.None ? " " + mtg.Media.ToString() : ""); // foreach (Selector sel in mtg.Selectors) { // txt.Append(Render(sel, 1)); // txt.Append("\r\n"); // } // txt.Append("}\r\n"); //} //foreach (Selector sel in css.Selectors) { // txt.Append(Render(sel)); // txt.Append("\r\n"); //} txt.Append(css.ToString()); return txt.ToString(); }
public void SmartDelete(List<ThreadUsr.StatusEnum> threadStatusesToChange, Model.Entities.ObjectType? statusChangeObjectType, int? statusChangeObjectK) { string memcachedKey = new Caching.CacheKey(Caching.CacheKeyPrefix.UpdateThreadUsrJobStatus, "UsrK", this.K.ToString(), "StatusChangeObjectType", statusChangeObjectType.ToString(), "StatusChangeObjectK", statusChangeObjectK.ToString()).ToString(); SmartDeleteThreadUsrJob sdtuj = new SmartDeleteThreadUsrJob(this.K, threadStatusesToChange, statusChangeObjectType, statusChangeObjectK, memcachedKey); sdtuj.ExecuteAsynchronously(); }
public void UpdateThreadUsrs(ThreadUsr.StatusEnum changeStatus, List<ThreadUsr.StatusEnum> threadStatusesToChange, Model.Entities.ObjectType? statusChangeObjectType, int? statusChangeObjectK) { string memcachedKey = new Caching.CacheKey(Caching.CacheKeyPrefix.UpdateThreadUsrJobStatus, "UsrK", this.K.ToString(), "StatusChangeObjectType", statusChangeObjectType.ToString(), "StatusChangeObjectK", statusChangeObjectK.ToString()).ToString(); UpdateThreadUsrJob utuj = new UpdateThreadUsrJob(this.K, changeStatus, threadStatusesToChange, statusChangeObjectType, statusChangeObjectK, memcachedKey); utuj.ExecuteAsynchronously(); //Update uThreadUsr = new Update(); //uThreadUsr.Table = TablesEnum.ThreadUsr; //uThreadUsr.Changes.Add(new Assign(ThreadUsr.Columns.Status, changeStatus)); //uThreadUsr.Changes.Add(new Assign(ThreadUsr.Columns.StatusChangeDateTime, Time.Now)); //uThreadUsr.Where = new Q(ThreadUsr.Columns.UsrK, this.K); //if (threadStatusesToChange != null && threadStatusesToChange.Count > 0) //{ // Or statusOr = new Or(); // foreach (ThreadUsr.StatusEnum statusEnum in threadStatusesToChange) // { // statusOr = new Or(statusOr, // new Q(ThreadUsr.Columns.Status, statusEnum)); // } // uThreadUsr.Where = new And(uThreadUsr.Where, // statusOr); //} //else // throw new Exception("Usr.UpdateThreadUsrs(): Invalid list of ThreadUsr.StatusEnum to change."); //if (statusChangeObjectType != null) //{ // if (statusChangeObjectType.Value == Model.Entities.ObjectType.Usr) // { // // do nothing here // } // else // { // uThreadUsr.Where = new And(uThreadUsr.Where, // new Q(ThreadUsr.Columns.StatusChangeObjectType, statusChangeObjectType.Value)); // } // if (statusChangeObjectK != null) // { // if (statusChangeObjectType.Value == Model.Entities.ObjectType.Usr) // { // uThreadUsr.Where = new And(uThreadUsr.Where, // new Q(ThreadUsr.Columns.InvitingUsrK, statusChangeObjectK.Value)); // } // else // { // uThreadUsr.Where = new And(uThreadUsr.Where, // new Q(ThreadUsr.Columns.StatusChangeObjectK, statusChangeObjectK.Value)); // } // } //} //uThreadUsr.CommandTimeout = 90; //uThreadUsr.Run(); }
public PostBulkDocuments(IDatabase db, Model.BulkDocuments documents) : base(UriBuilder.Build(db, documents), new Http.Methods.Post()) { _stream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(documents.ToString())); }
public void AdFailed(Model.AdType AdType) { _settings.AdFailed(AdType); OnLog(string.Format("Ads failed request for: {0}", AdType.ToString())); GetAd(null); }
/// <summary> /// 90 degree rotation of the cube with rotation axis-z in vertical direction /// </summary> /// <param name="direction">The direction (left/right) of the cube</param> public void rotateVertical90(Model.Direction direction, bool isRecorded = true) { string directionText = direction.ToString(); rotateSurface(Model.CubeSurface.Right, direction, false); rotateSurface(Model.CubeSurface.MiddleVertical, direction, false); rotateSurface(Model.CubeSurface.Left, direction == Model.Direction.Right ? Model.Direction.Left : Model.Direction.Right, false); string imgLocation = direction == Model.Direction.Right ? ImageLocation.VerticalRight90 : ImageLocation.VerticalLeft90; if (isRecorded) { // Step +1 this.numberSteps++; this.History.Add(new Model.HistoryItem(this.Clone(), NumberSteps, String.Format("90 degree vertical {0}", directionText), imgLocation)); } }
/*! \brief Check whether the logical context is satisfiable, and compare the result with the expected result. If the context is satisfiable, then display the model. */ public void check(Status expected_result, out Model model) { Status result = solver.Check(); model = null; Console.WriteLine("{0}", result); switch (result) { case Status.UNSATISFIABLE: break; case Status.UNKNOWN: break; case Status.SATISFIABLE: model = solver.Model; Console.WriteLine("{0}", model.ToString()); break; } if (result != expected_result) { Console.WriteLine("BUG: unexpected result"); } }
/// <summary> /// 更新状态栏 /// </summary> private void UpdateStatus(Model.DoState doState) { this.toolStripStatusLabel2.Text = doState.ToString(); this.toolStripProgressBar1.Value = (int)doState.DoPercent; if (doState.CurrentCount == doState.SumCount) { this.btnSave.Enabled = true; this.txtLog.AppendText("文件已全部处理完毕!" + Environment.NewLine); this.dgFiles.DataSource = fileBLL.GetAllList(); } }
/// <summary> /// 查询默认命名空间 /// </summary> /// <param name="namespace1"></param> /// <returns></returns> public Model.ConfigServers GetDefault(Model.DatabaseType dbType = Model.DatabaseType.Empty) { var list = GetAll(); if (list.Count == 0) { return null; } else { if (dbType == Model.DatabaseType.Empty) { return list.Last(); } else { var li = list.Where(p => p.Type == dbType.ToString()); var rli = li.Count() > 0 ? li.Last() : null; return rli; } } }
/// <summary> /// Creates a statement verb from the 0.90 set of verbs. /// </summary> /// <param name="verb"></param> /// <remarks>You really shouldn't be using this method. It's simply used as an easy way to promote the /// verb enum to the verb class.</remarks> public StatementVerb(Model.TinCan090.StatementVerb verb) : this((PredefinedVerbs)Enum.Parse(typeof(PredefinedVerbs), verb.ToString(), true)) { }
private void assignSpecific(int id, Model model) { GameObject target; GameObject targetLabel; switch (id) { case 0: target = d_original; targetLabel = d_originalLabel; break; case 1: target = d_copy; targetLabel = d_copyLabel; break; case 2: target = t_original; targetLabel = t_originalLabel; break; case 3: target = t_copyA; targetLabel = t_copyALabel; break; case 4: target = t_copyB; targetLabel = t_copyBLabel; break; default: MonoBehaviour.print("Illegal specific model assign("+id+")"); return; //break; } setupModel(target, model); if (!sceneParameters.hide_labels) { if (model != null) { targetLabel.GetComponent<TextMesh>().text = model.ToString(); } else { targetLabel.GetComponent<TextMesh>().text = "NULL"; } } }
public string GenerateFullFile(Model.FullFile file) { return file.ToString(); }
/// <summary> /// Update file in database /// </summary> /// <param name="file">File to update</param> /// <returns>File info</returns> public FileExecutionResult Update(Model.File item) { UpdateSessionCulture(); using (var logSession = Helpers.Log.Session($"{GetType()}.{System.Reflection.MethodBase.GetCurrentMethod().Name}()", VerboseLog, RaiseLog)) try { using (var rep = GetNewRepository(logSession)) { SRVCCheckCredentials(logSession, rep, Repository.Model.RightType.Login, Repository.Model.RightType.UploadFile); logSession.Add($"Try to get file with id = '{item.Id}' from database..."); var dbFile = rep.GetFile(item.Id); if (dbFile == null) throw new Exception(string.Format(Properties.Resources.FILESERVICE_FileNotFound, item.Id)); if (item.EncodingName != null) dbFile.Encoding = item.Encoding; dbFile.MimeType = (string.IsNullOrEmpty(item.Mime)) ? FileStorage.MimeStorage.GetMimeTypeByExtension(dbFile.UniqueFileName) : item.Mime; if (!string.IsNullOrEmpty(item.Name)) { dbFile.FileName = System.IO.Path.GetFileName(item.Name); logSession.Add($"Try to rename file in file storage..."); var fi = MainFileStorage.FileRename(item.Id, dbFile.FileName); dbFile.UniqueFileName = fi.Name; } logSession.Add($"Try to update file in database..."); rep.SaveChanges(); return new FileExecutionResult(AutoMapper.Mapper.Map<Model.File>(dbFile)); } } catch (Exception ex) { ex.Data.Add(nameof(item), item.ToString()); logSession.Enabled = true; logSession.Add(ex); return new FileExecutionResult(ex); } }
/// <summary> /// Sends the async. /// </summary> /// <param name="bytes">The bytes.</param> /// <param name="type">The type.</param> /// <param name="endOfMessage">if set to <c>true</c> [end of message].</param> /// <param name="cancellationToken">The cancellation token.</param> /// <returns>Task.</returns> public async Task SendAsync(byte[] bytes, Model.Net.WebSocketMessageType type, bool endOfMessage, CancellationToken cancellationToken = default(CancellationToken)) { await _sendResource.WaitAsync(cancellationToken).ConfigureAwait(false); try { WebSocketMessageType nativeType; if (!Enum.TryParse(type.ToString(), true, out nativeType)) { _logger.Warn("Unrecognized WebSocketMessageType: {0}", type.ToString()); } var linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, _cancellationTokenSource.Token); await _client.SendAsync(new ArraySegment<byte>(bytes), nativeType, true, linkedTokenSource.Token).ConfigureAwait(false); } finally { _sendResource.Release(); } }
/// <summary> /// Gets the cache file path based on a set of parameters /// </summary> private string GetCacheFilePath(string originalPath, ImageSize outputSize, int quality, DateTime dateModified, Model.Drawing.ImageFormat format, bool addPlayedIndicator, double percentPlayed, int? unwatchedCount, string backgroundColor) { var filename = originalPath; filename += "width=" + outputSize.Width; filename += "height=" + outputSize.Height; filename += "quality=" + quality; filename += "datemodified=" + dateModified.Ticks; filename += "f=" + format; var hasIndicator = false; if (addPlayedIndicator) { filename += "pl=true"; hasIndicator = true; } if (percentPlayed > 0) { filename += "p=" + percentPlayed; hasIndicator = true; } if (unwatchedCount.HasValue) { filename += "p=" + unwatchedCount.Value; hasIndicator = true; } if (hasIndicator) { filename += "iv=" + IndicatorVersion; } if (!string.IsNullOrEmpty(backgroundColor)) { filename += "b=" + backgroundColor; } return GetCachePath(ResizedImageCachePath, filename, "." + format.ToString().ToLower()); }
/// <summary> /// Update picture in database /// </summary> /// <param name="item">Picture to update</param> /// <returns>Picture info</returns> public PictureExecutionResult UpdatePicture(Model.Picture item) { UpdateSessionCulture(); using (var logSession = Helpers.Log.Session($"{GetType()}.{System.Reflection.MethodBase.GetCurrentMethod().Name}()", VerboseLog, RaiseLog)) try { using (var rep = GetNewRepository(logSession)) { var itm = rep .Get<Repository.Model.File>(p => p.FileId == item.FileId, asNoTracking: true) .LeftOuterJoin(rep.Get<Repository.Model.Picture>(asNoTracking: true), f=>f.FileId, p=>p.FileId, (File,Picture) => new { File, Picture }) .FirstOrDefault(); if (itm == null || itm.File == null) throw new Exception(string.Format(Properties.Resources.FILESERVICE_FileNotFound, item.FileId)); var dbPicture = AutoMapper.Mapper.Map<Repository.Model.Picture>(item); rep.AddOrUpdate(dbPicture, state: (itm.Picture != null ? System.Data.Entity.EntityState.Modified : System.Data.Entity.EntityState.Added) ); } return GetPicture(item.FileId); } catch (Exception ex) { ex.Data.Add(nameof(item), item.ToString()); logSession.Enabled = true; logSession.Add(ex); return new PictureExecutionResult(ex); } }
public static Intermediate.Operand Operand(Model.Register r) { return Operand(r.ToString()); }
/// <summary> /// Sends the async. /// </summary> /// <param name="bytes">The bytes.</param> /// <param name="type">The type.</param> /// <param name="endOfMessage">if set to <c>true</c> [end of message].</param> /// <param name="cancellationToken">The cancellation token.</param> /// <returns>Task.</returns> public Task SendAsync(byte[] bytes, Model.Net.WebSocketMessageType type, bool endOfMessage, CancellationToken cancellationToken) { WebSocketMessageType nativeType; if (!Enum.TryParse(type.ToString(), true, out nativeType)) { _logger.Warn("Unrecognized WebSocketMessageType: {0}", type.ToString()); } return _client.SendAsync(new ArraySegment<byte>(bytes), nativeType, true, cancellationToken); }
/// <summary> /// Create the order specified /// </summary> /// <param name="businessId">business for order</param> /// <param name="order">order to create</param> public void CreateOrder(long businessId, Model.Order.Order order) { // do the sql const string SQL_INSERT = @"DECLARE @CustomerCultureCode nvarchar(11), @CustomerTimezoneId int, @OrderRef nvarchar(11), @BusinessReference nvarchar(10) SELECT @CustomerCultureCode = B.DefaultCultureCode, @CustomerTimezoneId = B.TimezoneId, @BusinessReference = B.ReferenceCode FROM Business.Business as B INNER JOIN Business.BusinessStatus as S ON B.BusinessStatusCode = S.Code WHERE Id = @BusinessId exec booking.GetOrderReference @Reference = @OrderRef out INSERT INTO Booking.Orders (OrderSourceCode, ChannelId, ChannelReference, IntegrationTypeCode, AgentId, OfflineSourceCode, CustomerCultureCode, CustomerCurrencyCode, CustomerTimezoneId, LeadGuestId, UpdatedByUserId, GroupReference, OrderReference, Notes, IsIssue, ReasonForIssue, BusinessReference) VALUES (@OrderSourceCode, @ChannelId, @ChannelReference, @IntegrationTypeCode, @AgentId, @OfflineSourceCode, @CustomerCultureCode, @CustomerCurrencyCode, @CustomerTimezoneId, @LeadGuestId, @UpdatedByUserId, @GroupReference, @OrderRef, @Notes, @IsIssue, @ReasonForIssue, @BusinessReference) SELECT @Id = SCOPE_IDENTITY()"; SqlParameter orderIdParam = DbHelper.CreateParameterOut<int>(OrderMapper.Parameters.Id, System.Data.SqlDbType.Int); var parameters = new List<SqlParameter> { DbHelper.CreateParameter(OrderMapper.Parameters.OrderSourceCode, order.OrderSourceCode), DbHelper.CreateParameter(OrderMapper.Parameters.ChannelId, order.ChannelId), DbHelper.CreateParameter(OrderMapper.Parameters.ChannelReference, order.ChannelReference), DbHelper.CreateParameter(OrderMapper.Parameters.IntegrationTypeCode, order.IntegrationType != null && order.IntegrationType != IntegrationTypeEnum.Unknown ? order.IntegrationType.GetCode() : null), DbHelper.CreateParameter(OrderMapper.Parameters.AgentId, order.AgentId), DbHelper.CreateParameter(OrderMapper.Parameters.OfflineSourceCode, order.OfflineSourceEnum.HasValue ? order.OfflineSourceEnum.GetCode() : null), DbHelper.CreateParameter(OrderMapper.Parameters.CustomerCurrencyCode, order.CustomerCurrencyCode), DbHelper.CreateParameter(BookingMapper.Parameters.BusinessId, businessId), DbHelper.CreateParameter(OrderMapper.Parameters.LeadGuestId, order.LeadGuestId), DbHelper.CreateParameter(OrderMapper.Parameters.GroupReference, order.GroupReference), DbHelper.CreateParameter(OrderMapper.Parameters.Notes, order.Notes), DbHelper.CreateParameter(OrderMapper.Parameters.IsIssue, order.IsIssue), DbHelper.CreateParameter(OrderMapper.Parameters.ReasonForIssue, order.ReasonForIssue), orderIdParam }; AuditFieldsHelper.PopulateAuditFields(parameters); // execute DbHelper.ExecuteNonQueryCommand(SQL_INSERT, System.Data.CommandType.Text, parameters); // Make sure the record was created if (orderIdParam.Value == DBNull.Value) { throw new PrimaryKeyNotSetException(ErrorFactory.CreateAndLogError(Errors.SRVEX30112, "OrderDao.Create", additionalDescriptionParameters: (new object[] { "order", order.ToString() }), descriptionParameters: (new object[] { "order" }))); } // set the id order.Id = DbHelper.ParameterValue<int>(orderIdParam); }