当前位置: 首页>>代码示例>>C#>>正文


C# String.ToString方法代码示例

本文整理汇总了C#中System.String.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# String.ToString方法的具体用法?C# String.ToString怎么用?C# String.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.String的用法示例。


在下文中一共展示了String.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: convert

    // основная функция конвертации
    public void convert(String FilePath, String DocmFileName)
    {
        FilePath = @"d:\1\";
        DocmFileName = "130349";
        string DocmFilePath = System.IO.Path.Combine(FilePath.ToString(), (DocmFileName.ToString() + ".docm"));
        string XmlFilePath = System.IO.Path.Combine(FilePath.ToString(), (DocmFileName.ToString() + ".xml"));
        createXML(XmlFilePath, "");
        XmlDocument document = new XmlDocument();
        document.Load(XmlFilePath);
        XmlNode element = document.CreateElement("info");
        document.DocumentElement.AppendChild(element);

        XmlNode title = document.CreateElement("title");
        title.InnerText = FilePath;
        element.AppendChild(title);

        XmlNode chapter = document.CreateElement("chapter");
        document.DocumentElement.AppendChild(chapter);

        using (WordprocessingDocument doc = WordprocessingDocument.Open(DocmFilePath, true))
        {
            var body = doc.MainDocumentPart.Document.Body;
            foreach (var text in body.Descendants<Text>())
            {
                XmlNode para = document.CreateElement("para");
                para.InnerText = text.Text;
                chapter.AppendChild(para);
            }
        }
        document.Save(XmlFilePath);
    }
开发者ID:KateSenko,项目名称:DocmParser_dll,代码行数:32,代码来源:Parser.cs

示例2: InsertGalaDinnerPaymentdate

        public DataSet InsertGalaDinnerPaymentdate(int tourid, String paymentdate, String hotelname, String dinnertype, String cityname)
        {
            Database db = null;
            DbCommand dbCmd = null;
            DataSet dsData = null;
            try
            {

                db = DatabaseFactory.CreateDatabase(DALHelper.CRM_CONNECTION_STRING);
                dbCmd = db.GetStoredProcCommand("INSERT_PAYMENT_DATE_GALADINNER");
                db.AddInParameter(dbCmd, "@GIT_TOUR_ID", DbType.Int32, tourid);
                if (paymentdate.ToString().Equals("DD/MM/YYYY") || paymentdate.ToString().Equals(""))
                {

                    db.AddInParameter(dbCmd, "@PAYMENT_DATE", DbType.DateTime, DBNull.Value);
                }
                else
                {
                    db.AddInParameter(dbCmd, "@PAYMENT_DATE", DbType.DateTime, DateTime.ParseExact(paymentdate, "dd/MM/yyyy", null));
                }
                //db.AddInParameter(dbCmd, "@PAYMENT_DATE", DbType.String, paymentdate);
                db.AddInParameter(dbCmd, "@HOTEL_NAME", DbType.String, hotelname);
                db.AddInParameter(dbCmd, "@GALA_DINNER_TYPE_ID", DbType.String, dinnertype);
                db.AddInParameter(dbCmd, "@CITY_NAME", DbType.String, cityname);
                dsData = db.ExecuteDataSet(dbCmd);
            }
            catch (Exception ex)
            {

            }

            return dsData;
        }
开发者ID:pareshf,项目名称:testthailand,代码行数:33,代码来源:TobeReconform.cs

