ToString() публичный Метод

public ToString ( ) : string
Результат string
Пример #1
0
    private void getAgentsByCash()
    {
        DataTable      dtAgents = new DataTable();
        SqlDataAdapter daAgents = new SqlDataAdapter();
        SqlCommand     cmd      = new SqlCommand();
        String         agentid  = ddlAgents.SelectedValue;

        if (!String.IsNullOrEmpty(txt_fromDate.Text.ToString()) && !String.IsNullOrEmpty(txt_toDate.Text.ToString()))
        {
            DateTime ff = DateTime.ParseExact(txt_fromDate.Text, "dd/MM/yyyy", null);
            System.Data.SqlTypes.SqlDateTime dtSql = System.Data.SqlTypes.SqlDateTime.Parse(ff.ToString("yyyy-MM-dd"));
            from = dtSql.ToString();
            from = txt_fromDate.Text.ToString();
            to   = txt_toDate.Text.ToString();
        }

        try
        {
            cmd.Connection = con;
            con.Open();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "getAgentsByCash";
            cmd.Parameters.AddWithValue("@from", from);
            cmd.Parameters.AddWithValue("@to", to);
            cmd.Parameters.AddWithValue("@agentid", agentid);

            daAgents = new SqlDataAdapter(cmd);
            daAgents.Fill(dtAgents);
            if (dtAgents != null)
            {
                if (dtAgents.Rows.Count > 0)
                {
                    Session["dtProduct"] = dtAgents;
                    repAgents.DataSource = dtAgents;
                    repAgents.DataBind();
                    btnExcelExport.Visible = true;
                }
                else
                {
                    repAgents.DataSource = null;
                    repAgents.DataBind();
                    btnExcelExport.Visible = false;
                }
            }
            else
            {
                repAgents.DataSource = null;
                repAgents.DataBind();
                btnExcelExport.Visible = false;
            }
        }
        catch (Exception ex)
        {
            ErrHandler.writeError(ex.Message, ex.StackTrace);
        }
        finally
        {
            con.Close();
        }
    }
Пример #2
0
    private void GetIncomeExpenseJSON()
    {
        DataTable      dtDetails           = new DataTable();
        SqlDataAdapter daIncomeExpenseJSON = new SqlDataAdapter();
        SqlCommand     cmd = new SqlCommand();

        if (!String.IsNullOrEmpty(txt_fromDate.Text.ToString()) && !String.IsNullOrEmpty(txt_toDate.Text.ToString()))
        {
            DateTime ff = DateTime.ParseExact(txt_fromDate.Text, "dd/MM/yyyy", null);
            System.Data.SqlTypes.SqlDateTime dtSql = System.Data.SqlTypes.SqlDateTime.Parse(ff.ToString("yyyy-MM-dd"));
            from = dtSql.ToString();
            from = txt_fromDate.Text.ToString();
            to   = txt_toDate.Text.ToString();

            //from = String.Format("yyyy-MM-dd", txt_fromDate.Text.ToString());
            //to = String.Format("yyyy-MM-dd", txt_toDate.Text.ToString());
        }
        //else {
        //    //from = DateTime.ParseExact("01/01/1900", "dd/MM/yyyy", null);
        //    //to = DateTime.Now;
        //    from = "1900-01-01";
        //    to = DateTime.Now.ToString("yyyy-MM-dd");
        //}
        try
        {
            cmd.Connection = con;
            con.Open();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "getIncomeExpenseDetails";
            cmd.Parameters.AddWithValue("@from", from);
            cmd.Parameters.AddWithValue("@to", to);
            daIncomeExpenseJSON = new SqlDataAdapter(cmd);
            daIncomeExpenseJSON.Fill(dtDetails);
            if (dtDetails != null)
            {
                if (dtDetails.Rows.Count > 0)
                {
                    markers = DataTableToJSONWithJavaScriptSerializerDetails(dtDetails);
                }
            }
        }
        catch (Exception ex)
        {
            ErrHandler.writeError(ex.Message, ex.StackTrace);
        }
        finally
        {
            con.Close();
        }
    }
Пример #3
0
		public void ToStringTest()
		{
			//
			// Thanks for Marting Baulig for these (DateTimeTest.cs)
			//
			
                        SqlDateTime t1 = new SqlDateTime (2002, 2, 25, 5, 25, 13);
                        SqlDateTime t2 = new SqlDateTime (2002, 2, 25, 15, 25, 13);
			
			// Standard patterns
                        Assert.AreEqual("2/25/2002 5:25:13 AM", t1.ToString (), "L01");
                        Assert.AreEqual((SqlString)"2/25/2002 5:25:13 AM", t1.ToSqlString (), "L02");
		}
Пример #4
0
 public static string Dayname(SqlDateTime d)
 {
     return d.ToString();
 }