private static void AssertEqual <T>(T expectedEntity, T actualEntity) { Inspect .This(expectedEntity, actualEntity) .Report(Assert.True) .AreMemberWiseEqual(); }
public void ParamOverridesTest() { string expected = @"<?xml version=""1.0"" encoding=""utf-8""?> <function controlid=""unittest""> <inspect detail=""1""> <object>APBILL</object> </inspect> </function>"; Stream stream = new MemoryStream(); XmlWriterSettings xmlSettings = new XmlWriterSettings(); xmlSettings.Encoding = Encoding.UTF8; xmlSettings.Indent = true; xmlSettings.IndentChars = " "; IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings); Inspect inspect = new Inspect("unittest"); inspect.ObjectName = "APBILL"; inspect.ShowDetail = true; inspect.WriteXml(ref xml); xml.Flush(); stream.Position = 0; StreamReader reader = new StreamReader(stream); Diff xmlDiff = DiffBuilder.Compare(expected).WithTest(reader.ReadToEnd()) .WithDifferenceEvaluator(DifferenceEvaluators.Default) .Build(); Assert.IsFalse(xmlDiff.HasDifferences(), xmlDiff.ToString()); }
public void Does_display_only_specified_html_table_columns() { var rows = new[] { new Table { Id = 1, Name = "A" }, new Table { Id = 2, Name = "B", NInt = 0 }, new Table { Id = 3, Name = "C", DateTime2 = DateTime.MaxValue }, }; var output = Inspect.htmlDump(rows, headers: new[] { "Id", "Int", "Name" }); output.Print(); Assert.That(output.RemoveNewLines(), Is.EqualTo(@" <table class=""table""><thead> <tr><th>Id</th><th>Int</th><th>Name</th></tr> </thead><tbody> <tr><td>1</td><td>0</td><td>A</td></tr> <tr><td>2</td><td>0</td><td>B</td></tr> <tr><td>3</td><td>0</td><td>C</td></tr> </tbody></table> ".RemoveNewLines())); }
protected void Page_PreRender(object sender, System.EventArgs e) { string head_id = Request.QueryString["rowid"].ToString(); string lab_id = Request.QueryString["lab_id"]; string requesturl = string.Format("IPQC_Ra/Lab/LabEdit.aspx?rowid={0}&lab_id={1}", head_id, lab_id); Inspect lab = new Inspect(); lab.GetInfo(lab_id); //手動發mail 給下一關審核者 if (_NotifyReview) { SmoothEnterprise.Database.DataSet ds = new SmoothEnterprise.Database.DataSet(SmoothEnterprise.Database.DataSetType.OpenRead); ds.Open("select REPLACE(requesturl,'EDIT','VIEW') requesturl,b.name name,email,b.id bid, revieweruid , convert(varchar(20), a.initdate,120)'initdate' from dgflowqueue a left join dguser" + " b on revieweruid=b.id where requesturl like '%" + requesturl + "' AND reviewdate IS NULL AND qseq is not null "); if (!ds.EOF) { if (_NotifyType == "Next") { //送審 SendMail(head_id, lab_id, ds["revieweruid"].ToString(), lab_Ra_no.Text, lab.send_date.ToShortDateString()); } else { //退回 SendMail(head_id, lab_id, ds["revieweruid"].ToString(), lab_Ra_no.Text, lab.send_date.ToShortDateString()); } } Response.Redirect("http://" + Request.Url.Authority.ToString() + "/Flowwork/MyApproval.aspx");//回到個人待審頁面 } }
protected void Btn_Stop_Click(object sender, SmoothEnterprise.Flowwork.UI.WebControl.FlowButtonEventArgs e) { string head_id = Request.QueryString["rowid"].ToString(); _status = status.Stop; string lab_id = Request.QueryString["lab_id"]; Inspect lab = new Inspect(); lab.GetInfo(lab_id); lab.UpdateStatus(lab_id, status.Stop); setDisplay(); UpdateGV(); //發通知給目前審核者,說已經中止了 SendMail(head_id, lab_id, _leader, lab_Ra_no.Text, lab.send_date.ToShortDateString()); DBTransfer fs = new DBTransfer(); if (!string.IsNullOrEmpty(lab_id)) { fs.RunIUSql("delete dgflowqueue where requesturl like '%" + lab_id + "%'"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (idInspect != 0)//修改 { btn_Add.Text = "确认修改"; //回填 try { Inspect ins = Inspect.FindById(idInspect); input_RegisterDate.Value = DateTime.Compare((DateTime)ins.Time, new DateTime(1900, 1, 1)) > 0 ? ((DateTime)ins.Time).ToString("yyyy/MM/dd") : ""; TextBox1.Text = ins.Unit; tb_PublishPeriod.Text = ins.Result; if (!ins.PhotoName.IsNullOrEmpty()) { hide_PhotoName.Value = ins.PhotoName; Photo.ImageUrl = "../../upload/photos/" + ins.PhotoName; } } catch (Exception ex) { text(ex.ToString()); Page.ClientScript.RegisterStartupScript(this.GetType(), "alter", "alert('数据加载错误,请重新再试!')", true); } } } }
public override int GetHashCode() { int hash = 1; if (MaidInRoom.Length != 0) { hash ^= MaidInRoom.GetHashCode(); } if (Inspect.Length != 0) { hash ^= Inspect.GetHashCode(); } if (CleanSheetsNotChanged.Length != 0) { hash ^= CleanSheetsNotChanged.GetHashCode(); } if (CleanAndSheetsChanged.Length != 0) { hash ^= CleanAndSheetsChanged.GetHashCode(); } if (Dirty.Length != 0) { hash ^= Dirty.GetHashCode(); } return(hash); }
public void Does_not_display_html_table_columns_with_all_default_values() { var rows = new[] { new Table { Id = 1, Name = "A" }, new Table { Id = 2, Name = "B", NInt = 0 }, new Table { Id = 3, Name = "C", DateTime2 = DateTime.MaxValue }, }; var output = Inspect.htmlDump(rows); Assert.That(output.RemoveNewLines(), Is.EqualTo(@" <table class=""table""><thead> <tr><th>Id</th><th>Name</th><th>DateTime2</th></tr> </thead><tbody> <tr><td>1</td><td>A</td><td>0001-01-01</td></tr> <tr><td>2</td><td>B</td><td>0001-01-01</td></tr> <tr><td>3</td><td>C</td><td>9999-12-31</td></tr> </tbody></table> ".RemoveNewLines())); }
public ResultObj Update(Inspect newObj) { ResultObj resultObj = new ResultObj(); var obj = _context.Inspect.Find(newObj.GId); if (obj == null) { resultObj.IsSuccess = false; resultObj.ErrMsg = "修改对象不存在。"; return(resultObj); } if (IsExistSameNo(newObj)) { resultObj.IsSuccess = false; resultObj.ErrMsg = "编号已存在。"; return(resultObj); } obj.InspectName = newObj.InspectName; obj.InspectNo = newObj.InspectNo; obj.InspectOrderNo = newObj.InspectOrderNo; obj.Remark = newObj.Remark; obj.LastUpdateTime = DateTime.Now; obj.LastUpdateUser = newObj.LastUpdateUser; _context.Inspect.Update(obj); _context.SaveChanges(); resultObj.IsSuccess = true; return(resultObj); }
private void Back() { string head_id = Request.QueryString["rowid"].ToString(); string lab_id = Request.QueryString["lab_id"]; Inspect lab = new Inspect(); lab.GetInfo(lab_id); lab.UpdateStatus(lab_id, status.Back); string requesturl = string.Format("IPQC_Ra/Lab/LabEdit.aspx?rowid={0}&lab_id={1}", head_id, lab_id); using (SmoothEnterprise.Database.DataSet rs = new SmoothEnterprise.Database.DataSet(SmoothEnterprise.Database.DataSetType.OpenUpdate)) { StringBuilder sb = new StringBuilder(); sb.Append(" select top 1 requestuid from eipa.dbo.dgflowlog a "); sb.AppendFormat(" where a.requesturl like '%{0}' ", requesturl); sb.Append(" and revieweruid='00000000-0000-0000-0000-000000000000' "); rs.Open(sb.ToString()); SendMail(head_id, lab_id, rs["requestuid"].ToString(), lab_Ra_no.Text, lab.send_date.ToShortDateString()); DBTransfer fs = new DBTransfer(); if (!string.IsNullOrEmpty(lab_id)) { fs.RunIUSql("delete dgflowqueue where requesturl like '%" + lab_id + "%'"); } } }
private void Complete() { SmoothEnterprise.Database.DataSet ds = new SmoothEnterprise.Database.DataSet(SmoothEnterprise.Database.DataSetType.OpenRead); StringBuilder sql = new StringBuilder(); string head_id = Request.QueryString["rowid"].ToString(); string lab_id = Request.QueryString["lab_id"]; string requesturl = string.Format("IPQC_Ra/Lab/LabEdit.aspx?rowid={0}&lab_id={1}", head_id, lab_id); Inspect lab = new Inspect(); lab.GetInfo(lab_id); lab.UpdateStatus(lab_id, status.Complete); using (SmoothEnterprise.Database.DataSet rs = new SmoothEnterprise.Database.DataSet(SmoothEnterprise.Database.DataSetType.OpenUpdate)) { StringBuilder sb = new StringBuilder(); sb.Append(" select requestuid from eipa.dbo.dgflowqueue a "); sb.AppendFormat(" where a.requesturl like '%{0}' ", requesturl); sb.Append(" and revieweruid <>'00000000-0000-0000-0000-000000000000' "); sb.Append(" order by a.initdate desc "); rs.Open(sb.ToString()); SendMail(head_id, lab_id, rs["requestuid"].ToString(), lab_Ra_no.Text, lab.send_date.ToShortDateString()); } // Response.Redirect("http://" + Request.Url.Authority.ToString() + "/Flowwork/MyApproval.aspx");//回到個人待審頁面 }
public void NoDefaultValueIsGenerated_ExceptForBools() { Inspect .This(thing) .ForAllPrimitives( pi => pi.PropertyType == typeof(bool), (pi, p) => Ensure.False(IsDefaultValue(p), pi.Name)); }
public void NoEmptyStringIsGenerated() { Inspect .This(thing) .ForAllPrimitives( pi => pi.PropertyType == typeof(string), p => Ensure.NotEqual(String.Empty, p)); }
public void NoDefaultValueIsGeneratedForNonIgnoredPrimitives() { Inspect .This(thing) .ForAll( pi => pi.Name != propertyInfo.Name || pi.DeclaringType != propertyInfo.DeclaringType, (pi, p) => Ensure.False(IsDefaultValue(p), pi.Name)); }
public void DefaultValueIsGeneratedForIgnoredPrimitives() { Inspect .This(thing) .ForAll( pi => pi.Name == propertyInfo.Name && pi.DeclaringType == propertyInfo.DeclaringType, (pi, p) => Ensure.True(IsDefaultValue(p), pi.Name)); }
public void AddInspection( ) { AddInspectElement = new AddInspectElementViewModel(_windowManager, _eventAggregator); _windowManager.ShowDialog(AddInspectElement); Inspect temp = new Inspect() { }; }
void HandleInspect(Inspect inspect) { Player player = Global.ObjAccessor.GetPlayer(_player, inspect.Target); if (!player) { Log.outDebug(LogFilter.Network, "WorldSession.HandleInspectOpcode: Target {0} not found.", inspect.Target.ToString()); return; } if (!GetPlayer().IsWithinDistInMap(player, SharedConst.InspectDistance, false)) { return; } if (GetPlayer().IsValidAttackTarget(player)) { return; } InspectResult inspectResult = new InspectResult(); inspectResult.DisplayInfo.Initialize(player); if (GetPlayer().CanBeGameMaster() || WorldConfig.GetIntValue(WorldCfg.TalentsInspecting) + (GetPlayer().GetTeamId() == player.GetTeamId() ? 1 : 0) > 1) { var talents = player.GetTalentMap(player.GetActiveTalentGroup()); foreach (var v in talents) { if (v.Value != PlayerSpellState.Removed) { inspectResult.Talents.Add((ushort)v.Key); } } } Guild guild = Global.GuildMgr.GetGuildById(player.GetGuildId()); if (guild) { inspectResult.GuildData.HasValue = true; InspectGuildData guildData; guildData.GuildGUID = guild.GetGUID(); guildData.NumGuildMembers = guild.GetMembersCount(); guildData.AchievementPoints = (int)guild.GetAchievementMgr().GetAchievementPoints(); inspectResult.GuildData.Set(guildData); } inspectResult.LifetimeMaxRank = player.m_activePlayerData.LifetimeMaxRank; inspectResult.TodayHK = player.m_activePlayerData.TodayHonorableKills; inspectResult.YesterdayHK = player.m_activePlayerData.YesterdayHonorableKills; inspectResult.LifetimeHK = player.m_activePlayerData.LifetimeHonorableKills; inspectResult.HonorLevel = player.m_playerData.HonorLevel; SendPacket(inspectResult); }
public ActionResult Edit(Inspect inspect, Surgery surgery, Internal nal) { db.Entry(inspect).State = System.Data.Entity.EntityState.Modified; db.Entry(surgery).State = System.Data.Entity.EntityState.Modified; db.Entry(nal).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); }
public Spec TheDefaultStringValueIsNull() { return(new Spec( () => Inspect .This(thing) .ForAll( pi => pi.Name == propertyInfo.Name && pi.DeclaringType == propertyInfo.DeclaringType, (pi, p) => Ensure.Null(p, pi.Name))) .If(() => propertyInfo.PropertyType == typeof(string))); }
public List <Inspect> GetInspect() { List <Inspect> list = new List <Inspect>(); Inspect obj = new Inspect(); obj.InspectName = "测试"; obj.InspectNo = "1"; list.Add(obj); return(list); }
protected void Btn_fail_Click(object sender, EventArgs e) { string guid = Request.QueryString["lab_id"].ToString(); _status = status.Fial; Inspect lab = new Inspect(); lab.UpdateStatus(guid, status.Fial); setDisplay(); Response.Write("<script>alert('已經作廢完畢');</script>"); }
static void Main(string[] args) { Inspect funk = new Inspect(); Console.WriteLine($"{funk.GetInspector()}"); Console.WriteLine($"{funk.GenerateNumber("456", "d".ToUpper(), "75")}"); Console.WriteLine($"{funk.GetWorker()}"); Console.WriteLine($"{funk.AddWdorker()}"); Console.ReadLine(); }
/// <summary> /// 创建一条Inspect数据 /// </summary> /// <param name="entity">Inspect 对象</param> public void Create(Inspect entity) { if (entity == null) { throw new ArgumentNullException("inspect is null"); } else { this.context.Inspect.InsertOnSubmit(entity); } }
public void ForAllStrings() { var thing = new Something { MyIntProp = 42, MyStringProp = "ne string" }; var inspector = Inspect.This(thing); var list = new List <object>(); inspector.ForAll(pi => pi.PropertyType == typeof(string), list.Add); Assert.Equal(1, list.Count); Assert.Equal("ne string", list[0]); }
public void ForAllPrimitives() { var thing = new Something { MyIntProp = 42, MyStringProp = "ne string" }; var inspector = Inspect.This(thing); var list = new List <object>(); inspector.ForAllPrimitives(list.Add); Assert.Equal(2, list.Count); Assert.Equal(42, list[0]); Assert.Equal("ne string", list[1]); }
public ActionResult Create(Inspect inspect, Surgery surgery, Internal Int) { var Cus = db.Inspect.Add(inspect); if (Cus.InID != null) { db.Surgery.Add(surgery); db.Internal.Add(Int); db.SaveChanges(); return(RedirectToAction("Index")); } return(View()); }
protected Inspect getLab(string lab_id) { Inspect lab = new Inspect(); if (!string.IsNullOrEmpty(lab_id)) { lab.GetInfo(lab_id); _status = (status)lab.status; pass = lab.result; } return(lab); }
private static void ConfigureInspect(ModComponent modComponent) { if (!modComponent.InspectOnPickup) { return; } Inspect inspect = ModUtils.GetOrCreateComponent <Inspect>(modComponent); inspect.m_DistanceFromCamera = modComponent.InspectDistance; inspect.m_Scale = modComponent.InspectScale; inspect.m_Angles = modComponent.InspectAngles; inspect.m_Offset = modComponent.InspectOffset; }
public static void Main(string[] args) { MetaType mt = typeof(int); var i = 1; var ms = new MyStruct(); var oi = Inspect.Scan(ms, InspectOptions.Fields | InspectOptions.MemoryFields | InspectOptions.Values | InspectOptions.Padding); oi.Dump(); }
public static bool DeleteInspect(int inspectId) { try { DbEntry.UsingTransaction(delegate { Inspect st = Inspect.FindById(inspectId); st.IsDelete = true; st.Save(); }); } catch { return(false); } return(true); }