示例3: vulndb_appCheck

        /// <summary>
        /// Checks a single entry agasint vulnDB Search API.
        /// </summary>
        /// <param name="consumerkey"></param>
        /// <param name="consumersecret"></param>
        /// <param name="Application"></param>
        /// <returns></returns>
        public static string vulndb_appCheck(String consumerkey, String consumersecret, String Application)
        {
            try
            {
                var requestEndPoint = new Uri("https://vulndb.cyberriskanalytics.com/oauth/request_token");
                var authorizeEndPoint = new Uri("https://vulndb.cyberriskanalytics.com/oauth/authorize");
                var accessEndPoint = new Uri("https://vulndb.cyberriskanalytics.com/oauth/access_token");
                var ctx = new OAuthConsumerContext
                {
                    ConsumerKey = consumerkey,
                    ConsumerSecret = consumersecret,
                    SignatureMethod = SignatureMethod.HmacSha1
                };
                var genericSession = new OAuthSession(ctx, requestEndPoint, authorizeEndPoint, accessEndPoint);
                var targetServiceUri = new Uri("https://vulndb.cyberriskanalytics.com/api/v1/vulnerabilities/search_query?query=\"" + Application.ToString() +"\"");
                var respText = genericSession.Request().Get().ForUri(targetServiceUri).ToString();
               
                return respText;

            }
            catch (WebException ex)
            {
                using (var stream = ex.Response.GetResponseStream())
                using (var reader = new StreamReader(stream))
                {
                    Console.WriteLine(reader.ReadToEnd());
                    return "Nothing Found for: " + Application.ToString();
                }
            }
        }
开发者ID:riskbasedsecurity,项目名称:VulnDB-Client-Examples,代码行数:37,代码来源:vulndbAPI.cs

示例4: ActualizarFechaPeriodo

        public String ActualizarFechaPeriodo(Decimal ID_EMPRESA, String PERIODOSPROCESO, DateTime FECHA)
        {
            Conexion conexion = new Conexion(Empresa);
            conexion.IniciarTransaccion();
            Boolean ejecutar = true;
            String sql = null;
            String informacion = null;
            String actualizado = "N";
            tools fecha = new tools();

            sql = "usp_actualizar_fecha_memorando ";

            #region validaciones
            if (ID_EMPRESA > 0)
            {
                sql += ID_EMPRESA.ToString() + ", ";
                informacion += "ID_EMPRESA= '" + ID_EMPRESA.ToString() + ", ";
            }
            else
            {
                MensajeError = "El campo ID_EMPRESA es requerido para la consulta.";
                ejecutar = false;
            }

            sql += "'" + PERIODOSPROCESO.ToString() + "', ";
            informacion += "PERIODOSPROCESO = '" + PERIODOSPROCESO.ToString() + "', ";

            sql += "'" + fecha.obtenerStringConFormatoFechaSQLServer(FECHA) + "', ";
            informacion += "FECHA = '" + FECHA.ToString() + "', ";

            sql += "'" + Usuario.ToString() + "'";
            informacion += "USU_MOD = '" + Usuario.ToString() + "'";
            #endregion

            if (ejecutar)
            {
                try
                {
                    conexion.ExecuteNonQuery(sql);
                    actualizado = "S";
                    #region auditoria
                    auditoria _auditoria = new auditoria(Empresa);
                    _auditoria.Adicionar(Usuario, tabla.NOM_PERIODO, tabla.ACCION_LIQUIDAR, sql, informacion, conexion);
                    #endregion auditoria
                    conexion.AceptarTransaccion();
                }
                catch (Exception e)
                {
                    MensajeError = e.Message;
                    conexion.DeshacerTransaccion();
                }
                finally
                {
                    conexion.Desconectar();
                }
            }
            return actualizado;
        }
开发者ID:jquirogadesarrollador,项目名称:Varu,代码行数:58,代码来源:liquidacionNomina.cs

示例5: SearchPackages

        public DataSet SearchPackages(String QUOTATION_NO, String FROM_DATE_S, String TO_DATE_S, String STATUS)
        {
            Database db = null;
            DbCommand dbCmd = null;
            DataSet ds = null;

            try
            {
                db = DatabaseFactory.CreateDatabase(DALHelper.CRM_CONNECTION_STRING);
                dbCmd = db.GetStoredProcCommand("SEARCH_GIT_PACKAGES");
               if(QUOTATION_NO.ToString().Equals(""))
               {
                   db.AddInParameter(dbCmd, "@QUOTATION_NO", DbType.Int32, "0");
               }
               else
                {
                db.AddInParameter(dbCmd, "@QUOTATION_NO", DbType.Int32, QUOTATION_NO);
               }

               if (FROM_DATE_S.ToString().Equals(""))
               {
                   db.AddInParameter(dbCmd, "@FROM_DATE_S", DbType.DateTime, DBNull.Value);
               }
               else
               {
                   db.AddInParameter(dbCmd, "@FROM_DATE_S", DbType.DateTime, DateTime.ParseExact(FROM_DATE_S.ToString(), "dd/MM/yyyy", null));
               }

               if (TO_DATE_S.ToString().Equals(""))
               {
                   db.AddInParameter(dbCmd, "@TO_DATE_S", DbType.DateTime, DBNull.Value);
               }
               else
               {
                   db.AddInParameter(dbCmd, "@TO_DATE_S", DbType.DateTime, DateTime.ParseExact(TO_DATE_S.ToString(), "dd/MM/yyyy", null));
               }
                
                db.AddInParameter(dbCmd, "@STATUS", DbType.String, STATUS);


                ds = db.ExecuteDataSet(dbCmd);
            }

            catch (Exception ex)
            {
                bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME);
                if (rethrow)
                {
                    throw ex;
                }
            }

            finally
            {
                DALHelper.Destroy(ref dbCmd);
            }
            return ds;
        }
开发者ID:pareshf,项目名称:testthailand,代码行数:58,代码来源:GITSearch.cs

示例6: Error

 public static void Error(String error)
 {
     System.Diagnostics.Debug.WriteLine(error.ToString());
     using (StreamWriter file = new StreamWriter(@"Exceptions.txt", true))
     {
         file.WriteLine(error.ToString());
         file.Close();
     }
 }
开发者ID:lawilson5589,项目名称:geolabvirtualmaps,代码行数:9,代码来源:Log.cs

示例7: Parser

 public Parser(String FilePath, String DocxFileName)
 {
     document = new XmlDocument();
        DocxFilePath = System.IO.Path.Combine(FilePath.ToString(), (DocxFileName.ToString() + ".docx"));
        XmlFilePath = System.IO.Path.Combine(FilePath.ToString(), (DocxFileName.ToString() + ".xml"));
        wordProcessingDoc = WordprocessingDocument.Open(DocxFilePath, true);
        imgPart = wordProcessingDoc.MainDocumentPart.ImageParts.ToList();
        imgPart.Reverse();
        pathString = System.IO.Path.Combine(FilePath, "img");
 }
开发者ID:KateSenko,项目名称:DocmParser_dll,代码行数:10,代码来源:Parser.cs

示例8: fetchallInvoice

        public DataSet fetchallInvoice(String sp_name, String QID, String INVOICE, String param5, String param6, String param7,String agent_id)
        {
            Database db = null;
            DbCommand dbCmd = null;
            DataSet dsData = null;

            try
            {
                if (param5 == "0")
                {
                    param5 = "";
                }
                db = DatabaseFactory.CreateDatabase(DALHelper.CRM_CONNECTION_STRING);
                dbCmd = db.GetStoredProcCommand(sp_name);
                // db.AddInParameter(dbCmd, "@USERID", DbType.Int32, int.Parse(param1));
                db.AddInParameter(dbCmd, "@QUOTE_ID", DbType.Int32, int.Parse(QID));
                //db.AddInParameter(dbCmd, "@AGENT_NAME_S", DbType.String, AGENT);
                //db.AddInParameter(dbCmd, "@CLIENT_NAME_S", DbType.String, param3);
                //db.AddInParameter(dbCmd, "@TOUR_NAME_S", DbType.String, param4);
                db.AddInParameter(dbCmd, "@INVOICE_NO", DbType.String, INVOICE);
                if (param6.ToString().Equals(""))
                {
                    db.AddInParameter(dbCmd, "@PERIOD_STAY_FROM", DbType.DateTime, DBNull.Value);
                }
                else
                {
                    db.AddInParameter(dbCmd, "@PERIOD_STAY_FROM", DbType.DateTime, DateTime.ParseExact(param6.ToString(), "dd/MM/yyyy", null));
                }
                if (param7.ToString().Equals(""))
                {
                    db.AddInParameter(dbCmd, "@PERIOD_STAY_TO", DbType.DateTime, DBNull.Value);
                }
                else
                {
                    db.AddInParameter(dbCmd, "@PERIOD_STAY_TO", DbType.DateTime, DateTime.ParseExact(param7.ToString(), "dd/MM/yyyy", null));
                }
                if (param5.ToString().Equals(""))
                {
                    db.AddInParameter(dbCmd, "@INVOICE_DATE", DbType.DateTime, DBNull.Value);
                }
                else
                {
                    db.AddInParameter(dbCmd, "@INVOICE_DATE", DbType.DateTime, DateTime.ParseExact(param5.ToString(), "dd/MM/yyyy", null));
                }
                db.AddInParameter(dbCmd, "@AGENT_ID", DbType.Int32, int.Parse(agent_id));
                dsData = db.ExecuteDataSet(dbCmd);
            }
            catch (Exception ex)
            {

            }

            return dsData;
        }
