private void getConfigdatafromWebservice() { KPCTSDS.appserver.Service1 details = new KPCTSDS.appserver.Service1(); try { string ConnectionStatus = classConnectivityCheck.WebServiceConnectivityCheck(); if (ConnectionStatus == "Failed") { ConnectionStatus = classConnectivityCheck.WebServiceConnectivityCheck(); } if (ConnectionStatus == "Success") { classLog.writeLog("Message @:Web Service Connected."); classLog.writeLog("Message @:Reader IP: " + classLogin.ReaderIP.ToString()); DataSet ds = new DataSet(); //classLog.writeLog("Message @:" + DatabaseVarient.ToString()); if (DatabaseVarient == "SQL") { ds = details.GetReaderDetailsSQL(classLogin.ReaderIP); } else if (DatabaseVarient == "Oracle") { ds = details.GetReaderDetailsOracle(classLogin.ReaderIP); } //classLog.writeLog("Message @: Readerdetails recevied from database." ); if (ds.Tables[0].Rows.Count == 0) { MessageBox.Show("Config Details Not found."); classLog.writeLog("Message @:Config Details Not found."); } else { txtReaderNo.Text = ds.Tables[0].Rows[0].ItemArray[0].ToString(); txtReaderName.Text = ds.Tables[0].Rows[0].ItemArray[1].ToString(); txtReaderIP.Text = classLogin.ReaderIP; txtMacAdd.Text = ds.Tables[0].Rows[0].ItemArray[2].ToString(); txtServerIP.Text = ds.Tables[0].Rows[0].ItemArray[3].ToString(); txtServerPort.Text = ds.Tables[0].Rows[0].ItemArray[4].ToString(); //txtProcess.Text = "KPCT Operations"; classLog.writeLog("Message @:Details Received from DB."); clearlocaldb(); saveCofigdetailsinsdfdb(); } } else { MessageBox.Show("Network Not Connected.."); classLog.writeLog("Error @:Network Not Connected.."); } //} } catch (Exception ex) { //MessageBox.Show(ex.Message, "NetAvail2"); classLog.writeLog("Error @:Web Service Not Connected."); classLog.writeLog("Error @: " + ex.ToString()); } }
public void SyncLocationMaster() { string getdetails = cmbLocation.Text.ToString(); if (getdetails == "CT-Yard" || getdetails == "CT-Warehouse") { classLog.writeLog("Message @: Get Master Details for:" + getdetails.ToString()); DataTable dt = new DataTable(); KPCTSDS.appserver.Service1 details = new KPCTSDS.appserver.Service1(); try { string ConnectionStatus = classConnectivityCheck.WebServiceConnectivityCheck(); if (ConnectionStatus == "Failed") { ConnectionStatus = classConnectivityCheck.WebServiceConnectivityCheck(); } if (ConnectionStatus == "Success") { classLog.writeLog("Message @:Web Service Connected."); classLog.writeLog("Message @:GetDtails: " + getdetails.ToString()); dt = details.GetLocationMasterDetailsCFSSQL(getdetails); if (dt.Rows.Count == 0) { classLog.writeLog("Message @: Master Details Not found."); } else { classLog.writeLog("Message @:Master Received from DB."); clearlocaldbLocationMaster(); foreach (DataRow dr in dt.Rows) { if (dr != null) { string InsertQry = "INSERT INTO [LocationMst] ([LId],[LocationId],[LocationName]) Values ('" + dr[0].ToString() + "','" + dr[1].ToString() + "','" + dr[2].ToString() + "')"; string CONN_STRING = localConnection; SqlCeConnection Con = new SqlCeConnection(CONN_STRING); Con.Open(); SqlCeCommand cmd = new SqlCeCommand(InsertQry, Con); cmd.ExecuteNonQuery(); Con.Close(); } } classLog.writeLog("Message @:Location Mster Sync Complete."); } } else { classLog.writeLog("Error @:Network Not Connected.."); } } catch (Exception ex) { classLog.writeLog("Error @:Web Service Not Connected."); classLog.writeLog("Error @: " + ex.ToString()); } } }
private DataTable getDatafromWebservice(string getdetails) { DataTable dt = new DataTable(); KPCTSDS.appserver.Service1 details = new KPCTSDS.appserver.Service1(); try { string ConnectionStatus = classConnectivityCheck.WebServiceConnectivityCheck(); if (ConnectionStatus == "Failed") { ConnectionStatus = classConnectivityCheck.WebServiceConnectivityCheck(); } if (ConnectionStatus == "Success") { classLog.writeLog("Message @:Web Service Connected."); classLog.writeLog("Message @:GetDtails: " + getdetails.ToString()); if (DatabaseVarient == "SQL") { dt = details.GetMasterDetailsSQL(getdetails); } else if (DatabaseVarient == "Oracle") { dt = details.GetMasterDetailsOracle(getdetails); } if (dt.Rows.Count == 0) { lblStatus.Text = "Details Not found."; classLog.writeLog("Message @: Master Details Not found."); } else { classLog.writeLog("Message @:Master Received from DB."); } details.Dispose(); } else { lblStatus.Text = "Network Not Connected.."; classLog.writeLog("Error @:Network Not Connected.."); } } catch (Exception ex) { //MessageBox.Show(ex.Message, "NetAvail2"); lblStatus.Text = "Connection Failed."; classLog.writeLog("Error @:Web Service Not Connected."); classLog.writeLog("Error @: " + ex.ToString()); } return(dt); }