Хабр Курсы для всех
РЕКЛАМА
Практикум, Хекслет, SkyPro, авторские курсы — собрали всех и попросили скидки. Осталось выбрать!
(tr>(td.fls>GEN:FIELDLABEL[name="FieldLabel$"])(td.dfs[style="white-space:nowrap;"]>GEN:FIELDVALUE[NAME="Field$"]))*10
<Tag link="1" name="1" />
<Tag link="2" name="2" />
<Tag link="3" name="3" />
<Tag link="4" name="4" />
<Tag link="5" name="5" />
<Tag link="6" name="6" />
#region "Value Formatting"
private void FormatValues()
{
try
{
DbUtils.StartTransaction();
EmdCreeksAndOtherDamsSampleRecord rec = this.GetRecord();
// format {0}
this.{0}.Text = CommonHelper.ComposeValue(rec, EmdCreeksAndOtherDamsSampleTable.{0}, EmdCreeksAndOtherDamsSampleTable.{1});
}
catch
{
DbUtils.RollBackTransaction();
}
finally
{
DbUtils.EndTransaction();
}
}
#endregion
#region "DataBind"
// Populate the UI controls using the DataSource. To customize, override this method in EmdCreeksAndOtherDamsSampleTableControlRow.
public override void DataBind()
{
base.DataBind();
// Make sure that the DataSource is initialized.
if (this.DataSource == null)
{
return;
}
// For each field, check to see if a value is specified. If a value is specified,
// then format the value for display. If no value is specified, use the default value (formatted).
if (this.DataSource.{0}Specified)
{
string formattedValue = HttpUtility.HtmlEncode(this.DataSource.Format(EmdCreeksAndOtherDamsSampleTable.{0}));
if (formattedValue != null)
{
if (formattedValue.Length > (int)(100))
{
formattedValue = NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, 100));
formattedValue = formattedValue + "...";
}
}
this.{0}.Text = formattedValue;
}
else
{
this.{0}.Text = EmdCreeksAndOtherDamsSampleTable.{0}.Format(EmdCreeksAndOtherDamsSampleTable.{0}.DefaultValue);
}
if (this.{0}.Text == null ||
this.{0}.Text.Trim().Length == 0)
{
this.{0}.Text = " ";
}
}
#endregion
#region "Value Formatting"
private void FormatValues()
{
try
{
DbUtils.StartTransaction();
EmdCreeksAndOtherDamsSampleRecord rec = this.GetRecord();
// format pH
this.pH.Text = CommonHelper.ComposeValue(rec, EmdCreeksAndOtherDamsSampleTable.pH, EmdCreeksAndOtherDamsSampleTable.pHSign);
// format EC
this.EC.Text = CommonHelper.ComposeValue(rec, EmdCreeksAndOtherDamsSampleTable.EC, EmdCreeksAndOtherDamsSampleTable.ECSign);
// format WaterTemp
this.WaterTemp.Text = CommonHelper.ComposeValue(rec, EmdCreeksAndOtherDamsSampleTable.WaterTemp, EmdCreeksAndOtherDamsSampleTable.WaterTempSign);
// format TDS
this.TDS.Text = CommonHelper.ComposeValue(rec, EmdCreeksAndOtherDamsSampleTable.TDS, EmdCreeksAndOtherDamsSampleTable.TDSSign);
// format Turbidity
this.Turbidity.Text = CommonHelper.ComposeValue(rec, EmdCreeksAndOtherDamsSampleTable.Turbidity, EmdCreeksAndOtherDamsSampleTable.TurbiditySign);
// format TSS
this.TSS.Text = CommonHelper.ComposeValue(rec, EmdCreeksAndOtherDamsSampleTable.TSS, EmdCreeksAndOtherDamsSampleTable.TSSSign);
// format Fluoride
this.Fluoride.Text = CommonHelper.ComposeValue(rec, EmdCreeksAndOtherDamsSampleTable.Fluoride, EmdCreeksAndOtherDamsSampleTable.FluorideSign);
// format Chloride
this.Chloride.Text = CommonHelper.ComposeValue(rec, EmdCreeksAndOtherDamsSampleTable.Chloride, EmdCreeksAndOtherDamsSampleTable.ChlorideSign);
// format SO4
this.SO4.Text = CommonHelper.ComposeValue(rec, EmdCreeksAndOtherDamsSampleTable.SO4, EmdCreeksAndOtherDamsSampleTable.SO4Sign);
// format Nitrate
this.Nitrate.Text = CommonHelper.ComposeValue(rec, EmdCreeksAndOtherDamsSampleTable.Nitrate, EmdCreeksAndOtherDamsSampleTable.NitrateSign);
// format Nitrite
this.Nitrite.Text = CommonHelper.ComposeValue(rec, EmdCreeksAndOtherDamsSampleTable.Nitrite, EmdCreeksAndOtherDamsSampleTable.NitriteSign);
// format OilAndGrease
this.OilAndGrease.Text = CommonHelper.ComposeValue(rec, EmdCreeksAndOtherDamsSampleTable.OilAndGrease, EmdCreeksAndOtherDamsSampleTable.OilAndGreaseSign);
}
catch
{
DbUtils.RollBackTransaction();
}
finally
{
DbUtils.EndTransaction();
}
}
#endregion
#region "DataBind"
// Populate the UI controls using the DataSource. To customize, override this method in EmdCreeksAndOtherDamsSampleTableControlRow.
public override void DataBind()
{
base.DataBind();
// Make sure that the DataSource is initialized.
if (this.DataSource == null)
{
return;
}
// For each field, check to see if a value is specified. If a value is specified,
// then format the value for display. If no value is specified, use the default value (formatted).
if (this.DataSource.pHSpecified)
{
string formattedValue = HttpUtility.HtmlEncode(this.DataSource.Format(EmdCreeksAndOtherDamsSampleTable.pH));
if (formattedValue != null)
{
if (formattedValue.Length > (int)(100))
{
formattedValue = NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, 100));
formattedValue = formattedValue + "...";
}
}
this.pH.Text = formattedValue;
}
else
{
this.pH.Text = EmdCreeksAndOtherDamsSampleTable.pH.Format(EmdCreeksAndOtherDamsSampleTable.pH.DefaultValue);
}
if (this.pH.Text == null ||
this.pH.Text.Trim().Length == 0)
{
this.pH.Text = " ";
}
if (this.DataSource.ECSpecified)
{
string formattedValue = HttpUtility.HtmlEncode(this.DataSource.Format(EmdCreeksAndOtherDamsSampleTable.EC));
if (formattedValue != null)
{
if (formattedValue.Length > (int)(100))
{
formattedValue = NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, 100));
formattedValue = formattedValue + "...";
}
}
this.EC.Text = formattedValue;
}
else
{
this.EC.Text = EmdCreeksAndOtherDamsSampleTable.EC.Format(EmdCreeksAndOtherDamsSampleTable.EC.DefaultValue);
}
if (this.EC.Text == null ||
this.EC.Text.Trim().Length == 0)
{
this.EC.Text = " ";
}
if (this.DataSource.WaterTempSpecified)
{
string formattedValue = HttpUtility.HtmlEncode(this.DataSource.Format(EmdCreeksAndOtherDamsSampleTable.WaterTemp));
if (formattedValue != null)
{
if (formattedValue.Length > (int)(100))
{
formattedValue = NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, 100));
formattedValue = formattedValue + "...";
}
}
this.WaterTemp.Text = formattedValue;
}
else
{
this.WaterTemp.Text = EmdCreeksAndOtherDamsSampleTable.WaterTemp.Format(EmdCreeksAndOtherDamsSampleTable.WaterTemp.DefaultValue);
}
if (this.WaterTemp.Text == null ||
this.WaterTemp.Text.Trim().Length == 0)
{
this.WaterTemp.Text = " ";
}
if (this.DataSource.TDSSpecified)
{
string formattedValue = HttpUtility.HtmlEncode(this.DataSource.Format(EmdCreeksAndOtherDamsSampleTable.TDS));
if (formattedValue != null)
{
if (formattedValue.Length > (int)(100))
{
formattedValue = NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, 100));
formattedValue = formattedValue + "...";
}
}
this.TDS.Text = formattedValue;
}
else
{
this.TDS.Text = EmdCreeksAndOtherDamsSampleTable.TDS.Format(EmdCreeksAndOtherDamsSampleTable.TDS.DefaultValue);
}
if (this.TDS.Text == null ||
this.TDS.Text.Trim().Length == 0)
{
this.TDS.Text = " ";
}
if (this.DataSource.TurbiditySpecified)
{
string formattedValue = HttpUtility.HtmlEncode(this.DataSource.Format(EmdCreeksAndOtherDamsSampleTable.Turbidity));
if (formattedValue != null)
{
if (formattedValue.Length > (int)(100))
{
formattedValue = NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, 100));
formattedValue = formattedValue + "...";
}
}
this.Turbidity.Text = formattedValue;
}
else
{
this.Turbidity.Text = EmdCreeksAndOtherDamsSampleTable.Turbidity.Format(EmdCreeksAndOtherDamsSampleTable.Turbidity.DefaultValue);
}
if (this.Turbidity.Text == null ||
this.Turbidity.Text.Trim().Length == 0)
{
this.Turbidity.Text = " ";
}
if (this.DataSource.TSSSpecified)
{
string formattedValue = HttpUtility.HtmlEncode(this.DataSource.Format(EmdCreeksAndOtherDamsSampleTable.TSS));
if (formattedValue != null)
{
if (formattedValue.Length > (int)(100))
{
formattedValue = NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, 100));
formattedValue = formattedValue + "...";
}
}
this.TSS.Text = formattedValue;
}
else
{
this.TSS.Text = EmdCreeksAndOtherDamsSampleTable.TSS.Format(EmdCreeksAndOtherDamsSampleTable.TSS.DefaultValue);
}
if (this.TSS.Text == null ||
this.TSS.Text.Trim().Length == 0)
{
this.TSS.Text = " ";
}
if (this.DataSource.FluorideSpecified)
{
string formattedValue = HttpUtility.HtmlEncode(this.DataSource.Format(EmdCreeksAndOtherDamsSampleTable.Fluoride));
if (formattedValue != null)
{
if (formattedValue.Length > (int)(100))
{
formattedValue = NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, 100));
formattedValue = formattedValue + "...";
}
}
this.Fluoride.Text = formattedValue;
}
else
{
this.Fluoride.Text = EmdCreeksAndOtherDamsSampleTable.Fluoride.Format(EmdCreeksAndOtherDamsSampleTable.Fluoride.DefaultValue);
}
if (this.Fluoride.Text == null ||
this.Fluoride.Text.Trim().Length == 0)
{
this.Fluoride.Text = " ";
}
if (this.DataSource.ChlorideSpecified)
{
string formattedValue = HttpUtility.HtmlEncode(this.DataSource.Format(EmdCreeksAndOtherDamsSampleTable.Chloride));
if (formattedValue != null)
{
if (formattedValue.Length > (int)(100))
{
formattedValue = NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, 100));
formattedValue = formattedValue + "...";
}
}
this.Chloride.Text = formattedValue;
}
else
{
this.Chloride.Text = EmdCreeksAndOtherDamsSampleTable.Chloride.Format(EmdCreeksAndOtherDamsSampleTable.Chloride.DefaultValue);
}
if (this.Chloride.Text == null ||
this.Chloride.Text.Trim().Length == 0)
{
this.Chloride.Text = " ";
}
if (this.DataSource.SO4Specified)
{
string formattedValue = HttpUtility.HtmlEncode(this.DataSource.Format(EmdCreeksAndOtherDamsSampleTable.SO4));
if (formattedValue != null)
{
if (formattedValue.Length > (int)(100))
{
formattedValue = NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, 100));
formattedValue = formattedValue + "...";
}
}
this.SO4.Text = formattedValue;
}
else
{
this.SO4.Text = EmdCreeksAndOtherDamsSampleTable.SO4.Format(EmdCreeksAndOtherDamsSampleTable.SO4.DefaultValue);
}
if (this.SO4.Text == null ||
this.SO4.Text.Trim().Length == 0)
{
this.SO4.Text = " ";
}
if (this.DataSource.NitrateSpecified)
{
string formattedValue = HttpUtility.HtmlEncode(this.DataSource.Format(EmdCreeksAndOtherDamsSampleTable.Nitrate));
if (formattedValue != null)
{
if (formattedValue.Length > (int)(100))
{
formattedValue = NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, 100));
formattedValue = formattedValue + "...";
}
}
this.Nitrate.Text = formattedValue;
}
else
{
this.Nitrate.Text = EmdCreeksAndOtherDamsSampleTable.Nitrate.Format(EmdCreeksAndOtherDamsSampleTable.Nitrate.DefaultValue);
}
if (this.Nitrate.Text == null ||
this.Nitrate.Text.Trim().Length == 0)
{
this.Nitrate.Text = " ";
}
if (this.DataSource.NitriteSpecified)
{
string formattedValue = HttpUtility.HtmlEncode(this.DataSource.Format(EmdCreeksAndOtherDamsSampleTable.Nitrite));
if (formattedValue != null)
{
if (formattedValue.Length > (int)(100))
{
formattedValue = NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, 100));
formattedValue = formattedValue + "...";
}
}
this.Nitrite.Text = formattedValue;
}
else
{
this.Nitrite.Text = EmdCreeksAndOtherDamsSampleTable.Nitrite.Format(EmdCreeksAndOtherDamsSampleTable.Nitrite.DefaultValue);
}
if (this.Nitrite.Text == null ||
this.Nitrite.Text.Trim().Length == 0)
{
this.Nitrite.Text = " ";
}
if (this.DataSource.OilAndGreaseSpecified)
{
string formattedValue = HttpUtility.HtmlEncode(this.DataSource.Format(EmdCreeksAndOtherDamsSampleTable.OilAndGrease));
if (formattedValue != null)
{
if (formattedValue.Length > (int)(100))
{
formattedValue = NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0, 100));
formattedValue = formattedValue + "...";
}
}
this.OilAndGrease.Text = formattedValue;
}
else
{
this.OilAndGrease.Text = EmdCreeksAndOtherDamsSampleTable.OilAndGrease.Format(EmdCreeksAndOtherDamsSampleTable.OilAndGrease.DefaultValue);
}
if (this.OilAndGrease.Text == null ||
this.OilAndGrease.Text.Trim().Length == 0)
{
this.OilAndGrease.Text = " ";
}
}
#endregion
{0}? Вам нужно отредактировать плагин. Плюс в данном конкретном случае проблема не в копипасте, а в архитектуре приложения: в идеале в каждом из методов вместо однообразной портянки должен быть цикл.
Генерация повторяющихся блоков кода с помощью плагина для Sublime Text 2