开发者ID:pareshf,项目名称:testthailand,代码行数:54,代码来源:AgentInvoice.cs

示例9: Resolve

        public static ExtensibleData Resolve(String @ref, Gx.Gedcomx document)
        {
            if ([email protected]().StartsWith("#"))
            {
                return null;
            }

            GedcomxLocalReferenceResolver visitor = new GedcomxLocalReferenceResolver(@ref.ToString().Substring(1));
            document.Accept(visitor);
            return visitor.Resource;
        }
开发者ID:Herbert42,项目名称:gedcomx-csharp,代码行数:11,代码来源:GedcomxLocalReferenceResolver.cs

示例10: fetchallDatasearch

       public DataSet fetchallDatasearch(String sp_name, String invoice_no, String voucher_status, String voucher_type, String gl_code, String from_date, String to_date, String sales_invoice, String supplier_type, String supplier_name)
       {
           Database db = null;
           DbCommand dbCmd = null;
           DataSet dsData = null;

           try
           {
               //if (param5 == "0")
               //{
               //    param5 = "";
               //}
               db = DatabaseFactory.CreateDatabase(DALHelper.CRM_CONNECTION_STRING);
               dbCmd = db.GetStoredProcCommand(sp_name);
               db.AddInParameter(dbCmd, "@INVOICE_NO", DbType.String, invoice_no);
               db.AddInParameter(dbCmd, "@VOUCHER_STATUS", DbType.String, voucher_status);

               db.AddInParameter(dbCmd, "@VOUCHER_TYPE", DbType.String, voucher_type);
               db.AddInParameter(dbCmd, "@GL_CODE", DbType.String, gl_code);
               //db.AddInParameter(dbCmd, "@TOUR_NAME_S", DbType.String, param4);
               //db.AddInParameter(dbCmd, "@STATUS", DbType.String, param5);
               if (from_date.ToString().Equals(""))
               {
                   db.AddInParameter(dbCmd, "@FROM_DATE_S", DbType.DateTime, DBNull.Value);
               }
               else
               {
                   db.AddInParameter(dbCmd, "@FROM_DATE_S", DbType.DateTime, DateTime.ParseExact(from_date.ToString(), "dd/MM/yyyy", null));
               }
               if (to_date.ToString().Equals(""))
               {
                   db.AddInParameter(dbCmd, "@TO_DATE_S", DbType.DateTime, DBNull.Value);
               }
               else
               {
                   db.AddInParameter(dbCmd, "@TO_DATE_S", DbType.DateTime, DateTime.ParseExact(to_date.ToString(), "dd/MM/yyyy", null));
               }

               db.AddInParameter(dbCmd, "@SALES_INVOICE", DbType.String, sales_invoice );
               db.AddInParameter(dbCmd, "@SUPPLIER_TYPE", DbType.String, supplier_type);
               db.AddInParameter(dbCmd, "@SUPPLIER_NAME", DbType.String, supplier_name);
               
               dsData = db.ExecuteDataSet(dbCmd);
           }
           catch (Exception ex)
           {

           }

           return dsData;
       }
