private void rent_Click(object sender, EventArgs e) { Rscar.MoveFirst(); Rsuser.MoveFirst(); while (!Rscar.EOF) { if (carID.Text.Equals(Rscar.Fields["CarID"].Value)) { Rscar.Fields["Availability"].Value = "No"; Rsuser.AddNew(); Rsuser.Fields["CarID"].Value = Convert.ToInt32(carID.Text); Rsuser.Fields["FirstName"].Value = firstName.Text; Rsuser.Fields["LastName"].Value = lastName.Text; Rsuser.Fields["PhoneNumber"].Value = phoneNumber.Text; Rsuser.Fields["RentDate"].Value = Convert.ToDateTime(rentDate.Text); Rsuser.Fields["ReturnDate"].Value = Convert.ToDateTime(returnDate.Text); Rsuser.Fields["Rent"].Value = "Yes"; Rscar.Update(); Rsuser.Update(); MessageBox.Show("You rent car successfully"); return; } Rscar.MoveNext(); } MessageBox.Show("Something wrong...."); }
private void FillList() { if (cstmr_tb.RecordCount > 0) { while (cstmr_tb.EOF == false) { customers_list.Items.Add(cstmr_tb.Fields["CName"].Value.ToString()); customers_list.Update(); cstmr_tb.MoveNext(); } cstmr_tb.MoveFirst(); } }
private void FillList() { if (frmr_tb.RecordCount > 0) { while (frmr_tb.EOF == false) { farmers_list.Items.Add(frmr_tb.Fields["fNames"].Value.ToString()); farmers_list.Update(); frmr_tb.MoveNext(); } frmr_tb.MoveFirst(); } }
private void FillList() { if (comm_tb.RecordCount > 0) { while (comm_tb.EOF == false) { commidities_list.Items.Add(comm_tb.Fields["cname"].Value.ToString()); commidities_list.Update(); comm_tb.MoveNext(); } comm_tb.MoveFirst(); } }
protected bool WhatifExists(string whatifName) { bool exists = false; ADODB.Recordset rec = new ADODB.Recordset(); DbUse.OpenAdoRec(classE1_1.globaldb, rec, "SELECT WID, Name FROM tblWhatif;"); try { int i = 0; while (!rec.EOF && !exists) { if (i == 0) { rec.MoveFirst(); } else { rec.MoveNext(); } exists = rec.Fields["Name"].Value.ToString().ToUpper().Equals(whatifName.ToUpper()); i++; } } catch (Exception) { } DbUse.CloseAdoRec(rec); return(exists); }
private bool IsFeatureEdited(int p_FID) { bool bReturn = false; IGTJobManagementService oJobSrv = GTClassFactory.Create <IGTJobManagementService>(); oJobSrv.DataContext = DataContext; ADODB.Recordset rs = oJobSrv.FindPendingEdits(); if (rs != null) { if (rs.RecordCount > 0) { rs.MoveFirst(); while (rs.EOF == false) { if (Convert.ToInt32(rs.Fields["g3e_fid"].Value) == p_FID && (Convert.ToInt32(rs.Fields["G3E_CNO"].Value) == 21 || Convert.ToInt32(rs.Fields["G3E_CNO"].Value) == 22)) { bReturn = true; break; } rs.MoveNext(); } } } oJobSrv = null; return(bReturn); }
public void Execute() { try { string sSql = "select sysdate from dual"; ADODB.Recordset rs = m_GTDataContext.OpenRecordset(sSql, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly, -1); if (m_gComps[m_gCompName].Recordset != null) { if (!(m_gComps[m_gCompName].Recordset.EOF && m_gComps[m_gCompName].Recordset.BOF)) { if (rs != null) { if (!(rs.EOF && rs.BOF)) { rs.MoveFirst(); m_gComps[m_gCompName].Recordset.Fields[m_gFieldName].Value = rs.Fields[0].Value; } } } } } catch (Exception ex) { MessageBox.Show("There is an error in \"Set System Date On Create\" Funtional Interface \n" + ex.Message, "G/Technology"); } }
private bool IsCorrectionJob() { bool bReturn = false; ADODB.Recordset oRS = null; try { oRS = DataContext.OpenRecordset("select G3E_JOBTYPE from g3e_job where g3e_identifier = ?", ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockOptimistic, (int)ADODB.CommandTypeEnum.adCmdText, DataContext.ActiveJob); oRS.MoveFirst(); if (Convert.ToString(oRS.Fields["G3E_JOBTYPE"].Value).Equals("NON-WR")) { bReturn = true; } } catch (Exception ex) { throw ex; } finally { if (oRS != null) { if (oRS.State == 1) { oRS.Close(); oRS.ActiveConnection = null; } oRS = null; } } return(bReturn); }
private void cmdCancel_Click() { bool mbDataChanged = false; int mvBookMark = 0; ADODB.Recordset adoPrimaryRS = new ADODB.Recordset(); bool mbAddNewFlag = false; bool mbEditFlag = false; // ERROR: Not supported in C#: OnErrorStatement if (mbAddNewFlag) { this.Close(); } else { mbEditFlag = false; mbAddNewFlag = false; adoPrimaryRS.CancelUpdate(); if (mvBookMark > 0) { adoPrimaryRS.Bookmark = mvBookMark; } else { adoPrimaryRS.MoveFirst(); } mbDataChanged = false; } }
private string GetCUCategoryCode(string p_cuCode, IGTApplication p_App) { string cuCategoryCode = string.Empty; ADODB.Recordset rs = null; try { string sql = "select CATEGORY_C from CULIB_UNIT where CU_ID = ?"; rs = p_App.DataContext.OpenRecordset(sql, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockReadOnly, (int)ADODB.CommandTypeEnum.adCmdText, p_cuCode); if (rs != null) { if (rs.RecordCount > 0) { rs.MoveFirst(); cuCategoryCode = Convert.ToString(rs.Fields[0].Value); } } } catch (Exception) { throw; } return(cuCategoryCode); }
private void cmdCancel_Click(System.Object eventSender, System.EventArgs eventArgs) { bool mbDataChanged = false; int mvBookMark = 0; ADODB.Recordset adoPrimaryRS = default(ADODB.Recordset); bool mbAddNewFlag = false; bool mbEditFlag = false; // ERROR: Not supported in C#: OnErrorStatement if (mbAddNewFlag) { this.Close(); } else { mbEditFlag = false; mbAddNewFlag = false; adoPrimaryRS.CancelUpdate(); if (mvBookMark > 0) { adoPrimaryRS.Bookmark = mvBookMark; } else { adoPrimaryRS.MoveFirst(); } mbDataChanged = false; } this.Close(); }
private void Form1_Load(object sender, EventArgs e) { String Sqlstr1, Sqlstr2; Cn = new ADODB.Connection(); Rscar = new ADODB.Recordset(); Rsuser = new ADODB.Recordset(); Cn.Provider = "Microsoft.Jet.Oledb.4.0"; Cn.ConnectionString = "DataBase\\Cars.mdb"; Cn.Open(); Sqlstr1 = "select * from Car"; Sqlstr2 = "select * from Customer"; Rscar.Open(Sqlstr1, Cn, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockOptimistic); Rsuser.Open(Sqlstr2, Cn, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockOptimistic); menu.Parent = tab; info.Parent = null; customer.Parent = null; modify.Parent = null; returnCar.Parent = null; Rscar.MoveFirst(); //Rsuser.MoveFirst(); }
/// <summary> /// Method is used to get the owner status /// </summary> /// <param name="OwnerID">Owner Id</param> /// <returns></returns> private string GetOwnerStatus(int OwnerID) { string sql = ""; ADODB.Recordset rsTemp = null; int count = 0; try { sql = "select FEATURE_STATE_C from COMMON_N where g3e_id={0}"; rsTemp = DataContext.Execute(string.Format(sql, OwnerID), out count, (int)ADODB.CommandTypeEnum.adCmdText, null); if (rsTemp != null && rsTemp.RecordCount > 0) { rsTemp.MoveFirst(); return((String)rsTemp.Fields["FEATURE_STATE_C"].Value); } } catch { throw; } finally { rsTemp = null; } return(null); }
public void loadItem() { ADODB.Recordset rs = default(ADODB.Recordset); int lValue = 0; loading = true; rs = modRecordSet.getRS(ref "SELECT Company_MonthendID FROM Company;"); gMonth = rs.Fields("Company_MonthendID").Value; //- 1 if (gMonth < 1) { gMonth = 1; } rs = modRecordSet.getRS(ref "SELECT Customer.CustomerID, Customer.Customer_InvoiceName, Customer.Customer_PrintStatement From Customer WHERE Customer_Disabled = 0 ORDER BY Customer.Customer_InvoiceName;"); int m = 0; while (!(rs.EOF)) { m = lstCustomer.Items.Add(new LBI(rs.Fields("Customer_InvoiceName").Value, rs.Fields("CustomerID").Value)); lstCustomer.SetItemChecked(m, rs.Fields("Customer_PrintStatement").Value); rs.moveNext(); } rs.MoveFirst(); lstCustomer.SelectedIndex = 0; loading = false; loadLanguage(); this.ShowDialog(); }
static List <MyParagraph> getTitleParagraphs(ADODB.Connection cnn, UInt64 titleId) { var paragraphLst = new List <MyParagraph>(); //get title var qry = "select * from paragraphs where titleId = ? "; var rst = new ADODB.Recordset(); rst.Open(qry.Replace("?", titleId.ToString()), cnn, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic, (int)ADODB.CommandTypeEnum.adCmdText); rst.MoveFirst(); while (!rst.EOF) { var par = new MyParagraph(); par.order = Convert.ToInt32(rst.Fields["order"].Value); par.alignment = Convert.ToInt32(rst.Fields["alignment"].Value); par.leftIndent = Convert.ToInt32(rst.Fields["leftIndent"].Value); par.fontSize = Convert.ToInt32(rst.Fields["fontSize"].Value); par.fontBold = Convert.ToInt32(rst.Fields["fontBold"].Value); par.fontItalic = Convert.ToInt32(rst.Fields["fontItalic"].Value); par.content = Convert.ToString(rst.Fields["content"].Value); paragraphLst.Add(par); rst.MoveNext(); } rst.Close(); return(paragraphLst); }
/// <summary> /// This method will update the feature state for the selected feature /// </summary> /// <param name="selectedObject"></param> private void SetFeatureState(IGTDDCKeyObject selectedObject) { string featureState = string.Empty; ADODB.Recordset commonComponentRs = null; try { IGTKeyObject feature = m_iGtApp.DataContext.OpenFeature(selectedObject.FNO, selectedObject.FID); IGTComponent commonComponent = feature.Components.GetComponent(1); if (commonComponent != null) { commonComponentRs = commonComponent.Recordset; if (commonComponentRs != null && commonComponentRs.RecordCount > 0) { commonComponentRs.MoveFirst(); featureState = Convert.ToString(commonComponentRs.Fields["FEATURE_STATE_C"].Value); if (featureState == "PPI" || featureState == "ABI") { commonComponentRs.Fields["FEATURE_STATE_C"].Value = "INI"; } if (featureState == "PPR" || featureState == "ABR") { commonComponentRs.Fields["FEATURE_STATE_C"].Value = "OSR"; } } } } catch (Exception) { throw; } }
public void AccessTableAdd() { String Criteria; Criteria = "PartnerID =" + textBox1.Text; Rs.MoveFirst(); //go to the beginning to start serach Rs.Find(Criteria); //Either We find the record(s), which is the first record if there are more than one //If record is found the file pointer stays at it //if not found, the file pointer has passed eof meaning eof = true if (Rs.EOF == true) { //not found Rs.AddNew(); SaveinTable(); Rs.Update(); MessageBox.Show("Record Added succesfully"); ClearBoxes(); return; } else { //found MessageBox.Show("Duplicate Record, try another PartnerID"); return; } }
private void submit_Click(object sender, EventArgs e) { Boolean flag = false; RsAccount.MoveFirst(); if (amountbox.Text.Equals("") || numbox.Text.Equals("") || typebox.Text.Equals("") || branchnumbox.Text.Equals("")) { MessageBox.Show("Please enter full of your infomation."); Clear(); } else { while (!RsAccount.EOF) { if (Convert.ToInt32(numbox.Text) == RsAccount.Fields["AccountNumber"].Value && Convert.ToInt32(branchnumbox.Text) == RsAccount.Fields["BranchNumber"].Value) { flag = true; break; } RsAccount.MoveNext(); } if (flag == true) { RsTranscript.AddNew(); RsTranscript.Fields["Date"].Value = datebox.Text; RsTranscript.Fields["Time"].Value = timebox.Text; RsTranscript.Fields["Amount"].Value = Convert.ToInt32(amountbox.Text); RsTranscript.Fields["AccountNumber"].Value = Convert.ToInt32(numbox.Text); RsTranscript.Fields["TransactionType"].Value = typebox.Text; RsTranscript.Fields["BranchNumber"].Value = Convert.ToInt32(branchnumbox.Text); if (typebox.Text.Equals("Deposit")) { int total = Convert.ToInt32(amountbox.Text) + RsAccount.Fields["Balance"].Value; RsAccount.Fields["Balance"].Value = total; } else if (typebox.Text.Equals("Withdraw")) { int total = RsAccount.Fields["Balance"].Value - Convert.ToInt32(amountbox.Text); RsAccount.Fields["Balance"].Value = total; } RsAccount.Update(); RsTranscript.Update(); MessageBox.Show("Your transaction completed successfully!!!!"); Show(); info.Parent = tabControl1; transcript.Parent = null; createAccount.Parent = null; } else { MessageBox.Show("Your transaction faild...."); Clear(); } } }
private void setup() { ADODB.Recordset rs = default(ADODB.Recordset); rs = modRecordSet.getRS(ref "SELECT Channel_Code FROM Channel ORDER BY ChannelID"); rs.MoveFirst(); _lblCG_0.Text = _lblCG_1.Text == _lblCG_2.Text == _lblCG_3.Text == _lblCG_4.Text == _lblCG_5.Text == _lblCG_6.Text == _lblCG_7.Text == rs.Fields("Channel_Code").Value; rs = modRecordSet.getRS(ref "SELECT Company.Company_PosInstruction FROM Company;"); lblInstruction.Text = rs.Fields("Company_PosInstruction").Value; lblInstructionNew.Text = Convert.ToString(Convert.ToDouble(lblInstruction.Text) + 1); }
private bool IsPropertyUnit(string p_CU) { bool bReturn = false; ADODB.Recordset rs = m_oDataContext.OpenRecordset("select RETIREMENT_NBR from CULIB_UNIT where CU_ID =?", ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockReadOnly, (int)ADODB.CommandTypeEnum.adCmdText, p_CU); rs.MoveFirst(); if (Convert.ToString(rs.Fields[0].Value).Equals("1")) { bReturn = true; } return(bReturn); }
private void cmdBarcodes_Click() { int x = 0; ADODB.Recordset rs = default(ADODB.Recordset); string lCode = null; string lID = null; string lQuantity = null; bool changeCode = false; return; // If id = 0 Then // cnnDB.Execute "UPDATE Catalogue SET Catalogue.Catalogue_Barcode = ""0"" WHERE (((IsNumeric([Catalogue_Barcode]))<>0));" modRecordSet.cnnDB.Execute("UPDATE Catalogue INNER JOIN StockItem ON Catalogue.Catalogue_StockItemID = StockItem.StockItemID SET Catalogue.Catalogue_Barcode = '0' WHERE (((Left([Catalogue_Barcode],3))='888') AND ((StockItem.StockItem_BrandItemID)>0));"); for (x = 1; x <= 15; x++) { modRecordSet.cnnDB.Execute("UPDATE Catalogue SET Catalogue.Catalogue_Barcode = Mid([Catalogue_Barcode],2,999) WHERE (((Left([Catalogue_Barcode],1))=\"0\"));"); } rs = modRecordSet.getRS(ref "SELECT Catalogue.Catalogue_StockItemID, Catalogue.Catalogue_Quantity, Catalogue.Catalogue_Barcode From Catalogue;"); // Set rs = getRS("SELECT Catalogue.Catalogue_StockItemID, Catalogue.Catalogue_Quantity, Catalogue.Catalogue_Barcode From Catalogue WHERE Catalogue.Catalogue_Barcode = '0';") // Else // Set rs = getRS("SELECT Catalogue.Catalogue_StockItemID, Catalogue.Catalogue_Quantity, Catalogue.Catalogue_Barcode From Catalogue WHERE (((Catalogue.Catalogue_StockItemID)=" & id & "));") // End If if (rs.RecordCount) { rs.MoveFirst(); while (!(rs.EOF)) { changeCode = true; lCode = rs.Fields("Catalogue_Barcode").Value; if (doCheckSum(ref lCode)) { if (Strings.Len(lCode) > 5) { changeCode = false; } } if (changeCode) { lID = rs.Fields("Catalogue_StockItemID").Value; lQuantity = rs.Fields("Catalogue_Quantity").Value; lCode = lID + "0" + lQuantity; lCode = "888" + Strings.Right(new string("0", 9) + lCode + "0", 9); lCode = modApplication.addCheckSum(ref lCode); modRecordSet.cnnDB.Execute("UPDATE Catalogue SET Catalogue_Barcode = '" + Strings.Replace(lCode, "'", "''") + "' WHERE Catalogue_StockItemID = " + lID + " AND Catalogue_Quantity = " + lQuantity); } rs.moveNext(); } } }
private void Form1_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'clientDBDataSet.ClientTable' table. You can move, or remove it, as needed. this.clientTableTableAdapter.Fill(this.clientDBDataSet.ClientTable); Con = new ADODB.Connection(); Rs = new ADODB.Recordset(); Con.Provider = "Microsoft.jet.oledb.4.0"; Con.ConnectionString = "C:\\ITD\\Term 3\\C#\\assignment\\assignment6\\ClientDB.mdb"; Con.Open(); Rs.Open("Select * from ClientTable", Con, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockOptimistic); Rs.MoveFirst(); dataGridView1.DataSource = Rs.Fields[2]; }
private Boolean Check(String pass, int ID) { RsUser.MoveFirst(); while (!RsUser.EOF) { if ((ID == RsUser.Fields["ClientID"].Value) && pass.Equals(RsUser.Fields["Password"].Value.ToString())) { return(true); } RsUser.MoveNext(); } return(false); }
private void setup() { ADODB.Recordset rs = default(ADODB.Recordset); short x = 0; rs = modRecordSet.getRS(ref "SELECT Channel_Code FROM Channel ORDER BY ChannelID"); rs.MoveFirst(); for (x = 0; x <= 7; x++) { this.lblCG[x].Text = rs.Fields("Channel_Code").Value; rs.moveNext(); } }
private string GetLatestEditedByWR(bool p_Latest) { string sReturnEditedByWR = string.Empty; ADODB.Recordset rs = null; string sSql = string.Empty; try { if (p_Latest == true) { sSql = "select G3E_IDENTIFIER from ASSET_HISTORY where G3E_FID =? order by CHANGE_DATE desc"; rs = m_odataContext.OpenRecordset(sSql, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockOptimistic, (int)ADODB.CommandTypeEnum.adCmdText, m_oKeyObject.FID); if (rs != null) { if (rs.RecordCount > 0) { rs.MoveFirst(); sReturnEditedByWR = Convert.ToString(rs.Fields["G3E_IDENTIFIER"].Value); } else //The feature is not posted so return the active job as the most recently edited by { sReturnEditedByWR = m_odataContext.ActiveJob; } } } else { //string sComponentName = m_cuType == "PRIMARY" ? "COMP_UNIT_N" : "COMP_UNIT_ANCIL_N"; if (m_SignificantAncillary) { if (m_SignificantRecordFound) { sReturnEditedByWR = m_oKeyObject.Components[m_ComponentName].Recordset.RecordCount > 0 ? Convert.ToString(m_oKeyObject.Components[m_ComponentName].Recordset.Fields["WR_EDITED"].Value) : ""; } } else { sReturnEditedByWR = m_oKeyObject.Components[m_ComponentName].Recordset.RecordCount > 0 ? Convert.ToString(m_oKeyObject.Components[m_ComponentName].Recordset.Fields["WR_EDITED"].Value) : ""; } } } catch (Exception ex) { throw ex; } return(sReturnEditedByWR); }
static void doAsaRecordSet(OleDbCommand cmd) { // RecordSet var objConnection = new ADODB.Connection(); var rs = new ADODB.Recordset(); objConnection.Open("Provider=Search.CollatorDSO;Extended Properties='Application=Windows';"); //rs.Open(m_Qry, objConnection); // rs.Open(sql, cnnDBreport, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic); rs.CursorType = ADODB.CursorTypeEnum.adOpenForwardOnly; //rs.CursorLocation = ADODB.CursorLocationEnum.adUseClient; //adUseServer;// adUseClient; rs.Open(m_Qry, objConnection, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic); Console.WriteLine(rs); rs.MoveFirst(); int iCnt = 0; string col = "System.FileName"; //while (rs.EOF == false) for (int iRow = 1; rs.EOF == false; iRow++) { Console.WriteLine("{0}) {1}", ++iCnt, rs.Fields[col].Value); rs.MoveNext(); if (10 == iRow) { Console.WriteLine("{0}) AbsolutePage= {1} rs.AbsolutePosition= {2}", iRow, rs.AbsolutePosition, rs.RecordCount); //rs.CursorLocation //rs.Fields //rs.MaxRecords //rs.PageCount //rs.PageSize //rs.Properties Console.WriteLine("Hit Enter Key."); Console.ReadLine(); iRow = 0; } } rs.Close(); }
/// <summary> /// Method to get the triggering attribute ANO /// </summary> /// <returns></returns> private int GetTriggeringANO() { int iReturnANO = 0; ADODB.Recordset rs = m_oApp.DataContext.MetadataRecordset("G3E_ATTRIBUTEINFO_OPTABLE", "G3E_NAME = '" + m_sComponentName + "' AND G3E_FIELD = '" + m_sFieldName + "'"); // rs.Filter = "G3E_NAME = '" + m_sComponentName + "' AND G3E_FIELD = '" + m_sFieldName + "'"; if (rs != null) { if (rs.RecordCount > 0) { rs.MoveFirst(); iReturnANO = Convert.ToInt32(rs.Fields["G3E_ANO"].Value); } } return(iReturnANO); }
private bool IsWPExist(string p_StrucureID) { bool bReturn = false; ADODB.Recordset rs = m_oApp.DataContext.OpenRecordset("select count(*) from workpoint_n where structure_id = ?", ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockOptimistic, (int)ADODB.CommandTypeEnum.adCmdText, p_StrucureID); if (rs != null) { if (rs.RecordCount > 0) { rs.MoveFirst(); bReturn = Convert.ToInt32(rs.Fields[0].Value) == 1; } } return(bReturn); }
private void ExpandMacroWithinForm(string p_MUID) { ADODB.Recordset RS = m_oDataContext.OpenRecordset("select culib_macrounit.cu_id, mu_id, cu_qty, cu_desc from culib_macrounit, culib_unit where mu_id = ? and culib_macrounit.cu_id = culib_unit. cu_id", ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic, (int)ADODB.CommandTypeEnum.adCmdText, p_MUID); // DataTable dt = ((DataTable)grdSelected.DataSource); if (RS != null) { if (RS.RecordCount > 0) { RS.MoveFirst(); while (RS.EOF == false) { dt1.Rows.Add(RS.Fields["cu_qty"].Value, "ACU", RS.Fields["cu_id"].Value, RS.Fields["mu_id"].Value, RS.Fields["cu_desc"].Value); RS.MoveNext(); } } dt1.AcceptChanges(); } }
private bool IsFeatureOwnedToPrimarySwitchGear(int p_FID, int p_FNO) { bool bReturn = false; string sSQL = "Select count(*) from common_n where g3e_id = (select owner1_id from common_n where g3e_fno =? and g3e_fid = ?) and g3e_fno = 19"; ADODB.Recordset rs = m_gtApplication.DataContext.OpenRecordset(sSQL, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockOptimistic, (int)ADODB.CommandTypeEnum.adCmdText, p_FNO, p_FID); if (rs != null) { if (rs.RecordCount > 0) { rs.MoveFirst(); int iCount = Convert.ToInt32(rs.Fields[0].Value); bReturn = iCount == 1; } } return(bReturn); }
public void ExportToCSV(bool PrintHeader = true) { string ExportFilePath = null; ADODB.Recordset rs = default(ADODB.Recordset); int i = 0; int TotalRecords = 0; bool ErrorOccured = false; short NumberOfFields = 0; const string quote = "\""; //Faster then Chr$(34) string sql = null; Scripting.FileSystemObject fso = new Scripting.FileSystemObject(); cmdStart.Enabled = false; cmdExit.Enabled = false; txtPassword.Enabled = false; string ptbl = null; string t_day = null; string t_Mon = null; if (Strings.Len(Strings.Trim(Conversion.Str(DateAndTime.Day(DateAndTime.Today)))) == 1) t_day = "0" + Strings.Trim(Convert.ToString(DateAndTime.Day(DateAndTime.Today))); else t_day = Convert.ToString(DateAndTime.Day(DateAndTime.Today)); if (Strings.Len(Strings.Trim(Conversion.Str(DateAndTime.Month(DateAndTime.Today)))) == 1) t_Mon = "0" + Strings.Trim(Convert.ToString(DateAndTime.Month(DateAndTime.Today))); else t_Mon = Conversion.Str(DateAndTime.Month(DateAndTime.Today)); ExportFilePath = modRecordSet.serverPath + "4POSDebtor" + Strings.Trim(Convert.ToString(DateAndTime.Year(DateAndTime.Today))) + Strings.Trim(t_Mon) + Strings.Trim(t_day); if (fso.FileExists(ExportFilePath + ".csv")) fso.DeleteFile((ExportFilePath + ".csv")); rs = modRecordSet.getRS(ref "SELECT CustomerID, Customer_InvoiceName, Customer_DepartmentName, Customer_FirstName, Customer_Surname, Customer_PhysicalAddress, Customer_PostalAddress, Customer_Telephone, Customer_Current as CurrentBalance,Customer_30Days as 30Days, Customer_60Days as 60days, Customer_90Days as 90Days, Customer_120Days as 120Days,Customer_150Days as 150Days FROM Customer"); prgBar.Maximum = rs.RecordCount; if (rs.RecordCount > 0) { FileSystem.FileOpen(1, ExportFilePath + ".csv", OpenMode.Output); var _with2 = modRecordSet.getRS(ref ref "SELECT CustomerID, Customer_InvoiceName, Customer_DepartmentName, Customer_FirstName, Customer_Surname, Customer_PhysicalAddress, Customer_PostalAddress, Customer_Telephone, Customer_Current as CurrentBalance,Customer_30Days as 30Days, Customer_60Days as 60days, Customer_90Days as 90Days, Customer_120Days as 120Days,Customer_150Days as 150Days FROM Customer"); rs.MoveFirst(); NumberOfFields = rs.Fields.Count - 1; if (PrintHeader) { //Now add the field names for (i = 0; i <= NumberOfFields - 1; i++) { FileSystem.Print(1, rs.Fields(i).name + ","); //similar to the ones below } FileSystem.PrintLine(1, rs.Fields(NumberOfFields).name); } while (!rs.EOF) { prgBar.Value = prgBar.Value + 1; // ERROR: Not supported in C#: OnErrorStatement TotalRecords = TotalRecords + 1; //If there is an emty field, for (i = 0; i <= NumberOfFields; i++) { //add a , to indicate it is if ((Information.IsDBNull(rs.Fields(i).Value))) { FileSystem.Print(1, ","); //empty } else { if (i == NumberOfFields) { FileSystem.Print(1, quote + Strings.Trim(Convert.ToString(rs.Fields(i).Value)) + quote); } else { FileSystem.Print(1, quote + Strings.Trim(Convert.ToString(rs.Fields(i).Value)) + quote + ","); } } //Putting data under "" will not } //confuse the reader of the file DoEventsEx(); //between Dhaka, Bangladesh as two FileSystem.PrintLine(1); //fields or as one field. rs.moveNext(); } FileSystem.FileClose(1); Interaction.MsgBox("Customer details were successfully exported to : " + FilePath + "" + "4POSProd" + Strings.Trim(Convert.ToString(DateAndTime.Year(DateAndTime.Today))) + Strings.Trim(t_Mon) + Strings.Trim(t_day) + ".csv", MsgBoxStyle.OkOnly, "Customers"); // DoEvents // DoEvents // MsgBox "Now Zeroising...", vbOKOnly, "Customers" // cmdStart.Enabled = False // cmdExit.Enabled = False // Set rsZ = getRS("SELECT CustomerID FROM Customer") // Do While Not rsZ.EOF // DoEvents // cmdProcess_Click (rsZ("CustomerID")) // DoEvents // rsZ.moveNext // Loop //MsgBox "Completed", vbOKOnly, "Customers" //cmdStart.Enabled = True //cmdExit.Enabled = True this.Close(); } System.Windows.Forms.Cursor.Current = Cursors.Default; rs.Close(); //cnnDB.Close //Set cnnDB = Nothing //closeConnection }
public object CalcIntPeriod() { // ERROR: Not supported in C#: OnErrorStatement double IntFromPeriod = 0; double HoldTheSum = 0; string TSum = null; string CDateN = null; string HoldVer = null; string CmsBOx = null; ADODB.Recordset rs = default(ADODB.Recordset); rs = modRecordSet.getRS(ref "select * from Company"); modApplication.IntPeriod = rs.Fields("Company_IntPeriod").Value; modApplication.Intpercen = rs.Fields("Company_IntPercent").Value; if (!string.IsNullOrEmpty(modApplication.IntPeriod) & modApplication.Intpercen != 0) { if (Interaction.MsgBox("This will calculate interest Percentage of " + "'" + modApplication.Intpercen + "%' " + " from " + "'" + modApplication.IntPeriod + "'" + " on your Overdue accounts are you sure you want to continue", MsgBoxStyle.YesNo, "4Pos Interest Calculation") == MsgBoxResult.Yes) { //If vbYes Then CDateN = Strings.Format(DateAndTime.Today); adoPrimaryRS = modRecordSet.getRS(ref "select * from Customer"); if (modApplication.IntPeriod == "Current") { adoPrimaryRS.MoveFirst(); while (!(adoPrimaryRS.EOF)) { HoldTheSum = (adoPrimaryRS.Fields("Customer_Current").Value + adoPrimaryRS.Fields("Customer_30Days").Value + adoPrimaryRS.Fields("Customer_60Days").Value + adoPrimaryRS.Fields("Customer_90Days").Value + adoPrimaryRS.Fields("Customer_120Days").Value + adoPrimaryRS.Fields("Customer_150Days").Value); if (HoldTheSum > 0) { //Calculate interest IntFromPeriod = (HoldTheSum * modApplication.Intpercen / 100) / 12; TSum = Convert.ToString(IntFromPeriod + HoldTheSum); //cnnDB.Execute "INSERT INTO Interest (CustomerID,Perc,Period,CDate,Description,Debit,Credit,SumIntBal)VALUES ('" & adoPrimaryRS("CustomerID") & "','" & Intpercen & "%" & "','" & IntPeriod & "','" & CDateN & "',' Interest ','" & IntFromPeriod & "','" & 0 & " ','" & TSum & "')" System.Windows.Forms.Application.DoEvents(); cmdProcess_Click(ref adoPrimaryRS.Fields("CustomerID"), ref IntFromPeriod); System.Windows.Forms.Application.DoEvents(); } adoPrimaryRS.moveNext(); } } else if (modApplication.IntPeriod == "30 Days") { adoPrimaryRS.MoveFirst(); while (!(adoPrimaryRS.EOF)) { HoldTheSum = adoPrimaryRS.Fields("Customer_30Days").Value + adoPrimaryRS.Fields("Customer_60Days").Value + adoPrimaryRS.Fields("Customer_90Days").Value + adoPrimaryRS.Fields("Customer_120Days").Value + adoPrimaryRS.Fields("Customer_150Days").Value; if (HoldTheSum > 0) { //Calculate interest IntFromPeriod = (HoldTheSum * modApplication.Intpercen / 100) / 12; TSum = Convert.ToString(IntFromPeriod + HoldTheSum); //cnnDB.Execute "INSERT INTO Interest (CustomerID,Perc,Period,CDate,Description,Debit,Credit,SumIntBal)VALUES ('" & adoPrimaryRS("CustomerID") & "','" & Intpercen & "%" & "','" & IntPeriod & "','" & CDateN & "',' Interest ','" & IntFromPeriod & "','" & 0 & " ','" & TSum & "')" System.Windows.Forms.Application.DoEvents(); cmdProcess_Click(ref adoPrimaryRS.Fields("CustomerID"), ref IntFromPeriod); System.Windows.Forms.Application.DoEvents(); } adoPrimaryRS.moveNext(); } } else if (modApplication.IntPeriod == "60 Days") { adoPrimaryRS.MoveFirst(); while (!(adoPrimaryRS.EOF)) { HoldTheSum = adoPrimaryRS.Fields("Customer_60Days").Value + adoPrimaryRS.Fields("Customer_90Days").Value + adoPrimaryRS.Fields("Customer_120Days").Value + adoPrimaryRS.Fields("Customer_150Days").Value; if (HoldTheSum > 0) { //Calculate interest IntFromPeriod = (HoldTheSum * modApplication.Intpercen / 100) / 12; TSum = Convert.ToString(IntFromPeriod + HoldTheSum); //cnnDB.Execute "INSERT INTO Interest (CustomerID,Perc,Period,CDate,Description,Debit,Credit,SumIntBal)VALUES ('" & adoPrimaryRS("CustomerID") & "','" & Intpercen & "%" & "','" & IntPeriod & "','" & CDateN & "',' Interest ','" & IntFromPeriod & "','" & 0 & " ','" & TSum & "')" System.Windows.Forms.Application.DoEvents(); cmdProcess_Click(ref adoPrimaryRS.Fields("CustomerID"), ref IntFromPeriod); System.Windows.Forms.Application.DoEvents(); } adoPrimaryRS.moveNext(); } } else if (modApplication.IntPeriod == "90 Days") { adoPrimaryRS.MoveFirst(); while (!(adoPrimaryRS.EOF)) { HoldTheSum = adoPrimaryRS.Fields("Customer_90Days").Value + adoPrimaryRS.Fields("Customer_120Days").Value + adoPrimaryRS.Fields("Customer_150Days").Value; if (HoldTheSum > 0) { //Calculate interest IntFromPeriod = (HoldTheSum * modApplication.Intpercen / 100) / 12; TSum = Convert.ToString(IntFromPeriod + HoldTheSum); //cnnDB.Execute "INSERT INTO Interest (CustomerID,Perc,Period,CDate,Description,Debit,Credit,SumIntBal)VALUES ('" & adoPrimaryRS("CustomerID") & "','" & Intpercen & "%" & "','" & IntPeriod & "','" & CDateN & "',' Interest ','" & IntFromPeriod & "','" & 0 & " ','" & TSum & "')" System.Windows.Forms.Application.DoEvents(); cmdProcess_Click(ref adoPrimaryRS.Fields("CustomerID"), ref IntFromPeriod); System.Windows.Forms.Application.DoEvents(); } adoPrimaryRS.moveNext(); } } else if (modApplication.IntPeriod == "120 Days") { adoPrimaryRS.MoveFirst(); while (!(adoPrimaryRS.EOF)) { HoldTheSum = adoPrimaryRS.Fields("Customer_120Days").Value + adoPrimaryRS.Fields("Customer_150Days").Value; if (HoldTheSum > 0) { //Calculate interest IntFromPeriod = (HoldTheSum * modApplication.Intpercen / 100) / 12; TSum = Convert.ToString(IntFromPeriod + HoldTheSum); //cnnDB.Execute "INSERT INTO Interest (CustomerID,Perc,Period,CDate,Description,Debit,Credit,SumIntBal)VALUES ('" & adoPrimaryRS("CustomerID") & "','" & Intpercen & "%" & "','" & IntPeriod & "','" & CDateN & "',' Interest ','" & IntFromPeriod & "','" & 0 & " ','" & TSum & "')" System.Windows.Forms.Application.DoEvents(); cmdProcess_Click(ref adoPrimaryRS.Fields("CustomerID"), ref IntFromPeriod); System.Windows.Forms.Application.DoEvents(); } adoPrimaryRS.moveNext(); } } else if (modApplication.IntPeriod == "150 Days") { adoPrimaryRS.MoveFirst(); while (!(adoPrimaryRS.EOF)) { HoldTheSum = adoPrimaryRS.Fields("Customer_150Days").Value; if (HoldTheSum > 0) { //Calculate interest IntFromPeriod = (HoldTheSum * modApplication.Intpercen / 100) / 12; TSum = Convert.ToString(IntFromPeriod + HoldTheSum); //cnnDB.Execute "INSERT INTO Interest (CustomerID,Perc,Period,CDate,Description,Debit,Credit,SumIntBal)VALUES ('" & adoPrimaryRS("CustomerID") & "','" & Intpercen & "%" & "','" & IntPeriod & "','" & CDateN & "',' Interest ','" & IntFromPeriod & "','" & 0 & " ','" & TSum & "')" System.Windows.Forms.Application.DoEvents(); cmdProcess_Click(ref adoPrimaryRS.Fields("CustomerID"), ref IntFromPeriod); System.Windows.Forms.Application.DoEvents(); } adoPrimaryRS.moveNext(); } } } else if (MsgBoxResult.No) { } } else if (string.IsNullOrEmpty(modApplication.IntPeriod) & modApplication.Intpercen == 0) { Interaction.MsgBox("You must enter Percentage and Period in Store Setup and Security", MsgBoxStyle.Information, "4Pos Interest Calculation"); } else if (string.IsNullOrEmpty(modApplication.IntPeriod) & modApplication.Intpercen != 0) { Interaction.MsgBox("You must enter Period in Store Setup and Security", MsgBoxStyle.Information, "4Pos Interest Calculation"); } else if (!string.IsNullOrEmpty(modApplication.IntPeriod) & modApplication.Intpercen == 0) { Interaction.MsgBox("You must enter Percentage in Store Setup and Security", MsgBoxStyle.Information, "4Pos Interest Calculation"); } }
private void cmdExit_Click(System.Object eventSender, System.EventArgs eventArgs) { //On Error GoTo ErrH ADODB.Recordset rs = default(ADODB.Recordset); ADODB.Recordset rst = default(ADODB.Recordset); ADODB.Recordset rsHave = default(ADODB.Recordset); ADODB.Recordset rsMaxID = default(ADODB.Recordset); short HoldBClabelItem_BCLabelID = 0; string TheSample = null; ADODB.Recordset rsInner = default(ADODB.Recordset); short HoldLaIDVaBack = 0; short TMaxID = 0; rs = new ADODB.Recordset(); rst = new ADODB.Recordset(); rsHave = new ADODB.Recordset(); rsInner = new ADODB.Recordset(); rsMaxID = new ADODB.Recordset(); modApplication.IntDesign = 0; //New code rs = modRecordSet.getRS(ref "DELETE * FROM BClabelItemUndo"); strheight = 0; strwidht = 0; rs = modRecordSet.getRS(ref "SELECT * FROM LabelItem WHERE labelItem_LabelID=" + modApplication.MyLIDWHole + ""); if (rs.RecordCount == 1) { rs = modRecordSet.getRS(ref "DELETE * FROM LabelItem WHERE labelItem_LabelID=" + modApplication.MyLIDWHole + ""); rs = modRecordSet.getRS(ref "DELETE * FROM Label WHERE LabelID=" + modApplication.MyLIDWHole + ""); rs = modRecordSet.getRS(ref "DELETE * FROM BClabel WHERE BClabel_LabelID=" + modApplication.MyLIDWHole + ""); rs = modRecordSet.getRS(ref "DELETE * FROM BClabelItem WHERE BClabelItem_LabelID=" + modApplication.MyLIDWHole + ""); this.Close(); My.MyProject.Forms.frmDesign.RefreshLoad(ref modApplication.TheType); return; } else { } rs = modRecordSet.getRS(ref "SELECT Max(LabelItem.labelItem_LabelID) as TheMaxID FROM LabelItem"); TMaxID = rs.Fields("TheMaxID").Value; rs = modRecordSet.getRS(ref "SELECT * FROM LabelItem ORDER BY labelItem_LabelID"); rs.MoveFirst(); //Loading BClabelItem with Infor from LabelItem while (!(rs.EOF)) { // ERROR: Not supported in C#: OnErrorStatement rsHave = modRecordSet.getRS(ref "SELECT * FROM BClabelItem WHERE BClabelItem_LabelID=" + rs.Fields("labelItem_LabelID").Value + ""); HoldBClabelItem_BCLabelID = rsHave.Fields("BClabelItem_BCLabelID").Value; rst = modRecordSet.getRS(ref "DELETE * FROM BClabelItem WHERE BClabelItem_LabelID =" + rs.Fields("labelItem_LabelID").Value + ""); rsInner = modRecordSet.getRS(ref "SELECT * FROM LabelItem WHERE labelItem_LabelID=" + rs.Fields("labelItem_LabelID").Value + ""); while (!(rsInner.EOF)) { if (Information.IsDBNull(rsInner.Fields("labelItem_Sample").Value)) { TheSample = " "; } else { TheSample = rsInner.Fields("labelItem_Sample").Value; } rst = modRecordSet.getRS(ref "INSERT INTO BClabelItem(BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + HoldBClabelItem_BCLabelID + "," + rsInner.Fields("labelItem_Line").Value + ",'" + rsInner.Fields("labelItem_Field").Value + "'," + rsInner.Fields("labelItem_Align").Value + "," + rsInner.Fields("labelItem_Size").Value + "," + rsInner.Fields("labelItem_Bold").Value + ",'" + TheSample + "','" + 0 + "'," + rsInner.Fields("labelItem_LabelID").Value + ")"); rsInner.MoveNext(); } HoldLaIDVaBack = rs.Fields("labelItem_LabelID").Value; rs.MoveNext(); while (!(rs.Fields("labelItem_LabelID").Value != HoldLaIDVaBack)) { if (rs.Fields("labelItem_LabelID").Value == TMaxID) { rs.MoveLast(); rs.MoveNext(); break; // TODO: might not be correct. Was : Exit Do } rs.MoveNext(); } } this.Close(); My.MyProject.Forms.frmDesign.RefreshLoad(ref modApplication.TheType); //ErrH: frmDesign.RefreshLoad TheType //frmdesign.RefreshLoad TheType }
private void cmdShow_Click(System.Object eventSender, System.EventArgs eventArgs) { int x = 0; // ERROR: Not supported in C#: OnErrorStatement ADODB.Recordset rs = default(ADODB.Recordset); ADODB.Recordset rs1 = default(ADODB.Recordset); ADODB.Recordset rs2 = default(ADODB.Recordset); ADODB.Recordset rsB = default(ADODB.Recordset); ADODB.Recordset rsDcheck = default(ADODB.Recordset); decimal HMyPrice = default(decimal); string MyMarkup = null; decimal HMyPrice1 = default(decimal); double MyCounterF = 0; double MyCounterL = 0; string Delimiter = null; ADODB.Recordset rsk = default(ADODB.Recordset); rs = new ADODB.Recordset(); rs1 = new ADODB.Recordset(); rs2 = new ADODB.Recordset(); rsB = new ADODB.Recordset(); rsDcheck = new ADODB.Recordset(); rsk = new ADODB.Recordset(); Delimiter = " "; //create table name modApplication.Te_Names = "NewPricechanges"; //In case the table was not dropped then drop it rs = modRecordSet.getRS(ref "DROP TABLE " + modApplication.Te_Names + ""); modApplication.MyFTypess = "PriceChangesID_DayEndStockItemLnk Number,PriceChanges_StockItemName Text(50),OldPrice Currency,NewPrice Currency,SellingPrice Currency,Markup Number"; //create table NewPriceChanges modRecordSet.cnnDB.Execute("CREATE TABLE " + modApplication.Te_Names + " (" + modApplication.MyFTypess + ")"); rs1 = modRecordSet.getRS(ref "SELECT DayEnd.DayEndID, DayEnd.DayEnd_Date, DayEndStockItemLnk.DayEndStockItemLnk_StockItemID, aStockItem1.StockItem_Name, DayEndStockItemLnk.DayEndStockItemLnk_ListCost, aStockItem1.StockItemID FROM Report INNER JOIN (DayEnd INNER JOIN (DayEndStockItemLnk INNER JOIN aStockItem1 ON DayEndStockItemLnk.DayEndStockItemLnk_StockItemID = aStockItem1.StockItemID) ON DayEnd.DayEndID = DayEndStockItemLnk.DayEndStockItemLnk_DayEndID) ON Report.Report_DayEndEndID = DayEnd.DayEndID ORDER BY aStockItem1.StockItemID;"); if (rs1.RecordCount) { while (!(rs1.EOF)) { rs2 = modRecordSet.getRS(ref "SELECT DayEnd.DayEndID, DayEnd.DayEnd_Date, DayEndStockItemLnk.DayEndStockItemLnk_StockItemID, aStockItem1.StockItem_Name, DayEndStockItemLnk.DayEndStockItemLnk_ListCost, aStockItem1.StockItemID FROM Report INNER JOIN (DayEnd INNER JOIN (DayEndStockItemLnk INNER JOIN aStockItem1 ON DayEndStockItemLnk.DayEndStockItemLnk_StockItemID = aStockItem1.StockItemID) ON DayEnd.DayEndID = DayEndStockItemLnk.DayEndStockItemLnk_DayEndID) ON Report.Report_DayEndStartID = DayEnd.DayEndID WHERE (((aStockItem1.StockItemID)=" + rs1.Fields("DayEndStockItemLnk_StockItemID").Value + "));"); if (rs2.RecordCount) { if (rs1.Fields("DayEndStockItemLnk_ListCost").Value != rs2.Fields("DayEndStockItemLnk_ListCost").Value) { MyMarkup = Convert.ToString(0); //MyMarkup = (rs2("DayEndStockItemLnk_ListCost") / rsB("CatalogueChannelLnk_Price") * 100) //MyMarkup = 100 - MyMarkup //insert into Newpricechanges modRecordSet.cnnDB.Execute("INSERT INTO " + modApplication.Te_Names + "(PriceChangesID_DayEndStockItemLnk,PriceChanges_StockItemName,OldPrice,NewPrice,SellingPrice,Markup)VALUES(" + rs1.Fields("DayEndStockItemLnk_StockItemID").Value + ",'" + rs1.Fields("StockItem_Name").Value + "', " + rs1.Fields("DayEndStockItemLnk_ListCost").Value + ", " + rs2.Fields("DayEndStockItemLnk_ListCost").Value + "," + rs1.Fields("DayEndStockItemLnk_ListCost").Value + "," + MyMarkup + ")"); //delete duplicates //Set rsk = getRS("DELETE * FROM " & Te_Names & " WHERE (NewPricechanges.PriceChangesID_DayEndStockItemLnk =" & rs2("DayEndStockItemLnk_StockItemID") & " and NewPricechanges.OldPrice = " & rs2("DayEndStockItemLnk_ListCost") & " and NewPricechanges.NewPrice = " & rs2("DayEndStockItemLnk_ListCost") & ")") } } rs1.moveNext(); } } else { Interaction.MsgBox("There was No Price Changes of Items between " + this.txtstartdate.Text + " And " + this.txtenddate.Text, MsgBoxStyle.Information, "4POS"); } //validation for start date if (string.IsNullOrEmpty(this.txtstartdate.Text)) { Interaction.MsgBox("Please Select/enter the Start Date", MsgBoxStyle.ApplicationModal + MsgBoxStyle.OkCancel, "4POS"); this.txtstartdate.Focus(); return; //validation for end date } else if (string.IsNullOrEmpty(this.txtenddate.Text)) { Interaction.MsgBox("Please Select/enter the End Date", MsgBoxStyle.ApplicationModal + MsgBoxStyle.OkCancel, "4POS"); this.txtenddate.Focus(); return; } //create table name modApplication.Te_Names = "NewPricechanges"; //In case the table was not dropped then drop it rs = modRecordSet.getRS(ref "DROP TABLE " + modApplication.Te_Names + ""); modApplication.MyFTypess = "PriceChangesID_DayEndStockItemLnk Number,PriceChanges_StockItemName Text(50),OldPrice Currency,NewPrice Currency,SellingPrice Currency,Markup Number"; //create table NewPriceChanges modRecordSet.cnnDB.Execute("CREATE TABLE " + modApplication.Te_Names + " (" + modApplication.MyFTypess + ")"); //selecting from the start date rs = modRecordSet.getRS(ref "SELECT * FROM DayEnd WHERE Datevalue(DayEnd_Date)=#" + this.txtstartdate.Text + "#"); //selecting from the end date rs1 = modRecordSet.getRS(ref "SELECT * FROM DayEnd WHERE Datevalue(DayEnd_Date) = #" + this.txtenddate.Text + "#"); this.cmdshow.Enabled = false; this.cmdcancel.Enabled = false; //assigning the start date and the end date to the below variables MyCounterF = rs.Fields("DayEndID").Value; MyCounterL = rs1.Fields("DayEndID").Value; //loop/round from the first date until the last date selected for (x = MyCounterF; x <= MyCounterL; x++) { rs2 = modRecordSet.getRS(ref "SELECT * FROM DayEndStockItemLnk WHERE DayEndStockItemLnk_StockItemID=" + MyCounterF + ""); rsB = modRecordSet.getRS(ref "SELECT * FROM CatalogueChannelLnk WHERE CatalogueChannelLnk_StockItemID=" + MyCounterF + ""); rs = modRecordSet.getRS(ref "SELECT * FROM StockItem WHERE StockItemID=" + rs2.Fields("DayEndStockItemLnk_StockItemID").Value + ""); rs2.MoveFirst(); //formating the price HMyPrice1 = rs2.Fields("DayEndStockItemLnk_ListCost").Value; HMyPrice1 = Convert.ToDecimal(Strings.Format(HMyPrice1, "R# ,###.##")); //formating the price HMyPrice = rs2.Fields("DayEndStockItemLnk_ListCost").Value; HMyPrice = Convert.ToDecimal(Strings.Format(HMyPrice, "R# ,###.##")); rs2.Fields("DayEndStockItemLnk_ListCost").Value = Strings.Format(rs2.Fields("DayEndStockItemLnk_ListCost").Value, "R # ,###.##"); //looping through the price for a specific date,if the price differs then insert into newly created table while (!(rs2.EOF)) { if (rs2.Fields("DayEndStockItemLnk_ListCost").Value != HMyPrice) { HMyPrice = rs2.Fields("DayEndStockItemLnk_ListCost").Value; HMyPrice = Convert.ToDecimal(Strings.Format(HMyPrice, "R# ,###.##")); MyMarkup = Convert.ToString(rs2.Fields("DayEndStockItemLnk_ListCost").Value / rsB.Fields("CatalogueChannelLnk_Price").Value * 100); MyMarkup = Convert.ToString(100 - Convert.ToDouble(MyMarkup)); //insert into Newpricechanges rsk = modRecordSet.getRS(ref "INSERT INTO " + modApplication.Te_Names + "(PriceChangesID_DayEndStockItemLnk,PriceChanges_StockItemName,OldPrice,NewPrice,SellingPrice,Markup)VALUES(" + rs2.Fields("DayEndStockItemLnk_StockItemID").Value + ",'" + rs.Fields("StockItem_Name").Value + "', " + HMyPrice1 + ", " + rs2.Fields("DayEndStockItemLnk_ListCost").Value + "," + rsB.Fields("CatalogueChannelLnk_Price").Value + "," + MyMarkup + ")"); //delete duplicates rsk = modRecordSet.getRS(ref "DELETE * FROM " + modApplication.Te_Names + " WHERE (NewPricechanges.PriceChangesID_DayEndStockItemLnk =" + rs2.Fields("DayEndStockItemLnk_StockItemID").Value + " and NewPricechanges.OldPrice = " + rs2.Fields("DayEndStockItemLnk_ListCost").Value + " and NewPricechanges.NewPrice = " + rs2.Fields("DayEndStockItemLnk_ListCost").Value + ")"); } rs2.moveNext(); rs2.Fields("DayEndStockItemLnk_ListCost").Value = Strings.Format(rs2.Fields("DayEndStockItemLnk_ListCost").Value, "R # ,###.##"); } MyCounterF = MyCounterF + 1; } //for ends here rs = modRecordSet.getRS(ref "SELECT * FROM NewPriceChanges"); //if there was a price change then display the report if (rs.RecordCount > 0) { modApplication.ForNewPChange = 2; modApplication.report_NewPriceChange(); //if there was no price change then don't display the report instead display the below message } else if (rs.RecordCount < 1) { Interaction.MsgBox("There was No Price Changes of Items between " + this.txtstartdate.Text + " And " + this.txtenddate.Text, MsgBoxStyle.Information, "4POS"); //if there was no price change then enable the show and cancel button this.cmdshow.Enabled = true; this.cmdcancel.Enabled = true; } }
public string getAddress() { try { Position PoiX = new Position(); PoiX.X = Lat; PoiX.Y = Lon; double tempLen = 1000000; string tempTown = ""; ADODB.Recordset RST = new ADODB.Recordset(); string sqlSTR = "SELECT name,the_geom FROM mergedpoints WHERE the_geom && 'BOX3D(" + (Lon - 0.5) + " " + (Lat - 0.5) + "," + (Lon + 0.5) + " " + (Lat + 0.5) + ") '::box3d AND distance( the_geom, GeometryFromText( 'POINT(" + Lon + " " + Lat + ")', -1 ) ) < 0.5"; string sqlSTROther = "SELECT name,the_geom FROM mergedpoints WHERE the_geom && 'BOX3D(" + (Lon - 6) + " " + (Lat - 6) + "," + (Lon + 6) + " " + (Lat + 6) + ") '::box3d AND distance( the_geom, GeometryFromText( 'POINT(" + Lon + " " + Lat + ")', -1 ) ) < 7"; RST.Open(sqlSTR, this.odbcDatabaseConnection, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockBatchOptimistic, 0); if (RST.EOF == true) { try { RST.Close(); } catch { } RST.Open(sqlSTROther, this.odbcDatabaseConnection, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockBatchOptimistic, 0); } if (RST.EOF == false) { RST.MoveFirst(); while (RST.EOF == false) { string Coord = RST.Fields["the_geom"].Value.ToString(); int Len = Coord.Length; Coord = Right(Coord, (Len - 14)); Len = Coord.Length; Coord = Mid(Coord, 0, (Len - 1)); char[] SepChar = { ' ' }; Array coordArray = Coord.Split(SepChar); double xlon = Convert.ToDouble(coordArray.GetValue(0).ToString()); double xlat = Convert.ToDouble(coordArray.GetValue(1).ToString()); Position PoiY = new Position(); PoiY.X = xlat; PoiY.Y = xlon; Calculations calc = new Calculations(); double xLen = calc.CalculateDistace(PoiX, PoiY); //MessageBox.Show(xLen.ToString()); if (xLen < tempLen) { tempLen = xLen; tempTown = RST.Fields["name"].Value.ToString(); } //PoiY = null; coordArray = null; RST.MoveNext(); } RST.Close(); RST = null; } if (tempLen != 1000000) { string retVal = Decimal.Round((decimal)tempLen, 3).ToString(); return retVal + "Km From " + tempTown; } else { return " "; } } catch (System.Exception qw) { return " "; } }
public string getRoadName() { try { Position PoiX = new Position(); PoiX.X = Lat; PoiX.Y = Lon; double tempLen = 1000000; string tempTown = ""; ADODB.Recordset RST = new ADODB.Recordset(); /* string sqlSTR = "SELECT name,the_geom FROM " + this.roadsTableName +" WHERE the_geom && 'BOX3D(" + (Lon - 0.1) + " " + (Lat - 0.1) + "," + (Lon + 0.1) + " " + (Lat + 0.1) + ") '::box3d AND distance( the_geom, GeometryFromText( 'POINT(" + Lon + " " + Lat + ")', -1 ) ) < 0.11"; string sqlSTROther = "SELECT name,the_geom FROM " + this.roadsTableName + " WHERE the_geom && 'BOX3D(" + (Lon - 1) + " " + (Lat - 1) + "," + (Lon + 1) + " " + (Lat + 1) + ") '::box3d AND distance( the_geom, GeometryFromText( 'POINT(" + Lon + " " + Lat + ")', -1 ) ) < 1.1";*/ string sqlSTR = "SELECT rd_name,the_geom FROM kRoads WHERE the_geom && 'BOX3D(" + (Lon - 0.1) + " " + (Lat - 0.1) + "," + (Lon + 0.1) + " " + (Lat + 0.1) + ") '::box3d AND distance( the_geom, GeometryFromText( 'POINT(" + Lon + " " + Lat + ")', -1 ) ) < 0.11"; string sqlSTROther = "SELECT rd_name,the_geom FROM kRoads WHERE the_geom && 'BOX3D(" + (Lon - 1) + " " + (Lat - 1) + "," + (Lon + 1) + " " + (Lat + 1) + ") '::box3d AND distance( the_geom, GeometryFromText( 'POINT(" + Lon + " " + Lat + ")', -1 ) ) < 1.1"; RST.Open(sqlSTR, this.odbcDatabaseConnection, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockBatchOptimistic, 0); if (RST.EOF == true) { try { RST.Close(); } catch { } RST.Open(sqlSTROther, this.odbcDatabaseConnection, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockBatchOptimistic, 0); } if (RST.EOF == false) { RST.MoveFirst(); while (RST.EOF == false) { /*we are no longer dealing with a single point we are * dealind with a line string*/ string Coord = RST.Fields["the_geom"].Value.ToString(); int Len = Coord.Length; Coord = Right(Coord, (Len - 25)); Len = Coord.Length; Coord = Mid(Coord, 0, (Len - 2)); char[] SepChar = { ',' }; Array pointArray = Coord.Split(SepChar); /*lets loop through the line string*/ for (int p = 0; p < pointArray.Length; p++) { try { char[] pointSep = { ' ' }; Array coordArray = pointArray.GetValue(p).ToString().Split(pointSep); double xlon = Convert.ToDouble(coordArray.GetValue(0).ToString()); double xlat = Convert.ToDouble(coordArray.GetValue(1).ToString()); Position PoiY = new Position(); PoiY.X = xlat; PoiY.Y = xlon; Calculations calc = new Calculations(); double xLen = 10000001; try { xLen = calc.CalculateDistace(PoiX, PoiY); } catch { } calc = null; //MessageBox.Show(xLen.ToString()); if (xLen < tempLen) { tempLen = xLen; if (tempLen > 0.5) { tempTown = " Along Unknown Road"; } else { tempTown = " Along " + RST.Fields["rd_name"].Value.ToString(); } } //PoiY = null; coordArray = null; //Application.DoEvents(); } catch { } } //Application.DoEvents(); RST.MoveNext(); } RST.Close(); RST = null; } if (tempLen != 1000000) { return tempTown; } else { return " "; } } catch (System.Exception qw) { return " "; } }
static void Main(string[] args) { ADODB.Connection conn = null; ADODB.Recordset rs = null; try { //////////////////////////////////////////////////////////////////////////////// // 连接数据源. // Console.WriteLine("正在连接数据库 ..."); // 获取连接字符串 string connStr = string.Format("Provider=SQLOLEDB;Data Source={0};Initial Catalog={1};Integrated Security=SSPI", ".\\sqlexpress", "SQLServer2005DB"); // 打开连接 conn = new ADODB.Connection(); conn.Open(connStr, null, null, 0); //////////////////////////////////////////////////////////////////////////////// // 编写并执行ADO命令. // 可以是SQL指令(SELECT/UPDATE/INSERT/DELETE),或是调用存储过程. // 此处是一个INSERT命令示例. // Console.WriteLine("将一条记录插入表CountryRegion中..."); // 1. 生成一个Command对象 ADODB.Command cmdInsert = new ADODB.Command(); // 2. 将连接赋值于命令 cmdInsert.ActiveConnection = conn; // 3. 设置命令文本 // SQL指令或者存储过程名 cmdInsert.CommandText = "INSERT INTO CountryRegion(CountryRegionCode, Name, ModifiedDate)" + " VALUES (?, ?, ?)"; // 4. 设置命令类型 // ADODB.CommandTypeEnum.adCmdText 用于普通的SQL指令; // ADODB.CommandTypeEnum.adCmdStoredProc 用于存储过程. cmdInsert.CommandType = ADODB.CommandTypeEnum.adCmdText; // 5. 添加参数 // CountryRegionCode (nvarchar(20)参数的添加 ADODB.Parameter paramCode = cmdInsert.CreateParameter( "CountryRegionCode", // 参数名 ADODB.DataTypeEnum.adVarChar, // 参数类型 (nvarchar(20)) ADODB.ParameterDirectionEnum.adParamInput, // 参数类型 20, // 参数的最大长度 "ZZ"+DateTime.Now.Millisecond); // 参数值 cmdInsert.Parameters.Append(paramCode); // Name (nvarchar(200))参数的添加 ADODB.Parameter paramName = cmdInsert.CreateParameter( "Name", // 参数名 ADODB.DataTypeEnum.adVarChar, // 参数类型 (nvarchar(200)) ADODB.ParameterDirectionEnum.adParamInput, // 参数传递方向 200, // 参数的最大长度 "Test Region Name"); // 参数值 cmdInsert.Parameters.Append(paramName); // ModifiedDate (datetime)参数的添加 ADODB.Parameter paramModifiedDate = cmdInsert.CreateParameter( "ModifiedDate", // 参数名 ADODB.DataTypeEnum.adDate, // 参数类型 (datetime) ADODB.ParameterDirectionEnum.adParamInput, // 参数传递方向 -1, // 参数的最大长度 (datetime忽视该值) DateTime.Now); // 参数值 cmdInsert.Parameters.Append(paramModifiedDate); // 6. 执行命令 object nRecordsAffected = Type.Missing; object oParams = Type.Missing; cmdInsert.Execute(out nRecordsAffected, ref oParams, (int)ADODB.ExecuteOptionEnum.adExecuteNoRecords); //////////////////////////////////////////////////////////////////////////////// // 使用Recordset对象. // http://msdn.microsoft.com/en-us/library/ms681510.aspx // Recordset表示了数据表中记录或执行命令获得的结果的集合。 // 在任何时候, Recordset对象都指向集合中的单条记录,并将 // 该记录作为它的当前记录。 // Console.WriteLine("列出表CountryRegion中的所有记录"); // 1. 生成Recordset对象 rs = new ADODB.Recordset(); // 2. 打开Recordset对象 string strSelectCmd = "SELECT * FROM CountryRegion"; // WHERE ... rs.Open(strSelectCmd, // SQL指令/表,视图名 / // 存储过程调用 /文件名 conn, // 连接对象/连接字符串 ADODB.CursorTypeEnum.adOpenForwardOnly, // 游标类型. (只进游标) ADODB.LockTypeEnum.adLockOptimistic, // 锁定类型. (仅当需要调用 // 更新方法时,才锁定记录) (int)ADODB.CommandTypeEnum.adCmdText); // 将第一个参数视为SQL命令 // 或存储过程. // 3. 通过向前移动游标列举记录 // 移动到Recordset中的第一条记录 rs.MoveFirst(); while (!rs.EOF) { // 当在表中定义了一个可空字段,需要检验字段中的值是否为DBNull.Value. string code = (rs.Fields["CountryRegionCode"].Value == DBNull.Value) ? "(DBNull)" : rs.Fields["CountryRegionCode"].Value.ToString(); string name = (rs.Fields["Name"].Value == DBNull.Value) ? "(DBNull)" : rs.Fields["Name"].Value.ToString(); DateTime modifiedDate = (rs.Fields["ModifiedDate"].Value == DBNull.Value) ? DateTime.MinValue : (DateTime)rs.Fields["ModifiedDate"].Value; Console.WriteLine(" {2} \t{0}\t{1}", code, name, modifiedDate.ToString("yyyy-MM-dd")); // 移动到下一条记录 rs.MoveNext(); } } catch (Exception ex) { Console.WriteLine("应用程序出现错误: {0}", ex.Message); if (ex.InnerException != null) Console.WriteLine("描述: {0}", ex.InnerException.Message); } finally { //////////////////////////////////////////////////////////////////////////////// // 退出前清理对象. // Console.WriteLine("正在关闭连接 ..."); // 关闭record set,当它处于打开状态时 if (rs != null && rs.State == (int)ADODB.ObjectStateEnum.adStateOpen) rs.Close(); // 关闭数据库连接,当它处于打开状态时 if (conn != null && conn.State == (int)ADODB.ObjectStateEnum.adStateOpen) conn.Close(); } }
private void OLD_cmdShow_Click() { int x = 0; // ERROR: Not supported in C#: OnErrorStatement ADODB.Recordset rs = default(ADODB.Recordset); ADODB.Recordset rs1 = default(ADODB.Recordset); ADODB.Recordset rs2 = default(ADODB.Recordset); ADODB.Recordset rsB = default(ADODB.Recordset); ADODB.Recordset rsDcheck = default(ADODB.Recordset); decimal HMyPrice = default(decimal); string MyMarkup = null; decimal HMyPrice1 = default(decimal); double MyCounterF = 0; double MyCounterL = 0; string Delimiter = null; ADODB.Recordset rsk = default(ADODB.Recordset); rs = new ADODB.Recordset(); rs1 = new ADODB.Recordset(); rs2 = new ADODB.Recordset(); rsB = new ADODB.Recordset(); rsDcheck = new ADODB.Recordset(); rsk = new ADODB.Recordset(); Delimiter = " "; //Set rs = getRS("SELECT * FROM DayEnd WHERE DayEnd_Date = " & Me.txtstartdate.Text & "") //validation for start date if (string.IsNullOrEmpty(this.txtstartdate.Text)) { Interaction.MsgBox("Please Select/enter the Start Date", MsgBoxStyle.ApplicationModal + MsgBoxStyle.OkCancel, "4POS"); this.txtstartdate.Focus(); return; //validation for end date } else if (string.IsNullOrEmpty(this.txtenddate.Text)) { Interaction.MsgBox("Please Select/enter the End Date", MsgBoxStyle.ApplicationModal + MsgBoxStyle.OkCancel, "4POS"); this.txtenddate.Focus(); return; } //create table name modApplication.Te_Names = "NewPricechanges"; //In case the table was not dropped then drop it rs = modRecordSet.getRS(ref "DROP TABLE " + modApplication.Te_Names + ""); //selecting from dayend rsDcheck = modRecordSet.getRS(ref "SELECT * FROM DayEnd"); rsDcheck.MoveFirst(); //looping through all the selected records while (!(rsDcheck.EOF)) { //rsDcheck("DayEnd_Date") = Trim(Mid(rsDcheck("DayEnd_Date"), Len(rsDcheck("DayEnd_Date")) - 2, InStr(1, rsDcheck("DayEnd_Date"), Delimiter, Len(rsDcheck("DayEnd_Date")) - 1))) //formarting the date and time to just date rsDcheck.Fields("DayEnd_Date").Value = Strings.Trim(Strings.Mid(rsDcheck.Fields("DayEnd_Date").Value, 1, Strings.InStr(1, rsDcheck.Fields("DayEnd_Date").Value, Delimiter, 1) - 1)); //updating the date fields to only date not date and time rs = modRecordSet.getRS(ref "UPDATE DayEnd SET DayEnd_Date=#" + rsDcheck.Fields("DayEnd_Date").Value + "# WHERE DayEndID=" + rsDcheck.Fields("DayEndID").Value + ""); rsDcheck.moveNext(); } modApplication.MyFTypess = "PriceChangesID_DayEndStockItemLnk Number,PriceChanges_StockItemName Text(50),OldPrice Currency,NewPrice Currency,SellingPrice Currency,Markup Number"; //create table NewPriceChanges modRecordSet.cnnDB.Execute("CREATE TABLE " + modApplication.Te_Names + " (" + modApplication.MyFTypess + ")"); //selecting from the start date rs = modRecordSet.getRS(ref "SELECT * FROM DayEnd WHERE (DayEnd_Date=#" + this.txtstartdate.Text + "#)"); //selecting from the end date rs1 = modRecordSet.getRS(ref "SELECT * FROM DayEnd WHERE (DayEnd_Date = #" + this.txtenddate.Text + "#)"); //MyDayendIDs = rs("DayEndID") //MyDayendIDs1 = rs1("DayEndID") this.cmdshow.Enabled = false; this.cmdcancel.Enabled = false; //assigning the start date and the end date to the below variables MyCounterF = rs.Fields("DayEndID").Value; MyCounterL = rs1.Fields("DayEndID").Value; //loop/round from the first date until the last date selected for (x = MyCounterF; x <= MyCounterL; x++) { rs2 = modRecordSet.getRS(ref "SELECT * FROM DayEndStockItemLnk WHERE DayEndStockItemLnk_StockItemID=" + MyCounterF + ""); rsB = modRecordSet.getRS(ref "SELECT * FROM CatalogueChannelLnk WHERE CatalogueChannelLnk_StockItemID=" + MyCounterF + ""); rs = modRecordSet.getRS(ref "SELECT * FROM StockItem WHERE StockItemID=" + rs2.Fields("DayEndStockItemLnk_StockItemID").Value + ""); rs2.MoveFirst(); //formating the price HMyPrice1 = rs2.Fields("DayEndStockItemLnk_ListCost").Value; HMyPrice1 = Convert.ToDecimal(Strings.Format(HMyPrice1, "R# ,###.##")); //formating the price HMyPrice = rs2.Fields("DayEndStockItemLnk_ListCost").Value; HMyPrice = Convert.ToDecimal(Strings.Format(HMyPrice, "R# ,###.##")); rs2.Fields("DayEndStockItemLnk_ListCost").Value = Strings.Format(rs2.Fields("DayEndStockItemLnk_ListCost").Value, "R # ,###.##"); while (!(rs2.EOF)) { //looping through the price for a specific date,if the price differs then insert into newly created table if (rs2.Fields("DayEndStockItemLnk_ListCost").Value != HMyPrice) { //rsB("CatalogueChannelLnk_Price") = rsB("CatalogueChannelLnk_Price") HMyPrice = rs2.Fields("DayEndStockItemLnk_ListCost").Value; HMyPrice = Convert.ToDecimal(Strings.Format(HMyPrice, "R# ,###.##")); MyMarkup = Convert.ToString(rs2.Fields("DayEndStockItemLnk_ListCost").Value / rsB.Fields("CatalogueChannelLnk_Price").Value * 100); MyMarkup = Convert.ToString(100 - Convert.ToDouble(MyMarkup)); //Set rs = getRS("SELECT DayEndStockItemLnk_ListCost,StockItem_Name,CatalogueChannelLnk_Price FROM CatalogueChannelLnk INNER JOIN (StockItem INNER JOIN DayEndStockItemLnk ON StockItem.StockItemID = DayEndStockItemLnk.DayEndStockItemLnk_StockItemID) ON CatalogueChannelLnk.CatalogueChannelLnk_StockItemID = StockItem.StockItemID WHERE DayEndStockItemLnk_StockItemID=" & rs2("DayEndStockItemLnk_StockItemID") & ";") //modApplication.Report_PriceChanges //If rs2("DayEndStockItemLnk_ListCost") <> HMyPrice Then //insert into Newpricechanges rsk = modRecordSet.getRS(ref "INSERT INTO " + modApplication.Te_Names + "(PriceChangesID_DayEndStockItemLnk,PriceChanges_StockItemName,OldPrice,NewPrice,SellingPrice,Markup)VALUES(" + rs2.Fields("DayEndStockItemLnk_StockItemID").Value + ",'" + rs.Fields("StockItem_Name").Value + "', " + HMyPrice1 + ", " + rs2.Fields("DayEndStockItemLnk_ListCost").Value + "," + rsB.Fields("CatalogueChannelLnk_Price").Value + "," + MyMarkup + ")"); //End If //delete if there is records with same old price and new price rsk = modRecordSet.getRS(ref "DELETE * FROM " + modApplication.Te_Names + " WHERE (NewPricechanges.PriceChangesID_DayEndStockItemLnk =" + rs2.Fields("DayEndStockItemLnk_StockItemID").Value + " and NewPricechanges.OldPrice = " + rs2.Fields("DayEndStockItemLnk_ListCost").Value + " and NewPricechanges.NewPrice = " + rs2.Fields("DayEndStockItemLnk_ListCost").Value + ")"); } //rsB.moveNext rs2.moveNext(); rs2.Fields("DayEndStockItemLnk_ListCost").Value = Strings.Format(rs2.Fields("DayEndStockItemLnk_ListCost").Value, "R # ,###.##"); } //Set rs1 = getRS("SELECT * FROM DayEndStockItemLnk WHERE DayEndStockItemLnk_StockItemID=" & MyDayendIDs1 & "") //Set rs = getRS("SELECT * FROM StockItem WHERE StockItemID=" & rs1("DayEndStockItemLnk_StockItemID") & "") //rs1.MoveFirst //Do Until rs1.EOF //If HMyPrice <> rs1("DayEndStockItemLnk_ListCost") Then //HMyPrice1 = rs1("DayEndStockItemLnk_ListCost") //Set rs = getRS("INSERT INTO NewPriceChanges(PriceChangesID_DayEndStockItemLnk,PriceChanges_StockItemName,OldPrice,NewPrice)VALUES(" & rs1("DayEndStockItemLnk_StockItemID") & ",'" & rs("StockItem_Name") & "', '" & HMyPrice1 & "', '" & rs1("DayEndStockItemLnk_ListCost") & "')") //End If //rs1.moveNext //Loop MyCounterF = MyCounterF + 1; } rs = modRecordSet.getRS(ref "SELECT * FROM NewPriceChanges"); //if there was a price change then display the report if (rs.RecordCount > 0) { modApplication.ForNewPChange = 2; modApplication.report_NewPriceChange(); //if there was no price change then don't display the report instead display the below message } else if (rs.RecordCount < 1) { Interaction.MsgBox("There was No Price Changes of Items between " + this.txtstartdate.Text + " And " + this.txtenddate.Text, MsgBoxStyle.Information, "4POS"); //if there was no price change then enable the show and cancel button this.cmdshow.Enabled = true; this.cmdcancel.Enabled = true; } }
private void cmdSave_Click(System.Object eventSender, System.EventArgs eventArgs) { // ERROR: Not supported in C#: OnErrorStatement ADODB.Recordset rs = default(ADODB.Recordset); ADODB.Recordset rst = default(ADODB.Recordset); short RecSel1 = 0; string TheSpacess = null; string MyLines = null; rs = new ADODB.Recordset(); rst = new ADODB.Recordset(); ADODB.Recordset rsMax = default(ADODB.Recordset); short ThePosition = 0; short TheCode = 0; ADODB.Recordset rsDet = default(ADODB.Recordset); rsMax = new ADODB.Recordset(); rsDet = new ADODB.Recordset(); //If Not IsNumeric(Me.txtpos.Text) Then // MsgBox "Row Position Must be a Number.", vbInformation, "4Pos Back Office" //Exit Sub //Else //End If //for a sample of the selected field //Designing barcodes if (modApplication.TheNames == "Price") { TheSpacess = "R 21.99"; //And rsT.RecordCount < 1 Then if (_chkFields_4.CheckState == 1) { if (this._chkFields_0.CheckState == 1) { rs = modRecordSet.getRS(ref "INSERT INTO BClabelItem(BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 1 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + " )"); rsDet = modRecordSet.getRS(ref "SELECT Max(BClabelItem.BClabelItemID) as TheLastDe FROM BClabelItem"); rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("TheLastDe").Value + "," + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 1 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")"); } else { rs = modRecordSet.getRS(ref "INSERT INTO BClabelItem(BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 0 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + " )"); rsDet = modRecordSet.getRS(ref "SELECT Max(BClabelItem.BClabelItemID) as TheLastDe FROM BClabelItem"); rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("TheLastDe").Value + "," + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 0 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")"); } //ElseIf _chkFields_4.value = 1 And rsT.RecordCount > 0 Then //Set rs = getRS("UPDATE BClabelItem SET BClabelItem_Line=" & ThePosition & ",BClabelItem_Field='" & TheNames & "',BClabelItem_Align=" & MyFAlign & ",BClabelItem_Size=" & Me.cmbfont.Text & ",BClabelItem_Sample='" & TheSpacess & "',BClabelItem_Disabled='" & 0 & "' WHERE BClabelItem_BCLabelID=" & RecSel & " AND BClabelItem_Field='" & TheNames & "'") } else if (_chkFields_4.CheckState == 0) { //Set rsDet = getRS("SELECT Max(BClabelItem.BClabelItemID) as TheLastDe FROM BClabelItem") rsDet = modRecordSet.getRS(ref "SELECT * FROM BClabelItem WHERE BClabelItem_BCLabelID=" + modApplication.RecSel + " AND BClabelItem_Field='" + modApplication.TheNames + "'"); rsDet.MoveFirst(); rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("BClabelItemID").Value + "," + modApplication.RecSel + "," + rsDet.Fields("BClabelItem_Line").Value + ",'" + modApplication.TheNames + "'," + rsDet.Fields("BClabelItem_Align").Value + "," + rsDet.Fields("BClabelItem_Size").Value + "," + rsDet.Fields("BClabelItem_Bold").Value + ",'" + TheSpacess + "'," + rsDet.Fields("BClabelItem_Disabled").Value + "," + modApplication.MyLIDWHole + ")"); rs = modRecordSet.getRS(ref "DELETE * FROM BClabelItem WHERE BClabelItem_BCLabelID=" + modApplication.RecSel + " AND BClabelItem_Field='" + modApplication.TheNames + "' and BClabelItemID=" + rsDet.Fields("BClabelItemID").Value + ""); } //Designing barcodes } else if (modApplication.TheNames == "Price6") { TheSpacess = "R 21.99 for 6"; //And rsT.RecordCount < 1 Then if (_chkFields_4.CheckState == 1) { if (this._chkFields_0.CheckState == 1) { rs = modRecordSet.getRS(ref "INSERT INTO BClabelItem(BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 1 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + " )"); rsDet = modRecordSet.getRS(ref "SELECT Max(BClabelItem.BClabelItemID) as TheLastDe FROM BClabelItem"); rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("TheLastDe").Value + "," + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 1 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")"); } else { rs = modRecordSet.getRS(ref "INSERT INTO BClabelItem(BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 0 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + " )"); rsDet = modRecordSet.getRS(ref "SELECT Max(BClabelItem.BClabelItemID) as TheLastDe FROM BClabelItem"); rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("TheLastDe").Value + "," + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 0 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")"); } //ElseIf _chkFields_4.value = 1 And rsT.RecordCount > 0 Then //Set rs = getRS("UPDATE BClabelItem SET BClabelItem_Line=" & ThePosition & ",BClabelItem_Field='" & TheNames & "',BClabelItem_Align=" & MyFAlign & ",BClabelItem_Size=" & Me.cmbfont.Text & ",BClabelItem_Sample='" & TheSpacess & "',BClabelItem_Disabled='" & 0 & "' WHERE BClabelItem_BCLabelID=" & RecSel & " AND BClabelItem_Field='" & TheNames & "'") } else if (_chkFields_4.CheckState == 0) { //Set rsDet = getRS("SELECT Max(BClabelItem.BClabelItemID) as TheLastDe FROM BClabelItem") rsDet = modRecordSet.getRS(ref "SELECT * FROM BClabelItem WHERE BClabelItem_BCLabelID=" + modApplication.RecSel + " AND BClabelItem_Field='" + modApplication.TheNames + "'"); rsDet.MoveFirst(); rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("BClabelItemID").Value + "," + modApplication.RecSel + "," + rsDet.Fields("BClabelItem_Line").Value + ",'" + modApplication.TheNames + "'," + rsDet.Fields("BClabelItem_Align").Value + "," + rsDet.Fields("BClabelItem_Size").Value + "," + rsDet.Fields("BClabelItem_Bold").Value + ",'" + TheSpacess + "'," + rsDet.Fields("BClabelItem_Disabled").Value + "," + modApplication.MyLIDWHole + ")"); rs = modRecordSet.getRS(ref "DELETE * FROM BClabelItem WHERE BClabelItem_BCLabelID=" + modApplication.RecSel + " AND BClabelItem_Field='" + modApplication.TheNames + "' and BClabelItemID=" + rsDet.Fields("BClabelItemID").Value + ""); } //Designing barcodes } else if (modApplication.TheNames == "Price12") { TheSpacess = "R 21.99 for 12"; //And rsT.RecordCount < 1 Then if (_chkFields_4.CheckState == 1) { if (this._chkFields_0.CheckState == 1) { rs = modRecordSet.getRS(ref "INSERT INTO BClabelItem(BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 1 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + " )"); rsDet = modRecordSet.getRS(ref "SELECT Max(BClabelItem.BClabelItemID) as TheLastDe FROM BClabelItem"); rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("TheLastDe").Value + "," + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 1 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")"); } else { rs = modRecordSet.getRS(ref "INSERT INTO BClabelItem(BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 0 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + " )"); rsDet = modRecordSet.getRS(ref "SELECT Max(BClabelItem.BClabelItemID) as TheLastDe FROM BClabelItem"); rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("TheLastDe").Value + "," + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 0 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")"); } //ElseIf _chkFields_4.value = 1 And rsT.RecordCount > 0 Then //Set rs = getRS("UPDATE BClabelItem SET BClabelItem_Line=" & ThePosition & ",BClabelItem_Field='" & TheNames & "',BClabelItem_Align=" & MyFAlign & ",BClabelItem_Size=" & Me.cmbfont.Text & ",BClabelItem_Sample='" & TheSpacess & "',BClabelItem_Disabled='" & 0 & "' WHERE BClabelItem_BCLabelID=" & RecSel & " AND BClabelItem_Field='" & TheNames & "'") } else if (_chkFields_4.CheckState == 0) { //Set rsDet = getRS("SELECT Max(BClabelItem.BClabelItemID) as TheLastDe FROM BClabelItem") rsDet = modRecordSet.getRS(ref "SELECT * FROM BClabelItem WHERE BClabelItem_BCLabelID=" + modApplication.RecSel + " AND BClabelItem_Field='" + modApplication.TheNames + "'"); rsDet.MoveFirst(); rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("BClabelItemID").Value + "," + modApplication.RecSel + "," + rsDet.Fields("BClabelItem_Line").Value + ",'" + modApplication.TheNames + "'," + rsDet.Fields("BClabelItem_Align").Value + "," + rsDet.Fields("BClabelItem_Size").Value + "," + rsDet.Fields("BClabelItem_Bold").Value + ",'" + TheSpacess + "'," + rsDet.Fields("BClabelItem_Disabled").Value + "," + modApplication.MyLIDWHole + ")"); rs = modRecordSet.getRS(ref "DELETE * FROM BClabelItem WHERE BClabelItem_BCLabelID=" + modApplication.RecSel + " AND BClabelItem_Field='" + modApplication.TheNames + "' and BClabelItemID=" + rsDet.Fields("BClabelItemID").Value + ""); } //Designing barcodes } else if (modApplication.TheNames == "Price24") { TheSpacess = "R 21.99 for 24"; //And rsT.RecordCount < 1 Then if (_chkFields_4.CheckState == 1) { if (this._chkFields_0.CheckState == 1) { rs = modRecordSet.getRS(ref "INSERT INTO BClabelItem(BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 1 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + " )"); rsDet = modRecordSet.getRS(ref "SELECT Max(BClabelItem.BClabelItemID) as TheLastDe FROM BClabelItem"); rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("TheLastDe").Value + "," + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 1 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")"); } else { rs = modRecordSet.getRS(ref "INSERT INTO BClabelItem(BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 0 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + " )"); rsDet = modRecordSet.getRS(ref "SELECT Max(BClabelItem.BClabelItemID) as TheLastDe FROM BClabelItem"); rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("TheLastDe").Value + "," + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 0 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")"); } //ElseIf _chkFields_4.value = 1 And rsT.RecordCount > 0 Then //Set rs = getRS("UPDATE BClabelItem SET BClabelItem_Line=" & ThePosition & ",BClabelItem_Field='" & TheNames & "',BClabelItem_Align=" & MyFAlign & ",BClabelItem_Size=" & Me.cmbfont.Text & ",BClabelItem_Sample='" & TheSpacess & "',BClabelItem_Disabled='" & 0 & "' WHERE BClabelItem_BCLabelID=" & RecSel & " AND BClabelItem_Field='" & TheNames & "'") } else if (_chkFields_4.CheckState == 0) { //Set rsDet = getRS("SELECT Max(BClabelItem.BClabelItemID) as TheLastDe FROM BClabelItem") rsDet = modRecordSet.getRS(ref "SELECT * FROM BClabelItem WHERE BClabelItem_BCLabelID=" + modApplication.RecSel + " AND BClabelItem_Field='" + modApplication.TheNames + "'"); rsDet.MoveFirst(); rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("BClabelItemID").Value + "," + modApplication.RecSel + "," + rsDet.Fields("BClabelItem_Line").Value + ",'" + modApplication.TheNames + "'," + rsDet.Fields("BClabelItem_Align").Value + "," + rsDet.Fields("BClabelItem_Size").Value + "," + rsDet.Fields("BClabelItem_Bold").Value + ",'" + TheSpacess + "'," + rsDet.Fields("BClabelItem_Disabled").Value + "," + modApplication.MyLIDWHole + ")"); rs = modRecordSet.getRS(ref "DELETE * FROM BClabelItem WHERE BClabelItem_BCLabelID=" + modApplication.RecSel + " AND BClabelItem_Field='" + modApplication.TheNames + "' and BClabelItemID=" + rsDet.Fields("BClabelItemID").Value + ""); } } else if (modApplication.TheNames == "Company_Name") { TheSpacess = "4POS Demo"; //And rsT.RecordCount < 1 Then if (_chkFields_4.CheckState == 1) { if (this._chkFields_0.CheckState == 1) { rs = modRecordSet.getRS(ref "INSERT INTO BClabelItem(BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 1 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")"); rsDet = modRecordSet.getRS(ref "SELECT Max(BClabelItem.BClabelItemID) as TheLastDe FROM BClabelItem"); rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("TheLastDe").Value + "," + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 1 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")"); } else { rs = modRecordSet.getRS(ref "INSERT INTO BClabelItem(BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 0 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")"); rsDet = modRecordSet.getRS(ref "SELECT Max(BClabelItem.BClabelItemID) as TheLastDe FROM BClabelItem"); rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("TheLastDe").Value + "," + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 0 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")"); } //ElseIf _chkFields_4.value = 1 And rsT.RecordCount > 0 Then //Set rs = getRS("UPDATE BClabelItem SET BClabelItem_Line=" & ThePosition & ",BClabelItem_Field='" & TheNames & "',BClabelItem_Align=" & MyFAlign & ",BClabelItem_Size=" & Me.cmbfont.Text & ",BClabelItem_Sample='" & TheSpacess & "',BClabelItem_Disabled='" & 0 & "' WHERE BClabelItem_BCLabelID=" & RecSel & " AND BClabelItem_Field='" & TheNames & "'") } else if (_chkFields_4.CheckState == 0) { rsDet = modRecordSet.getRS(ref "SELECT * FROM BClabelItem WHERE BClabelItem_BCLabelID=" + modApplication.RecSel + " AND BClabelItem_Field='" + modApplication.TheNames + "'"); rsDet.MoveFirst(); rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("BClabelItemID").Value + "," + modApplication.RecSel + "," + rsDet.Fields("BClabelItem_Line").Value + ",'" + modApplication.TheNames + "'," + rsDet.Fields("BClabelItem_Align").Value + "," + rsDet.Fields("BClabelItem_Size").Value + "," + rsDet.Fields("BClabelItem_Bold").Value + ",'" + TheSpacess + "'," + rsDet.Fields("BClabelItem_Disabled").Value + "," + modApplication.MyLIDWHole + ")"); rs = modRecordSet.getRS(ref "DELETE * FROM BClabelItem WHERE BClabelItem_BCLabelID=" + modApplication.RecSel + " AND BClabelItem_Field='" + modApplication.TheNames + "' and BClabelItemID=" + rsDet.Fields("BClabelItemID").Value + ""); } } else if (modApplication.TheNames == "StockItem_Name") { TheSpacess = "Default Stock Item Name"; //And rsT.RecordCount < 1 Then if (_chkFields_4.CheckState == 1) { if (this._chkFields_0.CheckState == 1) { rs = modRecordSet.getRS(ref "INSERT INTO BClabelItem(BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 1 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")"); rsDet = modRecordSet.getRS(ref "SELECT Max(BClabelItem.BClabelItemID) as TheLastDe FROM BClabelItem"); rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("TheLastDe").Value + "," + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 1 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")"); } else { rs = modRecordSet.getRS(ref "INSERT INTO BClabelItem(BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 0 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")"); rsDet = modRecordSet.getRS(ref "SELECT Max(BClabelItem.BClabelItemID) as TheLastDe FROM BClabelItem"); rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("TheLastDe").Value + "," + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 0 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")"); } //ElseIf _chkFields_4.value = 1 And rsT.RecordCount > 0 Then //Set rs = getRS("UPDATE BClabelItem SET BClabelItem_Line=" & ThePosition & ",BClabelItem_Field='" & TheNames & "',BClabelItem_Align=" & MyFAlign & ",BClabelItem_Size=" & Me.cmbfont.Text & ",BClabelItem_Sample='" & TheSpacess & "',BClabelItem_Disabled='" & 0 & "' WHERE BClabelItem_BCLabelID=" & RecSel & " AND BClabelItem_Field='" & TheNames & "'") } else if (_chkFields_4.CheckState == 0) { rsDet = modRecordSet.getRS(ref "SELECT * FROM BClabelItem WHERE BClabelItem_BCLabelID=" + modApplication.RecSel + " AND BClabelItem_Field='" + modApplication.TheNames + "'"); rsDet.MoveFirst(); rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("BClabelItemID").Value + "," + modApplication.RecSel + "," + rsDet.Fields("BClabelItem_Line").Value + ",'" + modApplication.TheNames + "'," + rsDet.Fields("BClabelItem_Align").Value + "," + rsDet.Fields("BClabelItem_Size").Value + "," + rsDet.Fields("BClabelItem_Bold").Value + ",'" + TheSpacess + "'," + rsDet.Fields("BClabelItem_Disabled").Value + "," + modApplication.MyLIDWHole + ")"); rs = modRecordSet.getRS(ref "DELETE * FROM BClabelItem WHERE BClabelItem_BCLabelID=" + modApplication.RecSel + " AND BClabelItem_Field='" + modApplication.TheNames + "' and BClabelItemID=" + rsDet.Fields("BClabelItemID").Value + ""); } } else if (modApplication.TheNames == "Catalogue_Barcode") { TheSpacess = "6001060071416"; //And rsT.RecordCount < 1 Then if (_chkFields_4.CheckState == 1) { if (this._chkFields_0.CheckState == 1) { rs = modRecordSet.getRS(ref "INSERT INTO BClabelItem(BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 1 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")"); rsDet = modRecordSet.getRS(ref "SELECT Max(BClabelItem.BClabelItemID) as TheLastDe FROM BClabelItem"); rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("TheLastDe").Value + "," + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 1 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")"); } else { rs = modRecordSet.getRS(ref "INSERT INTO BClabelItem(BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 0 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")"); rsDet = modRecordSet.getRS(ref "SELECT Max(BClabelItem.BClabelItemID) as TheLastDe FROM BClabelItem"); rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("TheLastDe").Value + "," + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 0 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")"); } //ElseIf _chkFields_4.value = 1 And rsT.RecordCount > 0 Then //Set rs = getRS("UPDATE BClabelItem SET BClabelItem_Line=" & ThePosition & ",BClabelItem_Field='" & TheNames & "',BClabelItem_Align=" & MyFAlign & ",BClabelItem_Size=" & Me.cmbfont.Text & ",BClabelItem_Sample='" & TheSpacess & "',BClabelItem_Disabled='" & 0 & "' WHERE BClabelItem_BCLabelID=" & RecSel & " AND BClabelItem_Field='" & TheNames & "'") } else if (_chkFields_4.CheckState == 0) { rsDet = modRecordSet.getRS(ref "SELECT * FROM BClabelItem WHERE BClabelItem_BCLabelID=" + modApplication.RecSel + " AND BClabelItem_Field='" + modApplication.TheNames + "'"); rsDet.MoveFirst(); rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("BClabelItemID").Value + "," + modApplication.RecSel + "," + rsDet.Fields("BClabelItem_Line").Value + ",'" + modApplication.TheNames + "'," + rsDet.Fields("BClabelItem_Align").Value + "," + rsDet.Fields("BClabelItem_Size").Value + "," + rsDet.Fields("BClabelItem_Bold").Value + ",'" + TheSpacess + "'," + rsDet.Fields("BClabelItem_Disabled").Value + "," + modApplication.MyLIDWHole + ")"); rs = modRecordSet.getRS(ref "DELETE * FROM BClabelItem WHERE BClabelItem_BCLabelID=" + modApplication.RecSel + " AND BClabelItem_Field='" + modApplication.TheNames + "' and BClabelItemID=" + rsDet.Fields("BClabelItemID").Value + ""); } } else if (modApplication.TheNames == "Company_Telephone") { TheSpacess = "082 448 3987"; //And rsT.RecordCount < 1 Then if (_chkFields_4.CheckState == 1) { if (this._chkFields_0.CheckState == 1) { rs = modRecordSet.getRS(ref "INSERT INTO BClabelItem(BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 1 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")"); rsDet = modRecordSet.getRS(ref "SELECT Max(BClabelItem.BClabelItemID) as TheLastDe FROM BClabelItem"); rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("TheLastDe").Value + "," + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 1 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")"); } else { rs = modRecordSet.getRS(ref "INSERT INTO BClabelItem(BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 0 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")"); rsDet = modRecordSet.getRS(ref "SELECT Max(BClabelItem.BClabelItemID) as TheLastDe FROM BClabelItem"); rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("TheLastDe").Value + "," + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 0 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")"); } //ElseIf _chkFields_4.value = 1 And rsT.RecordCount > 0 Then // Set rs = getRS("UPDATE BClabelItem SET BClabelItem_Line=" & ThePosition & ",BClabelItem_Field='" & TheNames & "',BClabelItem_Align=" & MyFAlign & ",BClabelItem_Size=" & Me.cmbfont.Text & ",BClabelItem_Sample='" & TheSpacess & "',BClabelItem_Disabled='" & 0 & "' WHERE BClabelItem_BCLabelID=" & RecSel & " AND BClabelItem_Field='" & TheNames & "'") } else if (_chkFields_4.CheckState == 0) { rsDet = modRecordSet.getRS(ref "SELECT * FROM BClabelItem WHERE BClabelItem_BCLabelID=" + modApplication.RecSel + " AND BClabelItem_Field='" + modApplication.TheNames + "'"); rsDet.MoveFirst(); rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("BClabelItemID").Value + "," + modApplication.RecSel + "," + rsDet.Fields("BClabelItem_Line").Value + ",'" + modApplication.TheNames + "'," + rsDet.Fields("BClabelItem_Align").Value + "," + rsDet.Fields("BClabelItem_Size").Value + "," + rsDet.Fields("BClabelItem_Bold").Value + ",'" + TheSpacess + "'," + rsDet.Fields("BClabelItem_Disabled").Value + "," + modApplication.MyLIDWHole + ")"); rs = modRecordSet.getRS(ref "DELETE * FROM BClabelItem WHERE BClabelItem_BCLabelID=" + modApplication.RecSel + " AND BClabelItem_Field='" + modApplication.TheNames + "' and BClabelItemID=" + rsDet.Fields("BClabelItemID").Value + ""); } } else if (modApplication.TheNames == "PricingGroup_Name") { TheSpacess = "Beer Local"; //And rsT.RecordCount < 1 Then if (_chkFields_4.CheckState == 1) { if (this._chkFields_0.CheckState == 1) { rs = modRecordSet.getRS(ref "INSERT INTO BClabelItem(BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 1 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")"); rsDet = modRecordSet.getRS(ref "SELECT Max(BClabelItem.BClabelItemID) as TheLastDe FROM BClabelItem"); rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("TheLastDe").Value + "," + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 1 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")"); } else { rs = modRecordSet.getRS(ref "INSERT INTO BClabelItem(BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 0 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")"); rsDet = modRecordSet.getRS(ref "SELECT Max(BClabelItem.BClabelItemID) as TheLastDe FROM BClabelItem"); rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("TheLastDe").Value + "," + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 0 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")"); } //ElseIf _chkFields_4.value = 1 And rsT.RecordCount > 0 Then //Set rs = getRS("UPDATE BClabelItem SET BClabelItem_Line=" & ThePosition & ",BClabelItem_Field='" & TheNames & "',BClabelItem_Align=" & MyFAlign & ",BClabelItem_Size=" & Me.cmbfont.Text & ",BClabelItem_Sample='" & TheSpacess & "',BClabelItem_Disabled='" & 0 & "' WHERE BClabelItem_BCLabelID=" & RecSel & " AND BClabelItem_Field='" & TheNames & "'") } else if (_chkFields_4.CheckState == 0) { rsDet = modRecordSet.getRS(ref "SELECT * FROM BClabelItem WHERE BClabelItem_BCLabelID=" + modApplication.RecSel + " AND BClabelItem_Field='" + modApplication.TheNames + "'"); rsDet.MoveFirst(); rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("BClabelItemID").Value + "," + modApplication.RecSel + "," + rsDet.Fields("BClabelItem_Line").Value + ",'" + modApplication.TheNames + "'," + rsDet.Fields("BClabelItem_Align").Value + "," + rsDet.Fields("BClabelItem_Size").Value + "," + rsDet.Fields("BClabelItem_Bold").Value + ",'" + TheSpacess + "'," + rsDet.Fields("BClabelItem_Disabled").Value + "," + modApplication.MyLIDWHole + ")"); rs = modRecordSet.getRS(ref "DELETE * FROM BClabelItem WHERE BClabelItem_BCLabelID=" + modApplication.RecSel + " AND BClabelItem_Field='" + modApplication.TheNames + "' and BClabelItemID=" + rsDet.Fields("BClabelItemID").Value + ""); } } else if (modApplication.TheNames == "line") { TheSpacess = " "; //And rsT.RecordCount < 1 Then if (_chkFields_4.CheckState == 1) { if (this._chkFields_0.CheckState == 1) { rs = modRecordSet.getRS(ref "INSERT INTO BClabelItem(BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 1 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")"); rsDet = modRecordSet.getRS(ref "SELECT Max(BClabelItem.BClabelItemID) as TheLastDe FROM BClabelItem"); rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("TheLastDe").Value + "," + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 1 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")"); } else { rs = modRecordSet.getRS(ref "INSERT INTO BClabelItem(BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 0 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")"); rsDet = modRecordSet.getRS(ref "SELECT Max(BClabelItem.BClabelItemID) as TheLastDe FROM BClabelItem"); rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("TheLastDe").Value + "," + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 0 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")"); } //ElseIf _chkFields_4.value = 1 And rsT.RecordCount > 0 Then //Set rs = getRS("UPDATE BClabelItem SET BClabelItem_Line=" & ThePosition & ",BClabelItem_Field='" & TheNames & "',BClabelItem_Align=" & MyFAlign & ",BClabelItem_Size=" & Me.cmbfont.Text & ",BClabelItem_Sample='" & TheSpacess & "',BClabelItem_Disabled='" & 0 & "' WHERE BClabelItem_BCLabelID=" & RecSel & " AND BClabelItem_Field='" & TheNames & "'") } else if (_chkFields_4.CheckState == 0) { rsDet = modRecordSet.getRS(ref "SELECT * FROM BClabelItem WHERE BClabelItem_BCLabelID=" + modApplication.RecSel + " AND BClabelItem_Field='" + modApplication.TheNames + "'"); rsDet.MoveFirst(); rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("BClabelItemID").Value + "," + modApplication.RecSel + "," + rsDet.Fields("BClabelItem_Line").Value + ",'" + modApplication.TheNames + "'," + rsDet.Fields("BClabelItem_Align").Value + "," + rsDet.Fields("BClabelItem_Size").Value + "," + rsDet.Fields("BClabelItem_Bold").Value + ",'" + TheSpacess + "'," + rsDet.Fields("BClabelItem_Disabled").Value + "," + modApplication.MyLIDWHole + ")"); rs = modRecordSet.getRS(ref "DELETE * FROM BClabelItem WHERE BClabelItem_BCLabelID=" + modApplication.RecSel + " AND BClabelItem_Field='" + modApplication.TheNames + "' and BClabelItemID=" + rsDet.Fields("BClabelItemID").Value + ""); } //***** //Blank } else if (modApplication.TheNames == "blank") { TheSpacess = " "; //And rsT.RecordCount < 1 Then if (_chkFields_4.CheckState == 1) { if (this._chkFields_0.CheckState == 1) { rs = modRecordSet.getRS(ref "INSERT INTO BClabelItem(BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 1 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")"); rsDet = modRecordSet.getRS(ref "SELECT Max(BClabelItem.BClabelItemID) as TheLastDe FROM BClabelItem"); rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("TheLastDe").Value + "," + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 1 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")"); } else { rs = modRecordSet.getRS(ref "INSERT INTO BClabelItem(BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 0 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")"); rsDet = modRecordSet.getRS(ref "SELECT Max(BClabelItem.BClabelItemID) as TheLastDe FROM BClabelItem"); rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("TheLastDe").Value + "," + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 0 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")"); } //ElseIf _chkFields_4.value = 1 And rsT.RecordCount > 0 Then //Set rs = getRS("UPDATE BClabelItem SET BClabelItem_Line=" & ThePosition & ",BClabelItem_Field='" & TheNames & "',BClabelItem_Align=" & MyFAlign & ",BClabelItem_Size=" & Me.cmbfont.Text & ",BClabelItem_Sample='" & TheSpacess & "',BClabelItem_Disabled='" & 0 & "' WHERE BClabelItem_BCLabelID=" & RecSel & " AND BClabelItem_Field='" & TheNames & "'") } else if (_chkFields_4.CheckState == 0) { rsDet = modRecordSet.getRS(ref "SELECT * FROM BClabelItem WHERE BClabelItem_BCLabelID=" + modApplication.RecSel + " AND BClabelItem_Field='" + modApplication.TheNames + "'"); rsDet.MoveFirst(); rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("BClabelItemID").Value + "," + modApplication.RecSel + "," + rsDet.Fields("BClabelItem_Line").Value + ",'" + modApplication.TheNames + "'," + rsDet.Fields("BClabelItem_Align").Value + "," + rsDet.Fields("BClabelItem_Size").Value + "," + rsDet.Fields("BClabelItem_Bold").Value + ",'" + TheSpacess + "'," + rsDet.Fields("BClabelItem_Disabled").Value + "," + modApplication.MyLIDWHole + ")"); rs = modRecordSet.getRS(ref "DELETE * FROM BClabelItem WHERE BClabelItem_BCLabelID=" + modApplication.RecSel + " AND BClabelItem_Field='" + modApplication.TheNames + "' and BClabelItemID=" + rsDet.Fields("BClabelItemID").Value + ""); } //**** } else if (modApplication.TheNames == "code") { if (Convert.ToDouble(this.txtpos.Text) == -2) { TheCode = 50; } else if (Convert.ToDouble(this.txtpos.Text) == 0) { TheCode = 50; } else if (Convert.ToDouble(this.txtpos.Text) == 1) { TheCode = 45; } else if (Convert.ToDouble(this.txtpos.Text) == 2) { TheCode = 40; } else if (Convert.ToDouble(this.txtpos.Text) == 3) { TheCode = 35; } else if (Convert.ToDouble(this.txtpos.Text) == 4) { TheCode = 30; } else if (Convert.ToDouble(this.txtpos.Text) == 5) { TheCode = 25; } else if (Convert.ToDouble(this.txtpos.Text) == 6) { TheCode = 20; } else if (Convert.ToDouble(this.txtpos.Text) == 7) { TheCode = 15; } else if (Convert.ToDouble(this.txtpos.Text) == 8) { TheCode = 10; } else if (Convert.ToDouble(this.txtpos.Text) == 7) { TheCode = 5; } else if (Convert.ToDouble(this.txtpos.Text) == 8) { TheCode = 0; } //Set rs = getRS("UPDATE BClabel SET BClabel_Height=" & TheCode & " WHERE BClabelID=" & RecSel & "") TheSpacess = " "; //And rsT.RecordCount < 1 Then if (_chkFields_4.CheckState == 1) { if (this._chkFields_0.CheckState == 1) { rs = modRecordSet.getRS(ref "INSERT INTO BClabelItem(BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 1 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")"); rsDet = modRecordSet.getRS(ref "SELECT Max(BClabelItem.BClabelItemID) as TheLastDe FROM BClabelItem"); rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("TheLastDe").Value + "," + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 1 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")"); } else { rs = modRecordSet.getRS(ref "INSERT INTO BClabelItem(BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 0 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")"); rsDet = modRecordSet.getRS(ref "SELECT Max(BClabelItem.BClabelItemID) as TheLastDe FROM BClabelItem"); rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("TheLastDe").Value + "," + modApplication.RecSel + "," + this.txtpos.Text + ",'" + modApplication.TheNames + "'," + modApplication.MyFAlign + "," + this.cmbfont.Text + ",'" + 0 + "','" + TheSpacess + "','" + 0 + "'," + modApplication.MyLIDWHole + ")"); } if (Convert.ToDouble(this.txtpos.Text) == -2) { rs = modRecordSet.getRS(ref "UPDATE BClabel SET BClabel_Height=" + 50 + " WHERE BClabelID=" + modApplication.RecSel + ""); } else if (Convert.ToDouble(this.txtpos.Text) == 0) { rs = modRecordSet.getRS(ref "UPDATE BClabel SET BClabel_Height=" + 40 + " WHERE BClabelID=" + modApplication.RecSel + ""); } else if (Convert.ToDouble(this.txtpos.Text) == 2) { rs = modRecordSet.getRS(ref "UPDATE BClabel SET BClabel_Height=" + 40 + " WHERE BClabelID=" + modApplication.RecSel + ""); } else if (Convert.ToDouble(this.txtpos.Text) == 3) { rs = modRecordSet.getRS(ref "UPDATE BClabel SET BClabel_Height=" + 35 + " WHERE BClabelID=" + modApplication.RecSel + ""); } else if (Convert.ToDouble(this.txtpos.Text) == 4) { rs = modRecordSet.getRS(ref "UPDATE BClabel SET BClabel_Height=" + 30 + " WHERE BClabelID=" + modApplication.RecSel + ""); } else if (Convert.ToDouble(this.txtpos.Text) == 5) { rs = modRecordSet.getRS(ref "UPDATE BClabel SET BClabel_Height=" + 20 + " WHERE BClabelID=" + modApplication.RecSel + ""); } else if (Convert.ToDouble(this.txtpos.Text) == 6) { rs = modRecordSet.getRS(ref "UPDATE BClabel SET BClabel_Height=" + 10 + " WHERE BClabelID=" + modApplication.RecSel + ""); } else if (Convert.ToDouble(this.txtpos.Text) == 7) { rs = modRecordSet.getRS(ref "UPDATE BClabel SET BClabel_Height=" + 0 + " WHERE BClabelID=" + modApplication.RecSel + ""); } //ElseIf _chkFields_4.value = 1 And rsT.RecordCount > 0 Then //Set rs = getRS("UPDATE BClabelItem SET BClabelItem_Line=" & ThePosition & ",BClabelItem_Field='" & TheNames & "',BClabelItem_Align=" & MyFAlign & ",BClabelItem_Size=" & Me.cmbfont.Text & ",BClabelItem_Sample='" & TheSpacess & "',BClabelItem_Disabled='" & 0 & "' WHERE BClabelItem_BCLabelID=" & RecSel & " AND BClabelItem_Field='" & TheNames & "'") } else if (_chkFields_4.CheckState == 0) { //Set rs = getRS("INSERT INTO BClabelItem(BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" & RecSel & "," & Me.txtpos.Text & ",'" & TheNames & "'," & MyFAlign & "," & Me.cmbfont.Text & ",'" & 1 & "','" & TheSpacess & "','" & 0 & "'," & MyLIDWHole & ")") rsDet = modRecordSet.getRS(ref "SELECT * FROM BClabelItem WHERE BClabelItem_BCLabelID=" + modApplication.RecSel + " AND BClabelItem_Field='" + modApplication.TheNames + "'"); rsDet.MoveFirst(); rs = modRecordSet.getRS(ref "INSERT INTO BClabelItemUndo(BClabelItemID,BClabelItem_BCLabelID,BClabelItem_Line,BClabelItem_Field,BClabelItem_Align,BClabelItem_Size,BClabelItem_Bold,BClabelItem_Sample,BClabelItem_Disabled,BClabelItem_LabelID)VALUES(" + rsDet.Fields("BClabelItemID").Value + "," + modApplication.RecSel + "," + rsDet.Fields("BClabelItem_Line").Value + ",'" + modApplication.TheNames + "'," + rsDet.Fields("BClabelItem_Align").Value + "," + rsDet.Fields("BClabelItem_Size").Value + "," + rsDet.Fields("BClabelItem_Bold").Value + ",'" + TheSpacess + "'," + rsDet.Fields("BClabelItem_Disabled").Value + "," + modApplication.MyLIDWHole + ")"); rs = modRecordSet.getRS(ref "DELETE * FROM BClabelItem WHERE BClabelItem_BCLabelID=" + modApplication.RecSel + " AND BClabelItem_Field='" + modApplication.TheNames + "' and BClabelItemID=" + rsDet.Fields("BClabelItemID").Value + ""); } } modApplication.TheSelectedPrinterNew = 2; labelsfile(); modApplication.TheSelectedPrinterNew = 0; }