public string GetDTC(string ID) { string freezeList = string.Empty; List <Freeze> data = new List <Freeze>(); var ConStr = ConnectionString.GetDBConnectionString(); string Query = "GetDTCValue"; SqlParameter[] param = new SqlParameter[1]; param[0] = new SqlParameter("@ID", SqlDbType.Int); param[0].Value = Convert.ToInt32(ID); DataSet ds = new DataSet(); try { ds = DBL.executeDataSet(ConStr, CommandType.StoredProcedure, Query, param); } catch (Exception ex) { } var Serializer = new JavaScriptSerializer(); freezeList = JsonConvert.SerializeObject(ds, Formatting.Indented); return(freezeList); }
private DataTable GetDataTable(string _sStartDate, string _sEndDate) { DataTable objDT = new DataTable(); DataSet dsFreezeView = new DataSet(); string ConQuery = string.Empty; var ConStr = ConnectionString.GetDBConnectionString(); ConQuery = "SELECT freeze_MASTER_ID,freeze_VIN_NUMBER,freeze_MOBILE_NUMBER,freeze_LATITUDE,freeze_LATITUDE,freeze_TIMESTAMP,freeze_ECUNAME,freeze_VEHICLENAME,freeze_LOGINID,freeze_LOGINNAME,freeze_MOBILE_MAC_ADDRESS,freeze_VCIID,freeze_APP_VERSION,freeze_DEALER_NAME,freeze_AREA,freeze_LOCATION,freeze_SOURCE,freeze_UPDATEDON,freeze_ODOValue FROM tab_CA_EMS_MASTER_INFO WHERE CONVERT(date, freeze_TIMESTAMP, 101) between '" + _sStartDate + "' and '" + _sEndDate + "'"; dsFreezeView = DBL.executeDataSet(ConStr, CommandType.Text, ConQuery, null); objDT = dsFreezeView.Tables[0]; return(objDT); }
private DataTable GetDTCVale(int ID) { DataTable objDT = new DataTable(); var ConStr = ConnectionString.GetDBConnectionString(); string Query = string.Empty; Query = " select d.freeze_DTC_CODE, d.freeze_DTC_DESCRIPTION, d.freeze_DTC_STATUS, freeze_SIGNAL, freeze_VALUE from tab_CA_EMS_DTC_INFO d "; Query += " join tab_CA_EMS_FREEZEFRAME_DATA fm on d.dtc_id = fm.dtc_INFO_ID where fm.MASTER_ID = '" + ID + "'"; DataSet dsDTCCode = DBL.executeDataSet(ConStr, CommandType.Text, Query, null); objDT = dsDTCCode.Tables[0]; return(objDT); }
private void BindCriticalDTC() { string sqry = "select * from tab_CA_CRITICAL_DTC_ADD"; DataSet objDs = DBL.executeDataSet(Config.getConnString(), CommandType.Text, sqry, null); if (objDs != null && objDs.Tables[0].Rows.Count > 0) { gvCriticalDTC.DataSource = objDs.Tables[0]; gvCriticalDTC.DataBind(); } else { gvCriticalDTC.DataSource = null; gvCriticalDTC.DataBind(); } }
private DataTable GetDataTable(string _sStartDate, string _sEndDate) { DataTable objDT = new DataTable(); DataSet dsFreezeView = new DataSet(); string ConQuery = string.Empty; var ConStr = ConnectionString.GetDBConnectionString(); //ConQuery = "SELECT freeze_MASTER_ID,freeze_VIN_NUMBER,freeze_MOBILE_NUMBER,freeze_LATITUDE,freeze_LATITUDE,freeze_TIMESTAMP,freeze_ECUNAME,freeze_VEHICLENAME,freeze_LOGINID,freeze_LOGINNAME,freeze_MOBILE_MAC_ADDRESS,freeze_VCIID,freeze_APP_VERSION,freeze_DEALER_NAME,freeze_AREA,freeze_LOCATION,freeze_SOURCE,freeze_UPDATEDON,freeze_ODOValue FROM tab_CA_EMS_MASTER_INFO WHERE CONVERT(date, freeze_TIMESTAMP, 101) between '" + _sStartDate + "' and '" + _sEndDate + "'"; ConQuery = "SELECT DISTINCT M.freeze_MASTER_ID, freeze_VIN_NUMBER, c.crt_DTC_CODE, C.crt_PLATFORM_NAME, c.crt_ECU_NAME, ISNULL(M.freeze_PUSH_NOTIFY, 0) AS freeze_PUSH_NOTIFY, ISNULL(M.freeze_NOTIFY_COUNTER, 0) AS freeze_NOTIFY_COUNTER "; ConQuery += "FROM tab_CA_EMS_MASTER_INFO M "; ConQuery += "INNER JOIN tab_CA_EMS_DTC_INFO D ON M.freeze_MASTER_ID = D.freeze_MASTER_ID "; ConQuery += "INNER JOIN tab_CA_CRITICAL_DTC_ADD C ON D.freeze_DTC_CODE = C.crt_DTC_CODE WHERE CONVERT(date, M.freeze_TIMESTAMP, 101) between '" + _sStartDate + "' and '" + _sEndDate + "'and C.crt_ISCRITICAL = 1"; dsFreezeView = DBL.executeDataSet(ConStr, CommandType.Text, ConQuery, null); objDT = dsFreezeView.Tables[0]; return(objDT); }
private void BindFreezeDetails() { string _sStartDate = ""; string _sEndDate = ""; string _strStart = ""; string _strEnd = ""; int DateSelect = Convert.ToInt32(hfvDateval.Value); var dt = DateTime.Now; if (DateSelect == 0) { _sStartDate = dt.Month + "/" + dt.Day + "/" + dt.Year; _sEndDate = dt.Month + "/" + (dt.Day) + "/" + dt.Year; txtSDate.Enabled = false; txtEDate.Enabled = false; txtSDate.Text = ""; txtEDate.Text = ""; } else if (DateSelect == 1) { _sStartDate = "01/01/" + DateTime.Now.Year; _sEndDate = dt.Month + "/" + dt.Day + "/" + dt.Year; txtSDate.Enabled = false; txtEDate.Enabled = false; txtSDate.Text = ""; txtEDate.Text = ""; } else if (DateSelect == 2) { txtSDate.Enabled = true; txtEDate.Enabled = true; _strStart = txtSDate.Text; _strEnd = txtEDate.Text; if (string.IsNullOrEmpty(_strStart) || string.IsNullOrEmpty(_strEnd)) { return; } else { _sStartDate = _strStart; _sEndDate = _strEnd; } } DataSet dsFreezeView = new DataSet(); string ConQuery = string.Empty; var ConStr = ConnectionString.GetDBConnectionString(); ConQuery = "SELECT DISTINCT M.freeze_MASTER_ID, freeze_VIN_NUMBER, c.crt_DTC_CODE, C.crt_PLATFORM_NAME, c.crt_ECU_NAME, ISNULL(M.freeze_PUSH_NOTIFY, 0) AS freeze_PUSH_NOTIFY, ISNULL(M.freeze_NOTIFY_COUNTER, 0) AS freeze_NOTIFY_COUNTER "; ConQuery += "FROM tab_CA_EMS_MASTER_INFO M "; ConQuery += "INNER JOIN tab_CA_EMS_DTC_INFO D ON M.freeze_MASTER_ID = D.freeze_MASTER_ID "; ConQuery += "INNER JOIN tab_CA_CRITICAL_DTC_ADD C ON D.freeze_DTC_CODE = C.crt_DTC_CODE WHERE CONVERT(date, M.freeze_TIMESTAMP, 101) between '" + _sStartDate + "' and '" + _sEndDate + "'and C.crt_ISCRITICAL = 1"; dsFreezeView = DBL.executeDataSet(ConStr, CommandType.Text, ConQuery, null); if (dsFreezeView != null && dsFreezeView.Tables[0].Rows.Count > 0) { gvFreezeView.DataSource = dsFreezeView; gvFreezeView.DataBind(); } else { gvFreezeView.DataSource = null; gvFreezeView.DataBind(); } }
public string GetAAA(string ID) { string freezeList = string.Empty; DataSet dsC = new DataSet(); var ConStr = ConnectionString.GetDBConnectionString(); string Query = "Get_Analysis_Value"; SqlParameter[] param = new SqlParameter[1]; param[0] = new SqlParameter("@ID", SqlDbType.Int); param[0].Value = Convert.ToInt32(ID); DataSet ds = new DataSet(); SqlConnection _objdtcBuild = new SqlConnection(ConStr); try { if (_objdtcBuild.State != ConnectionState.Open) { string BuildStatus = ""; _objdtcBuild.Open(); ds = DBL.executeDataSet(ConStr, CommandType.StoredProcedure, Query, param); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { DataSet dsInvert = new DataSet(); string SP = "Get_Invert_Value"; SqlParameter[] param1 = new SqlParameter[1]; param1[0] = new SqlParameter("@ID", SqlDbType.Int); param1[0].Value = Convert.ToInt32(ID); dsInvert = DBL.executeDataSet(ConStr, CommandType.StoredProcedure, SP, param1); if (dsInvert != null && dsInvert.Tables.Count > 0 && dsInvert.Tables[0].Rows.Count > 0) { foreach (DataRow row1 in dsInvert.Tables[0].Rows) { int check_A = 0; int check_B = 0; int check_C = 0; int check_D = 0; string BuildID = row1["BuildID"].ToString(); string Opreator = row1["Opreator"].ToString(); string DTCCODE_A = row1["DTCCODE_A"] + ""; string DTCLOGIC_A = row1["DTCLOGIC_A"] + ""; bool DTCCODE_A_INVERT = false; if (row1["DTCCODE_A_INVERT"] != DBNull.Value) { DTCCODE_A_INVERT = Convert.ToBoolean(row1["DTCCODE_A_INVERT"]); } string DTCCODE_B = row1["DTCCODE_B"] + ""; string DTCLOGIC_B = row1["DTCLOGIC_B"] + ""; bool DTCCODE_B_INVERT = false; if (row1["DTCCODE_B_INVERT"] != DBNull.Value) { DTCCODE_B_INVERT = Convert.ToBoolean(row1["DTCCODE_B_INVERT"]); } string DTCCODE_C = row1["DTCCODE_C"] + ""; string DTCLOGIC_C = row1["DTCLOGIC_C"] + ""; bool DTCCODE_C_INVERT = false; if (row1["DTCCODE_C_INVERT"] != DBNull.Value) { DTCCODE_C_INVERT = Convert.ToBoolean(row1["DTCCODE_C_INVERT"]); } string DTCCODE_D = row1["DTCCODE_D"] + ""; string DTCLOGIC_D = row1["DTCLOGIC_D"] + ""; bool DTCCODE_D_INVERT = false; if (row1["DTCCODE_D_INVERT"] != DBNull.Value) { DTCCODE_D_INVERT = Convert.ToBoolean(row1["DTCCODE_D_INVERT"]); } if (DTCCODE_A != "" && DTCLOGIC_A != "") { check_A = 1; var dtcValue = ds.Tables[0] .AsEnumerable() .Where(x => x.Field <string>("DTCCODE") == DTCCODE_A) .Select(x => x.Field <decimal>("Result")) .FirstOrDefault(); if (CheckLogic(DTCCODE_A, DTCLOGIC_A, Convert.ToDouble(dtcValue), DTCCODE_A_INVERT)) { check_A = 2; } } if (DTCCODE_B != "" && DTCLOGIC_B != "") { check_B = 1; var dtcValue = ds.Tables[0] .AsEnumerable() .Where(x => x.Field <string>("DTCCODE") == DTCCODE_B) .Select(x => x.Field <decimal>("Result")) .FirstOrDefault(); if (CheckLogic(DTCCODE_B, DTCLOGIC_B, Convert.ToDouble(dtcValue), DTCCODE_B_INVERT)) { check_B = 2; } } if (DTCCODE_C != "" && DTCLOGIC_C != "") { check_C = 1; var dtcValue = ds.Tables[0] .AsEnumerable() .Where(x => x.Field <string>("DTCCODE") == DTCCODE_C) .Select(x => x.Field <decimal>("Result")) .FirstOrDefault(); if (CheckLogic(DTCCODE_C, DTCLOGIC_C, Convert.ToDouble(dtcValue), DTCCODE_C_INVERT)) { check_C = 2; } } if (DTCCODE_D != "" && DTCLOGIC_D != "") { check_D = 1; var dtcValue = ds.Tables[0] .AsEnumerable() .Where(x => x.Field <string>("DTCCODE") == DTCCODE_D) .Select(x => x.Field <decimal>("Result")) .FirstOrDefault(); if (CheckLogic(DTCCODE_D, DTCLOGIC_D, Convert.ToDouble(dtcValue), DTCCODE_D_INVERT)) { check_D = 2; } } if (Opreator == "AND") { if ((check_A == 0 || check_A == 2) && (check_B == 0 || check_B == 2) && (check_C == 0 || check_C == 2) && (check_D == 0 || check_D == 2)) { BuildStatus = BuildStatus + "," + BuildID; } } if (Opreator == "OR") { if (check_A == 2 || check_B == 2 || check_C == 2 || check_D == 2) { BuildStatus = BuildStatus + "," + BuildID; } } if (Opreator == " ") { if (check_A == 2) { BuildStatus = BuildStatus + "," + BuildID; } } } if (BuildStatus != "") { BuildStatus = BuildStatus.Remove(0, 1); } } } if (!string.IsNullOrEmpty(BuildStatus) && BuildStatus != string.Empty) { string ConQuery = string.Empty; ConQuery = " select distinct b.dtc_LOGIC_CONCLUSION,b.dtc_LOGIC_BUILD_PK,b.dtc_LOGIC_SMILEY from tab_CA_EMS_DTC_LOGIC_ADD a "; ConQuery += " inner join tab_CA_EMS_DTC_LOGIC_BUILD b on a.dtc_DTC_CODE+'_'+a.dtc_LOGIC=b.dtc_DTC_CODE_A+'_'+b.dtc_DTC_LOGIC_A or a.dtc_DTC_CODE+'_'+a.dtc_LOGIC=b.dtc_DTC_CODE_B+'_'+b.dtc_DTC_LOGIC_B or a.dtc_DTC_CODE+'_'+a.dtc_LOGIC=b.dtc_DTC_CODE_c+'_'+b.dtc_DTC_LOGIC_C or a.dtc_DTC_CODE+'_'+a.dtc_LOGIC=b.dtc_DTC_CODE_D+'_'+b.dtc_DTC_LOGIC_D"; ConQuery += " where b.dtc_LOGIC_BUILD_PK in (" + BuildStatus + ")"; dsC = DBL.executeDataSet(ConStr, CommandType.Text, ConQuery, null); var Serializer = new JavaScriptSerializer(); freezeList = JsonConvert.SerializeObject(dsC, Formatting.Indented); } else { freezeList = "{\r\n \"Table\": []\r\n}"; } } } catch (Exception ex) { } finally { if (_objdtcBuild.State != ConnectionState.Closed) { _objdtcBuild.Close(); } _objdtcBuild.Dispose(); } return(freezeList); }
private void BindFreezeDetails() { string _sStartDate = ""; string _sEndDate = ""; string _strStart = ""; string _strEnd = ""; int DateSelect = Convert.ToInt32(hfvDateval.Value); var dt = DateTime.Now; if (DateSelect == 0) { _sStartDate = dt.Month + "/" + dt.Day + "/" + dt.Year; _sEndDate = dt.Month + "/" + (dt.Day) + "/" + dt.Year; txtSDate.Enabled = false; txtEDate.Enabled = false; txtSDate.Text = ""; txtEDate.Text = ""; } else if (DateSelect == 1) { _sStartDate = "01/01/" + DateTime.Now.Year; _sEndDate = dt.Month + "/" + dt.Day + "/" + dt.Year; txtSDate.Enabled = false; txtEDate.Enabled = false; txtSDate.Text = ""; txtEDate.Text = ""; } else if (DateSelect == 2) { txtSDate.Enabled = true; txtEDate.Enabled = true; _strStart = txtSDate.Text; _strEnd = txtEDate.Text; if (string.IsNullOrEmpty(_strStart) || string.IsNullOrEmpty(_strEnd)) { return; } else { _sStartDate = _strStart; _sEndDate = _strEnd; } } DataSet dsFreezeView = new DataSet(); string ConQuery = string.Empty; var ConStr = ConnectionString.GetDBConnectionString(); ConQuery = "SELECT * FROM tab_CA_EMS_MASTER_INFO WHERE CONVERT(date, freeze_TIMESTAMP, 101) between '" + _sStartDate + "' and '" + _sEndDate + "'"; dsFreezeView = DBL.executeDataSet(ConStr, CommandType.Text, ConQuery, null); if (dsFreezeView != null && dsFreezeView.Tables[0].Rows.Count > 0) { gvFreezeView.DataSource = dsFreezeView; gvFreezeView.DataBind(); } else { gvFreezeView.DataSource = null; gvFreezeView.DataBind(); } }