protected virtual string FormatCommentOn(string sql) { StringBuilder result = new StringBuilder(60).Append(Indent1); IEnumerator<string> tokens = (new StringTokenizer(sql, " '[]\"", true)).GetEnumerator(); bool quoted = false; while (tokens.MoveNext()) { string token = tokens.Current; result.Append(token); if (IsQuote(token)) { quoted = !quoted; } else if (!quoted) { if ("is".Equals(token)) { result.Append(Indent2); } } } return result.ToString(); }
protected void Page_Load(object sender, EventArgs e) { ReciboBE reciboBE; //if (Session["ReciboBE"] != null) //{ reciboBE = Session["ReciboBE"] as ReciboBE; //} CarregaProfissional(Convert.ToInt32(reciboBE.RefProfissionalBE.id)); lblReciboNumero.Text = Convert.ToString(reciboBE.id); lblValorTotalCabecalho.Text = String.Format("{0:C2}", reciboBE.ValorTotal); lblValorTotal.Text = String.Format("{0:C2}", reciboBE.ValorTotal); lblSessoesQtd.Text = Convert.ToString(reciboBE.RefReciboAgendamentoSessoesBE.Count.ToString("00")); lblPacienteNome.Text = Convert.ToString(reciboBE.PacienteNome); //Pego a possicao zero da lista de sessooes lblValorSessao.Text = String.Format("{0:C2}", reciboBE.RefReciboAgendamentoSessoesBE[0].Valor); StringBuilder sb = new System.Text.StringBuilder(); for (int i = 0; i < reciboBE.RefReciboAgendamentoSessoesBE.Count; i++) { if (i > 0) sb.Append(", "); sb.Append(reciboBE.RefReciboAgendamentoSessoesBE[i].Data.ToString("dd/MM/yyyy")); } lblDatas.Text = Convert.ToString(sb); DataExtenso(); }
protected virtual string FormatAlterTable(string sql) { StringBuilder result = new StringBuilder(60).Append(Indent1); IEnumerator<string> tokens = (new StringTokenizer(sql, " (,)'[]\"", true)).GetEnumerator(); bool quoted = false; while (tokens.MoveNext()) { string token = tokens.Current; if (IsQuote(token)) { quoted = !quoted; } else if (!quoted) { if (IsBreak(token)) { result.Append(Indent3); } } result.Append(token); } return result.ToString(); }
internal override StringBuilder AsNegatedUserString(StringBuilder builder, string blockAlias, bool skipIsNotNull) { builder.Append("NOT("); builder = AsUserString(builder, blockAlias, skipIsNotNull); builder.Append(")"); return builder; }
public static object MediaHelper(string image) { var sb = new StringBuilder(); sb.Append(ConfigurationManager.AppSettings["MediaPath"]); sb.Append(image); return new MvcHtmlString(sb.ToString()); }
public override void AsText(StringBuilder b, int pad) { b.Append(' ', pad); b.AppendLine("JewelerDataInitialMessage:"); b.Append(' ', pad++); b.Append(CrafterData.ToString()); }
internal override StringBuilder AsEsql(StringBuilder builder, bool isTopLevel, int indentLevel) { // The SELECT/DISTINCT part. StringUtil.IndentNewLine(builder, indentLevel); builder.Append("SELECT "); if (m_selectDistinct == CellQuery.SelectDistinct.Yes) { builder.Append("DISTINCT "); } GenerateProjectionEsql(builder, m_nodeTableAlias, true, indentLevel, isTopLevel); // Get the FROM part. builder.Append("FROM "); CqlWriter.AppendEscapedQualifiedName(builder, m_extent.EntityContainer.Name, m_extent.Name); builder.Append(" AS ").Append(m_nodeTableAlias); // Get the WHERE part only when the expression is not simply TRUE. if (!BoolExpression.EqualityComparer.Equals(WhereClause, BoolExpression.True)) { StringUtil.IndentNewLine(builder, indentLevel); builder.Append("WHERE "); WhereClause.AsEsql(builder, m_nodeTableAlias); } return builder; }
public string Replace (string str) { if (string.IsNullOrEmpty (str)) { return str; } System.Text.StringBuilder formatted = new System.Text.StringBuilder (); int lastMatch = 0; string variable; string replacement; foreach (System.Text.RegularExpressions.Match m in re.Matches(str)) { formatted.Append (str.Substring (lastMatch, m.Index - lastMatch)); variable = m.Groups [1].Value; if (vars.TryGetValue (variable, out replacement)) formatted.Append (this.Replace (replacement)); else throw new ObfuscarException("Unable to replace variable: " + variable); lastMatch = m.Index + m.Length; } formatted.Append (str.Substring (lastMatch)); return formatted.ToString (); }
/// <exception cref="MyException"></exception> public void Inserir(ICliente cliente, ILog log) { var sql = new StringBuilder(); var tblLog = new TblClientesLog(); sql.AppendFormat(" INSERT INTO {0} ({1},{2},{3}", tblLog.NomeTabela, tblLog.Clientes_Id, tblLog.Clientes_Nome, tblLog.Clientes_Status_Id); sql.AppendFormat(",{0},{1},{2})", tblLog.Usuarios_Id, tblLog.Operacao_Id, tblLog.DataHora); sql.Append(" VALUES (@id,@nome,@status_id"); sql.Append(",@usuarios_id,@operacao_id,@datahora);"); using (var dal = new DalHelperSqlServer()) { try { dal.CriarParametroDeEntrada("id", SqlDbType.Int, cliente.Id); dal.CriarParametroDeEntrada("nome", SqlDbType.Char, cliente.Nome); dal.CriarParametroDeEntrada("status_id", SqlDbType.SmallInt, cliente.Status.GetHashCode()); dal.CriarParametroDeEntrada("usuarios_id", SqlDbType.Int, log.Usuario.Id); dal.CriarParametroDeEntrada("operacao_id", SqlDbType.SmallInt, log.Operacao.GetHashCode()); dal.CriarParametroDeEntrada("datahora", SqlDbType.DateTime, log.DataHora); dal.ExecuteNonQuery(sql.ToString()); } catch (SqlException) { throw new MyException("Operação não realizada, por favor, tente novamente!"); } } }
public string ReadNext(bool peek = false) { var isInQuote = false; var curToken = new StringBuilder(); int i; for (i = 0; i < _cmd.Length; i++) { if (isInQuote && _cmd[i] == '"' && i < _cmd.Length - 1 && _cmd[i + 1] == '"') { curToken.Append('"'); i++; continue; } if (isInQuote == false && _cmd[i] == '"') isInQuote = true; else if (isInQuote && _cmd[i] == '"') { i++; break; } else if (_cmd[i] == ' ' && isInQuote == false) break; else curToken.Append(_cmd[i]); } if (peek == false) { _cmd = _cmd.Substring(i); _cmd = _cmd.TrimStart(); } return curToken.ToString(); }
private static StringBuilder ParseRoute(IEnumerator<char> tokenizer, StringBuilder routePattern, IDictionary<string, string> routeParametersVsNamedGroup, IList<string> queryParameters) { char nextCharacterInRoute = tokenizer.Current; if (nextCharacterInRoute == '{') { tokenizer.MoveNext(); return ParseRouteParameter(tokenizer, routePattern, routeParametersVsNamedGroup, queryParameters); } else if (nextCharacterInRoute == '?') { routePattern.Append(Regex.Escape(nextCharacterInRoute.ToString(CultureInfo.InvariantCulture))); tokenizer.MoveNext(); return ParseQueryStringParameters(tokenizer, routePattern, queryParameters); } else { routePattern.Append(Regex.Escape(nextCharacterInRoute.ToString(CultureInfo.InvariantCulture))); if (tokenizer.MoveNext()) return ParseRoute(tokenizer, routePattern, routeParametersVsNamedGroup, queryParameters); else return routePattern; } }
public override string ToString() { if (invariant) { if (invariant_result) return "PivotsExpression.TrueExpression"; else return "PivotsExpression.FalseExpression"; } StringBuilder res = new StringBuilder(); bool first_combination = true; foreach (var combination in matching_combinations) { if (!first_combination) res.Append("|"); res.Append("("); bool first_value = true; foreach (var item in combination) { if (!first_value) res.Append(","); res.Append(item); first_value = false; } res.Append(")"); first_combination = false; } return res.ToString(); }
public static string ToCsv(this DataTable dataTable) { var sbData = new StringBuilder(); // Only return Null if there is no structure. if (dataTable.Columns.Count == 0) return null; foreach (var col in dataTable.Columns) { if (col == null) sbData.Append(","); else sbData.Append("\"" + col.ToString().Replace("\"", "\"\"") + "\","); } sbData.Replace(",", System.Environment.NewLine, sbData.Length - 1, 1); foreach (DataRow dr in dataTable.Rows) { foreach (var column in dr.ItemArray) { if (column == null) sbData.Append(","); else sbData.Append("\"" + column.ToString().Replace("\"", "\"\"") + "\","); } sbData.Replace(",", System.Environment.NewLine, sbData.Length - 1, 1); } return sbData.ToString(); }
public static object MediaHelper(string image, int width, int height, bool forceFit) { var sb = new StringBuilder(); sb.Append(MediaHelper(image)); sb.Append(string.Format("?width={0}&height={1}&force={2}", width, height,forceFit)); return sb.ToString(); }
private string Postfix(string prefix) { var result = new StringBuilder(prefix); result.Append(TileDirectionUtil.GetChar(Direction)); result.Append(TurnDirectionUtil.GetChar(Turn)); return result.ToString(); }
public override void Write(StringBuilder builder, int index) { if (index > 0) builder.Append('.'); builder.Append(property); }
private static string Get2000() { StringBuilder sql = new StringBuilder(); sql.Append("SELECT groupname as name, convert(int,groupid) AS [ID],is_default=convert(bit,status & 16),is_read_only=convert(bit,status & 8),'FG' as type "); sql.Append("FROM sysfilegroups ORDER BY groupname"); return sql.ToString(); }
/// <summary> /// Processes the specified arguments. /// </summary> /// <param name="args">The arguments.</param> public virtual void Process(PipelineArgs args) { Assert.ArgumentNotNull(args, "args"); ShoppingCart shoppingCart = Context.Entity.GetInstance<ShoppingCart>(); PaymentProvider paymentProvider = Context.Entity.Resolve<PaymentProvider>(shoppingCart.PaymentSystem.Code); PaymentUrlResolver paymentUrlResolver = new PaymentUrlResolver(); PaymentArgs paymentArgs = new PaymentArgs { ShoppingCart = shoppingCart, PaymentUrls = paymentUrlResolver.Resolve(), }; StringBuilder description = new StringBuilder(); foreach (ShoppingCartLine shoppingCartLine in shoppingCart.ShoppingCartLines) { description.Append(shoppingCartLine.Product.Title); description.Append(", "); } paymentArgs.Description = description.ToString().Trim().TrimEnd(','); paymentProvider.Invoke(shoppingCart.PaymentSystem, paymentArgs); args.AbortPipeline(); }
public void CanReadCompleContent() { // Arrange var content = "This is"; var sb = new StringBuilder(); var sr = new StreamReader(content.ToStream()); var lab = new CharBuffer(() => { int read = sr.Read(); return read != -1 ? new char?((char)read) : new char?(); }, 3); // Act while (lab.HasNext()) { sb.Append(lab.PeekAt(0)); lab.Consume(); } sb.Append(lab.PeekAt(0)); // Assert sb.ToString().Should().Be(content); }
public static string BuildSql([NotNull] this IEnumerable<SearchCondition> conditions, bool surroundWithParathesis) { var sb = new StringBuilder(); conditions.ForEachFirst( (item, isFirst) => { sb.Append(" "); if (!isFirst) { sb.Append(item.ConditionType.GetStringValue()); sb.Append(" "); } if (surroundWithParathesis) { sb.AppendFormat("({0})", (object)item.Condition); } else { sb.Append((string)item.Condition); } }); return sb.ToString(); }
/// <summary> /// Gets the method body without definition and curly braces. /// </summary> public string GetMethodBody() { StringBuilder buffer = new StringBuilder(512); var signature = MethodSignature.GetIndexSignature(_index); buffer.AppendLine("using (var connection = GetReadOnlyConnection())"); buffer.AppendLine("{"); buffer.AppendLine("connection.Open();"); buffer.AppendFormat("return connection.Query<{0}>(\"SELECT * FROM {1} WHERE ", _index.Table.EntityName, _index.Table.FullName); buffer.Append(string.Join(" AND ", signature.Parameters.Select(p => p.Key + " = @" + p.Key))); buffer.Append("\", new { "); buffer.Append(string.Join(", ", signature.Parameters.Select(p => p.Key))); if (!_index.Unique) buffer.AppendLine(" });"); else buffer.AppendLine(" }).FirstOrDefault();"); buffer.AppendLine("}"); return buffer.ToString(); }
internal static string EscapeDisplayName(string internalName) { // initial capacity = length of internalName. // Maybe we won't have to escape anything. var res = new Text.StringBuilder(internalName.Length); foreach (char c in internalName) { switch (c) { case '+': case ',': case '[': case ']': case '*': case '&': case '\\': res.Append('\\').Append(c); break; default: res.Append(c); break; } } return(res.ToString()); }
public string FormatHtml(object data) { const string keywordFormat = "<span style=\"color: #0000FF\">{0}</span>"; const string typeFormat = "<span style=\"color: #2B91AF\">{0}</span>"; var methodInfo = (MethodInfo)data; var sb = new StringBuilder(); var declaringType = methodInfo.DeclaringType; sb.AppendFormat("{0} {1}.{2} {{ ", string.Format(keywordFormat, "class"), declaringType.Namespace, string.Format(typeFormat, declaringType.Name)); AppendAccess(methodInfo, sb, keywordFormat); if (methodInfo.IsVirtual) { sb.AppendFormat(keywordFormat, "virtual"); sb.Append(" "); } AppendMethodName(methodInfo, sb); sb.Append(" (...)"); sb.Append("}}"); return sb.ToString(); }
private static string PascalCaseToElement(string input) { if (string.IsNullOrEmpty(input)) { return null; } var result = new StringBuilder(); result.Append(char.ToLowerInvariant(input[0])); for (var i = 1; i < input.Length; i++) { if (char.IsLower(input[i])) { result.Append(input[i]); } else { result.Append("_"); result.Append(char.ToLowerInvariant(input[i])); } } return result.ToString(); }
public void AddTableEle(TableEle tableEle, params string[] cols) { if (cols != null && cols.Length > 0) { StringBuilder th = new StringBuilder(""); ITableItemStrategy item = TableFactoryMethod.GetTableItem(tableEle); for (int i = 0; i < cols.Length; i++) { //### commented in order to render the cell regardless of null or empty string //if(!"".Equals(cols[i])){ th.Append("\n" + item.Middle.Replace("{value}", cols[i])); //} } if (!"".Equals(th.ToString())) { th.Insert(0, item.Top); th.Append(item.Bottom); } string finalResult = SetUpRepeatTableHeaderOnEveryPage(th); _txt.Append(finalResult); //final result appended } }
//public static void WriteErrFile(Exception es,string type) //{ // try // { // System.Text.StringBuilder sb = new System.Text.StringBuilder(""); // sb.Append("������Ϣ��"); // sb.Append(es.Message); // sb.Append("\n\r"); // sb.Append("����ԭ��"); // sb.Append(es.Source); // sb.Append("\n\r"); // sb.Append("����λ�ã�"); // sb.Append(es.StackTrace); // sb.Append("\n\r"); // sb.Append("���������"); // sb.Append(es.TargetSite); // sb.Append("\n\r"); // sb.Append("����ʱ�䣺"); // sb.Append(DateTime.Now); // sb.Append("\n\r"); // //string content = ""; // //FileStream aFile = new FileStream(Util.GetMapPath("~") + @"\errinfo.txt", FileMode.OpenOrCreate); // //StreamReader dd = new StreamReader(aFile); // //content = dd.ReadToEnd(); // StreamWriter sw = new StreamWriter(Utils.GetMapPath("~") + @"\errinfo.txt", true); // sw.Write(sb.ToString()); // sw.Flush(); // sw.Close(); // XYECOM. // string url = ""; // if (type == "user") // { // url = wci.WebURL +"user/errinfo."+wci.Suffix+"?"; // } // else if (type == "xyecom") // { // url = wci.WebURL + "xymanage/err.aspx?"; // } // else if (type == "index") // { // url = wci.WebURL + "page404." + wci.Suffix + "?"; // } // else if (type == "person") // { // url = wci.WebURL + "person/errinfo." + wci.Suffix + "?"; // } // //�Դ�����Դ�����ж� // if (es.Source.ToString().IndexOf(".Net SqlClient Data Provider") >= 0) // url += "key=002"; // else // url += "key=003"; // System.Web.HttpContext.Current.Response.Redirect(url,true ); // } // catch (Exception ex) // { // throw ex; // } //} public static void WriteErrFile(Exception es) { try { System.Text.StringBuilder sb = new System.Text.StringBuilder(""); sb.Append("������Ϣ��"); sb.Append(es.Message); sb.Append("\n\r"); sb.Append("����ԭ��"); sb.Append(es.Source); sb.Append("\n\r"); sb.Append("����λ�ã�"); sb.Append(es.StackTrace); sb.Append("\n\r"); sb.Append("���������"); sb.Append(es.TargetSite); sb.Append("\n\r"); sb.Append("����ʱ�䣺"); sb.Append(DateTime.Now); sb.Append("\n\r"); //string content = ""; //FileStream aFile = new FileStream(Util.GetMapPath("~") + @"\errinfo.txt", FileMode.OpenOrCreate); //StreamReader dd = new StreamReader(aFile); //content = dd.ReadToEnd(); StreamWriter sw = new StreamWriter(Utils.GetMapPath("~") + @"\errinfo.txt", true); sw.Write(sb.ToString()); sw.Flush(); sw.Close(); } catch (Exception ex) { throw ex; } }
public CreationInfo(string customMessage, IEnumerable <Exception> innerExceptions) { var exceptions = new List <Exception>(); var result = new Text.StringBuilder(string.Format(_baseMessage, customMessage)); var first = true; _exception = null; foreach (var exception in innerExceptions) { if (exception == null) { throw new ArgumentException("An element of innerExceptions is null."); } if (first) { _exception = exception; first = false; } exceptions.Add(exception); result.Append(Environment.NewLine); result.Append("[ "); result.Append(exception); result.Append(" ]"); result.Append(Environment.NewLine); } _string = result.ToString(); _innerExceptions = exceptions.AsReadOnly(); }
/// <summary> /// Generates the VPS Signature from the parameters of the POST. /// </summary> public virtual string GenerateSignature(string securityKey, string vendorName) { var builder = new StringBuilder(); builder.Append(VPSTxId); builder.Append(VendorTxCode); builder.Append(Status.ToString().ToUpper()); builder.Append(TxAuthNo); builder.Append(vendorName.ToLower()); builder.Append(AVSCV2); builder.Append(securityKey); builder.Append(AddressResult); builder.Append(PostCodeResult); builder.Append(CV2Result); builder.Append(GiftAid); builder.Append(ThreeDSecureStatus); builder.Append(CAVV); builder.Append(AddressStatus); builder.Append(PayerStatus); builder.Append(CardType); builder.Append(Last4Digits); builder.Append(DeclineCode); builder.Append(ExpiryDate); builder.Append(FraudResponse); builder.Append(BankAuthCode); var hash = FormsAuthentication.HashPasswordForStoringInConfigFile(builder.ToString(), "MD5"); return hash; }
public static string EvaluateRelativePath(string mainDirPath, string absoluteFilePath) { string first = mainDirPath.ToUpper().Substring(0, 2); if (first == "\\\\" || first != absoluteFilePath.ToUpper().Substring(0, 2)) return absoluteFilePath; if (mainDirPath[mainDirPath.Length - 1] != '\\') mainDirPath += "\\"; StringBuilder sb = new StringBuilder(); while (mainDirPath.Length > 0) { if (!absoluteFilePath.ToUpper().StartsWith(mainDirPath.ToUpper())) { sb.Append("..\\"); int i = mainDirPath.LastIndexOf("\\"); if (i == mainDirPath.Length - 1) { mainDirPath = mainDirPath.Remove(i, 1); i = mainDirPath.LastIndexOf("\\"); } mainDirPath = mainDirPath.Remove(i + 1, mainDirPath.Length - i - 1); } else { absoluteFilePath = absoluteFilePath.Remove(0, mainDirPath.Length); mainDirPath = ""; } } sb.Append(absoluteFilePath); return sb.ToString(); }
private static string Get2008() { StringBuilder sql = new StringBuilder(); sql.Append("SELECT name, data_space_id AS [ID], is_default, is_read_only, type "); sql.Append("FROM sys.filegroups ORDER BY name"); return sql.ToString(); }
private static string GetFilesInFileGroup2000(FileGroup filegroup) { StringBuilder sql = new StringBuilder(); sql.Append("select convert(int,fileid) as file_id,type=convert(tinyint,(status&64)/64),name,filename as physical_name,size,maxsize as max_size,growth,convert(bit,0) as is_sparse,is_percent_growth =convert(bit,status & 1048576) "); sql.Append("FROM sysfiles where groupid="+filegroup.Id.ToString()); return sql.ToString(); }
private static string GetFilesInFileGroup2008(FileGroup filegroup) { StringBuilder sql = new StringBuilder(); sql.Append("select file_id,type,name,physical_name,size,max_size,growth,is_sparse,is_percent_growth "); sql.Append("from sys.database_files WHERE data_space_id = " + filegroup.Id.ToString()); return sql.ToString(); }
public static String Concat(String str0, String str1) { var sb = new Text.StringBuilder(); sb.Append(str0); sb.Append(str1); return(sb.ToString()); }
public Text.StringBuilder Append(Text.StringBuilder sb) { if (bound) { return(sb.Append("[*]")); } return(sb.Append('[') .Append(',', dimensions - 1) .Append(']')); }
/// <summary> /// Generates a full line with the given character. Used to create clear visual separation /// </summary> /// <param name="character">the character to fill the line with</param> public static void FillLine(char character) { var s = new Text.StringBuilder("\r", width + 2); for (var n = 0; n < width; n++) { s.Append(character); } s.Append("\b\n"); Console.Write(s); }
/// <summary> /// An extension method to join an array of strings with a separator. Sort of a fluent /// interface for System.string.Join. /// </summary> /// <param name="parts">The strings to join.</param> /// <param name="separator">The separator to insert between each string value. Defaults to the empty string.</param> /// <returns>The joined string.</returns> public static string Join(this string[] parts, string separator) { if (parts is null) { throw new ArgumentNullException(nameof(parts)); } if (parts.Length == 0) { return(string.Empty); } if (separator is null) { separator = string.Empty; } var sb = new Text.StringBuilder(parts[0]); for (var i = 1; i < parts.Length; ++i) { sb.Append(separator) .Append(parts[i]); } return(sb.ToString()); }
//using S=System.Console;using System.Linq;class C{static void Main(){int M=int.Parse(S.ReadLine().Split()[0]),m=0,i,j;int[]a={};var s=a.ToList();try{for(i=0;;){j=int.Parse(S.ReadLine());m=i++<M&&j>m?j:m;if(j<=m)s.Add(j);}}catch{}var l=a.ToList();for(i=s.Count;--i>=M;){for(j=i;j>=M;l.Add(s[i]*s[j--]));}l.Sort();for(i=0;i<M;++i,S.WriteLine(j))for(m=0;(j=l[m++]-s[i])<0;);}} /// ac //using S=System.Console;using System.Text;using System.Linq;class C{static void Main(){int M=int.Parse(S.ReadLine().Split()[0]),m=0,i,j;int[]a={};var s=a.ToList();try{for(i=0;;){j=int.Parse(S.ReadLine());m=i++<M&&j>m?j:m;if(j<=m)s.Add(j);}}catch{}var l=a.ToList();for(i=s.Count;--i>=M;){for(j=i;j>=M;l.Add(s[i]*s[j--]));}l.Sort();var b=new StringBuilder();for(i=0;i<M;++i){for(m=0;(j=l[m++]-s[i])<0;);b.Append(j.ToString()+"\n");}S.Write(b.ToString());}} /// ac //using S=System.Console;using System.Linq;class C{static void Main(){int M=int.Parse(S.ReadLine().Split()[0]),m=0,i,j;int[]a={};var b=a.ToList();try{for(i=0;;){j=int.Parse(S.ReadLine());m=i++<M&&j>m?j:m;if(j<=m)b.Add(j);}}catch{}var c=a.ToList();for(i=b.Count;--i>=M;){for(j=i;j>=M;c.Add(b[i]*b[j--]));}c.Sort();var s=new System.Text.StringBuilder();for(i=0;i<M;++i){for(m=0;(j=c[m++]-b[i])<0;);s.Append(j+"\n");}S.Write(s);}} namespace System { using S = Console; using Linq; class C { static void Main() { int M = int.Parse(S.ReadLine().Split()[0]), m = 0, i, j; int[] a = { }; var b = a.ToList(); try{ for (i = 0;;) { j = int.Parse(S.ReadLine()); m = i++ < M && j > m?j:m; if (j <= m) { b.Add(j); } } }catch {} var c = a.ToList(); for (i = b.Count; --i >= M;) { for (j = i; j >= M; c.Add(b[i] * b[j--])) { ; } } c.Sort(); var s = new Text.StringBuilder(); for (i = 0; i < M; ++i) { for (m = 0; (j = c[m++] - b[i]) < 0;) { ; } s.Append(j + "\n"); } S.Write(s); }
public static String Concat(params String[] values) { var sb = new Text.StringBuilder(); foreach (var value in values) { sb.Append(value); } return(sb.ToString()); }
/** * */ private static string htmlContato(List <LogEmailDestino> listaDestinos) { System.Text.StringBuilder html = new Text.StringBuilder(); //listaDestinos = listaDestinos.DistinctBy(x => x.emailDestino).ToList(); listaDestinos = listaDestinos.ToList(); listaDestinos.ForEach(item => { if (!String.IsNullOrEmpty(item.nomeDestino) && !item.nomeDestino.Equals(item.emailDestino)) { html.Append(String.Concat(item.nomeDestino, " <", item.emailDestino, "> ")); } else { html.Append(item.emailDestino); } html.Append("; "); }); return(html.ToString()); }
private Text.StringBuilder GetModifierString(Text.StringBuilder sb) { if (modifier_spec != null) { foreach (IModifierSpec?md in modifier_spec) { md.Append(sb); } } if (is_byref) { sb.Append('&'); } return(sb); }
internal static string UnescapeInternalName(string displayName) { var res = new Text.StringBuilder(displayName.Length); for (int i = 0; i < displayName.Length; ++i) { char c = displayName[i]; if (c == '\\') { if (++i < displayName.Length) { c = displayName[i]; } } res.Append(c); } return(res.ToString()); }
string GetDisplayFullName(DisplayNameFormat flags) { bool wantAssembly = (flags & DisplayNameFormat.WANT_ASSEMBLY) != 0; bool wantModifiers = (flags & DisplayNameFormat.NO_MODIFIERS) == 0; var sb = new Text.StringBuilder(name.DisplayName); if (nested != null) { foreach (var n in nested) { sb.Append('+').Append(n.DisplayName); } } if (generic_params != null) { sb.Append('['); for (int i = 0; i < generic_params.Count; ++i) { if (i > 0) { sb.Append(", "); } if (generic_params [i].assembly_name != null) { sb.Append('[').Append(generic_params [i].DisplayFullName).Append(']'); } else { sb.Append(generic_params [i].DisplayFullName); } } sb.Append(']'); } if (wantModifiers) { GetModifierString(sb); } if (assembly_name != null && wantAssembly) { sb.Append(", ").Append(assembly_name); } return(sb.ToString()); }
private string GenerateJsonString(System.Collections.Generic.IList <AttributeInfo> attributes, System.Data.DataTable tbBrandCategories) { System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); System.Text.StringBuilder stringBuilder2 = new System.Text.StringBuilder(); System.Text.StringBuilder stringBuilder3 = new System.Text.StringBuilder(); System.Text.StringBuilder stringBuilder4 = new System.Text.StringBuilder(); bool flag = false; bool flag2 = false; bool flag3 = false; if (attributes != null && attributes.Count > 0) { stringBuilder2.Append("\"Attributes\":["); stringBuilder3.Append("\"SKUs\":["); foreach (AttributeInfo current in attributes) { if (current.UsageMode == AttributeUseageMode.Choose) { flag2 = true; stringBuilder3.Append("{"); stringBuilder3.AppendFormat("\"Name\":\"{0}\",", current.AttributeName); stringBuilder3.AppendFormat("\"AttributeId\":\"{0}\",", current.AttributeId.ToString(System.Globalization.CultureInfo.InvariantCulture)); stringBuilder3.AppendFormat("\"UseAttributeImage\":\"{0}\",", current.UseAttributeImage ? 1 : 0); stringBuilder3.AppendFormat("\"SKUValues\":[{0}]", this.GenerateValueItems(current.AttributeValues)); stringBuilder3.Append("},"); } else if (current.UsageMode == AttributeUseageMode.View || current.UsageMode == AttributeUseageMode.MultiView) { flag = true; stringBuilder2.Append("{"); stringBuilder2.AppendFormat("\"Name\":\"{0}\",", current.AttributeName); stringBuilder2.AppendFormat("\"AttributeId\":\"{0}\",", current.AttributeId.ToString(System.Globalization.CultureInfo.InvariantCulture)); stringBuilder2.AppendFormat("\"UsageMode\":\"{0}\",", ((int)current.UsageMode).ToString()); stringBuilder2.AppendFormat("\"AttributeValues\":[{0}]", this.GenerateValueItems(current.AttributeValues)); stringBuilder2.Append("},"); } } if (stringBuilder2.Length > 14) { stringBuilder2.Remove(stringBuilder2.Length - 1, 1); } if (stringBuilder3.Length > 8) { stringBuilder3.Remove(stringBuilder3.Length - 1, 1); } stringBuilder2.Append("]"); stringBuilder3.Append("]"); } if (tbBrandCategories != null && tbBrandCategories.Rows.Count > 0) { flag3 = true; stringBuilder4.AppendFormat("\"BrandCategories\":[{0}]", this.GenerateBrandString(tbBrandCategories)); } stringBuilder.Append("{\"HasAttribute\":\"" + flag.ToString() + "\","); stringBuilder.Append("\"HasSKU\":\"" + flag2.ToString() + "\","); stringBuilder.Append("\"HasBrandCategory\":\"" + flag3.ToString() + "\","); if (flag) { stringBuilder.Append(stringBuilder2.ToString()).Append(","); } if (flag2) { stringBuilder.Append(stringBuilder3.ToString()).Append(","); } if (flag3) { stringBuilder.Append(stringBuilder4.ToString()).Append(","); } stringBuilder.Remove(stringBuilder.Length - 1, 1); stringBuilder.Append("}"); return(stringBuilder.ToString()); }
public static object InvokeWebService(string url, string classname, string methodname, object[] args) { string @namespace = "EnterpriseServerBase.WebService.DynamicWebCalling"; if ((classname == null) || (classname == "")) { classname = WebServiceHelper.GetWsClassName(url); } try { //获取WSDL WebClient wc = new WebClient(); Stream stream = wc.OpenRead(url + "?WSDL"); ServiceDescription sd = ServiceDescription.Read(stream); ServiceDescriptionImporter sdi = new ServiceDescriptionImporter(); sdi.AddServiceDescription(sd, "", ""); CodeNamespace cn = new CodeNamespace(@namespace); //生成客户端代理类代码 CodeCompileUnit ccu = new CodeCompileUnit(); ccu.Namespaces.Add(cn); sdi.Import(cn, ccu); CSharpCodeProvider csc = new CSharpCodeProvider(); ICodeCompiler icc = csc.CreateCompiler(); //设定编译参数 CompilerParameters cplist = new CompilerParameters(); cplist.GenerateExecutable = false; cplist.GenerateInMemory = true; cplist.ReferencedAssemblies.Add("System.dll"); cplist.ReferencedAssemblies.Add("System.XML.dll"); cplist.ReferencedAssemblies.Add("System.Web.Services.dll"); cplist.ReferencedAssemblies.Add("System.Data.dll"); //编译代理类 CompilerResults cr = icc.CompileAssemblyFromDom(cplist, ccu); if (true == cr.Errors.HasErrors) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); foreach (System.CodeDom.Compiler.CompilerError ce in cr.Errors) { sb.Append(ce.ToString()); sb.Append(System.Environment.NewLine); } throw new Exception(sb.ToString()); } //生成代理实例,并调用方法 System.Reflection.Assembly assembly = cr.CompiledAssembly; Type t = assembly.GetType(@namespace + "." + classname, true, true); object obj = Activator.CreateInstance(t); System.Reflection.MethodInfo mi = t.GetMethod(methodname); return(mi.Invoke(obj, args)); } catch (Exception ex) { throw new Exception(ex.InnerException.Message, new Exception(ex.InnerException.StackTrace)); } }
protected void Page_Load(object sender, EventArgs e) { Master.Title = "推荐注册排行榜"; int meid = new BCW.User.Users().GetUsId(); int ptype = int.Parse(Utils.GetRequest("ptype", "get", 1, @"^[0-2]\d*$", "0")); int Year = int.Parse(Utils.GetRequest("Year", "get", 1, @"^(?:19[3-9]\d|20[01]\d)$", "0")); int Month = int.Parse(Utils.GetRequest("Month", "get", 1, @"^(?:[0]?[1-9]|1[012])$", "0")); if (Year < 2010) Year = 0; builder.Append(Out.Tab("<div class=\"title\">", "")); if (Year == 0 || Month == 0) { if (ptype == 0) builder.Append("总榜|"); else builder.Append("<a href=\"" + Utils.getPage("recomuser.aspx?backurl=" + Utils.getPage(0) + "") + "\">总榜</a>|"); if (ptype == 1) builder.Append("本月|"); else builder.Append("<a href=\"" + Utils.getPage("recomuser.aspx?ptype=1&backurl=" + Utils.getPage(0) + "") + "\">本月</a>|"); if (ptype == 2) builder.Append("上月"); else builder.Append("<a href=\"" + Utils.getPage("recomuser.aspx?ptype=2&backurl=" + Utils.getPage(0) + "") + "\">上月</a>"); } else { builder.Append("<a href=\"" + Utils.getPage("recomuser.aspx?backurl=" + Utils.getPage(0) + "") + "\">总榜</a>|" + Year + "年" + Month + "月"); ptype = 3; } builder.Append(Out.Tab("</div>", "<br />")); int pageIndex; int recordCount; int pageSize = 20;// Convert.ToInt32(ub.Get("SiteListNo")); string strWhere = ""; string[] pageValUrl = {"ptype", "Year", "Month", "backurl" }; pageIndex = Utils.ParseInt(Request.QueryString["page"]); if (pageIndex == 0) pageIndex = 1; //查询条件 if (ptype == 1) strWhere = "Year(RegTime)=" + DateTime.Now.Year + " and Month(RegTime)=" + DateTime.Now.Month + " and "; else if (ptype == 2) { DateTime ForDate = DateTime.Parse(DateTime.Now.AddMonths(-1).ToShortDateString()); int ForYear = ForDate.Year; int ForMonth = ForDate.Month; strWhere = "Year(RegTime) = " + (ForYear) + " AND Month(RegTime) = " + (ForMonth) + " and "; } else if (ptype == 3) strWhere = "(Year(RegTime) = " + Year + ") AND (Month(RegTime) = " + Month + ") and "; strWhere += "InviteNum>0 and IsVerify=1"; // 开始读取列表 IList<BCW.Model.User> listUser = new BCW.BLL.User().GetInvites(pageIndex, pageSize, strWhere, out recordCount); if (listUser.Count > 0) { int k = 1; foreach (BCW.Model.User n in listUser) { if (k % 2 == 0) builder.Append(Out.Tab("<div class=\"text\">", "<br />")); else { if (k == 1) builder.Append(Out.Tab("<div>", "")); else builder.Append(Out.Tab("<div>", "<br />")); } builder.Append("<a href=\"" + Utils.getUrl("uinfo.aspx?uid=" + n.ID + "&backurl=" + Utils.PostPage(1) + "") + "\">" + BCW.User.Users.SetUser(n.ID) + "(" + n.InviteNum + "人)</a>"); k++; builder.Append(Out.Tab("</div>", "")); } // 分页 builder.Append(BasePage.MultiPage(pageIndex, pageSize, recordCount, Utils.getPageUrl(), pageValUrl, "page", 1)); } else { builder.Append(Out.Div("div", "没有相关记录..")); } if (pageIndex == 1) { builder.Append(Out.Tab("<div class=\"text\">", Out.Hr())); builder.Append("按月份查询:"); builder.Append(Out.Tab("</div>", "<br />")); string strText = "年,月:,"; string strName = "Year,Month,backurl"; string strType = "snum,snum,hidden"; string strValu = "" + DateTime.Now.Year + "'" + DateTime.Now.Month + "'" + Utils.getPage(0) + ""; string strEmpt = "true,true,false"; string strIdea = ""; string strOthe = "查询,recomuser.aspx,get,3,red"; builder.Append(Out.wapform(strText, strName, strType, strValu, strEmpt, strIdea, strOthe)); if (meid > 0) { builder.Append(Out.Tab("<div>", "<br />")); builder.Append("您的推荐地址:<br /><a href=\"http://" + Utils.GetDomain() + "/reg-" + meid + ".aspx\">http://" + Utils.GetDomain() + "/reg-" + meid + ".aspx</a>"); builder.Append(Out.Tab("</div>", "")); } } builder.Append(Out.Tab("<div class=\"title\">", Out.Hr())); builder.Append("<a href=\"" + Utils.getUrl("/default.aspx") + "\">首页</a>-"); builder.Append("<a href=\"" + Utils.getPage("uinfo.aspx") + "\">上级</a>"); builder.Append(Out.Tab("</div>", "")); }
private static void WriteString(System.Text.StringBuilder sb, string s) { sb.Append("\""); sb.Append(s.Replace("\"", "“")); sb.Append("\"" + s + "\""); int i = 0; while (i < s.Length) { char c = s[i]; char c2 = c; switch (c2) { case '\b': sb.Append("\\b"); break; case '\t': sb.Append("\\t"); break; case '\n': sb.Append("\\n"); break; case '\v': goto IL_E8; case '\f': sb.Append("\\f"); break; case '\r': sb.Append("\\r"); break; default: if (c2 != '"') { if (c2 != '\\') { goto IL_E8; } sb.Append("\\\\"); } else { sb.Append("\\\""); } break; } IL_122: i++; continue; IL_E8: int num = (int)c; if (num < 32 || num > 127) { sb.AppendFormat("\\u{0:X04}", num); } else { sb.Append(c); } goto IL_122; } sb.Append("\""); }
void DisplayStatusBar() { GUILayout.BeginHorizontal(); if (BrowserUtility.localBranchNames != null) { int currentBranch = EditorGUILayout.Popup(BrowserUtility.localBranchIndex, BrowserUtility.localBranchNames, EditorStyles.toolbarPopup, GUILayout.Width(150)); if (currentBranch != BrowserUtility.localBranchIndex) { DisplaySwitchBranchPopup(currentBranch); } } #region status strings var sb = new System.Text.StringBuilder(); bool clean = true; if (BrowserUtility.addedFileCount > 0) { sb.Append(BrowserUtility.addedFileCount).Append(" added"); clean = false; } if (BrowserUtility.copiedFileCount > 0) { sb.Append(' ').Append(BrowserUtility.copiedFileCount).Append(" copied"); clean = false; } if (BrowserUtility.deletedFileCount > 0) { sb.Append(' ').Append(BrowserUtility.deletedFileCount).Append(" deleted"); clean = false; } if (BrowserUtility.modifiedFileCount > 0) { sb.Append(' ').Append(BrowserUtility.modifiedFileCount).Append(" modified"); clean = false; } if (BrowserUtility.renamedFileCount > 0) { sb.Append(' ').Append(BrowserUtility.renamedFileCount).Append(" renamed"); clean = false; } if (BrowserUtility.unmergedFileCount > 0) { sb.Append(' ').Append(BrowserUtility.unmergedFileCount).Append(" unmerged"); clean = false; } if (BrowserUtility.untrackedFileCount > 0) { sb.Append(' ').Append(BrowserUtility.untrackedFileCount).Append(" untracked"); clean = false; } if (clean) { sb.Append("Clean"); } #endregion GUILayout.Label(sb.ToString(), EditorStyles.toolbarButton, GUILayout.ExpandWidth(true)); if (viewMode != BrowserViewMode.ArtistMode) { if (VersionControl.versionControlType == VersionControlType.Git) { GUI.color = BrowserUtility.stagedFiles.Count > 0 ? Color.red : Color.white; string stagedString = BrowserUtility.stagedFiles.Count > 0 ? "S (" + BrowserUtility.stagedFiles.Count + ")" : "S"; bool showStagedFilesTemp = GUILayout.Toggle(showStagedFiles, stagedString, EditorStyles.toolbarButton, GUILayout.Width(40)); GUI.color = Color.white; if (showStagedFilesTemp != showStagedFiles) { showStagedFiles = showStagedFilesTemp; EditorPrefs.SetBool("UnityVersionControl.ShowStagedFiles", showStagedFiles); verticalResizeWidget1 = Mathf.Clamp(verticalResizeWidget1, 60, position.height - 180); Repaint(); } } bool showDiffTemp = GUILayout.Toggle(showDiff, "D", EditorStyles.toolbarButton, GUILayout.Width(40)); if (showDiffTemp != showDiff) { showDiff = showDiffTemp; EditorPrefs.SetBool("UnityVersionControl.ShowDiff", showDiff); horizontalResizeWidget1 = Mathf.Clamp(horizontalResizeWidget1, 80, position.width - 80); Repaint(); } } GUILayout.EndHorizontal(); }
private DataTable GetConstraintInformation() { DataTable table = new DataTable(); System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append(" select object_name(constid) CONSTRAINT_NAME, "); sb.Append(" db_name() TABLE_CATALOG, user_name(o1.uid) TABLE_SCHEMA, o1.name TABLE_NAME, c1.name COLUMN_NAME,"); sb.Append(" db_name() REF_TABLE_CATALOG, user_name(o2.uid) REF_TABLE_SCHEMA, o2.name REF_TABLE_NAME, c2.name REF_COLUMN_NAME"); sb.Append(" from sysforeignkeys a"); sb.Append(" INNER JOIN syscolumns c1"); sb.Append(" ON a.fkeyid = c1.id"); sb.Append(" AND a.fkey = c1.colid"); sb.Append(" INNER JOIN syscolumns c2"); sb.Append(" ON a.rkeyid = c2.id"); sb.Append(" AND a.rkey = c2.colid"); sb.Append(" INNER JOIN sysobjects o1"); sb.Append(" ON c1.id = o1.id"); sb.Append(" INNER JOIN sysobjects o2"); sb.Append(" ON c2.id = o2.id"); //sb.Append(" WHERE constid in ("); //sb.Append(" SELECT object_id(CONSTRAINT_NAME)"); //sb.Append(" FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS)"); base.OpenConnection(); try { SqlConnection cn = (SqlConnection)Connection; using (SqlCommand cmd = cn.CreateCommand()) { cmd.CommandText = sb.ToString(); cmd.CommandType = CommandType.Text; using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(table); } } } finally { base.CloseConnection(); } return(table); }
/// <summary> /// Returns a copy of the given string with text replaced using a regular expression. /// </summary> /// <param name="input"> The string on which to perform the search. </param> /// <param name="replaceText"> A string containing the text to replace for every successful match. </param> /// <returns> A copy of the given string with text replaced using a regular expression. </returns> public string Replace(string input, string replaceText) { // Check if the replacement string contains any patterns. bool replaceTextContainsPattern = replaceText.IndexOf('$') >= 0; // Replace the input string with replaceText, recording the last match found. Match lastMatch = null; string result = this.value.Replace(input, match => { lastMatch = match; // If there is no pattern, replace the pattern as is. if (replaceTextContainsPattern == false) { return(replaceText); } // Patterns // $$ Inserts a "$". // $& Inserts the matched substring. // $` Inserts the portion of the string that precedes the matched substring. // $' Inserts the portion of the string that follows the matched substring. // $n or $nn Where n or nn are decimal digits, inserts the nth parenthesized submatch string, provided the first argument was a RegExp object. var replacementBuilder = new System.Text.StringBuilder(); for (int i = 0; i < replaceText.Length; i++) { char c = replaceText[i]; if (c == '$' && i < replaceText.Length - 1) { c = replaceText[++i]; if (c == '$') { replacementBuilder.Append('$'); } else if (c == '&') { replacementBuilder.Append(match.Value); } else if (c == '`') { replacementBuilder.Append(input.Substring(0, match.Index)); } else if (c == '\'') { replacementBuilder.Append(input.Substring(match.Index + match.Length)); } else if (c >= '0' && c <= '9') { int matchNumber1 = c - '0'; // The match number can be one or two digits long. int matchNumber2 = 0; if (i < replaceText.Length - 1 && replaceText[i + 1] >= '0' && replaceText[i + 1] <= '9') { matchNumber2 = matchNumber1 * 10 + (replaceText[i + 1] - '0'); } // Try the two digit capture first. if (matchNumber2 > 0 && matchNumber2 < match.Groups.Count) { // Two digit capture replacement. replacementBuilder.Append(match.Groups[matchNumber2].Value); i++; } else if (matchNumber1 > 0 && matchNumber1 < match.Groups.Count) { // Single digit capture replacement. replacementBuilder.Append(match.Groups[matchNumber1].Value); } else { // Capture does not exist. replacementBuilder.Append('$'); i--; } } else { // Unknown replacement pattern. replacementBuilder.Append('$'); replacementBuilder.Append(c); } } else { replacementBuilder.Append(c); } } return(replacementBuilder.ToString()); }, this.Global == true ? -1 : 1); // Set the deprecated RegExp properties if at least one match was found. if (lastMatch != null) { this.Engine.RegExp.SetDeprecatedProperties(input, lastMatch); } return(result); }
void FormatText(ref string _targetString, string _source) { if (formatting == false || wordWrapWidth == 0 || _fontInst.texelSize == Vector2.zero) { _targetString = _source; return; } float lineWidth = _fontInst.texelSize.x * wordWrapWidth; System.Text.StringBuilder target = new System.Text.StringBuilder(_source.Length); float widthSoFar = 0.0f; float wordStart = 0.0f; int targetWordStartIndex = -1; int fmtWordStartIndex = -1; bool ignoreNextCharacter = false; for (int i = 0; i < _source.Length; ++i) { char idx = _source[i]; tk2dFontChar chr; bool inlineHatChar = (idx == '^'); if (_fontInst.useDictionary) { if (!_fontInst.charDict.ContainsKey(idx)) idx = (char)0; chr = _fontInst.charDict[idx]; } else { if (idx >= _fontInst.chars.Length) idx = (char)0; // should be space chr = _fontInst.chars[idx]; } if (inlineHatChar) idx = '^'; if (ignoreNextCharacter) { ignoreNextCharacter = false; continue; } if (data.inlineStyling && idx == '^' && i + 1 < _source.Length) { if (_source[i + 1] == '^') { ignoreNextCharacter = true; target.Append('^'); // add the second hat that we'll skip } else { int cmdLength = GetInlineStyleCommandLength(_source[i + 1]); int skipLength = 1 + cmdLength; // The ^ plus the command for (int j = 0; j < skipLength; ++j) { if (i + j < _source.Length) { target.Append(_source[i + j]); } } i += skipLength - 1; continue; } } if (idx == '\n') { widthSoFar = 0.0f; wordStart = 0.0f; targetWordStartIndex = target.Length; fmtWordStartIndex = i; } else if (idx == ' '/* || idx == '.' || idx == ',' || idx == ':' || idx == ';' || idx == '!'*/) { /*if ((widthSoFar + chr.p1.x * data.scale.x) > lineWidth) { target.Append('\n'); widthSoFar = chr.advance * data.scale.x; } else {*/ widthSoFar += (chr.advance + data.spacing) * data.scale.x; //} wordStart = widthSoFar; targetWordStartIndex = target.Length; fmtWordStartIndex = i; } else { if ((widthSoFar + chr.p1.x * data.scale.x) > lineWidth) { // If the last word started after the start of the line if (wordStart > 0.0f) { wordStart = 0.0f; widthSoFar = 0.0f; // rewind target.Remove(targetWordStartIndex + 1, target.Length - targetWordStartIndex - 1); target.Append('\n'); i = fmtWordStartIndex; continue; // don't add this character } else { target.Append('\n'); widthSoFar = (chr.advance + data.spacing) * data.scale.x; } } else { widthSoFar += (chr.advance + data.spacing) * data.scale.x; } } target.Append(idx); } _targetString = target.ToString(); }
private static string ExcelHeader() { System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append("<?xml version=\"1.0\"?>\n"); sb.Append("<?mso-application progid=\"Excel.Sheet\"?>\n"); sb.Append( "<Workbook xmlns=\"urn:schemas-microsoft-com:office:spreadsheet\" "); sb.Append("xmlns:o=\"urn:schemas-microsoft-com:office:office\" "); sb.Append("xmlns:x=\"urn:schemas-microsoft-com:office:excel\" "); sb.Append("xmlns:ss=\"urn:schemas-microsoft-com:office:spreadsheet\" "); sb.Append("xmlns:html=\"http://www.w3.org/TR/REC-html40\">\n"); sb.Append( "<DocumentProperties xmlns=\"urn:schemas-microsoft-com:office:office\">"); sb.Append("</DocumentProperties>"); sb.Append( "<ExcelWorkbook xmlns=\"urn:schemas-microsoft-com:office:excel\">\n"); sb.Append("<ProtectStructure>False</ProtectStructure>\n"); sb.Append("<ProtectWindows>False</ProtectWindows>\n"); sb.Append("</ExcelWorkbook>\n"); return(sb.ToString()); }
public Text.StringBuilder Append(Text.StringBuilder sb) { return(sb.Append('*', pointer_level)); }
private void LoadProduct(ProductInfo product, System.Collections.Generic.Dictionary <int, System.Collections.Generic.IList <int> > attrs) //商品详情控件赋值 { if (product.integral != "" & product.integral != "0") //如果积分兑换有值则关闭积分设置 { this.cbIntegralOperation.Checked = false; this.txtIntegral.Enabled = true; this.txtIntegral.Text = product.integral.ToString();//为送积分框赋值 } else { this.cbIntegralOperation.Checked = true; this.txtIntegral.Enabled = false; this.txtIntegral.Text = ""; } if (product.LeaseGood == 1)//租赁商品设置(1能,0否) { this.cbLeaseOpration.Checked = false; } else if (product.LeaseGood == 0) { this.cbLeaseOpration.Checked = true; } if (product.ZeroBuy == 1)//是否能零元购(1能,0否) { this.cbZeroByOperation.Checked = false; } else if (product.ZeroBuy == 0) { this.cbZeroByOperation.Checked = true; } if (product.IntegralToNow == 1)//是否能积分兑换(1能,0否) { this.cbPointsSetUp.Checked = false; this.txtIntegralCeiling.Enabled = true; this.txtIntegralCeiling.Text = product.IntegralCeiling.ToString();//为积分兑换上限框赋值 } else if (product.IntegralToNow == 0) { this.cbPointsSetUp.Checked = true; this.txtIntegralCeiling.Enabled = false; this.txtIntegralCeiling.Text = ""; } else { this.cbPointsSetUp.Checked = true; this.txtIntegralCeiling.Enabled = false; this.txtIntegralCeiling.Text = ""; } this.dropProductTypes.SelectedValue = product.TypeId; this.dropBrandCategories.SelectedValue = product.BrandId; bool isSetCommission = product.IsSetCommission; if (isSetCommission) { this.cbIsSetCommission.Checked = false; this.txtFirstCommission.Enabled = true; this.txtSecondCommission.Enabled = true; this.txtThirdCommission.Enabled = true; this.txtFirstCommission.Text = product.FirstCommission.ToString("F2"); this.txtSecondCommission.Text = product.SecondCommission.ToString("F2"); this.txtThirdCommission.Text = product.ThirdCommission.ToString("F2"); } else { CategoryInfo category = CatalogHelper.GetCategory(this.categoryid); if (category != null) { this.txtFirstCommission.Text = category.FirstCommission; this.txtSecondCommission.Text = category.SecondCommission; this.txtThirdCommission.Text = category.ThirdCommission; } } this.txtDisplaySequence.Text = product.DisplaySequence.ToString(); this.txtProductName.Text = Globals.HtmlDecode(product.ProductName); this.txtProductShortName.Text = Globals.HtmlDecode(product.ProductShortName); this.txtProductCode.Text = product.ProductCode; this.txtUnit.Text = product.Unit; if (product.MarketPrice.HasValue) { this.txtMarketPrice.Text = product.MarketPrice.Value.ToString("F2"); } this.txtShortDescription.Text = product.ShortDescription; this.fckDescription.Text = product.Description; if (product.SaleStatus == ProductSaleStatus.OnSale) { this.radOnSales.Checked = true; } else if (product.SaleStatus == ProductSaleStatus.UnSale) { this.radUnSales.Checked = true; } else { this.radInStock.Checked = true; } this.ChkisfreeShipping.Checked = product.IsfreeShipping; string text = string.Concat(new string[] { product.ImageUrl1, ",", product.ImageUrl2, ",", product.ImageUrl3, ",", product.ImageUrl4, ",", product.ImageUrl5 }); this.ucFlashUpload1.Value = text.Replace(",,", ",").Replace(",,", ",").Trim(new char[] { ',' }); if (attrs != null && attrs.Count > 0) { System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); stringBuilder.Append("<xml><attributes>"); foreach (int current in attrs.Keys) { stringBuilder.Append("<item attributeId=\"").Append(current.ToString(System.Globalization.CultureInfo.InvariantCulture)).Append("\" usageMode=\"").Append(((int)ProductTypeHelper.GetAttribute(current).UsageMode).ToString()).Append("\" >"); foreach (int current2 in attrs[current]) { stringBuilder.Append("<attValue valueId=\"").Append(current2.ToString(System.Globalization.CultureInfo.InvariantCulture)).Append("\" />"); } stringBuilder.Append("</item>"); } stringBuilder.Append("</attributes></xml>"); this.txtAttributes.Text = stringBuilder.ToString(); } if (product.HasSKU && product.Skus.Keys.Count > 0) { System.Text.StringBuilder stringBuilder2 = new System.Text.StringBuilder(); stringBuilder2.Append("<xml><productSkus>"); foreach (string current3 in product.Skus.Keys) { SKUItem sKUItem = product.Skus[current3]; string text2 = string.Concat(new string[] { "<item skuCode=\"", sKUItem.SKU, "\" salePrice=\"", sKUItem.SalePrice.ToString("F2"), "\" costPrice=\"", (sKUItem.CostPrice > 0m) ? sKUItem.CostPrice.ToString("F2") : "", "\" qty=\"", sKUItem.Stock.ToString(System.Globalization.CultureInfo.InvariantCulture), "\" weight=\"", (sKUItem.Weight > 0m) ? sKUItem.Weight.ToString("F2") : "", "\">" }); text2 += "<skuFields>"; foreach (int current4 in sKUItem.SkuItems.Keys) { string str = string.Concat(new string[] { "<sku attributeId=\"", current4.ToString(System.Globalization.CultureInfo.InvariantCulture), "\" valueId=\"", sKUItem.SkuItems[current4].ToString(System.Globalization.CultureInfo.InvariantCulture), "\" />" }); text2 += str; } text2 += "</skuFields>"; if (sKUItem.MemberPrices.Count > 0) { text2 += "<memberPrices>"; foreach (int current5 in sKUItem.MemberPrices.Keys) { text2 += string.Format("<memberGrande id=\"{0}\" price=\"{1}\" />", current5.ToString(System.Globalization.CultureInfo.InvariantCulture), sKUItem.MemberPrices[current5].ToString("F2")); } text2 += "</memberPrices>"; } text2 += "</item>"; stringBuilder2.Append(text2); } stringBuilder2.Append("</productSkus></xml>"); this.txtSkus.Text = stringBuilder2.ToString(); } else { product.HasSKU = false; } SKUItem defaultSku = product.DefaultSku; this.txtSku.Text = product.SKU; this.txtSalePrice.Text = defaultSku.SalePrice.ToString("F2"); this.txtCostPrice.Text = ((defaultSku.CostPrice > 0m) ? defaultSku.CostPrice.ToString("F2") : ""); this.txtStock.Text = ProductHelper.GetProductSumStock(product.ProductId).ToString(); this.txtWeight.Text = ((defaultSku.Weight > 0m) ? defaultSku.Weight.ToString("F2") : ""); if (defaultSku.MemberPrices.Count > 0) { this.txtMemberPrices.Text = "<xml><gradePrices>"; foreach (int current6 in defaultSku.MemberPrices.Keys) { TrimTextBox expr_7F8 = this.txtMemberPrices; expr_7F8.Text += string.Format("<grande id=\"{0}\" price=\"{1}\" />", current6.ToString(System.Globalization.CultureInfo.InvariantCulture), defaultSku.MemberPrices[current6].ToString("F2")); } TrimTextBox expr_859 = this.txtMemberPrices; expr_859.Text += "</gradePrices></xml>"; } this.chkSkuEnabled.Checked = product.HasSKU; this.rbtIsSetTemplate.Checked = (product.FreightTemplateId > 0); this.txtShowSaleCounts.Text = product.ShowSaleCounts.ToString(); this.txtCubicMeter.Text = product.CubicMeter.ToString("F2"); this.txtFreightWeight.Text = product.FreightWeight.ToString("F2"); this.FreightTemplateDownList1.SelectedValue = product.FreightTemplateId; }
protected override void OnLoad(EventArgs args) { if (!IsInLiveEditingMode) { this.config["elements"] = this.ClientID; } bool first = true; // Render HTML for TinyMCE instance // in the liveediting mode we're always preloading tinymce script if (!IsInLiveEditingMode) { //TinyMCE uses it's own compressor so leave it up to ScriptManager to render ScriptManager.RegisterClientScriptInclude(this, this.GetType(), _versionId.ToString(), this.ScriptURI); } else { //We're in live edit mode so add the base js file to the dependency list ClientDependencyLoader.Instance.RegisterDependency("tinymce3/tiny_mce_src.js", "UmbracoClient", ClientDependencyType.Javascript); } // Write script tag start m_scriptInitBlock.Append(HtmlTextWriter.TagLeftChar.ToString()); m_scriptInitBlock.Append("script"); m_scriptInitBlock.Append(" type=\"text/javascript\""); m_scriptInitBlock.Append(HtmlTextWriter.TagRightChar.ToString()); m_scriptInitBlock.Append("\n"); m_scriptInitBlock.Append("tinyMCE.init({\n"); // Write options foreach (string key in this.config.Keys) { //TODO: This is a hack to test if we can prevent tinymce from automatically download languages if (!IsInLiveEditingMode || (key != "language")) { string val = this.config[key]; if (!first) { m_scriptInitBlock.Append(",\n"); } else { first = false; } // Is boolean state or string if (val == "true" || val == "false") { m_scriptInitBlock.Append(key + ":" + this.config[key]); } else { m_scriptInitBlock.Append(key + ":'" + this.config[key] + "'"); } } } m_scriptInitBlock.Append("\n});\n"); // we're wrapping the tinymce init call in a load function when in live editing, // so we'll need to close that function declaration if (IsInLiveEditingMode) { m_scriptInitBlock.Append(@"(function() { var f = function() { if(document.getElementById('__umbraco_tinyMCE')) tinyMCE.execCommand('mceAddControl',false,'").Append(ClientID).Append(@"'); ItemEditing.remove_startEdit(f); } ItemEditing.add_startEdit(f);})();"); m_scriptInitBlock.Append(@"(function() { var f = function() { tinyMCE.execCommand('mceRemoveControl',false,'").Append(ClientID).Append(@"'); ItemEditing.remove_stopEdit(f); } ItemEditing.add_stopEdit(f);})();"); } // Write script tag end m_scriptInitBlock.Append(HtmlTextWriter.EndTagLeftChars); m_scriptInitBlock.Append("script"); m_scriptInitBlock.Append(HtmlTextWriter.TagRightChar.ToString()); // add to script manager if (IsInLiveEditingMode) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), new Guid().ToString(), m_scriptInitBlock.ToString(), false); } }
public override int GetHashCode() { System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append(this.GetType().FullName); sb.Append(GCMik); sb.Append(GCKod); sb.Append(Tarih); sb.Append(BirimFiyat); sb.Append(FisNo); sb.Append(KdvOrani); sb.Append(Isk1); sb.Append(Isk2); sb.Append(Isk3); sb.Append(Isk4); sb.Append(Isk5); sb.Append(FisNo); sb.Append(Ftirsip); sb.Append(HareketBirim); sb.Append(HareketMiktar); return(sb.ToString().GetHashCode()); }
protected String UpdateResponse(String trackid, String reference, String result, String postdate, String auth) { System.Text.StringBuilder qstring = new System.Text.StringBuilder(); try { TransactionRecord tr = new TransactionRecord(); string IpAddress = System.Configuration.ConfigurationManager.AppSettings["KoDTicketingIPAddress"]; #region parsereference Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Transaction reference: " + trackid); string refNo = trackid; if (refNo.Length < 1) { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Payment Response: Tokenization of reference string did not result in enough sub tokens. --> " + refNo); return("?err=pay"); } tr.VLBookingID = refNo; Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(string.Format("HDFC Payment Response: Reference[{0}], Booking ID [{1}], Agent Code [{2}] ", tr.ReferenceNo.ToString(), tr.VLBookingID.ToString(), tr.AgentCode)); #endregion parsereference if (Request["amt"] != null) { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Amount: " + Request["amt"].ToString()); tr.VLTotalAmount = decimal.Parse(Request["amt"].ToString()); } if (Request["paymentid"] != null) { try { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Receipt: " + Request["paymentid"].ToString()); tr.VLReceiptNo = Request["paymentid"].ToString(); } catch (Exception ex) { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Response: Error parsing receipt."); Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(ex.Message); } } if (result == "CAPTURED") { # region CAPTURED //string retURL = UpdateResponseByTranId(status, amount, transactionId); Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC payment captured."); try { string VLBookingID = tr.VLBookingID.ToString(); TransactionBOL.Get_Valentine_Details(tr.VLBookingID, tr.VLReceiptNo); Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Going to Fetch Details of Booking Id from DB.Booking ID where" + VLBookingID); DataTable dt = TransactionBOL.Select_ValentineTransaction(tr.VLBookingID.ToString()); Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Fetched Details of Booking Id from DB.Booking ID where" + VLBookingID); if (dt != null && dt.Rows.Count > 0) { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Fetched Details of Booking Id from DB.Booking ID where" + dt.Rows[0]); try { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Seats booked against HDFC payment."); qstring.Append("?b="); qstring.Append(tr.VLBookingID.ToString()); ReceiptUtils.ValentinePaymentSuccess(dt.Rows[0], tr.VLReceiptNo.ToString(), tr.BookingID.ToString()); Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Payment successful..." + tr.VLBookingID.ToString() + tr.VLReceiptNo.ToString()); GTICKV.LogEntry("HDFC Payment successful...", "10", tr.BookingID.ToString(), tr.ReceiptNo.ToString()); } catch (Exception ex) { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Error processing receipt post booking. " + ex.Message); ReceiptUtils.SuccessPaymentResponse(tr.ReceiptNo.ToString(), dt.Rows[0], ""); //ReceiptUtils.SuccessPaymentResponse(tr.VLBookingID.ToString(), tr.VLReceiptNo); qstring.Append((qstring.Length == 0) ? "?err=seat" : "&err=seat"); } return(qstring.ToString()); } else { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC successful booking but ask customer to call");; long BookingID1 = long.Parse(tr.ReferenceNo.ToString()); DataTable dt1 = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID1); ReceiptUtils.SuccessPaymentResponse(tr.ReceiptNo.ToString(), dt1.Rows[0], ""); //ReceiptUtils.SuccessPaymentResponse(tr.VLBookingID.ToString(), tr.VLReceiptNo); qstring.Append((qstring.Length == 0) ? "?err=seat" : "&err=seat"); } } catch (Exception ex) { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Receipt: error getting transaction details - " + ex.Message); qstring.Append((qstring.Length == 0) ? "?err=seat" : "&err=seat"); } //if you reach here problem occurred String _refNo = tr.VLBookingID.ToString(); KoDTicketing.GTICKV.LogEntry(_refNo, "HDFC Payment Not Successful", "17", tr.VLBookingID.ToString()); //GTICKBOL.ON_Session_out(_refNo); KoDTicketing.GTICKV.LogEntry(_refNo, "Seats Unlocked", "18", tr.VLBookingID.ToString()); qstring.Append("err=pay"); KoDTicketing.GTICKV.LogEntry(tr.VLReceiptNo.ToString(), "HDFC Error Occurred -- Payment Not Successful", "19", tr.VLBookingID.ToString()); string BookingID = tr.VLBookingID.ToString(); try { DataTable dt = TransactionBOL.Select_ValentineTransaction(BookingID); if (dt.Rows.Count == 0) { ReceiptUtils.FailurePaymentResponse(); } else { ReceiptUtils.FailurePaymentResponse(dt.Rows[0]); } qstring.Append((qstring.Length == 1) ? "err=seat" : "&err=seat"); return(qstring.ToString()); } catch (Exception ex) { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Error occurred processing unsuccessful payment..." + ex.Message); } Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Final Call"); Response.Redirect(IpAddress + "ValentineAffair/HDFC/FinalCall.aspx" + qstring.ToString(), false); #endregion } else { GTICKV.LogEntry(tr.VLReceiptNo.ToString(), "HDFC Payment Not Successful", "17", tr.VLBookingID.ToString()); //GTICKBOL.ON_Session_out(tr.ReferenceNo.ToString()); GTICKV.LogEntry(tr.VLReceiptNo.ToString(), "Seats Unlocked", "18", tr.VLBookingID.ToString()); long BookingID = long.Parse(tr.ReferenceNo.ToString()); DataTable dt = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID); ReceiptUtils.PaymentNotCaptureResponse(tr.ReceiptNo.ToString(), dt.Rows[0], ""); qstring.Append("?err=pay"); } }
public static MvcHtmlString Paging(this HtmlHelper helper, string action, string controller, int pageCount, int pageNo, int pageSize) { StringBuilder sb = new System.Text.StringBuilder(); //sb.Append("<div class='box-body no-padding'>"); sb.Append("<div class='btn-groups modal-footer' style='padding: 5px'>"); sb.Append("<div class='form-group col-md-12 paging' style='margin:0px;padding-left:0px;' id ='paging' controller = '" + controller + "' action = '" + action + "' container = '' pageCount='" + pageCount + "' >"); string isFirstPage = ""; string isLastPage = ""; if (pageNo == 1) { isFirstPage = "disabled='disabled'"; } if (pageNo == pageCount || pageCount == 0) { isLastPage = "disabled='disabled'"; } sb.Append("<div class='col-md-12 startDiv' style='display:inline-flex;padding-left:0px;'>"); sb.Append("<input type = 'button' value = '<<' id = 'btnFirst' class='btn btn-info btn-xs btnPaging' " + isFirstPage + "/>"); sb.Append("<input type = 'button' value = '<' id = 'btnPrev' class='btn btn-info btn-xs btnPaging' style='margin-left:2px;' " + isFirstPage + " /> "); sb.Append("<div class='col-md-0 hidden-xs'>Page</div>"); sb.Append("<input type='text' id='pageNo' class='form-control txtPaging' style='max-width:75px;max-height:24px;text-align:center;padding:0px;' value='" + pageNo + "'/> "); sb.Append("<span style='display:inline-block'> of " + pageCount + " </span>"); sb.Append("<input type = 'button' value = ' > ' id = 'btnNxt' class='btn btn-info btn-xs btnPaging' " + isLastPage + " />"); sb.Append("<input type = 'button' value = '>>' id = 'btnLast' class='btn btn-info btn-xs btnPaging' style='margin-left:2px;' " + isLastPage + " />"); sb.Append("<div class='col-md-5'>"); sb.Append("Page Size:<input type='text' id='pageSize' class='form-control txtPaging' style='max-width:30px;height:24px;text-align:center;display:inline-block;padding:0px;' value='" + pageSize + "'> "); sb.Append("</div>"); sb.Append("</div>"); sb.Append("<div id='erormsg' class='alert-danger' style='display:none'>"); sb.Append("<p>No page!! Moved to first page</p>"); sb.Append("</div>"); sb.Append("<div id='erormsgpagesize' class='alert-danger' style='display:none'>"); sb.Append("<p>Can not be less than 1!!! setting to default</p>"); sb.Append("</div>"); sb.Append("</div>"); sb.Append("</div>"); //sb.Append("</div>"); return(MvcHtmlString.Create(sb.ToString())); }
protected void Pop_Cookie() { Panel1.Visible = true; System.Text.StringBuilder output = new System.Text.StringBuilder(); HttpCookie aCookie; string subkeyName; string subkeyValue; //for (int i = 0; i < Request.Cookies.Count; i++) //{ // aCookie = Request.Cookies[i]; // output.Append("Cookie name = " + Server.HtmlEncode(aCookie.Name) // + "<br />"); // output.Append("Cookie value = " + Server.HtmlEncode(aCookie.Value) // + "<br /><br />"); //} //DeBug_Footer.Text += "<hr />" + output.ToString(); //output = new System.Text.StringBuilder(); //for (int i = 0; i < Request.Cookies.Count; i++) //{ // aCookie = Request.Cookies[i]; // output.Append("Name = " + aCookie.Name + "<br />"); // output.Append("Expires = " + aCookie.Expires.ToString() + "<br />"); // output.Append("Secure = " + aCookie.Secure.ToString() + "<br />"); // if (aCookie.HasKeys) // { // for (int j = 0; j < aCookie.Values.Count; j++) // { // subkeyName = Server.HtmlEncode(aCookie.Values.AllKeys[j]); // subkeyValue = Server.HtmlEncode(aCookie.Values[j]); // output.Append("Subkey name = " + subkeyName + "<br />"); // output.Append("Subkey value = " + subkeyValue + "<br /><br />"); // } // } // else // { // output.Append("Value = " + Server.HtmlEncode(aCookie.Value) + // "<br /><br />"); // } //} DeBug_Footer.Text += "<hr />" + output.ToString(); output = new System.Text.StringBuilder(); for (int i = 0; i < Request.Cookies.Count; i++) { aCookie = Request.Cookies[i]; output.Append("Name = " + aCookie.Name + "<br />"); output.Append("Expires = " + aCookie.Expires.ToString() + "<br />"); output.Append("Secure = " + aCookie.Secure.ToString() + "<br />"); if (aCookie.HasKeys) { System.Collections.Specialized.NameValueCollection CookieValues = aCookie.Values; string[] CookieValueNames = CookieValues.AllKeys; for (int j = 0; j < CookieValues.Count; j++) { subkeyName = Server.HtmlEncode(CookieValueNames[j]); subkeyValue = Server.HtmlEncode(CookieValues[j]); output.Append("Subkey name = " + subkeyName + "<br />"); output.Append("Subkey value = " + subkeyValue + "<br /><br />"); } } else { output.Append("Value = " + Server.HtmlEncode(aCookie.Value) + "<br /><br />"); } } DeBug_Footer.Text += "<hr />" + output.ToString(); }
/// <summary> /// Function to return number in text /// </summary> /// <param name="number"></param> /// <returns></returns> public string NumberToText(int number) { // Converting the number to words if (number == 0) { return("Zero"); } if (number == -2147483648) { return("Minus Two Hundred and Fourteen Crore Seventy Four Lakh Eighty Three Thousand Six Hundred and Forty Eight"); } int[] num = new int[4]; int first = 0; int u, h, t; System.Text.StringBuilder sb = new System.Text.StringBuilder(); if (number < 0) { sb.Append("Minus "); number = -number; } string[] words0 = { "", "One ", "Two ", "Three ", "Four ", "Five ", "Six ", "Seven ", "Eight ", "Nine " }; string[] words1 = { "Ten ", "Eleven ", "Twelve ", "Thirteen ", "Fourteen ", "Fifteen ", "Sixteen ", "Seventeen ", "Eighteen ", "Nineteen " }; string[] words2 = { "Twenty ", "Thirty ", "Forty ", "Fifty ", "Sixty ", "Seventy ", "Eighty ", "Ninety " }; string[] words3 = { "Thousand ", "Lakh ", "Crore " }; num[0] = number % 1000; // units num[1] = number / 1000; num[2] = number / 100000; num[1] = num[1] - 100 * num[2]; // thousands num[3] = number / 10000000; // crores num[2] = num[2] - 100 * num[3]; // lakhs for (int i = 3; i > 0; i--) { if (num[i] != 0) { first = i; break; } } for (int i = first; i >= 0; i--) { if (num[i] == 0) { continue; } u = num[i] % 10; // ones t = num[i] / 10; h = num[i] / 100; // hundreds t = t - 10 * h; // tens if (h > 0) { sb.Append(words0[h] + "Hundred "); } if (u > 0 || t > 0) { if (h > 0 || i == 0) { sb.Append(" "); } if (t == 0) { sb.Append(words0[u]); } else if (t == 1) { sb.Append(words1[u]); } else { sb.Append(words2[t - 2] + words0[u]); } } if (i != 0) { sb.Append(words3[i - 1]); } } return(sb.ToString().TrimEnd()); }
public string getWhileLoopData() { CaseManager caseManager = new CaseManager(); var htmlStr = new System.Text.StringBuilder(); List <Case> empty = new List <Case>(); empty = caseManager.GetChildItems(caseManager.Read(null).First().Id, empty); htmlStr.Append("<tr><td>"); htmlStr.Append(caseManager.Read(null).First().Id); htmlStr.Append("</td><td>"); htmlStr.Append(""); htmlStr.Append("</td><td>"); htmlStr.Append(caseManager.Read(null).First().Name); htmlStr.Append("</td><td>"); htmlStr.Append("خروجی: " + "0"); htmlStr.Append("</td><td>"); htmlStr.Append("ورودی: " + "0"); htmlStr.Append("</td></tr>"); foreach (var item in empty) { string parent = ""; if (item.ParentCase != null) { parent = item.ParentCase.Id.ToString(); } Guid id = item.Id; string name = item.Name; htmlStr.Append("<tr><td>"); htmlStr.Append(id); htmlStr.Append("</td><td>"); htmlStr.Append(parent); htmlStr.Append("</td><td>"); htmlStr.Append(name); htmlStr.Append("</td><td>"); htmlStr.Append("خروجی: " + "0"); htmlStr.Append("</td><td>"); htmlStr.Append("ورودی: " + "0"); htmlStr.Append("</td></tr>"); } return(htmlStr.ToString()); }