开发者ID:pareshf,项目名称:testthailand,代码行数:51,代码来源:SearchPaymentVoucherStoredProcedure.cs

示例11: Purchase

        public Boolean Purchase(String ProductID, int Quantity, String APIKey, string[] customercardinfo)
        {
            //copied and pasted code from project3ws and modiefied to work with this project
            //my verify method was super weird and very specific to the previous project
            //however i still use the basic functionality with the verifyinfo stored procedure
            DBConnect db = new DBConnect();
            SqlCommand command = new SqlCommand();
            command.CommandType = CommandType.StoredProcedure;
            command.CommandText = "UpdateProduct";
            command.Parameters.AddWithValue("@productID", int.Parse(ProductID.ToString()));
            command.Parameters.AddWithValue("@quantity", Quantity);
            command.Parameters.AddWithValue("@API", APIKey);
            db.DoUpdateUsingCmdObj(command);
            //-------------------------update product-------------------------------------------------

            //-------------------------------update customer--------------------------------------------
            SqlCommand hank = new SqlCommand();
            hank.CommandType = CommandType.StoredProcedure;
            hank.CommandText = "UpdateCustomer";
            hank.Parameters.AddWithValue("@Email", customercardinfo[0]);
            hank.Parameters.AddWithValue("@productID", int.Parse(ProductID.ToString()));
            hank.Parameters.AddWithValue("@Quantity", Quantity);
            hank.Parameters.AddWithValue("@Name", customercardinfo[1]);
            hank.Parameters.AddWithValue("@ShippingAddress", customercardinfo[2]);
            hank.Parameters.AddWithValue("@ShippingCity", customercardinfo[3]);
            hank.Parameters.AddWithValue("@ShippingState", customercardinfo[4]);
            hank.Parameters.AddWithValue("@ShippingCountry", customercardinfo[5]);
            hank.Parameters.AddWithValue("@ShippingZipCode", customercardinfo[6]);
            hank.Parameters.AddWithValue("@BillingAddress", customercardinfo[7]);
            hank.Parameters.AddWithValue("@BillingCity", customercardinfo[8]);
            hank.Parameters.AddWithValue("@BillingState", customercardinfo[9]);
            hank.Parameters.AddWithValue("@BillingZip", customercardinfo[10]);

               // int RETVAL = 0;
               // string tempTest = command.Parameters["@RETVAL"].Value.ToString();
            //RETVAL = int.Parse(tempTest);

            //SqlCommand c = new SqlCommand();
            //c.CommandType = CommandType.StoredProcedure;
            //c.CommandText = "TPVerifyInfo";
            //c.Parameters.AddWithValue("@CreditCardNum", customercardinfo[11]);
            //c.Parameters.AddWithValue("@CVV", customercardinfo[12]);
            //db.DoUpdateUsingCmdObj(c);

            if (db.DoUpdateUsingCmdObj(hank) > 0)
            {
                return true;
            }
            return true;
        }
开发者ID:ariannaC,项目名称:george,代码行数:50,代码来源:TheWebService.asmx.cs

示例12: DateGBString

        public static String DateGBString(String udate)
        {
            String dtstr = String.Empty;
            DateTime dateVal;

            String returndate = String.Empty;

            try
            {
                if (!String.IsNullOrEmpty(udate))
                {
                    IFormatProvider culture = new CultureInfo("en-GB", true);
                    dateVal = DateTime.Parse(udate.ToString(), culture);

                    dtstr = dateVal.ToString("dd/MM/yyyy");
                    returndate = dtstr.Replace("/", "-");
                }

            }
            catch (Exception ex)
            {
                throw;
            }
            return returndate;
        }
开发者ID:arnabknd4,项目名称:scs0400915,代码行数:25,代码来源:Common.cs

