protected override void ClearInvalidSubitem() { if (Subitem == null) { return; // nothing to do. } if (!Subitem.IsOwnedBy(CurrentObject)) { Subitem = null; // not valid to try to select it as part of selecting current object. } }
public ActionResult CreateEdit(INTGSTBL Obj) { if (Obj.Typeid == 1) { if (Obj.Qty == 0) { return(Json(new { msg = "Opening Stock Required" })); } } int i = Obj.Save(); foreach (var Subitem in Obj.iNTItems) { Subitem.IParentId = Obj.GSID; Subitem.Save(); } if (i > 0) { return(Json(new { data = Obj }, JsonRequestBehavior.AllowGet)); } return(RedirectToAction("Error")); }
public List <TestSpecViewModel> GetTestSpecs(string source, string content) { var specs = new List <TestSpecViewModel>(); var Subitems = content.Split(';'); foreach (var Subitem in Subitems) { var vals = Subitem.Split(','); if (vals.Length == 5) { bool[] pr = new bool[3]; pr[0] = float.TryParse(vals[1], out float upper); pr[1] = float.TryParse(vals[2], out float lower); pr[2] = float.TryParse(vals[3], out float value); if (pr.Any(x => x == false)) { Events.Publish(new MsgItem() { Level = "D", Time = DateTime.Now, Value = $"Camera date parse error:{Subitem}" }); return(specs); } specs.Add( new TestSpecViewModel() { Name = vals[0], Upper = upper, Lower = lower, Value = value, Result = vals[4].ToUpper().Contains("PASS") ? 1F : -1F, Source = source }); } } return(specs); }
private void CargarPrivilegiosDelUsuario() { try { this.Cursor = Cursors.WaitCursor; ModuloInterfazUsuariosEN oRegistroEN = new ModuloInterfazUsuariosEN(); ModuloInterfazUsuariosLN oRegistroLN = new ModuloInterfazUsuariosLN(); oRegistroEN.oUsuarioEN.idUsuario = Program.oLoginEN.idUsuario; if (oRegistroLN.ListadoPrivilegiosDelUsuariosPorModulo(oRegistroEN, Program.oDatosDeConexion)) { //PRIVILEGIOS A BARRA DE MENÚS foreach (ToolStripMenuItem item in this.menuStrip.Items) { if (item.Tag != null) { if (item.Tag.ToString().Trim().Length > 0) { //item.Enabled = oRegistroLN.VerificarSiTengoAcceso(item.Tag.ToString()); if (item.DropDownItems.Count > 0) { foreach (ToolStripItem Subitem in item.DropDownItems) { if (Subitem.GetType() == typeof(ToolStripMenuItem)) { if (Subitem.Tag != null) { if (Subitem.Tag.ToString().Length > 0) { Subitem.Enabled = oRegistroLN.VerificarSiTengoAccesoDeInterfaz(Subitem.Tag.ToString()); } } else { Subitem.Enabled = false; } } } } } } } foreach (ToolStripItem item in tsMenu.Items) { if (item.Tag != null) { if (item.GetType() == typeof(ToolStripButton)) { item.Enabled = oRegistroLN.VerificarSiTengoAccesoDeInterfaz(item.Tag.ToString()); } } else { item.Enabled = false; } } } else { throw new ArgumentException(oRegistroLN.Error); } this.Cursor = Cursors.Default; } catch (Exception ex) { MessageBox.Show(ex.Message, "Verificacion de Privilegios del Usuario", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } finally { this.Cursor = Cursors.Default; } }
//public IActionResult Index() //{ // return View(); //} public List <fc3D> GetFc3Ds() { var anode = CommonHelper.GetExpect("http://kaijiang.500.com/sd.shtml"); List <fc3D> fc3Ds = new List <fc3D>(); foreach (HtmlNode item in anode) { fc3D fc3D = new fc3D(); List <LotteryInfo> lotteries = new List <LotteryInfo>(); fc3D.expect = item.InnerHtml; if (Convert.ToInt32(item.InnerHtml) == 2018333) { return(fc3Ds); } var html = "http://kaijiang.500.com/shtml/sd/" + item.InnerHtml + ".shtml"; HtmlWeb web = new HtmlWeb(); CommonHelper.Gzip(web); var htmlDoc = web.Load(html); #region 第一个表格 var GameTime = htmlDoc.DocumentNode.SelectNodes("//table[@class='kj_tablelist02']")[0].SelectNodes("tr")[0].SelectSingleNode("//span[@class='span_right']").InnerHtml; fc3D.LotteryDate = GameTime.Split(":")[1].Split('兑')[0]; fc3D.AwardDeadline = GameTime.Split(":")[2]; fc3D.SalesVolume = htmlDoc.DocumentNode.SelectNodes("//table[@class='kj_tablelist02']").FirstOrDefault().SelectNodes("tr")[2].SelectSingleNode("//span[@class='cfont1 ']").InnerHtml.Replace("元", ""); var firstTableNode = htmlDoc.DocumentNode.SelectNodes("//table[@class='kj_tablelist02']")[0].SelectNodes("tr")[1].SelectSingleNode("td").SelectSingleNode("table").SelectSingleNode("tr").SelectNodes("td"); int i = 0; foreach (var Subitem in firstTableNode) { if (i == 0) { i++; continue; } else//第二个开始截取数据 { if (i == 1) { foreach (var Sub_subitem in Subitem.SelectNodes("//li[@class='ball_orange']")) { fc3D.opencode += Sub_subitem.InnerHtml + ","; } fc3D.opencode = fc3D.opencode.Remove(fc3D.opencode.Length - 1, 1); i++; } else if (i == 2) { var textNumber = Subitem.SelectSingleNode("div").InnerHtml.Split(":")[1].Replace(' ', ','); if (textNumber.StartsWith(',')) { fc3D.TestNumber = textNumber.Remove(0, 1); } else { fc3D.TestNumber = textNumber; } i++; } else { fc3D.numberType = Subitem.SelectSingleNode("//font[@class='cfont1']").InnerHtml; i++; } } } #endregion #region 第二个表格 var table_tr = htmlDoc.DocumentNode.SelectNodes("//table[@class='kj_tablelist02']")[1].SelectNodes("tr"); for (int m = 0; m < table_tr.Count; m++)//遍历tr { if (m <= 1) { continue; } else//第二个tr开始爬取数据 { if (m < 21) { if (table_tr[m].SelectNodes("td")[0].OuterHtml.Contains("rowspan")) { for (int n = 0; n < Convert.ToInt32(table_tr[m].SelectNodes("td")[0].Attributes[0].Value); n++)//获取跨越的行 { if (n == 0) { LotteryInfo fc = new LotteryInfo(); fc.Prize = table_tr[m].SelectNodes("td")[0].InnerHtml.Trim(); fc.PrizeSubItem = table_tr[m].SelectNodes("td")[1].InnerHtml.Trim(); fc.BettingCount = table_tr[m].SelectNodes("td")[2].InnerHtml.Trim(); fc.Bonus = table_tr[m].SelectNodes("td")[3].InnerHtml.TrimStart().Trim(); lotteries.Add(fc); } if (n >= 1) { LotteryInfo fc = new LotteryInfo(); fc.Prize = table_tr[m].SelectNodes("td")[0].InnerHtml; fc.PrizeSubItem = table_tr[m + n].SelectNodes("td")[0].InnerHtml.Trim(); fc.BettingCount = table_tr[m + n].SelectNodes("td")[1].InnerHtml.Trim(); fc.Bonus = table_tr[m + n].SelectNodes("td")[2].InnerHtml.Trim(); lotteries.Add(fc); } } m = m + Convert.ToInt32(table_tr[m].SelectNodes("td")[0].Attributes[0].Value) - 1; } else { LotteryInfo fc = new LotteryInfo(); fc.Prize = table_tr[m].SelectNodes("td")[0].InnerHtml.Trim(); fc.BettingCount = table_tr[m].SelectNodes("td")[1].InnerHtml.Trim(); fc.Bonus = table_tr[m].SelectNodes("td")[2].InnerHtml.Trim(); lotteries.Add(fc); } } } } #endregion fc3D.SubItemList = lotteries; fc3Ds.Add(fc3D); } return(fc3Ds); }
private void CargarPrivilegiosDelUsuario() { try { this.Cursor = Cursors.WaitCursor; ModuloInterfazUsuarioEN oRegistroEN = new ModuloInterfazUsuarioEN(); ModuloInterfazUsuarioLN oRegistroLN = new ModuloInterfazUsuarioLN(); oRegistroEN.oUsuarioEN.IdUsuario = Program.oLoginEN.IdUsuario; if (oRegistroLN.ListadoPrivilegiosDelUsuariosPorModulo(oRegistroEN, Program.oDatosDeConexioEN)) { //PRIVILEGIOS A BARRA DE MENÚS foreach (ToolStripMenuItem item in this.menuStrip.Items) { if (item.Tag != null) { if (item.Tag.ToString().Trim().Length > 0) { //item.Enabled = oRegistroLN.VerificarSiTengoAcceso(item.Tag.ToString()); if (item.DropDownItems.Count > 0) { foreach (ToolStripItem Subitem in item.DropDownItems) { if (Subitem.GetType() == typeof(ToolStripMenuItem)) { if (Subitem.Tag != null) { if (Subitem.Tag.ToString().Length > 0) { Subitem.Enabled = oRegistroLN.VerificarSiTengoAccesoDeInterfaz(Subitem.Tag.ToString()); } } else { Subitem.Enabled = false; } } } } } } } /*foreach (ToolStripItem item in tsMenu.Items) * { * if (item.Tag != null) * { * if (item.GetType() == typeof(ToolStripButton)) * { * item.Enabled = oRegistroLN.VerificarSiTengoAccesoDeInterfaz(item.Tag.ToString()); * } * } * else { * item.Enabled = false; * } * }*/ foreach (Control item in splitContainer1.Panel2.Controls) { if (item.GetType() == typeof(System.Windows.Forms.Button)) { Button btn = (Button)item; if (btn.Tag != null) { if (btn.Tag.ToString() == "Débitos" || btn.Tag.ToString() == "Créditos") { btn.Enabled = oRegistroLN.VerificarSiTengoAccesoDeInterfaz("Movimientos"); } else { if (btn.Tag.ToString() == "Reportes del Historico") { btn.Enabled = oRegistroLN.VerificarSiTengoAccesoDeInterfaz("Reportes"); } else { btn.Enabled = oRegistroLN.VerificarSiTengoAccesoDeInterfaz(btn.Tag.ToString().Trim()); } } } else { btn.Enabled = false; } } } } else { throw new ArgumentException(oRegistroLN.Error); } this.Cursor = Cursors.Default; } catch (Exception ex) { MessageBox.Show(ex.Message, "Verificacion de Privilegios del Usuario", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } finally { this.Cursor = Cursors.Default; } }
private void GetFc3Ds() { var anode = CommonHelper.GetExpect("http://kaijiang.500.com/sd.shtml"); var Issue = _digitalLotteryService.Getnormal_lotteryIssue(); List <fc3D> fc3Ds = new List <fc3D>(); foreach (HtmlNode item in anode) { int.TryParse(item.InnerHtml, out int result); if (result >= Convert.ToInt32(Issue)) { fc3D fc3D = new fc3D(); List <LotteryInfo> lotteries = new List <LotteryInfo>(); var htmlDoc = CommonHelper.LoadGziphtml("http://kaijiang.500.com/shtml/sd/" + item.InnerHtml + ".shtml", CollectionUrlEnum.url_500kaijiang); #region 第一个表格 var GameTime = htmlDoc.DocumentNode.SelectNodes("//table[@class='kj_tablelist02']")[0].SelectNodes("tr")[0].SelectSingleNode("//span[@class='span_right']").InnerHtml; fc3D.expect = item.InnerHtml; fc3D.LotteryDate = Convert.ToDateTime(GameTime.Split(":")[1].Split('兑')[0]).ToString("yyyy-MM-dd"); fc3D.AwardDeadline = Convert.ToDateTime(GameTime.Split(":")[2]).ToString("yyyy-MM-dd"); fc3D.SalesVolume = htmlDoc.DocumentNode.SelectNodes("//table[@class='kj_tablelist02']").FirstOrDefault().SelectNodes("tr")[2].SelectSingleNode("//span[@class='cfont1 ']").InnerHtml.Replace("元", ""); var firstTableNode = htmlDoc.DocumentNode.SelectNodes("//table[@class='kj_tablelist02']")[0].SelectNodes("tr")[1].SelectSingleNode("td").SelectSingleNode("table").SelectSingleNode("tr").SelectNodes("td"); int i = 0; foreach (var Subitem in firstTableNode) { if (i == 0) { i++; continue; } else//第二个开始截取数据 { if (i == 1) { foreach (var Sub_subitem in Subitem.SelectNodes("//li[@class='ball_orange']")) { fc3D.opencode += Sub_subitem.InnerHtml + ","; } fc3D.opencode = fc3D.opencode.Remove(fc3D.opencode.Length - 1, 1); i++; } else if (i == 2) { var textNumber = Subitem.SelectSingleNode("div").InnerHtml.Split(":")[1].Replace(' ', ','); if (textNumber.StartsWith(',')) { fc3D.TestNumber = textNumber.Remove(0, 1); } else { fc3D.TestNumber = textNumber; } i++; } else { fc3D.numberType = Subitem.SelectSingleNode("//font[@class='cfont1']").InnerHtml; i++; } } } #endregion #region 第二个表格 var table_tr = htmlDoc.DocumentNode.SelectNodes("//table[@class='kj_tablelist02']")[1].SelectNodes("tr"); for (int m = 0; m < table_tr.Count; m++)//遍历tr { if (m <= 1) { continue; } else//第二个tr开始爬取数据 { if (m < 19) { if (table_tr[m].SelectNodes("td")[0].OuterHtml.Contains("rowspan")) { for (int n = 0; n < Convert.ToInt32(table_tr[m].SelectNodes("td")[0].Attributes[0].Value); n++)//获取跨越的行 { if (n == 0) { LotteryInfo fc = new LotteryInfo(); fc.Prize = table_tr[m].SelectNodes("td")[0].InnerHtml.Trim(); fc.PrizeSubItem = table_tr[m].SelectNodes("td")[1].InnerHtml.Trim(); fc.BettingCount = table_tr[m].SelectNodes("td")[2].InnerHtml.Trim(); fc.Bonus = table_tr[m].SelectNodes("td")[3].InnerHtml.TrimStart().Trim(); lotteries.Add(fc); } if (n >= 1) { LotteryInfo fc = new LotteryInfo(); fc.Prize = table_tr[m].SelectNodes("td")[0].InnerHtml; fc.PrizeSubItem = table_tr[m + n].SelectNodes("td")[0].InnerHtml.Trim(); fc.BettingCount = table_tr[m + n].SelectNodes("td")[1].InnerHtml.Trim(); fc.Bonus = table_tr[m + n].SelectNodes("td")[2].InnerHtml.Trim(); lotteries.Add(fc); } } m = m + Convert.ToInt32(table_tr[m].SelectNodes("td")[0].Attributes[0].Value) - 1; } else { LotteryInfo fc = new LotteryInfo(); fc.Prize = table_tr[m].SelectNodes("td")[0].InnerHtml.Trim(); fc.BettingCount = table_tr[m].SelectNodes("td")[1].InnerHtml.Trim(); fc.Bonus = table_tr[m].SelectNodes("td")[2].InnerHtml.Trim(); lotteries.Add(fc); } } } } #endregion fc3D.SubItemList = lotteries; fc3Ds.Add(fc3D); _digitalLotteryService.Addnormal_lotterydetail(fc3Ds); } } }