public ActionResult DeleteRepairRecord(RecordID fc) { var result = RepairRecordBLL.DeleteRecord(fc.ID.ToString()); base.DoLog(OperationTypeEnum.Delete, result, fc.ID.ToString()); return(Json(result)); }
internal void NetSend(BinaryWriter writer, RecordID specificRecord) { writer.Write((int)specificRecord); // We need this for NetRecieve as well if (!specificRecord.HasFlag(RecordID.ResetAll)) // If ResetAll is flagged there is no need to write the rest // Prev records ALWAYS are written. They always update as either record attempts or old records { if (specificRecord.HasFlag(RecordID.ShortestFightTime)) { writer.Write(durationBest); } writer.Write(durationPrev); if (specificRecord.HasFlag(RecordID.LeastHits)) { writer.Write(hitsTakenBest); } writer.Write(hitsTakenPrev); if (specificRecord.HasFlag(RecordID.DodgeTime)) { writer.Write(dodgeTimePrev); } if (specificRecord.HasFlag(RecordID.BestBrink)) { writer.Write(healthLossBest); writer.Write(healthAtStart); } writer.Write(healthLossPrev); writer.Write(healthAtStartPrev); } }
protected void InitialDataBind() { rddlOffice.DataSource = db.Offices .Where(p => p.wsc_id == WSCID) .Select(p => new { office_id = p.office_id, office_nm = p.office_nm }) .OrderBy(p => p.office_nm).ToList(); rddlOffice.DataBind(); rddlOffice.Items.Insert(0, ""); rddlRecords.DataSource = db.Records .Where(p => p.Site.Office.wsc_id == WSCID) .Select(p => new { rms_record_id = p.rms_record_id, SiteRecord = p.Site.site_no + " " + p.Site.station_full_nm + " (" + p.RecordType.type_cd + ")" }) .OrderBy(p => p.SiteRecord).ToList(); rddlRecords.DataBind(); rddlRecords.Items.Insert(0, ""); if (RecordID > 0) { rddlRecords.SelectedValue = RecordID.ToString(); } rdpBeginDt.SelectedDate = Convert.ToDateTime("10/1/" + (DateTime.Now.Year - 1).ToString()); rdpEndDt.SelectedDate = DateTime.Now; ltlNotice1.Visible = true; ltlNotice2.Visible = true; ltlNotice3.Visible = true; ltlError.Visible = false; }
public ActionResult AuditeRepairRecord(RecordID ids) { string[] idslist = ids.idList.Split(','); var result = RepairRecordBLL.AuditeRecord(idslist, base.UserIDForLog); base.DoLog(OperationTypeEnum.Delete, result); return(Json(result)); }
public override int GetHashCode() { unchecked { int result = RecordID.GetHashCode(); result = (result * 397) ^ (Attribute != null ? Attribute.GetHashCode() : 0); result = (result * 397) ^ (Error != null ? Error.GetHashCode() : 0); return(result); } }
internal void NetRecieve(BinaryReader reader, Player player, int boss) { RecordID brokenRecords = (RecordID)reader.ReadInt32(); if (!brokenRecords.HasFlag(RecordID.ResetAll)) { // Determine if a new record was made (Prev records need to change still) bool newRecord = brokenRecords.HasFlag(RecordID.ShortestFightTime) || brokenRecords.HasFlag(RecordID.LeastHits) || brokenRecords.HasFlag(RecordID.BestBrink); kills++; // Kills always increase by 1, since records can only be made when a boss is defeated if (brokenRecords.HasFlag(RecordID.ShortestFightTime)) { durationBest = reader.ReadInt32(); } durationPrev = reader.ReadInt32(); if (brokenRecords.HasFlag(RecordID.LeastHits)) { hitsTakenBest = reader.ReadInt32(); } hitsTakenPrev = reader.ReadInt32(); if (brokenRecords.HasFlag(RecordID.DodgeTime)) { dodgeTimeBest = reader.ReadInt32(); } if (brokenRecords.HasFlag(RecordID.BestBrink)) { healthLossBest = reader.ReadInt32(); healthAtStart = reader.ReadInt32(); } healthLossPrev = reader.ReadInt32(); healthAtStartPrev = reader.ReadInt32(); if (newRecord) { player.GetModPlayer <PlayerAssist>().hasNewRecord[boss] = true; CombatText.NewText(player.getRect(), Color.LightYellow, "New Record!", true); } } else // If ResetAll was flagged, change all variables to their default { kills = deaths = 0; durationBest = durationPrev = -1; hitsTakenBest = hitsTakenPrev = dodgeTimeBest = dodgeTimePrev = -1; healthLossBest = healthLossPrev = healthAtStart = healthAtStartPrev = -1; } }
public override bool Equals(object obj) { Record temp = obj as Record; if (temp == null) { return(false); } return(RecordID.Equals(temp.RecordID) && Amount == temp.Amount && Date == temp.Date && RecordType.Equals(temp.RecordType) && Category.Equals(temp.Category) && //Description.Equals(temp.Description) && // TODO bug fix here, description is null if not set to something IsDeleted == temp.IsDeleted && LastModified == temp.LastModified); }
public CardPaymentInfo GetByID(RecordID id) { CardPaymentRecordSearchCondition con = new CardPaymentRecordSearchCondition(); con.CardID = id.CardID; con.RecordDateTimeRange = new DateTimeRange(id.RecordDateTime, id.RecordDateTime); List <CardPaymentInfo> records = provider.GetItems(con).QueryObjects; if (records.Count == 1) { return(records[0]); } else if (records.Count == 0) { return(null); } else { throw new InvalidCastException(Resource1.CardPaymentRecordBll_notSingle); } }
internal void NetRecieve(BinaryReader reader) { RecordID brokenRecords = (RecordID)reader.ReadInt32(); if (brokenRecords.HasFlag(RecordID.ShortestFightTime)) { durationHolder = reader.ReadString(); durationWorld = reader.ReadInt32(); } if (brokenRecords.HasFlag(RecordID.LeastHits)) { hitsTakenHolder = reader.ReadString(); hitsTakenWorld = reader.ReadInt32(); dodgeTimeWorld = reader.ReadInt32(); } if (brokenRecords.HasFlag(RecordID.BestBrink)) { healthLossHolder = reader.ReadString(); healthLossWorld = reader.ReadInt32(); healthAtStartWorld = reader.ReadInt32(); } }
internal void NetSend(BinaryWriter writer, RecordID specificRecord) { writer.Write((int)specificRecord); // We need this for NetRecieve as well // Packet should have any beaten records written on it if (specificRecord.HasFlag(RecordID.ShortestFightTime)) { writer.Write(durationHolder); writer.Write(durationWorld); } if (specificRecord.HasFlag(RecordID.LeastHits)) { writer.Write(hitsTakenHolder); writer.Write(hitsTakenWorld); writer.Write(dodgeTimeWorld); } if (specificRecord.HasFlag(RecordID.BestBrink)) { writer.Write(healthLossHolder); writer.Write(healthLossWorld); writer.Write(healthAtStartWorld); } }
public string this[string columnName] { get { Error = string.Empty; if (columnName == "Till") { if (Till == null) { Error = "Please select the Till."; } } if (columnName == "Name") { if (string.IsNullOrWhiteSpace(Name)) { Error = "Group Name can't be empty"; } } if (columnName == "RecordID") { if (string.IsNullOrWhiteSpace(RecordID.ToString())) { Error = "Record Id can't be empty"; } else if (RecordID < 1 || RecordID > 256) { Error = "Record Id must be between 1 and 256"; } } return(Error); } }
public void CheckRecordsMultiplayer(NPC npc, int recordIndex) { string[] newRecordHolders = new string[] { "", "", "" }; int[] newWorldRecords = new int[] { WorldAssist.worldRecords[recordIndex].stat.durationWorld, WorldAssist.worldRecords[recordIndex].stat.hitsTakenWorld, WorldAssist.worldRecords[recordIndex].stat.dodgeTimeWorld, WorldAssist.worldRecords[recordIndex].stat.healthLossWorld, WorldAssist.worldRecords[recordIndex].stat.healthAtStartWorld, }; for (int i = 0; i < 255; i++) { Player player = Main.player[i]; // Players must be active AND have interacted with the boss AND cannot have recordingstats disabled if (!player.active || !npc.playerInteraction[i]) { continue; } PlayerAssist modPlayer = player.GetModPlayer <PlayerAssist>(); List <BossStats> list = BossChecklist.ServerCollectedRecords[i]; BossStats oldRecord = list[recordIndex]; // Establish the new records for comparing BossStats newRecord = new BossStats() { durationPrev = modPlayer.RecordTimers[recordIndex], hitsTakenPrev = modPlayer.AttackCounter[recordIndex], dodgeTimePrev = modPlayer.DodgeTimer[recordIndex], healthLossPrev = modPlayer.BrinkChecker[recordIndex], healthAtStartPrev = modPlayer.MaxHealth[recordIndex] }; // Setup player's last fight attempt numbers modPlayer.durationLastFight = newRecord.durationPrev; modPlayer.hitsTakenLastFight = newRecord.hitsTakenPrev; modPlayer.healthLossLastFight = newRecord.healthLossPrev; RecordID specificRecord = RecordID.None; // For each record type we check if its beats the current record or if it is not set already // If it is beaten, we add a flag to specificRecord to allow newRecord's numbers to override the current record if (newRecord.durationPrev < oldRecord.durationBest || oldRecord.durationBest <= 0) { Console.WriteLine($"{player.name} set a new record for DURATION: {newRecord.durationPrev} (Previous Record: {oldRecord.durationBest})"); specificRecord |= RecordID.ShortestFightTime; oldRecord.durationPrev = oldRecord.durationBest; oldRecord.durationBest = newRecord.durationPrev; } else { oldRecord.durationPrev = newRecord.durationPrev; } if (newRecord.hitsTakenPrev < oldRecord.hitsTakenBest || oldRecord.hitsTakenBest < 0) { Console.WriteLine($"{player.name} set a new record for HITS TAKEN: {newRecord.hitsTakenPrev} (Previous Record: {oldRecord.hitsTakenBest})"); specificRecord |= RecordID.LeastHits; oldRecord.hitsTakenPrev = oldRecord.hitsTakenBest; oldRecord.hitsTakenBest = newRecord.hitsTakenPrev; } else { oldRecord.hitsTakenPrev = newRecord.hitsTakenPrev; } if (newRecord.dodgeTimePrev > oldRecord.dodgeTimeBest || oldRecord.dodgeTimeBest <= 0) { Console.WriteLine($"{player.name} set a new record for BEST DODGE TIME: {newRecord.dodgeTimePrev} (Previous Record: {oldRecord.dodgeTimeBest})"); specificRecord |= RecordID.DodgeTime; oldRecord.dodgeTimeBest = newRecord.dodgeTimePrev; } if (newRecord.healthLossPrev > oldRecord.healthLossBest || oldRecord.healthLossBest <= 0) { Console.WriteLine($"{player.name} set a new record for BEST HEALTH: {newRecord.healthLossPrev} (Previous Record: {oldRecord.healthLossBest})"); specificRecord |= RecordID.BestBrink; oldRecord.healthLossPrev = oldRecord.healthLossBest; oldRecord.healthLossBest = newRecord.healthLossPrev; } else { oldRecord.healthLossPrev = newRecord.healthLossPrev; } // Make and send the packet ModPacket packet = mod.GetPacket(); packet.Write((byte)PacketMessageType.RecordUpdate); packet.Write((int)recordIndex); // Which boss record are we changing? newRecord.NetSend(packet, specificRecord); // Writes all the variables needed packet.Send(toClient: i); // We send to the player. Only they need to see their own records } if (newRecordHolders.Any(x => x != "")) { WorldStats worldStats = WorldAssist.worldRecords[recordIndex].stat; RecordID specificRecord = RecordID.None; if (newRecordHolders[0] != "") { specificRecord |= RecordID.ShortestFightTime; worldStats.durationHolder = newRecordHolders[0]; worldStats.durationWorld = newWorldRecords[0]; } if (newRecordHolders[1] != "") { specificRecord |= RecordID.LeastHits; worldStats.hitsTakenHolder = newRecordHolders[1]; worldStats.hitsTakenWorld = newWorldRecords[1]; worldStats.dodgeTimeWorld = newWorldRecords[2]; } if (newRecordHolders[2] != "") { specificRecord |= RecordID.BestBrink; worldStats.healthLossHolder = newRecordHolders[2]; worldStats.healthLossWorld = newWorldRecords[3]; worldStats.healthAtStartWorld = newWorldRecords[4]; } ModPacket packet = mod.GetPacket(); packet.Write((byte)PacketMessageType.WorldRecordUpdate); packet.Write((int)recordIndex); // Which boss record are we changing? worldStats.NetSend(packet, specificRecord); packet.Send(); // To server (world data for everyone) } }
public override void HandlePacket(BinaryReader reader, int whoAmI) { MessageType msgType = (MessageType)reader.ReadByte(); Player player; PlayerAssist modPlayer; switch (msgType) { case MessageType.SendRecordsToServer: player = Main.player[whoAmI]; Console.WriteLine("Receiving boss records from the joined player + " + player.name + "!"); for (int i = 0; i < instance.setup.SortedBosses.Count; i++) { ServerCollectedRecords[whoAmI][i].kills = reader.ReadInt32(); ServerCollectedRecords[whoAmI][i].deaths = reader.ReadInt32(); ServerCollectedRecords[whoAmI][i].fightTime = reader.ReadInt32(); ServerCollectedRecords[whoAmI][i].fightTime2 = reader.ReadInt32(); ServerCollectedRecords[whoAmI][i].brink2 = reader.ReadInt32(); ServerCollectedRecords[whoAmI][i].brink = reader.ReadInt32(); ServerCollectedRecords[whoAmI][i].totalDodges = reader.ReadInt32(); ServerCollectedRecords[whoAmI][i].totalDodges2 = reader.ReadInt32(); ServerCollectedRecords[whoAmI][i].dodgeTime = reader.ReadInt32(); Console.WriteLine("Establishing " + player.name + "'s records for " + instance.setup.SortedBosses[i].name + " to the server"); } break; case MessageType.RecordUpdate: Main.NewText("Record update packet is being handled"); player = Main.LocalPlayer; modPlayer = player.GetModPlayer <PlayerAssist>(); //Server just sent us information about what boss just got killed and its records shall be updated //Since we did packet.Send(toClient: i);, you can use LocalPlayer here RecordID brokenRecords = (RecordID)reader.ReadInt32(); int npcPos = reader.ReadInt32(); BossStats specificRecord = modPlayer.AllBossRecords[npcPos].stat; //RecordID.Kills will just be increased by 1 automatically specificRecord.kills++; if (brokenRecords.HasFlag(RecordID.ShortestFightTime)) { specificRecord.fightTime = reader.ReadInt32(); } if (brokenRecords.HasFlag(RecordID.LongestFightTime)) { specificRecord.fightTime2 = reader.ReadInt32(); } specificRecord.fightTimeL = reader.ReadInt32(); if (brokenRecords.HasFlag(RecordID.BestBrink)) { specificRecord.brink2 = reader.ReadInt32(); specificRecord.brinkPercent2 = reader.ReadInt32(); } if (brokenRecords.HasFlag(RecordID.WorstBrink)) { specificRecord.brink = reader.ReadInt32(); specificRecord.brinkPercent = reader.ReadInt32(); } specificRecord.brinkL = reader.ReadInt32(); specificRecord.brinkPercentL = reader.ReadInt32(); if (brokenRecords.HasFlag(RecordID.LeastHits)) { specificRecord.totalDodges = reader.ReadInt32(); } if (brokenRecords.HasFlag(RecordID.MostHits)) { specificRecord.totalDodges2 = reader.ReadInt32(); } specificRecord.totalDodgesL = reader.ReadInt32(); if (brokenRecords.HasFlag(RecordID.DodgeTime)) { specificRecord.dodgeTime = reader.ReadInt32(); } specificRecord.dodgeTimeL = reader.ReadInt32(); //Main.NewText(ServerCollectedRecords[Main.myPlayer][0].kills + " / " + ServerCollectedRecords[Main.myPlayer][0].deaths); //Main.NewText(ServerCollectedRecords[Main.myPlayer][0].fightTime.ToString()); //Main.NewText(ServerCollectedRecords[Main.myPlayer][0].brink + "(" + ServerCollectedRecords[Main.myPlayer][0].brinkPercent + ")"); //Main.NewText(ServerCollectedRecords[Main.myPlayer][0].totalDodges + "(" + ServerCollectedRecords[Main.myPlayer][0].dodgeTime + ")"); // ORDER MATTERS FOR reader break; case MessageType.DeathCount: Console.WriteLine("Death count packet is being handled"); List <BossRecord> deathRecord = Main.LocalPlayer.GetModPlayer <PlayerAssist>().AllBossRecords; int num = reader.ReadInt32(); for (int i = 0; i < num; i++) { int npcPos2 = reader.ReadInt32(); Console.WriteLine("Recording a death from " + instance.setup.SortedBosses[npcPos2].name); deathRecord[npcPos2].stat.deaths++; } break; } }
public void CheckRecordsMultiplayer(NPC npc) { int recordIndex = SpecialBossCheck(npc); for (int i = 0; i < 255; i++) { Player player = Main.player[i]; PlayerAssist modPlayer = player.GetModPlayer <PlayerAssist>(); if (!player.active || !npc.playerInteraction[i]) { continue; // Players must be active AND have interacted with the boss } if (Main.netMode == NetmodeID.Server) { Console.WriteLine("<<<<<<<<<<<<<<<<<<< Starting the Server NPCLoot stuff"); List <BossStats> list = BossAssist.ServerCollectedRecords[i]; BossStats oldRecord = list[recordIndex]; // Establish the new records for comparing BossStats newRecord = new BossStats() { fightTimeL = modPlayer.RecordTimers[recordIndex], totalDodgesL = modPlayer.AttackCounter[recordIndex], dodgeTimeL = modPlayer.DodgeTimer[recordIndex], brinkL = modPlayer.BrinkChecker[recordIndex], brinkPercentL = (int)(((double)modPlayer.BrinkChecker[recordIndex] / modPlayer.MaxHealth[recordIndex]) * 100), }; Console.WriteLine("<<<<<<<<<<<<<<<<<<< Declared new and old records"); // Compare the records RecordID specificRecord = RecordID.None; if (newRecord.fightTimeL < oldRecord.fightTime) { specificRecord |= RecordID.ShortestFightTime; BossAssist.ServerCollectedRecords[i][recordIndex].fightTime = newRecord.fightTime; } if (newRecord.fightTimeL > oldRecord.fightTime2) { specificRecord |= RecordID.LongestFightTime; BossAssist.ServerCollectedRecords[i][recordIndex].fightTime2 = newRecord.fightTime2; } BossAssist.ServerCollectedRecords[i][recordIndex].fightTimeL = newRecord.fightTimeL; if (newRecord.brink2 > oldRecord.brink2) { specificRecord |= RecordID.BestBrink; BossAssist.ServerCollectedRecords[i][recordIndex].brink2 = newRecord.brink; BossAssist.ServerCollectedRecords[i][recordIndex].brinkPercent2 = newRecord.brinkPercent2; } if (newRecord.brink < oldRecord.brink) { specificRecord |= RecordID.WorstBrink; BossAssist.ServerCollectedRecords[i][recordIndex].brink = newRecord.brink; BossAssist.ServerCollectedRecords[i][recordIndex].brinkPercent = newRecord.brinkPercent; } BossAssist.ServerCollectedRecords[i][recordIndex].brinkL = newRecord.brinkL; BossAssist.ServerCollectedRecords[i][recordIndex].brinkPercentL = newRecord.brinkPercentL; if (newRecord.totalDodges < oldRecord.totalDodges) { specificRecord |= RecordID.LeastHits; BossAssist.ServerCollectedRecords[i][recordIndex].totalDodges = newRecord.totalDodges; } if (newRecord.totalDodges2 > oldRecord.totalDodges2) { specificRecord |= RecordID.MostHits; BossAssist.ServerCollectedRecords[i][recordIndex].totalDodges2 = newRecord.totalDodges2; } BossAssist.ServerCollectedRecords[i][recordIndex].totalDodgesL = newRecord.totalDodgesL; if (newRecord.dodgeTime > oldRecord.dodgeTime) { specificRecord |= RecordID.DodgeTime; BossAssist.ServerCollectedRecords[i][recordIndex].dodgeTime = newRecord.dodgeTime; } BossAssist.ServerCollectedRecords[i][recordIndex].dodgeTimeL = newRecord.dodgeTimeL; Console.WriteLine("<<<<<<<<<<<<<<<<<<< Updated recrods apporiately"); // Make the packet ModPacket packet = mod.GetPacket(); packet.Write((byte)MessageType.RecordUpdate); packet.Write((int)specificRecord); packet.Write((int)recordIndex); // Kills update by 1 automatically // Deaths have to be sent elsewhere (NPCLoot wont run if the player dies) if (specificRecord.HasFlag(RecordID.ShortestFightTime)) { packet.Write(newRecord.fightTime); } if (specificRecord.HasFlag(RecordID.LongestFightTime)) { packet.Write(newRecord.fightTime2); } packet.Write(newRecord.fightTimeL); if (specificRecord.HasFlag(RecordID.BestBrink)) { packet.Write(newRecord.brink2); packet.Write(newRecord.brinkPercent2); } if (specificRecord.HasFlag(RecordID.WorstBrink)) { packet.Write(newRecord.brink); packet.Write(newRecord.brinkPercent); } packet.Write(newRecord.brinkL); packet.Write(newRecord.brinkPercentL); if (specificRecord.HasFlag(RecordID.LeastHits)) { packet.Write(newRecord.totalDodges); } if (specificRecord.HasFlag(RecordID.MostHits)) { packet.Write(newRecord.totalDodges2); } packet.Write(newRecord.totalDodgesL); if (specificRecord.HasFlag(RecordID.DodgeTime)) { packet.Write(newRecord.dodgeTime); } packet.Write(newRecord.dodgeTimeL); Console.WriteLine("<<<<<<<<<<<<<<<<<<< Making Packet"); // ORDER MATTERS packet.Send(toClient: i); Console.WriteLine("<<<<<<<<<<<<<<<<<<< PACKET SENT!"); } } }
protected void LoadRecordList() { if (!string.IsNullOrEmpty(rddlOffice.SelectedValue)) { if (!string.IsNullOrEmpty(rddlFieldTrip.SelectedValue)) { rlbRecords.DataSource = db.Records .Where(p => p.Site.TripSites.Select(t => t.trip_id).Contains(Convert.ToInt32(rddlFieldTrip.SelectedValue))) .Select(p => new { rms_record_id = p.rms_record_id, record_nm = p.Site.site_no + " - " + p.RecordType.type_ds }).ToList(); } else { rlbRecords.DataSource = db.Records .Where(p => p.RecordAltOffice.alt_office_id == Convert.ToInt32(rddlOffice.SelectedValue) || p.Site.office_id == Convert.ToInt32(rddlOffice.SelectedValue)) .Select(p => new { rms_record_id = p.rms_record_id, record_nm = p.Site.site_no + " - " + p.RecordType.type_ds }).ToList(); } } else { rlbRecords.DataSource = db.Records .Where(p => p.Site.Office.wsc_id == WSCID) .Select(p => new { rms_record_id = p.rms_record_id, record_nm = p.Site.site_no + " - " + p.RecordType.type_ds }).ToList(); } rlbRecords.DataBind(); if (RecordID > 0) { RadListBoxItem item1 = rlbRecords.Items.Where(p => p.Value == RecordID.ToString()).FirstOrDefault(); if (item1 != null) { item1.Checked = true; rlbRecords.Items.Remove(item1); rlbRecords.Items.Insert(0, item1); } else { RadListBoxItem item2 = new RadListBoxItem() { Value = RecordID.ToString(), Text = currRecord.Site.site_no + " - " + currRecord.RecordType.type_ds }; item2.Checked = true; rlbRecords.Items.Insert(0, item2); } rlbRecords.SelectedIndex = 0; } if (currAudit != null) { int x = 0; foreach (var rec in currAudit.AuditRecords) { RadListBoxItem item3 = rlbRecords.Items.Where(p => p.Value == rec.rms_record_id.ToString()).FirstOrDefault(); if (item3 != null) { item3.Checked = true; rlbRecords.Items.Remove(item3); rlbRecords.Items.Insert(x, item3); } else { var record = db.Records.FirstOrDefault(p => p.rms_record_id == rec.rms_record_id); RadListBoxItem item4 = new RadListBoxItem() { Value = rec.rms_record_id.ToString(), Text = record.Site.site_no + " - " + record.RecordType.type_ds }; item4.Checked = true; rlbRecords.Items.Insert(x, item4); } x += 1; } } }
/// <summary> /// 通过ID号获取卡片事件 /// </summary> /// <param name="id"></param> /// <returns></returns> public QueryResult <CardEventRecord> GetByID(RecordID id) { return(provider.GetByID(id)); }
protected void SetupAuditForm(string type) { if (type == "single") { if (rlbRecordPeriods.CheckedItems.Count == 0) { ltlAuditDateRange.Text = String.Format("{0:MM/dd/yyyy} - {1:MM/dd/yyyy}", rdpBeginDt1.SelectedDate, rdpEndDt1.SelectedDate); } else { ltlAuditDateRange.Text = String.Format("{0:MM/dd/yyyy} - {1:MM/dd/yyyy}", PeriodDate("begin"), PeriodDate("end")); bool consecutive = false; bool theend = false; foreach (RadListBoxItem item in rlbRecordPeriods.Items) { if (item.Checked && !consecutive) //will enter this part of the statement upon reaching the first checked item { consecutive = true; } else if (!item.Checked && consecutive) //will enter this part of the statement upon reaching the first unchecked item after a checked item { theend = true; } else if (item.Checked && consecutive && theend) //will enter this part of the statement if another checked period is found after a series of checked and unchecked - non-consecutive periods were selected!! { consecutive = false; break; } } if (!consecutive) { pnlNotice.Visible = true; ltlNotice.Text = "<b>You did not select consecutive periods.</b> The audit date range is determined by the earliest selected period begin date and " + "latest selected period end date, and this audit includes all periods within the audit date range."; } } List <RecordItem> rec = new List <RecordItem>(); rec.Add(new RecordItem() { rms_record_id = RecordID.ToString(), record_nm = currRecord.Site.site_no + " - " + currRecord.RecordType.type_ds }); rlbViewRecords.DataSource = rec; rlbViewRecords.DataBind(); } else { ltlAuditDateRange.Text = String.Format("{0:MM/dd/yyyy} - {1:MM/dd/yyyy}", rdpBeginDt2.SelectedDate, rdpEndDt2.SelectedDate); rlbViewRecords.DataSource = rlbRecords.CheckedItems.Select(p => new { rms_record_id = p.Value, record_nm = p.Text }); rlbViewRecords.DataBind(); } rddlAuditType.DataSource = db.AuditTypes.Select(p => new { audit_type_id = p.audit_type_id, description = p.type + ": " + p.description }).ToList(); rddlAuditType.DataBind(); rddlAuditType.Items.Insert(0, new DropDownListItem { Value = "", Text = "" }); rddlAuditResults.DataSource = db.AuditResults.Select(p => new { audit_results_id = p.audit_results_id, description = p.result + p.description }).ToList(); rddlAuditResults.DataBind(); rddlAuditResults.Items.Insert(0, new DropDownListItem { Value = "", Text = "" }); if (currAudit != null) { ltlAuditBy.Text = currAudit.audit_by; rddlAuditResults.SelectedValue = currAudit.audit_results_id.ToString(); rddlAuditType.SelectedValue = currAudit.audit_type_id.ToString(); rbCreateEditAudit.Text = "Edit Audit Period"; rbCreateEditAudit.CommandArgument = "Edit"; } else { ltlAuditBy.Text = user.ID; rddlAuditType.SelectedIndex = 0; rddlAuditResults.SelectedIndex = 0; rbCreateEditAudit.Text = "Create Audit"; rbCreateEditAudit.CommandArgument = "Add"; } }