示例13: ObtenerNominasHojaTrabajo

        public DataTable ObtenerNominasHojaTrabajo(Decimal ID_EMPRESA, String ID_EMPRESAS, String ANALISTA)
        {
            Conexion conexion = new Conexion(Empresa);
            DataSet _dataSet = new DataSet();
            DataView _dataView = new DataView();
            DataTable _dataTable = new DataTable();
            String sql = null;
            Boolean ejecutar = true;

            sql = "usp_obtener_nomina_proceso_hoja_trabajo ";

            #region validaciones
            if (ID_EMPRESA > 0)
            {
                sql += ID_EMPRESA.ToString() + " ";
            }
            else
            {
                sql += "0" + " ";
            }

            if (!(String.IsNullOrEmpty(ID_EMPRESAS)))
            {
                sql += ", '" + ID_EMPRESAS.ToString() + "'";
            }
            else
            {
                sql += ",''";
            }

            if (!(String.IsNullOrEmpty(ANALISTA)))
            {
                sql += ", '" + ANALISTA.ToString() + "'";
            }
            else
            {
                sql += ",''";
            }

            #endregion

            if (ejecutar == true)
            {
                try
                {
                    _dataSet = conexion.ExecuteReader(sql);
                    _dataView = _dataSet.Tables[0].DefaultView;
                    _dataTable = _dataView.Table;
                }
                catch (Exception e)
                {
                    MensajeError = e.Message;
                }
                finally
                {
                    conexion.Desconectar();
                }
            }
            return _dataTable;
        }
开发者ID:jquirogadesarrollador,项目名称:Varu,代码行数:60,代码来源:hojaTrabajo.cs

示例14: ShowTheFile

    private void ShowTheFile(String EstNum, String seqNum)
    {
        // Define SQL select statement

        string SQL = "SELECT document,doc_mime_type from Project_documents WHERE EstNum = " + EstNum.ToString() + " AND seq_num = " + seqNum.ToString();
        // Create Connection object
        SqlConnection dbConn = null;
        dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection String"].ConnectionString);
        // Create Command Object
        SqlCommand dbComm = new SqlCommand(SQL, dbConn);
        // Open Connection
        dbConn.Open();
        // Execute command and receive DataReader
        SqlDataReader dbRead = dbComm.ExecuteReader();
        // Read row
        dbRead.Read();
        // Clear Response buffer
        Response.Clear();
        // Set ContentType to the ContentType of our file
        Response.ContentType = (string)dbRead["doc_mime_type"];
        Response.BinaryWrite((byte[])dbRead["document"]);
        // Write data out of database into Output Stream
        //Response.OutputStream.Write((byte[])dbRead["ABSTRACT_DOCUMENT"], 0, (int)dbRead["CONTENT_SIZE"]);
        // Close database connection
        dbConn.Close();
        // End the page
        Response.End();
    }
开发者ID:frdharish,项目名称:WhitfieldAPPs,代码行数:28,代码来源:view_document.aspx.cs

示例15: DirectDebitWorkFlowRecordList

        public static IEnumerable<DirectDebitWrokFlow> DirectDebitWorkFlowRecordList(String ProcessingDate)
        {
            IEnumerable<DirectDebitWrokFlow> List = null;
            using (var context = new SycousCon())
            {
                try
                {
                    var parDate = new SqlParameter
                    {
                        ParameterName = "ProcessingDate",
                        Value = Commmon.DateGB(ProcessingDate.ToString()),
                        Direction = ParameterDirection.Input
                    };
             // List = context.ExecuteStoreQuery<DirectDebitWrokFlow>("exec SYCOUS.GenerateDirectDebitWorkFlow @ProcessingDate", parDate).ToList();

                    List = context.ExecuteStoreQuery<DirectDebitWrokFlow>("exec SYCOUS.GenerateDirectDebitWorkFlow @ProcessingDate", parDate).ToList();

                }
                catch (Exception ex)
                {
                    context.Dispose();
                    throw;
                }
            }//using
            return List;
        }
开发者ID:arnabknd4,项目名称:scs0400915,代码行数:26,代码来源:DALWFDirectDebit.cs


注:本文中的System.String.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。