public void insertKPCTDetailstoWS(string tagno) //inserting data to Web Service { if (tagno.ToString() == "") { MessageBox.Show("Tag details not found."); classLog.writeLog("Warning @: KPCT Operations: Tag details not found."); } else { string truckno = txtTruckNo.Text.Trim().Replace("'", "").Replace(" ", "").ToUpper().ToString(); string savetime = System.DateTime.Now.ToString("dd-MMM-yyyy HH:mm:ss"); string OPLOCid = cmbLocation.SelectedValue.ToString(); try { string state = ""; if (classLogin.Connectivity == "WIFI") { KPCTSDS.appserver.Service1 details = new KPCTSDS.appserver.Service1(); if (classServerDetails.DBType == "Oracle") { state = details.InsertKPCTOperationDetailsOracle(tagno, classLogin.ReaderNo.ToString(), btnSave.Text, savetime, classLogin.User, classLogin.UserType.ToString(), classLogin.Location.ToString(), txtOpQty.Text.ToString(), OPLOCid, "", "", "", "", "", ""); } } else if (classLogin.Connectivity == "GPRS") { KPCTSDS.WebReference_GPRS.Service1 details = new KPCTSDS.WebReference_GPRS.Service1(); if (classServerDetails.DBType == "Oracle") { state = details.InsertKPCTOperationDetailsOracle(tagno, classLogin.ReaderNo.ToString(), btnSave.Text, savetime, classLogin.User, classLogin.UserType.ToString(), classLogin.Location.ToString(), txtOpQty.Text.ToString(), OPLOCid, "", "", "", "", "", ""); } } //classLog.writeLog("Info @: KPCT Operations:"+TagRegid+","+ tagno+"," +truckno+","+ trucktype+","+ readerno+","+readerip+","+ User+","+ unregtime); if (state == "SUCCESS") { lblStatus.Text = "Saved..in Online."; MessageBox.Show("Saved..Successfully."); WAP3.formKPCTOps r = new WAP3.formKPCTOps(1); r.btnVerify_Click(TAG); this.Close(); } else { classLog.writeLog("Error @: KPCT Operations Tally Sheet: Connection failed."); //insertexitdatatoLocalDB(); } } catch (Exception ex) { classLog.writeLog("Error @: KPCT Operations TallySheet: Connection failed."); classLog.writeLog("Exception @: " + ex.ToString()); //insertexitdatatoLocalDB(); } } }
private void button1_Click(object sender, EventArgs e) { KPCTSDS.appserver.Service1 details = new KPCTSDS.appserver.Service1(); DataSet ds = new DataSet(); if (classServerDetails.DBVarient == "Oracle") { ds = details.GetKPCTTruckTallySheetDetailsOracle(TAG); } DataTable dt = ds.Tables[0]; if (dt.Rows.Count > 0) { dt.Columns.Remove("TRUCKID"); workTable.Rows.Clear(); foreach (DataRow row in dt.Rows) { object[] o = { row["1"].ToString(), row["2"].ToString(), row["3"].ToString(), row["4"].ToString(), row["5"].ToString(), row["6"].ToString(), row["7"].ToString(), row["8"].ToString() }; workTable.Rows.Add(o); } } dataGridTallySheet.DataSource = workTable; ////--Start-- Grid Style--- //dataGridTallySheet.TableStyles.Clear(); //DataGridTableStyle tableStyle = new DataGridTableStyle(); //tableStyle.MappingName = workTable.TableName; //foreach (DataColumn item in workTable.Columns) //{ // DataGridTextBoxColumn tbcName = new DataGridTextBoxColumn(); // tbcName.Width = 50; // tbcName.MappingName = item.ColumnName; // tbcName.HeaderText = item.ColumnName; // tableStyle.GridColumnStyles.Add(tbcName); //} //dataGridTallySheet.TableStyles.Add(tableStyle); ////--End-- Grid Style--- //Display Total Qty and Status---Start--- int sum = 0; for (int i = 1; i <= 8; i++) { foreach (DataRow dr in workTable.Rows) { sum += Convert.ToInt32(dr[i.ToString()]); } } txtOpQty.Text = txtTotalQty1.Text = sum.ToString(); lblStatus1.Text = lblStatus.Text = workTable.Rows.Count.ToString() + " Rows Inserted."; }
private void btnSave_Click(object sender, EventArgs e) { if (cmbReasonName.Text == "OTHER" && txtRemarks.Text.ToString().Trim() == "") { MessageBox.Show("Please enter Remarks."); txtRemarks.Focus(); } else { string reasonid = cmbReasonName.SelectedValue.ToString(); btnSave.Enabled = false; string reasondesc = txtRemarks.Text.ToString(); string savetime = System.DateTime.Now.ToString("dd-MMM-yyyy HH:mm:ss"); if (classLogin.Connectivity == "WIFI") { string wifistate = classConnectivityCheck.WifiSignalStrenthCheck(); if (wifistate == "Success") { string ConnectionStatus = classConnectivityCheck.WebServiceConnectivityCheck(); if (ConnectionStatus == "Failed") { ConnectionStatus = classConnectivityCheck.WebServiceConnectivityCheck(); } if (ConnectionStatus == "Success") { KPCTSDS.appserver.Service1 details = new KPCTSDS.appserver.Service1(); string state = details.InsertReasonDetailsOracle(TAG, classLogin.ReaderNo.ToString(), saveops, savetime, classLogin.User.ToString(), classLogin.UserType.ToString(), classLogin.Location.ToString(), QTY, OPLOCID, reasonid, reasondesc); if (state == "SUCCESS") { this.Close(); } else { lblStatus.Text = state.ToString(); } } else { classLog.writeLog("Error @: KPCT Operations-Save: Web Service Not Connected."); lblStatus.Text = "Web Service Not Connected."; } } else { classLog.writeLog("Error @: KPCT Operations-Save: Wifi Signal Week."); lblStatus.Text = "Wifi Signal Week."; } } } }
public void syncTime() { KPCTSDS.appserver.Service1 details = new KPCTSDS.appserver.Service1(); try { //HttpWebRequest request = (HttpWebRequest)WebRequest.Create(@"http://172.168.0.45/rfid-web/"); //request.Method = "GET"; //request.Accept = "text/html, application/xhtml+xml, */*"; //request.Proxy = null; //request.Timeout = 5000; //using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) //{ // if (response.StatusCode == HttpStatusCode.OK) string ConnectionStatus = classConnectivityCheck.WebServiceConnectivityCheck(); if (ConnectionStatus == "Failed") { ConnectionStatus = classConnectivityCheck.WebServiceConnectivityCheck(); } if (ConnectionStatus == "Success") { DataSet ds = new DataSet(); if (DatabaseVarient == "SQL") { ds = details.GetDBTimeSQL(); } else if (DatabaseVarient == "Oracle") { ds = details.GetDBTimeOracle(); } DateTime dt = Convert.ToDateTime(ds.Tables[0].Rows[0].ItemArray[0]); UpdateCEMobileLocalTime.classSyncTime.SetSystemDateTime(dt); classLog.writeLog("Message @: Login: Time Sync Completed"); ds.Dispose(); } else { classLog.writeLog("Error @: Login: Time Sync Failed due to Web Request Failed."); } //} } catch (Exception ex) { classLog.writeLog("Error @: Login: Web Service Not Connected."); classLog.writeLog("Exception @: Login:" + ex.ToString()); } }
private void btnCheck_Click(object sender, EventArgs e) { KPCTSDS.appserver.Service1 details = new KPCTSDS.appserver.Service1(); try { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(@"http://172.168.0.45/rfid-web/"); request.Method = "GET"; request.Accept = "text/html, application/xhtml+xml, */*"; request.Proxy = null; request.Timeout = 5000; using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) { if (response.StatusCode == HttpStatusCode.OK) { MessageBox.Show("Hi"); DataSet ds = new DataSet(); if (DatabaseVarient == "SQL") { details.GetReaderDetailsSQL(classLogin.ReaderIP); } else if (DatabaseVarient == "Oracle") { ds = details.GetReaderDetailsOracle(classLogin.ReaderIP); } if (ds.Tables[0].Rows.Count == 0) { MessageBox.Show("Config Details Not found."); classLog.writeLog("Message @:Config Details Not found."); } } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public void insertKPCTDetailstoWS(string tagno) //inserting data to Web Service { if (tagno.ToString() == "") { MessageBox.Show("Tag details not found."); classLog.writeLog("Warning @: KPCT Operations: Tag details not found."); } else { string savetime = System.DateTime.Now.ToString("dd-MMM-yyyy HH:mm:ss"); string OPLOCid = cmbLocation.SelectedValue.ToString(); string HandledType; if (cmbHandledType.Text == "Select") { HandledType = ""; } else { HandledType = cmbHandledType.Text; } string TallySheetType = ""; if (radioCarting.Checked == true) { TallySheetType = radioCarting.Text.ToString(); } else if (radioStuffing.Checked == true) { TallySheetType = radioStuffing.Text.ToString(); } try { string state = ""; if (classLogin.Connectivity == "WIFI") { KPCTSDS.appserver.Service1 details = new KPCTSDS.appserver.Service1(); if (classServerDetails.DBType == "Oracle") { state = details.InsertKPCTOperationDetailsOracle(tagno, classLogin.ReaderNo.ToString(), btnSave.Text, savetime, classLogin.User, classLogin.UserType.ToString(), classLogin.Location.ToString(), txtOpQty.Text.ToString(), OPLOCid, cmbCargoCondition.SelectedValue.ToString(), cmbWeatherCondition.SelectedValue.ToString(), cmbHandledBy.SelectedValue.ToString(), HandledType, TallySheetType, txtContainerNo.ToString()); } } else if (classLogin.Connectivity == "GPRS") { KPCTSDS.WebReference_GPRS.Service1 details = new KPCTSDS.WebReference_GPRS.Service1(); if (classServerDetails.DBType == "Oracle") { state = details.InsertKPCTOperationDetailsOracle(tagno, classLogin.ReaderNo.ToString(), btnSave.Text, savetime, classLogin.User, classLogin.UserType.ToString(), classLogin.Location.ToString(), txtOpQty.Text.ToString(), OPLOCid, cmbCargoCondition.SelectedValue.ToString(), cmbWeatherCondition.SelectedValue.ToString(), cmbHandledBy.SelectedValue.ToString(), HandledType, TallySheetType, txtContainerNo.ToString()); } } //classLog.writeLog("Info @: KPCT Operations:"+TagRegid+","+ tagno+"," +truckno+","+ trucktype+","+ readerno+","+readerip+","+ User+","+ unregtime); if (state == "SUCCESS") { lblStatus.Text = "Saved..in Online."; MessageBox.Show("Saved..Successfully."); WAP3.formKPCTOps r = new WAP3.formKPCTOps(1); r.btnVerify_Click(TAG); r._lbReadInfoReadWrite.Text = "Saved..in Online."; this.Close(); } else { classLog.writeLog("Error @: KPCT Operations Tally Sheet: " + state.ToString()); lblStatus.Text = state.ToString(); } } catch (Exception ex) { classLog.writeLog("Error @: KPCT Operations TallySheet: Connection failed."); classLog.writeLog("Exception @: " + ex.ToString()); lblStatus.Text = "Connection failed."; } } }
public void LoadTallySheetDetails() { TSRequired = ""; DataSet ds = new DataSet(); DataSet dstallylocdetails = new DataSet(); if (classLogin.Connectivity == "WIFI") { KPCTSDS.appserver.Service1 details = new KPCTSDS.appserver.Service1(); if (classServerDetails.DBVarient == "Oracle") { ds = details.GetKPCTTruckTallySheetDetailsOracleNew(TAG); TSRequired = details.GetKPCTTruckTallySheetValidationDetailsOracle(TAG); if (btnSave.Text == "CT-YARD/WH OUT") { dstallylocdetails = details.GetKPCTTruckTallySheetLocationDetailsOracle(TAG); cmbLocation.SelectedValue = dstallylocdetails.Tables[0].Rows[0].ItemArray[0]; cmbCargoCondition.SelectedValue = dstallylocdetails.Tables[0].Rows[0].ItemArray[1]; cmbWeatherCondition.SelectedValue = dstallylocdetails.Tables[0].Rows[0].ItemArray[2]; cmbHandledBy.SelectedValue = dstallylocdetails.Tables[0].Rows[0].ItemArray[3]; cmbHandledType.Text = dstallylocdetails.Tables[0].Rows[0].ItemArray[4].ToString(); txtContainerNo.Text = dstallylocdetails.Tables[0].Rows[0].ItemArray[6].ToString(); if (dstallylocdetails.Tables[0].Rows[0].ItemArray[5].ToString() == "Carting") { radioCarting.Checked = true; } else if (dstallylocdetails.Tables[0].Rows[0].ItemArray[5].ToString() == "Stuffing") { radioStuffing.Checked = true; } } } } else if (classLogin.Connectivity == "GPRS") { KPCTSDS.WebReference_GPRS.Service1 details = new KPCTSDS.WebReference_GPRS.Service1(); if (classServerDetails.DBVarient == "Oracle") { ds = details.GetKPCTTruckTallySheetDetailsOracleNew(TAG); TSRequired = details.GetKPCTTruckTallySheetValidationDetailsOracle(TAG); if (btnSave.Text == "CT-YARD/WH OUT") { dstallylocdetails = details.GetKPCTTruckTallySheetLocationDetailsOracle(TAG); cmbLocation.SelectedValue = dstallylocdetails.Tables[0].Rows[0].ItemArray[0]; cmbCargoCondition.SelectedValue = dstallylocdetails.Tables[0].Rows[0].ItemArray[1]; cmbWeatherCondition.SelectedValue = dstallylocdetails.Tables[0].Rows[0].ItemArray[2]; cmbHandledBy.SelectedValue = dstallylocdetails.Tables[0].Rows[0].ItemArray[3]; cmbHandledType.Text = dstallylocdetails.Tables[0].Rows[0].ItemArray[4].ToString(); } } } DataTable dt = ds.Tables[0]; if (dt.Rows.Count > 0) { dt.Columns.Remove("TRUCKID"); workTable.Rows.Clear(); foreach (DataRow row in dt.Rows) { string sno = (dataGridTallySheet.VisibleRowCount + 1).ToString(); object[] o = { sno.ToString(), row["WIDTH"].ToString(), row["HEIGHT"].ToString(), row["COLTOTAL"].ToString() }; workTable.Rows.Add(o); } } dataGridTallySheet.DataSource = workTable; //Display Total Qty and Status---Start--- int sum = 0; foreach (DataRow dr in workTable.Rows) { sum += Convert.ToInt32(dr["RTotal"]); } txtOpQty.Text = txtTotalQty1.Text = sum.ToString(); lblStatus1.Text = lblStatus.Text = workTable.Rows.Count.ToString() + " Rows Inserted."; }
public void savedetails() { if (txtHight.Text == "" || txtWidth.Text == "") { lblStatus.Text = "Please Enter Hight&Width details."; } else if (txtHight.Text == "0" || txtWidth.Text == "0") { lblStatus.Text = "Please Enter Hight&Width details."; } else { if (classLogin.Connectivity == "WIFI") { KPCTSDS.appserver.Service1 details = new KPCTSDS.appserver.Service1(); string WifiConnectionStatus = classConnectivityCheck.WifiSignalStrenthCheck(); if (WifiConnectionStatus == "Success") { string ConnectionStatus = classConnectivityCheck.WebServiceConnectivityCheck(); if (ConnectionStatus == "Failed") { ConnectionStatus = classConnectivityCheck.WebServiceConnectivityCheck(); } if (ConnectionStatus == "Success") { string savetime = System.DateTime.Now.ToString("dd-MMM-yyyy HH:mm:ss"); string state = details.InsertKPCTTruckTallySheetDetailsOracleNew(TAG, txtWidth.Text.ToString(), txtHight.Text.ToString(), txtCTotal.Text.ToString(), classLogin.User, savetime); if (state == "SUCCESS") { classLog.writeLog("Message @: KPCT Operations Tally Sheet: Saved successfully in DB."); AddDetailstoDataGrid(); txtWidth.Text = ""; txtHight.Text = ""; txtCTotal.Text = ""; } else { lblStatus.Text = state.ToString(); classLog.writeLog("Error @: KPCT Operations-TallySheet Insert: SaveFailed."); } } else { lblStatus.Text = " Webservice Not Connected.."; classLog.writeLog("Error @: KPCT Operations-TallySheet Wifi: Webservice Not Connected.."); } } else { lblStatus.Text = "Wifi Network Not Connected.."; classLog.writeLog("Error @: KPCT Operations-TallySheet: Wifi Network Not Connected.."); } } else if (classLogin.Connectivity == "GPRS") { string ConnectionStatus = classConnectivityCheck.WebServiceConnectivityCheck(); if (ConnectionStatus == "Failed") { ConnectionStatus = classConnectivityCheck.WebServiceConnectivityCheck(); } if (ConnectionStatus == "Success") { KPCTSDS.WebReference_GPRS.Service1 details = new KPCTSDS.WebReference_GPRS.Service1(); string savetime = System.DateTime.Now.ToString("dd-MMM-yyyy HH:mm:ss"); string state = details.InsertKPCTTruckTallySheetDetailsOracleNew(TAG, txtWidth.Text.ToString(), txtHight.Text.ToString(), txtCTotal.Text.ToString(), classLogin.User, savetime); if (state == "SUCCESS") { classLog.writeLog("Error @: KPCT Operations Tally Sheet: Saved successfully in DB."); AddDetailstoDataGrid(); txtWidth.Text = ""; txtHight.Text = ""; txtCTotal.Text = ""; } else { classLog.writeLog("Error @: KPCT Operations-TallySheet Insert: SaveFailed."); } } else { lblStatus.Text = " Webservice Not Connected.."; classLog.writeLog("Error @: KPCT Operations-TallySheet GPRS: Webservice Not Connected.."); } } else { lblStatus.Text = "Network Not Connected.."; classLog.writeLog("Error @: KPCT Operations-TallySheet: Network Not Connected.."); } } }
public void savedetails() { btnDisable(); if (textBox1.Text == "" && textBox2.Text == "" && textBox3.Text == "" && textBox4.Text == "" && textBox5.Text == "" && textBox6.Text == "" && textBox7.Text == "" && textBox8.Text == "" && textBox9.Text == "") { lblStatus.Text = "Please Enter details."; //MessageBox.Show("Please Enter details."); } else if (textBox1.Text == "0" && textBox2.Text == "0" && textBox3.Text == "0" && textBox4.Text == "0" && textBox5.Text == "0" && textBox6.Text == "0" && textBox7.Text == "0" && textBox8.Text == "0" && textBox9.Text == "0") { lblStatus.Text = "Please Enter details."; //MessageBox.Show("Please Enter details."); } else { if (textBox1.Text == "") { textBox1.Text = "0"; } if (textBox2.Text == "") { textBox2.Text = "0"; } if (textBox3.Text == "") { textBox3.Text = "0"; } if (textBox4.Text == "") { textBox4.Text = "0"; } if (textBox5.Text == "") { textBox5.Text = "0"; } if (textBox6.Text == "") { textBox6.Text = "0"; } if (textBox7.Text == "") { textBox7.Text = "0"; } if (textBox8.Text == "") { textBox8.Text = "0"; } if (textBox9.Text == "") { textBox9.Text = "0"; } if (classLogin.Connectivity == "WIFI") { KPCTSDS.appserver.Service1 details = new KPCTSDS.appserver.Service1(); string WifiConnectionStatus = classConnectivityCheck.WifiSignalStrenthCheck(); if (WifiConnectionStatus == "Success") { string ConnectionStatus = classConnectivityCheck.WebServiceConnectivityCheck(); if (ConnectionStatus == "Failed") { ConnectionStatus = classConnectivityCheck.WebServiceConnectivityCheck(); } if (ConnectionStatus == "Success") { string savetime = System.DateTime.Now.ToString("dd-MMM-yyyy HH:mm:ss"); string state = details.InsertKPCTTruckTallySheetDetailsOracle(textBox1.Text.ToString(), textBox2.Text.ToString(), textBox3.Text.ToString(), textBox4.Text.ToString(), textBox5.Text.ToString(), textBox6.Text.ToString(), textBox7.Text.ToString(), textBox8.Text.ToString(), textBox9.Text.ToString(), TAG, classLogin.User, savetime); if (state == "SUCCESS") { classLog.writeLog("Error @: KPCT Operations Tally Sheet: Saved successfully in DB."); AddDetailstoDataGrid(); } else { classLog.writeLog("Error @: KPCT Operations-TallySheet Insert: SaveFailed."); } } else { lblStatus.Text = " Webservice Not Connected.."; classLog.writeLog("Error @: KPCT Operations-TallySheet Wifi: Webservice Not Connected.."); } } else { lblStatus.Text = "Wifi Network Not Connected.."; classLog.writeLog("Error @: KPCT Operations-TallySheet: Wifi Network Not Connected.."); } } else if (classLogin.Connectivity == "GPRS") { string ConnectionStatus = classConnectivityCheck.WebServiceConnectivityCheck(); if (ConnectionStatus == "Failed") { ConnectionStatus = classConnectivityCheck.WebServiceConnectivityCheck(); } if (ConnectionStatus == "Success") { KPCTSDS.WebReference_GPRS.Service1 details = new KPCTSDS.WebReference_GPRS.Service1(); string savetime = System.DateTime.Now.ToString("dd-MMM-yyyy HH:mm:ss"); string state = details.InsertKPCTTruckTallySheetDetailsOracle(textBox1.Text.ToString(), textBox2.Text.ToString(), textBox3.Text.ToString(), textBox4.Text.ToString(), textBox5.Text.ToString(), textBox6.Text.ToString(), textBox7.Text.ToString(), textBox8.Text.ToString(), textBox9.Text.ToString(), TAG, classLogin.User, savetime); if (state == "SUCCESS") { classLog.writeLog("Error @: KPCT Operations Tally Sheet: Saved successfully in DB."); AddDetailstoDataGrid(); } else { classLog.writeLog("Error @: KPCT Operations-TallySheet Insert: SaveFailed."); } } else { lblStatus.Text = " Webservice Not Connected.."; classLog.writeLog("Error @: KPCT Operations-TallySheet GPRS: Webservice Not Connected.."); } } else { lblStatus.Text = "Network Not Connected.."; classLog.writeLog("Error @: KPCT Operations-TallySheet: Network Not Connected.."); } } btnEnable(); }