/// <summary> /// Gets the next interval. /// </summary> /// <param name="attempts">The number of attempts.</param> /// <param name="defaultTimeout">The default timeout.</param> /// <returns>The next interval in ms.</returns> public int GetNextInterval(int attempts, int defaultTimeout) { if (Retry != null && Attrs.Contains("auto-retry")) { return(Retry.GetNextInterval(attempts)); } return(defaultTimeout); }
public void Bind() { #region 生成标题 Entity en = this.HisEn; Map map = this.HisEn.EnMap; Attrs attrs = map.Attrs; bool isFJ = false; if (attrs.Contains("MyFileName")) { isFJ = true; } this.ucsys1.AddTable(); this.ucsys1.AddTR(); this.ucsys1.AddTDTitle(); string str1 = "<INPUT id='checkedAll' onclick='SelectAll(this);' type='checkbox' name='checkedAll'>"; this.ucsys1.AddTDTitle(str1); foreach (Attr attr in attrs) { if (attr.UIVisible == false) { continue; } this.ucsys1.AddTDTitle(attr.Desc); } if (isFJ) { this.ucsys1.AddTDTitle(); } this.ucsys1.AddTREnd(); #endregion 生成标题 this.Page.Title = en.EnDesc; Entities dtls = this.HisEns; QueryObject qo = new QueryObject(dtls); qo.AddWhere(this.RefKey, this.RefVal); #region 生成翻页 this.ucsys2.Clear(); try { this.ucsys2.BindPageIdx(qo.GetCount(), BP.SystemConfig.PageSize, this.PageIdx, "Dtl.aspx?EnName=" + this.EnName + "&PK=" + this.RefVal + "&EnsName=" + this.EnsName + "&RefVal=" + this.RefVal + "&RefKey=" + this.RefKey + "&MainEnsName=" + this.MainEnsName); qo.DoQuery(en.PK, this.PageSize, this.PageIdx, false); } catch { dtls.GetNewEntity.CheckPhysicsTable(); // this.Response.Redirect("Ens.aspx?EnsName=" + this.EnsName + "&RefPKVal=" + this.RefPKVal, true); return; } #endregion 生成翻页 UAC uac = en.HisUAC; if (uac.IsDelete == false) { this.ToolBar1.GetBtnByID(NamesOfBtn.Delete).Enabled = false; } if (uac.IsInsert) { en.PKVal = "0"; dtls.AddEntity(en); } DDL ddl = new DDL(); CheckBox cb = new CheckBox(); bool is1 = false; #region 生成数据 int i = 0; foreach (Entity dtl in dtls) { i++; if (dtl.PKVal == "0" || dtl.PKVal == "") { this.ucsys1.AddTRSum(); this.ucsys1.AddTD("colspan=2", "<b>*</B>"); } else { // is1 = this.ucsys1.AddTR(is1, "ondblclick=\"WinOpen( 'UIEn.aspx?EnsName=" + this.EnsName + "&PK=" + dtl.PKVal + "', 'cd' )\""); is1 = this.ucsys1.AddTR(is1); // is1 = this.ucsys1.AddTR(is1); this.ucsys1.AddTDIdx(i); cb = new CheckBox(); cb.ID = "CB_" + dtl.PKVal; this.ucsys1.AddTD(cb); } foreach (Attr attr in attrs) { if (attr.UIVisible == false) { continue; } if (attr.Key == "OID") { continue; } string val = dtl.GetValByKey(attr.Key).ToString(); switch (attr.UIContralType) { case UIContralType.TB: TB tb = new TB(); this.ucsys1.AddTD(tb); tb.LoadMapAttr(attr); tb.ID = "TB_" + attr.Key + "_" + dtl.PKVal; tb.Attributes["style"] = "width:" + attr.UIWidth + "px;border-width:0px;"; switch (attr.MyDataType) { case DataType.AppMoney: case DataType.AppRate: tb.TextExtMoney = decimal.Parse(val); break; case DataType.AppDate: tb.Text = val.ToString(); tb.ShowType = TBType.Date; if (attr.UIIsReadonly == false) { tb.Attributes["onfocus"] = "WdatePicker();"; } break; case DataType.AppDateTime: tb.Text = val.ToString(); tb.ShowType = TBType.DateTime; if (attr.UIIsReadonly == false) { tb.Attributes["onfocus"] = "WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'});"; } break; default: tb.Text = val; break; } if (attr.IsNum && attr.IsFKorEnum == false) { if (tb.Enabled) { // OnKeyPress="javascript:return VirtyNum(this);" // tb.Attributes["OnKeyDown"] = "javascript:return VirtyNum(this);"; // tb.Attributes["onkeyup"] += "javascript:C" + dtl.PKVal + "();C" + attr.Key + "();"; tb.Attributes["class"] = "TBNum"; } else { // tb.Attributes["onpropertychange"] += "C" + attr.Key + "();"; tb.Attributes["class"] = "TBNumReadonly"; } } break; case UIContralType.DDL: ddl = new DDL(); ddl.ID = "DDL_" + attr.Key + "_" + dtl.PKVal; if (attr.UIIsReadonly == false) { ddl.Items.Add(new ListItem(dtl.GetValRefTextByKey(attr.Key), val)); ddl.Enabled = false; } else { if (attr.IsEnum) { ddl.BindSysEnum(attr.UIBindKey); } else { ddl.BindEntities(attr.HisFKEns, attr.UIRefKeyValue, attr.UIRefKeyText); } } this.ucsys1.AddTD(ddl); ddl.SetSelectItem(val); break; case UIContralType.CheckBok: cb = new CheckBox(); cb.ID = "CB_" + attr.Key + "_" + dtl.PKVal; cb.Text = attr.Desc; if (val == "1") { cb.Checked = true; } else { cb.Checked = false; } this.ucsys1.AddTD("nowarp=true", cb); break; default: break; } } if (isFJ) { string ext = dtl.GetValStrByKey("MyFileExt"); if (ext != "") { this.ucsys1.AddTD("<img src='../Images/FileType/" + ext + ".gif' border=0/>" + dtl.GetValStrByKey("MyFileName")); } } this.ucsys1.AddTREnd(); } #region 生成合计 //this.ucsys1.AddTRSum(); //this.ucsys1.AddTD("colspan=2", "合计"); //foreach (Attr attr in attrs) //{ // if (attr.UIVisible == false) // continue; // if (attr.IsNum && attr.IsFKorEnum == false) // { // TB tb = new TB(); // tb.ID = "TB_" + attr.Key; // tb.Text = attr.DefaultVal.ToString(); // tb.ShowType = attr.HisTBType; // tb.ReadOnly = true; // tb.Font.Bold = true; // tb.BackColor = System.Drawing.Color.FromName("infobackground"); // switch (attr.MyDataType) // { // case DataType.AppRate: // case DataType.AppMoney: // tb.TextExtMoney = dtls.GetSumDecimalByKey(attr.Key); // break; // case DataType.AppInt: // tb.TextExtInt = dtls.GetSumIntByKey(attr.Key); // break; // case DataType.AppFloat: // tb.TextExtFloat = dtls.GetSumFloatByKey(attr.Key); // break; // default: // break; // } // this.ucsys1.AddTD(tb); // } // else // { // this.ucsys1.AddTD(); // } //} //this.ucsys1.AddTD(); //this.ucsys1.AddTREnd(); #endregion 生成合计 #endregion 生成数据 this.ucsys1.AddTableEnd(); }
public bool HasAttr(Attr attr) { return(Attrs != null && Attrs.Contains(attr)); }