private ScheduleLogView PlanLog2ScheduleLogView(PlanProgress log) { var item = new ScheduleLogView() { Guid = log.Guid, Creator = log.Creator, CreateDate = log.CreateDate.Value.ToString("yyyy/MM/dd HH:mm:ss"), Content = log.Content, CurProgress = log.CurProgress + "%", }; return(item); }
private void DisplayRecords() { try { myList.Clear(); if (con.con.State == ConnectionState.Open) { con.con.Close(); } con.con.Open(); string qot = "'"; System.Data.SqlClient.SqlDataReader sdr; string script = File.ReadAllText("SQL//ScheduleOrderLog.sql"); script = script.Replace("@dow", qot + dateTimePicker1.Text + qot); script = script.Replace("\r\n", " "); script = script.Replace("\t", " "); script = script.Replace("@date", qot + dateTimePicker1.Text + qot); SqlCommand cmd = new SqlCommand(script, con.con); sdr = cmd.ExecuteReader(); while (sdr.Read()) { ScheduleLogView slv = new ScheduleLogView() { VendorID = sdr["VendorID"].ToString(), Email = sdr["Email"].ToString(), OrderValue = ifNullReturnZero(sdr["OrderValue"].ToString()), PONumber = sdr["PONumber"].ToString(), Status = ifNullReturnPending(sdr["Status"].ToString()), Vendor = sdr["Vendor"].ToString(), Schedule_Date_Time = sdr["Schedule Date/Time"].ToString(), }; myList.Add(slv); } con.con.Close(); DG2.DataSource = ConvertToDatatable.ToDataTable(myList); GridSetting(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }