public override void Init(int flowCount, long flowRecordCount) { engine = StorageEngine.FromFile(Path.Combine(DataDirectory, "test.stsdb")); table = engine.Scheme.CreateOrOpenXTable<long, Tick>(new Locator(CollectionName)); engine.Scheme.Commit(); }
static public void Initialize() { myTimer = new Timer(); myTimer.Interval = 8000; myTimer.Tick += timer1_Tick; myTimer.Enabled = true; myData = XSupport.GetSQLDataSet("Select code, Name from trdr where sodtype=13", null); }
private ICommand Backward(XTable table, ICommand command) { BackwardCommand cmd = (BackwardCommand)command; List <KeyValuePair <IData, IData> > list = new List <KeyValuePair <IData, IData> >(); foreach (var item in table.Backward(cmd.FromKey, cmd.FromKey != null, cmd.ToKey, cmd.ToKey != null).Take(cmd.PageCount)) { list.Add(item); } return(new BackwardCommand(cmd.PageCount, cmd.FromKey, cmd.ToKey, list)); }
public void GetBodyRow(XTable table) { if (Input != null && Input.Any()) { XRow bodyRow; foreach (var item in Input) { bodyRow = new XRow() { Cells = new List <XCell>() }; bodyRow.Cells.Add(new XCell() { Data = item.UserName }); bodyRow.Cells.Add(new XCell() { Data = item.FirstName }); bodyRow.Cells.Add(new XCell() { Data = item.LastName }); bodyRow.Cells.Add(new XCell() { Data = item.Position }); bodyRow.Cells.Add(new XCell() { Data = item.Email }); bodyRow.Cells.Add(new XCell() { Data = item.Role }); bodyRow.Cells.Add(new XCell() { Data = item.GeoCode }); bodyRow.Cells.Add(new XCell() { Data = item.Org }); bodyRow.Cells.Add(new XCell() { Data = item.ReceiveEmailAlert }); table.Rows.Add(bodyRow); } } }
public override void Initialize() { CustTable = XModule.GetTable("TRDR"); customerForm = new CustomerForm(); customerForm.TopLevel = false; customerForm.Visible = true; customerForm.TRDR = CustTable; XModule.InsertControl(customerForm, "+PAGE(PG8,Web)"); CallCount++; }
private void AddGridTables(XTemplate xTemplate) { Progress?.Report("Adding grid tables"); foreach (XField xField in xTemplate.XProject.XFields) { if (xField.FieldType != MetaFieldType.Grid) { continue; } Progress?.Report($"Adding grid table: {xField.Name}"); DataTable table = Metadata.GetGridColumns(xField.FieldId); table.TableName = xField.Name; xTemplate.Add(XTable.Create(ElementNames.GridTable, table)); } }
public static void updateQTYS(String MTRL) { try { Settings settings = Settings.getInstance(); String strQTY = ""; String FILTER_CHECKBOX = ""; S1Custom.Io.HttpWeb.ItemHttp itemHttp = new S1Custom.Io.HttpWeb.ItemHttp(); String MTRL_SQL = ""; if (!MTRL.Equals("")) { MTRL_SQL = " AND A.MTRL=" + MTRL + " "; } if (!settings.ITEM_ON_WEB.Equals("")) { FILTER_CHECKBOX = " AND ME." + settings.ITEM_ON_WEB + " = 1"; } String s = S1Init.myXSupport.ConnectionInfo.YearId.ToString(); XTable QTYREsults = S1Init.myXSupport.GetSQLDataSet( " SELECT " + " A.MTRL, " + " ISNULL(B.QTY1,0) AS QTY, " + " A.CODE " + " FROM ((MTRL A " + " LEFT OUTER JOIN MTRDATA B ON A.MTRL=B.MTRL ) " + " LEFT OUTER JOIN MTREXTRA ME ON A.MTRL = ME.MTRL ) " + " WHERE A.COMPANY= " + S1Init.myXSupport.ConnectionInfo.CompanyId.ToString() + " AND B.FISCPRD= " + S1Init.myXSupport.ConnectionInfo.YearId.ToString() + " AND A.SODTYPE=51 " + FILTER_CHECKBOX + MTRL_SQL + " ORDER BY A.CODE,A.MTRL "); for (int j = 0; j < QTYREsults.Count; j++) { strQTY += "&QTYS[" + QTYREsults[j, "CODE"] + "]=" + QTYREsults[j, "QTY"]; } itemHttp.syncQTY(strQTY); } catch (Exception ex) { } }
public int ItemCodeToMtrl(String ItemCode) { int ItemID = -1; XTable CUSTOMER_MTRL = Model.S1Init.myXSupport.GetSQLDataSet("SELECT MTRL " + " FROM MTRL WHERE COMPANY= " + Model.S1Init.myXSupport.ConnectionInfo.CompanyId + " AND SODTYPE=51 AND CODE = '" + ItemCode + "'" ); if (CUSTOMER_MTRL.Count == 1) { ItemID = Convert.ToInt32(CUSTOMER_MTRL[0, "MTRL"].ToString()); } return(ItemID); }
private void InstantiateGridTable(XTable xTable) { Progress?.Report($"Adding grid table: {xTable.TableName}"); DataTable table = xTable.Instantiate(); foreach (DataRow row in table.Rows) { if (IgnoredGridColumnNames.Contains(row.Field <string>(ColumnNames.NAME))) { continue; } int fieldId = row.Field <int>(ColumnNames.FIELD_ID); row.SetField(ColumnNames.FIELD_ID, context.FieldIdMap[fieldId]); Metadata.AddGridColumn(row); } }
public int CustomerCodeToTrdr(String customerCode) { int CustID = -1; XTable CUSTOMER_MTRL = Model.S1Init.myXSupport.GetSQLDataSet("SELECT TRDR " + " FROM TRDR WHERE COMPANY= " + Model.S1Init.myXSupport.ConnectionInfo.CompanyId + " AND SODTYPE=13 AND CODE = '" + customerCode + "'" ); if (CUSTOMER_MTRL.Count == 1) { CustID = Convert.ToInt32(CUSTOMER_MTRL[0, "TRDR"].ToString()); } return(CustID); }
public override void Initialize() { CustTable = XModule.GetTable("PRCCATEGORY"); // XModule.SetEvent("ON_TRDR_NAME", NameChanged); // XModule.SetEvent("ON_TRDR_POST", NameChanged); form1 = new panel1(); pRCCategoryForm = new PRCCategoryForm(); p2 = new panel2(); pRCCategoryForm.TopLevel = false; pRCCategoryForm.Visible = true; pRCCategoryForm.PRCCategory = CustTable; // XModule.InsertControl(itemForm, "+PANEL(Panel1,Web)"); //XModule.InsertControl(itemForm, "+PANEL(NULL, 0,Web)"); //XModule.SetEvent("ON_TRDR", checkActive); XModule.InsertControl(pRCCategoryForm, "+PAGE(Pl1,Web)"); CallCount++; }
public override void Initialize() { CustTable = XModule.GetTable("TRDR"); // MessageBox.Show((String)CustTable.Current["EMAIL"]); XModule.SetEvent("ON_TRDR_NAME", NameChanged); XModule.SetEvent("ON_TRDR_POST", NameChanged); form1 = new panel1(); customerForm = new CustomerForm(); p2 = new panel2(); customerForm.TopLevel = false; customerForm.Visible = true; customerForm.TRDR = CustTable; XModule.InsertControl(customerForm, "+PAGE(PG2,Web)"); XModule.SetEvent("ON_TRDR", checkActive); CallCount++; }
public override void Initialize() { CustTable = XModule.GetTable("MTRL"); CustTableExtra = XModule.GetTable("MTREXTRA"); // XModule.SetEvent("ON_MTRL_POST", NameChanged); // XModule.SetEvent("ON_TRDR_POST", Page_Load); form1 = new panel1(); itemForm = new ItemForm(); p2 = new panel2(); itemForm.TopLevel = false; itemForm.MTRL = CustTable; itemForm.MTREXTRA = CustTableExtra; itemForm.CompanyId = this.XSupport.ConnectionInfo.CompanyId; //itemForm.XSupport = this.XSupport; // MessageBox.Show("SELECT A.COMPANY,A.PRCCATEGORY,A.CODE,A.NAME,A.ACNMSK,A.ISACTIVE,A.PRICEZONE " + // "FROM [DEMO].[dbo].[PRCCATEGORY] A WHERE A.COMPANY=" + this.XSupport.ConnectionInfo.CompanyId + " ORDER BY A.PRCCATEGORY"); XTable pRCCategories = this.XSupport.GetSQLDataSet( "SELECT A.COMPANY,A.PRCCATEGORY,A.CODE,A.NAME,A.ACNMSK,A.ISACTIVE,A.PRICEZONE " + "FROM PRCCATEGORY A WHERE A.COMPANY=" + this.XSupport.ConnectionInfo.CompanyId + " ORDER BY A.PRCCATEGORY" ); itemForm.pRCCategories = pRCCategories; // PRCCategories[1, 1].ToString(); // itemForm.dataGridView1.VirtualMode = true; // itemForm.dataGridView1.RowCount = table1.Count; itemForm.Visible = true; XModule.InsertControl(itemForm, "+PAGE(PG8,Web)"); //XModule.SetEvent("ON_TRDR", checkActive); CallCount++; }
public override void Initialize() { CustTable = XModule.GetTable("TRDR"); XModule.SetEvent("ON_TRDR_NAME", NameChanged); XModule.SetEvent("ON_TRDR_POST", NameChanged); string s; for (int i = 0; i < XModule.Params.Length; i++) { s = XModule.Params[i]; if (!String.IsNullOrEmpty(s)) { if ((s.Length > 4) && (s.StartsWith("FORM"))) { MessageBox.Show(XModule.Params[i]); } } } }
public static void updateQTYsByMtrlsOnTransactions() { try { Settings settings = Settings.getInstance(); String strQTY = ""; String FILTER_CHECKBOX = ""; S1Custom.Io.HttpWeb.ItemHttp itemHttp = new S1Custom.Io.HttpWeb.ItemHttp(); if (!settings.ITEM_ON_WEB.Equals("")) { FILTER_CHECKBOX = " AND ME." + settings.ITEM_ON_WEB + " = 1"; } String s = S1Init.myXSupport.ConnectionInfo.YearId.ToString(); XTable QTYREsults = S1Init.myXSupport.GetSQLDataSet( " SELECT " + " A.MTRL, " + " ISNULL(B.QTY1,0) AS QTY, " + " A.CODE " + " FROM (MTRL A " + " LEFT OUTER JOIN MTRDATA B ON A.MTRL=B.MTRL ) " + " WHERE A.COMPANY= " + S1Init.myXSupport.ConnectionInfo.CompanyId.ToString() + " AND B.FISCPRD= " + S1Init.myXSupport.ConnectionInfo.YearId.ToString() + " AND A.MTRL IN (SELECT ML.MTRL FROM MTRLINES ML INNER JOIN FINDOC F ON F.FINDOC = ML.FINDOC WHERE F.TRNDATE > DATEADD(day, -15, GETDATE()) ) " + " AND A.SODTYPE=51 " + FILTER_CHECKBOX + " ORDER BY A.CODE,A.MTRL "); for (int j = 0; j < QTYREsults.Count; j++) { strQTY += "&QTYS[" + QTYREsults[j, "CODE"] + "]=" + QTYREsults[j, "QTY"]; } itemHttp.syncQTY(strQTY); } catch (Exception ex) { } }
private Workbook PptGetWorkbook(XTable table, int position) { var path = Server.MapPath(@"~\Content\ExportTemplate\SingleTableForPPT.xlsx"); var workbook = ExportHelper.GetWorkbook(path); var sheet = workbook.Worksheets["Sheet1"]; sheet.Cells.MemorySetting = MemorySetting.MemoryPreference; if (Config.KPI_Text.ToUpper() == "SALES") { sheet.WriteTable(table, "B7"); sheet.DeleteColumns(table.Rows[0].Cells.Count + 1, 100); } else { sheet.WriteTable(table, "A7"); sheet.DeleteColumns(table.Rows[0].Cells.Count, 100); } sheet.DeleteRows(7 + table.Rows.Count, 100); sheet.SetMargin(0, 0, 0, 0); return(workbook); }
public void GetBodyRow(XTable table) { if (Input == null || !Input.Any()) { return; } foreach (var item in Input) { var bodyRow = new XRow() { Cells = new List <XCell>() }; bodyRow.Cells.Add(new XCell() { Data = item.FirstName }); bodyRow.Cells.Add(new XCell() { Data = item.LastName }); bodyRow.Cells.Add(new XCell() { Data = item.Position }); bodyRow.Cells.Add(new XCell() { Data = item.Email }); bodyRow.Cells.Add(new XCell() { Data = item.GeoCode }); bodyRow.Cells.Add(new XCell() { Data = item.Org }); table.Rows.Add(bodyRow); } }
public void uploadItemImage(String MTRLsTR, String CODE) { XTable MTRL_IMAGE = S1Init.myXSupport.GetSQLDataSet( " SELECT SODATA " + " FROM XTRDOCDATA " + " WHERE REFOBJID= " + MTRLsTR + " AND SOSOURCE=51 " + " AND LNUM=0 " ); if (MTRL_IMAGE.Count < 1) { return; } byte[] picData = MTRL_IMAGE[0, "SODATA"] as byte[] ?? null; if (picData != null) { using (Image image = Image.FromStream(new MemoryStream(picData))) { if (ImageFormat.Jpeg.Equals(image.RawFormat)) { image.Save(System.IO.Path.GetTempPath() + CODE + "-IMG.jpg", ImageFormat.Jpeg); this.itemHttp.UpLoadImage(System.IO.Path.GetTempPath() + CODE + "-IMG.jpg", CODE + "-IMG.jpg"); this.itemHttp.SyncImage(CODE, CODE + "-IMG.jpg"); } else if (ImageFormat.Png.Equals(image.RawFormat) || ImageFormat.Bmp.Equals(image.RawFormat)) { image.Save(System.IO.Path.GetTempPath() + CODE + "-IMG.png", ImageFormat.Png); this.itemHttp.UpLoadImage(System.IO.Path.GetTempPath() + CODE + "-IMG.png", CODE + "-IMG.png"); this.itemHttp.SyncImage(CODE, CODE + "-IMG.png"); } } } }
private void SyncColorsForm_Load(object sender, EventArgs e) { String Sql = " SELECT TOP 1 A.* " + " FROM CCCCONNECTIONBRICK A " + " WHERE A.COMPANY= " + S1Custom.Model.S1Init.myXSupport.ConnectionInfo.CompanyId.ToString() + " AND A.CODE = 'GC' " + " AND ACTIVE = 1 " + " ORDER BY A.EXECUTIONORDER "; XTable tbl = S1Custom.Model.S1Init.myXSupport.GetSQLDataSet(Sql); if (tbl.Count == 1) { String Sql2 = tbl[0, "SQLCOMMAND"].ToString(); XTable tbl2 = S1Custom.Model.S1Init.myXSupport.GetSQLDataSet(Sql2); for (int i = 0; i < tbl2.Count; i++) { List <String> DatagridValue = new List <string>(); DatagridValue.Add(tbl2[i, "CODE"].ToString()); DatagridValue.Add(tbl2[i, "NAME"].ToString()); DatagridValue.Add(tbl2[i, "HEX1"].ToString()); DatagridValue.Add(tbl2[i, "GENNAME"].ToString()); string[] DatagridRow = DatagridValue.ToArray(); this.DGV1.Rows.Add(DatagridRow); } // List<String> DatagridValue = new List<string>(); // DatagridValue.Add(tbl[i, "SQLCOMMAND"].ToString()); // DatagridValue.Add(tbl[i, "CODE"].ToString()); // DatagridValue.Add(tbl[i, "NAME"].ToString()); // string[] DatagridRow = DatagridValue.ToArray(); // BricksDataGridView.Rows.Add(DatagridRow); } }
public static void readCDIMS() { if (CDIMSDICT != null) { return; } CDIMSDICT = new Dictionary <int, CDIM>(); String slq = "SELECT * FROM CDIM WHERE COMPANY=" + S1Init.myXSupport.ConnectionInfo.CompanyId.ToString() + " AND MTRL IS NULL ORDER BY CDIM,COMPANY"; XTable RESULTS = S1Init.myXSupport.GetSQLDataSet(slq); for (int i = 0; i < RESULTS.Count; i++) { CDIM cdim = new CDIM( Convert.ToInt32(RESULTS[i, "CDIM"].ToString()), RESULTS[i, "CODE"].ToString(), RESULTS[i, "NAME"].ToString() ); CDIMSDICT.Add(Convert.ToInt32(RESULTS[i, "CDIM"].ToString()), cdim); } }
private Workbook PptGetWorkbook(XTable table) { string path = Server.MapPath(@"~\Content\ExportTemplate\AtAGlanceForPpt.xlsx"); var workbook = ExportHelper.GetWorkbook(path); var sheet = workbook.Worksheets["Sheet1"]; sheet.Name = "AtAGlance"; if (Config.ToUpper().Contains("CATEGORIES")) { sheet.DeleteColumns(3, 1);//delete Rank Column } sheet.Cells.MemorySetting = MemorySetting.MemoryPreference; sheet.WriteText(Data.Header1, "C1"); sheet.WriteText(Data.Header2, "C2"); sheet.WriteText(Data.Header3, "C3"); sheet.WriteTable(table, "C4"); sheet.DeleteColumns(StartColumn + Data.DataTable.Rows[0].Cells.Count, 100); sheet.DeleteRows(4 + table.Rows.Count, 100); sheet.SetMargin(0, 0, 0, 0); return(workbook); }
private void InstantiateSourceTable(XTable xTable) { Progress?.Report($"Adding source table: {xTable.TableName}"); DataTable table = xTable.Instantiate(); if (context.TableNameGenerator.Exists(table.TableName)) { if (table.DataEquals(Metadata.GetCodeTableData(table.TableName))) { return; } string original = table.TableName; string modified = context.TableNameGenerator.MakeUnique(original); context.TableNameMap[original] = modified; table.TableName = modified; Progress?.Report($"Renamed source table: {table.TableName}"); } string[] columnNames = table.Columns.Cast <DataColumn>() .Select(column => column.ColumnName) .ToArray(); Metadata.CreateCodeTable(table.TableName, columnNames); Metadata.SaveCodeTableData(table, table.TableName, columnNames); }
private void button8_Click_1(object sender, EventArgs e) { if (this.BarcodeTextBox.Text == "") { return; } try { String Barcode = this.BarcodeTextBox.Text; Barcode = Barcode.Replace("*", "%"); XTable CODELINES = S1Init.myXSupport.GetSQLDataSet( " SELECT MTRL FROM MTRL WHERE " + " ( CODE2 LIKE '" + Barcode + "' " + " OR CODE LIKE '" + Barcode + "' " + " OR CODE1 LIKE '" + Barcode + "' ) " + " AND SODTYPE = 51 " + " AND COMPANY = " + S1Init.myXSupport.ConnectionInfo.CompanyId.ToString()); this.LoadingProgressBar.Maximum = CODELINES.Count; for (int j = 0; j < CODELINES.Count; j++) { GlobalFunctions.syncMtrl(this.LoadingProgressBar, CODELINES[j, "MTRL"].ToString()); GlobalFunctions.updateQTYS(CODELINES[j, "MTRL"].ToString()); GlobalFunctions.updateCharQTYS(CODELINES[j, "MTRL"].ToString()); // MessageBox.Show("Διαδικασία ολοκληρώθηκε."); this.LoadingProgressBar.Step = this.LoadingProgressBar.Step + 1; } this.LoadingProgressBar.Value = 0; } catch { } MessageBox.Show("Διαδικασία ολοκληρώθηκε."); }
public String FindoCExist(String OrderWebId) { String CODE = "-1"; Settings settings = Settings.getInstance(); XTable RESULTS = Model.S1Init.myXSupport.GetSQLDataSet( " SELECT " + " A." + settings.OrderWebRel + "," + " A.FINCODE " + " FROM FINDOC A " + " WHERE A.COMPANY= " + Model.S1Init.myXSupport.ConnectionInfo.CompanyId + " AND A.SOSOURCE=1351 " + " AND A.SODTYPE=13 " + " AND A." + settings.OrderWebRel + "=" + OrderWebId + " " + " ORDER BY A.FINDOC " ); if (RESULTS.Count > 0) { CODE = RESULTS[0, "FINCODE"].ToString(); } return(CODE); }
public CDIM(int CDIM, String CODE, String NAME) { this.CDIMID = CDIM; this.CODE = CODE; this.NAME = NAME; CDIMLINES = new Dictionary <int, CDIMLINE>(); String slq = " SELECT * " + " FROM CDIMLINES A " + " WHERE A.COMPANY= " + S1Init.myXSupport.ConnectionInfo.CompanyId.ToString() + " AND A.CDIM=" + this.CDIMID.ToString(); XTable RESULTS = S1Init.myXSupport.GetSQLDataSet(slq); for (int i = 0; i < RESULTS.Count; i++) { CDIMLINE cdimLine = new CDIMLINE( Convert.ToInt32(RESULTS[i, "CDIMLINES"].ToString()), RESULTS[i, "CODE"].ToString(), RESULTS[i, "NAME"].ToString() ); this.CDIMLINES.Add(Convert.ToInt32(RESULTS[i, "CDIMLINES"].ToString()), cdimLine); } }
public override void BeforePost() { t = XModule.GetTable("TRDR"); MessageBox.Show((string)t[0, "CODE"]); base.BeforePost(); }
private ICommand LastRow(XTable table, ICommand command) { KeyValuePair <IData, IData> cmd = table.LastRow; return(new LastRowCommand(cmd)); }
public static void updateCharQTYSByMtrlsOnTransactions(String MTRL) { String postString = ""; Settings settings = Settings.getInstance(); String strQTY = ""; String FILTER_CHECKBOX = ""; String MTRL_SQL = ""; S1Custom.Io.HttpWeb.ItemHttp itemHttp = new S1Custom.Io.HttpWeb.ItemHttp(); if (!MTRL.Equals("")) { MTRL_SQL = " AND MT.MTRL=" + MTRL + " "; } else { if (!settings.ITEM_ON_WEB.Equals("")) { FILTER_CHECKBOX = " AND ME." + settings.ITEM_ON_WEB + " = 1 "; } } String sql = " SELECT " + " MT.CODE, " + " M.CDIM1, " + " M.CDIM2, " + " M.CDIM3, " + " M.CDIMLINES1, " + " M.CDIMLINES2, " + " M.CDIMLINES3, " + " SUM(M.OPNIMPQTY1+M.IMPQTY1-M.EXPQTY1) AS QTY " + " FROM " + " ( CDIMFINDATA M INNER JOIN MTRL MT ON M.MTRL = MT.MTRL ) " + " INNER JOIN MTREXTRA ME ON ME.MTRL = MT.MTRL " + " WHERE " + " M.COMPANY=" + S1Init.myXSupport.ConnectionInfo.CompanyId.ToString() + " AND M.FISCPRD=" + S1Init.myXSupport.ConnectionInfo.YearId.ToString() + " AND MT.MTRL IN (SELECT ML.MTRL FROM MTRLINES ML INNER JOIN FINDOC F ON F.FINDOC = ML.FINDOC WHERE F.TRNDATE > DATEADD(day, -15, GETDATE()) ) " + " AND MT.SODTYPE = 51 " + FILTER_CHECKBOX + MTRL_SQL + " GROUP BY " + " MT.CODE, " + " M.CDIM1, " + " M.CDIMLINES1, " + " M.CDIMLINES2, " + " M.CDIMLINES3, " + " M.CDIM2, " + " M.CDIM3 "; // String s = S1Init.myXSupport.ConnectionInfo.YearId.ToString(); XTable QTYREsults = S1Init.myXSupport.GetSQLDataSet(sql); for (int j = 0; j < QTYREsults.Count; j++) { strQTY += "&QTYS[a" + (j + 1) + "]=" + QTYREsults[j, "CDIM1"] + "~" + QTYREsults[j, "CDIMLINES1"] + "~" + QTYREsults[j, "CDIMLINES2"] + "~" + QTYREsults[j, "CDIMLINES3"] + "~" + QTYREsults[j, "QTY"] + "~" + QTYREsults[j, "CODE"] + "~" + QTYREsults[j, "CDIM2"] + "~" + QTYREsults[j, "CDIM3"] + "~ "; } itemHttp.syncCharQTY(strQTY); }
private ICommand Count(XTable table, ICommand command) { long count = table.Count(); return(new CountCommand(count)); }
/* * public static void syncMtrl() * { * S1Custom.Io.HttpWeb.ItemHttp itemHttp = new S1Custom.Io.HttpWeb.ItemHttp(); * string[,] PRICERPRC = new string[12, 2]; * String CODE = "", MTRL = "", NAME = "", NAME2 = "", DESCR = "", DESCR2 = "", ITEM_PRICE = ""; * String NAMEpREFIX = "", NAME2pREFIX = "", DESCRpREFIX = "", DESCR2pREFIX = ""; * String CATEG_NAME = "-1", CATEG_ID = "-1", QTY = ""; * Settings settings = Settings.getInstance(); * String FILTER_CHECKBOX = ""; * ImageUploader imageUp = new ImageUploader(); * String MTRMANFCTR = ""; * * XTable pRCCategories = S1Init.myXSupport.GetSQLDataSet( * "SELECT A.COMPANY,A.PRCCATEGORY,A.CODE,A.NAME,A.ACNMSK,A.ISACTIVE,A.PRICEZONE " + * "FROM PRCCATEGORY A WHERE A.COMPANY=" + S1Init.myXSupport.ConnectionInfo.CompanyId + " ORDER BY A.PRCCATEGORY" * ); * * if (!settings.ITEM_ON_WEB.Equals("")) * { * FILTER_CHECKBOX = " AND ME." + settings.ITEM_ON_WEB + " = 1"; * } * * if (settings.ItemTitle1.Contains("VARCHAR")) NAMEpREFIX = "ME."; * else NAMEpREFIX = "M."; * * if (settings.ItemDescr1.Contains("VARCHAR")) DESCRpREFIX = "ME."; * else DESCRpREFIX = "M."; * * if (settings.ItemTitle2.Contains("VARCHAR")) NAME2pREFIX = "ME."; * else NAME2pREFIX = "M."; * * if (settings.ItemDescr2.Contains("VARCHAR")) DESCR2pREFIX = "ME."; * else DESCR2pREFIX = "M."; * * * XTable MTRLS = S1Init.myXSupport.GetSQLDataSet( * " SELECT " + * " M.MTRL AS MTRL, " + * " M.CODE , " + * " M." + settings.ITEM_PRICE + ", " + * " M." + settings.ITEM_PRICE + "01, " + * " M." + settings.ITEM_PRICE + "02, " + * " M." + settings.ITEM_PRICE + "03, " + * " M." + settings.ITEM_PRICE + "04, " + * " M." + settings.ITEM_PRICE + "05, " + * " M." + settings.ITEM_PRICE + "06, " + * " M." + settings.ITEM_PRICE + "07, " + * " M." + settings.ITEM_PRICE + "08, " + * " M." + settings.ITEM_PRICE + "09, " + * " M." + settings.ITEM_PRICE + "10, " + * " M." + settings.ITEM_PRICE + "11, " + * " M." + settings.ITEM_PRICE + "12, " + * " G.CODE , " + * " G.NAME , " + * * NAMEpREFIX + settings.ItemTitle1 + " AS " + settings.ItemTitle1 + "_Lang1 ," + * DESCRpREFIX + settings.ItemDescr1 + " AS " + settings.ItemDescr1 + "_Desc1 ," + * NAME2pREFIX + settings.ItemTitle2 + " AS " + settings.ItemTitle2 + "_Lang2 ," + * DESCR2pREFIX + settings.ItemDescr2 + " AS " + settings.ItemDescr2 + "_Desc2 ," + * " B.QTY1, " + * " M.MTRMANFCTR " + * " FROM (( MTRL M LEFT OUTER JOIN MTRGROUP G ON M.MTRGROUP = G.MTRGROUP " + * " AND G.SODTYPE = 51 " + * " AND G.COMPANY = " + S1Init.myXSupport.ConnectionInfo.CompanyId + " ) " + * " LEFT OUTER JOIN MTREXTRA ME ON M.MTRL = ME.MTRL ) " + * " LEFT OUTER JOIN MTRDATA B ON M.MTRL=B.MTRL AND B.FISCPRD= " + S1Init.myXSupport.ConnectionInfo.YearId.ToString() + * " WHERE M.SODTYPE = 51 " + * " AND M.COMPANY = " + S1Init.myXSupport.ConnectionInfo.CompanyId + * FILTER_CHECKBOX * ); * * int zone; * PRICERPRC = new string[12, 2]; * for (int j = 0; j < pRCCategories.Count; j++) * { * zone = int.Parse(pRCCategories[j, 7].ToString()); * PRICERPRC[zone - 1, 0] = pRCCategories[j, 2].ToString(); * } * * for (int i = 0; i < MTRLS.Count; i++) * { * int j = 0; * CATEG_NAME = "-1"; * CATEG_ID = "-1"; * * * CODE = ""; * if (!DBNull.Value.Equals(MTRLS[i, "CODE"])) * { * CODE = (String)MTRLS[i, "CODE"]; * } * * MTRL = ""; * if (!DBNull.Value.Equals(MTRLS[i, "MTRL"])) * { * MTRL = (String)MTRLS[i, "MTRL"].ToString(); * } * * NAME = ""; * if (!DBNull.Value.Equals(MTRLS[i, settings.ItemTitle1 + "_Lang1"])) * { * NAME = (String)MTRLS[i, settings.ItemTitle1 + "_Lang1"]; * } * * DESCR = ""; * if (!DBNull.Value.Equals(MTRLS[i, settings.ItemDescr1 + "_Desc1"])) * { * DESCR = (String)MTRLS[i, settings.ItemDescr1 + "_Desc1"]; * } * * NAME2 = ""; * if (!DBNull.Value.Equals(MTRLS[i, settings.ItemTitle2 + "_Lang2"])) * { * NAME2 = (String)MTRLS[i, settings.ItemTitle2 + "_Lang2"]; * } * * DESCR2 = ""; * if (!DBNull.Value.Equals(MTRLS[i, settings.ItemDescr2 + "_Desc2"])) * { * DESCR2 = (String)MTRLS[i, settings.ItemDescr2 + "_Desc2"]; * } * * MTRMANFCTR = ""; * if (!DBNull.Value.Equals(MTRLS[i, "MTRMANFCTR"])) * { * try * { * MTRMANFCTR = (String)MTRLS[i, "MTRMANFCTR"].ToString(); * } * catch (Exception ex) * { * * } * } * * QTY = "0"; * if (!DBNull.Value.Equals(MTRLS[i, "QTY1"])) * { * try * { * QTY = (String)MTRLS[i, "QTY1"].ToString(); * } * catch (Exception ex) * { * * } * } * * * ITEM_PRICE = ""; * if (!DBNull.Value.Equals(MTRLS[i, settings.ITEM_PRICE])) * { * ITEM_PRICE = (String)MTRLS[i, settings.ITEM_PRICE].ToString(); * } * * * if (!DBNull.Value.Equals(MTRLS[i, settings.ITEM_PRICE + "01"])) * { * PRICERPRC[j, 1] = (String)MTRLS[i, settings.ITEM_PRICE + "01"].ToString(); * j++; * } * if (!DBNull.Value.Equals(MTRLS[i, settings.ITEM_PRICE + "02"])) * { * PRICERPRC[j, 1] = (String)MTRLS[i, settings.ITEM_PRICE + "02"].ToString(); * j++; * } * if (!DBNull.Value.Equals(MTRLS[j, settings.ITEM_PRICE + "03"])) * { * PRICERPRC[i, 1] = (String)MTRLS[i, settings.ITEM_PRICE + "03"].ToString(); * j++; * } * if (!DBNull.Value.Equals(MTRLS[j, settings.ITEM_PRICE + "04"])) * { * PRICERPRC[i, 1] = (String)MTRLS[i, settings.ITEM_PRICE + "04"].ToString(); * j++; * } * if (!DBNull.Value.Equals(MTRLS[i, settings.ITEM_PRICE + "05"])) * { * PRICERPRC[j, 1] = (String)MTRLS[i, settings.ITEM_PRICE + "05"].ToString(); * j++; * } * if (!DBNull.Value.Equals(MTRLS[i, settings.ITEM_PRICE + "06"])) * { * PRICERPRC[j, 1] = (String)MTRLS[i, settings.ITEM_PRICE + "06"].ToString(); * j++; * } * if (!DBNull.Value.Equals(MTRLS[i, settings.ITEM_PRICE + "07"])) * { * PRICERPRC[j, 1] = (String)MTRLS[i, settings.ITEM_PRICE + "07"].ToString(); * j++; * } * if (!DBNull.Value.Equals(MTRLS[i, settings.ITEM_PRICE + "08"])) * { * PRICERPRC[j, 1] = (String)MTRLS[i, settings.ITEM_PRICE + "08"].ToString(); * j++; * } * if (!DBNull.Value.Equals(MTRLS[i, settings.ITEM_PRICE + "09"])) * { * PRICERPRC[j, 1] = (String)MTRLS[i, settings.ITEM_PRICE + "09"].ToString(); * j++; * } * if (!DBNull.Value.Equals(MTRLS[i, settings.ITEM_PRICE + "10"])) * { * PRICERPRC[j, 1] = (String)MTRLS[i, settings.ITEM_PRICE + "10"].ToString(); * j++; * } * if (!DBNull.Value.Equals(MTRLS[i, settings.ITEM_PRICE + "11"])) * { * PRICERPRC[j, 1] = (String)MTRLS[i, settings.ITEM_PRICE + "11"].ToString(); * j++; * } * if (!DBNull.Value.Equals(MTRLS[i, settings.ITEM_PRICE + "12"])) * { * PRICERPRC[j, 1] = (String)MTRLS[i, settings.ITEM_PRICE + "12"].ToString(); * j++; * } * * itemHttp.syncMTRL(CODE, NAME, NAME2, DESCR, DESCR2, ITEM_PRICE, PRICERPRC, j, CATEG_NAME, CATEG_ID, QTY, MTRMANFCTR, "" ,"",""); * imageUp.uploadItemImage(MTRL, CODE); * * } * * } */ public static void syncMtrl(ProgressBar loadingProgressBar, String MTRL_FILTER) { S1Custom.Io.HttpWeb.ItemHttp itemHttp = new S1Custom.Io.HttpWeb.ItemHttp(); string[,] PRICERPRC = new string[12, 2]; String CODE = ""; String MTRL = ""; String NAME = ""; String NAME2 = ""; String DESCR = ""; String DESCR2 = ""; String ITEM_PRICE = ""; String NAMEpREFIX = ""; String NAME2pREFIX = ""; String DESCRpREFIX = ""; String DESCR2pREFIX = ""; String WEIGHT = ""; String CATEG_NAME = "-1"; String CATEG_ID = "-1"; String CATEG_SQl = ""; String QTY = ""; Settings settings = Settings.getInstance(); String FILTER_CHECKBOX = ""; ImageUploader imageUp = new ImageUploader(); String MTRMANFCTR = ""; String ItemExtra1 = ""; String ItemExtra2 = ""; String ItemExtra3 = ""; String ItemExtra1Sql = ""; String ItemExtra2Sql = ""; String ItemExtra3Sql = ""; String MTRUNIT1 = ""; String VAT = ""; String SODISCOUNT = ""; String RELITEM = ""; String EXPN1 = ""; String EXPN2 = ""; String EXPN3 = ""; String EXPVAL1 = ""; String EXPVAL2 = ""; String EXPVAL3 = ""; String MTRL_SQL = ""; if (!MTRL_FILTER.Equals("")) { MTRL_SQL = " AND M.MTRL=" + MTRL_FILTER + " "; } if (loadingProgressBar != null) { loadingProgressBar.Maximum = 2; loadingProgressBar.Value = 0; loadingProgressBar.Step = 1; loadingProgressBar.PerformStep(); } XTable pRCCategories = S1Init.myXSupport.GetSQLDataSet( "SELECT A.COMPANY,A.PRCCATEGORY,A.CODE,A.NAME,A.ACNMSK,A.ISACTIVE,A.PRICEZONE " + "FROM PRCCATEGORY A WHERE A.COMPANY=" + S1Init.myXSupport.ConnectionInfo.CompanyId + " ORDER BY A.PRCCATEGORY" ); if (settings.ItemCateg.Contains("VARCHAR") || settings.ItemCateg.Contains("UTBL") || settings.ItemCateg.Contains("NUM")) { CATEG_SQl = "ME." + settings.ItemCateg + ","; } else { CATEG_SQl = "M." + settings.ItemCateg + ","; } if (!settings.ITEM_ON_WEB.Equals("") && MTRL_FILTER == "") { FILTER_CHECKBOX = " AND ME." + settings.ITEM_ON_WEB + " = 1"; } if (settings.ItemTitle1.Contains("VARCHAR")) { NAMEpREFIX = "ME."; } else { NAMEpREFIX = "M."; } if (settings.ItemDescr1.Contains("VARCHAR")) { DESCRpREFIX = "ME."; } else { DESCRpREFIX = "M."; } if (settings.ItemTitle2.Contains("VARCHAR")) { NAME2pREFIX = "ME."; } else { NAME2pREFIX = "M."; } if (settings.ItemDescr2.Contains("VARCHAR")) { DESCR2pREFIX = "ME."; } else { DESCR2pREFIX = "M."; } if (!settings.ItemExtra1.Equals("")) { if (settings.ItemExtra1.Contains("VARCHAR") || settings.ItemExtra1.Contains("UTBL") || settings.ItemExtra1.Contains("NUM") || settings.ItemExtra1.Contains("BOOL") || settings.ItemExtra1.Contains("DATE")) { ItemExtra1Sql = "ME." + settings.ItemExtra1 + ","; } else if (!settings.ItemExtra1.Equals("")) { ItemExtra1Sql = "M." + settings.ItemExtra1 + ","; } } if (!settings.ItemExtra2.Equals("")) { if (settings.ItemExtra2.Contains("VARCHAR") || settings.ItemExtra2.Contains("UTBL") || settings.ItemExtra2.Contains("NUM") || settings.ItemExtra2.Contains("BOOL") || settings.ItemExtra2.Contains("DATE")) { ItemExtra2Sql = "ME." + settings.ItemExtra2 + ","; } else if (!settings.ItemExtra2.Equals("")) { ItemExtra2Sql = "M." + settings.ItemExtra2 + ","; } } if (!settings.ItemExtra3.Equals("")) { if (settings.ItemExtra3.Contains("VARCHAR") || settings.ItemExtra3.Contains("UTBL") || settings.ItemExtra3.Contains("NUM") || settings.ItemExtra3.Contains("BOOL") || settings.ItemExtra3.Contains("DATE")) { ItemExtra3Sql = "ME." + settings.ItemExtra3 + ","; } else if (!settings.ItemExtra3.Equals("")) { ItemExtra3Sql = "M." + settings.ItemExtra3 + ","; } } XTable MTRLS = S1Init.myXSupport.GetSQLDataSet( " SELECT " + " M.MTRL AS MTRL, " + " M.CODE , " + " M.WEIGHT , " + " M." + settings.ITEM_PRICE + ", " + " M." + settings.ITEM_PRICE + "01, " + " M." + settings.ITEM_PRICE + "02, " + " M." + settings.ITEM_PRICE + "03, " + " M." + settings.ITEM_PRICE + "04, " + " M." + settings.ITEM_PRICE + "05, " + " M." + settings.ITEM_PRICE + "06, " + " M." + settings.ITEM_PRICE + "07, " + " M." + settings.ITEM_PRICE + "08, " + " M." + settings.ITEM_PRICE + "09, " + " M." + settings.ITEM_PRICE + "10, " + " M." + settings.ITEM_PRICE + "11, " + " M." + settings.ITEM_PRICE + "12, " + " G.CODE , " + " G.NAME , " + " M.MTRUNIT1," + " M.VAT," + " M.SODISCOUNT," + " RL.CODE AS REL ," + " M.EXPN1," + " M.EXPN2," + " M.EXPN3," + " M.EXPVAL1," + " M.EXPVAL2 ," + " M.EXPVAL3 ," + CATEG_SQl + NAMEpREFIX + settings.ItemTitle1 + " AS " + settings.ItemTitle1 + "_Lang1 ," + DESCRpREFIX + settings.ItemDescr1 + " AS " + settings.ItemDescr1 + "_Desc1 ," + NAME2pREFIX + settings.ItemTitle2 + " AS " + settings.ItemTitle2 + "_Lang2 ," + DESCR2pREFIX + settings.ItemDescr2 + " AS " + settings.ItemDescr2 + "_Desc2 ," + ItemExtra1Sql + ItemExtra2Sql + ItemExtra3Sql + " B.QTY1, " + " M.MTRMANFCTR " + " FROM ((( MTRL M LEFT OUTER JOIN MTRGROUP G ON M.MTRGROUP = G.MTRGROUP " + " AND G.SODTYPE = 51 " + " AND G.COMPANY = " + S1Init.myXSupport.ConnectionInfo.CompanyId + " ) " + " LEFT OUTER JOIN MTREXTRA ME ON M.MTRL = ME.MTRL ) " + " LEFT OUTER JOIN MTRDATA B ON M.MTRL=B.MTRL AND B.FISCPRD= " + S1Init.myXSupport.ConnectionInfo.YearId.ToString() + " ) " + " LEFT OUTER JOIN MTRL RL ON M.RELITEM = RL.MTRL" + " WHERE M.SODTYPE = 51 " + " AND M.COMPANY = " + S1Init.myXSupport.ConnectionInfo.CompanyId + " " + FILTER_CHECKBOX + " " + MTRL_SQL ); int zone; PRICERPRC = new string[12, 2]; for (int j = 0; j < pRCCategories.Count; j++) { zone = int.Parse(pRCCategories[j, 7].ToString()); PRICERPRC[zone - 1, 0] = pRCCategories[j, 2].ToString(); } if (loadingProgressBar != null) { if (MTRLS.Count > 0) { loadingProgressBar.Maximum = MTRLS.Count; } loadingProgressBar.Value = 0; } for (int i = 0; i < MTRLS.Count; i++) { if (loadingProgressBar != null) { loadingProgressBar.PerformStep(); } int j = 0; CATEG_NAME = "-1"; CATEG_ID = "-1"; if (!DBNull.Value.Equals(MTRLS[i, settings.ItemCateg])) { CATEG_ID = (String)MTRLS[i, settings.ItemCateg].ToString(); if (CATEG_ID.Equals("")) { CATEG_ID = "-1"; } } CODE = ""; if (!DBNull.Value.Equals(MTRLS[i, "CODE"])) { CODE = (String)MTRLS[i, "CODE"].ToString(); } MTRL = ""; if (!DBNull.Value.Equals(MTRLS[i, "MTRL"])) { MTRL = (String)MTRLS[i, "MTRL"].ToString(); } NAME = ""; if (!DBNull.Value.Equals(MTRLS[i, settings.ItemTitle1 + "_Lang1"])) { NAME = (String)MTRLS[i, settings.ItemTitle1 + "_Lang1"].ToString(); } DESCR = ""; if (!DBNull.Value.Equals(MTRLS[i, settings.ItemDescr1 + "_Desc1"])) { DESCR = (String)MTRLS[i, settings.ItemDescr1 + "_Desc1"].ToString(); } NAME2 = ""; if (!DBNull.Value.Equals(MTRLS[i, settings.ItemTitle2 + "_Lang2"])) { NAME2 = (String)MTRLS[i, settings.ItemTitle2 + "_Lang2"].ToString(); } DESCR2 = ""; if (!DBNull.Value.Equals(MTRLS[i, settings.ItemDescr2 + "_Desc2"])) { DESCR2 = (String)MTRLS[i, settings.ItemDescr2 + "_Desc2"].ToString(); } WEIGHT = ""; if (!DBNull.Value.Equals(MTRLS[i, "WEIGHT"])) { WEIGHT = (String)MTRLS[i, "WEIGHT"].ToString(); } MTRUNIT1 = ""; if (!DBNull.Value.Equals(MTRLS[i, "MTRUNIT1"])) { MTRUNIT1 = (String)MTRLS[i, "MTRUNIT1"].ToString(); } VAT = ""; if (!DBNull.Value.Equals(MTRLS[i, "VAT"])) { VAT = (String)MTRLS[i, "VAT"].ToString(); } SODISCOUNT = ""; if (!DBNull.Value.Equals(MTRLS[i, "SODISCOUNT"])) { SODISCOUNT = (String)MTRLS[i, "SODISCOUNT"].ToString(); } ItemExtra1 = ""; if (settings.ItemExtra1 != "") { if (!DBNull.Value.Equals(MTRLS[i, settings.ItemExtra1])) { ItemExtra1 = (String)MTRLS[i, settings.ItemExtra1].ToString(); } } ItemExtra2 = ""; if (settings.ItemExtra2 != "") { if (!DBNull.Value.Equals(MTRLS[i, settings.ItemExtra2])) { ItemExtra2 = (String)MTRLS[i, settings.ItemExtra2].ToString(); } } ItemExtra3 = ""; if (settings.ItemExtra3 != "") { if (!DBNull.Value.Equals(MTRLS[i, settings.ItemExtra3])) { ItemExtra3 = (String)MTRLS[i, settings.ItemExtra3].ToString(); } } RELITEM = ""; if (!DBNull.Value.Equals(MTRLS[i, "REL"])) { RELITEM = (String)MTRLS[i, "REL"].ToString(); } EXPN1 = ""; if (!DBNull.Value.Equals(MTRLS[i, "EXPN1"])) { EXPN1 = (String)MTRLS[i, "EXPN1"].ToString(); } EXPN2 = ""; if (!DBNull.Value.Equals(MTRLS[i, "EXPN2"])) { EXPN2 = (String)MTRLS[i, "EXPN2"].ToString(); } EXPN3 = ""; if (!DBNull.Value.Equals(MTRLS[i, "EXPN3"])) { EXPN3 = (String)MTRLS[i, "EXPN3"].ToString(); } EXPVAL1 = ""; if (!DBNull.Value.Equals(MTRLS[i, "EXPVAL1"])) { EXPVAL1 = (String)MTRLS[i, "EXPVAL1"].ToString(); } EXPVAL2 = ""; if (!DBNull.Value.Equals(MTRLS[i, "EXPVAL2"])) { EXPVAL2 = (String)MTRLS[i, "EXPVAL2"].ToString(); } EXPVAL3 = ""; if (!DBNull.Value.Equals(MTRLS[i, "EXPVAL3"])) { EXPVAL3 = (String)MTRLS[i, "EXPVAL3"].ToString(); } MTRMANFCTR = ""; if (!DBNull.Value.Equals(MTRLS[i, "MTRMANFCTR"])) { try { MTRMANFCTR = (String)MTRLS[i, "MTRMANFCTR"].ToString(); } catch (Exception ex) { } } QTY = "0"; if (!DBNull.Value.Equals(MTRLS[i, "QTY1"])) { try { QTY = (String)MTRLS[i, "QTY1"].ToString(); } catch (Exception ex) { } } ITEM_PRICE = ""; if (settings.ITEM_PRICE != "") { if (!DBNull.Value.Equals(MTRLS[i, settings.ITEM_PRICE])) { ITEM_PRICE = (String)MTRLS[i, settings.ITEM_PRICE].ToString(); } } if (settings.ITEM_PRICE != "") { if (!DBNull.Value.Equals(MTRLS[i, settings.ITEM_PRICE + "01"])) { PRICERPRC[j, 1] = (String)MTRLS[i, settings.ITEM_PRICE + "01"].ToString(); j++; } } if (settings.ITEM_PRICE != "") { if (!DBNull.Value.Equals(MTRLS[i, settings.ITEM_PRICE + "02"])) { PRICERPRC[j, 1] = (String)MTRLS[i, settings.ITEM_PRICE + "02"].ToString(); j++; } } if (settings.ITEM_PRICE != "") { if (!DBNull.Value.Equals(MTRLS[j, settings.ITEM_PRICE + "03"])) { PRICERPRC[i, 1] = (String)MTRLS[i, settings.ITEM_PRICE + "03"].ToString(); j++; } } if (settings.ITEM_PRICE != "") { if (!DBNull.Value.Equals(MTRLS[j, settings.ITEM_PRICE + "04"])) { PRICERPRC[i, 1] = (String)MTRLS[i, settings.ITEM_PRICE + "04"].ToString(); j++; } } if (settings.ITEM_PRICE != "") { if (!DBNull.Value.Equals(MTRLS[i, settings.ITEM_PRICE + "05"])) { PRICERPRC[j, 1] = (String)MTRLS[i, settings.ITEM_PRICE + "05"].ToString(); j++; } } if (settings.ITEM_PRICE != "") { if (!DBNull.Value.Equals(MTRLS[i, settings.ITEM_PRICE + "06"])) { PRICERPRC[j, 1] = (String)MTRLS[i, settings.ITEM_PRICE + "06"].ToString(); j++; } } if (settings.ITEM_PRICE != "") { if (!DBNull.Value.Equals(MTRLS[i, settings.ITEM_PRICE + "07"])) { PRICERPRC[j, 1] = (String)MTRLS[i, settings.ITEM_PRICE + "07"].ToString(); j++; } } if (settings.ITEM_PRICE != "") { if (!DBNull.Value.Equals(MTRLS[i, settings.ITEM_PRICE + "08"])) { PRICERPRC[j, 1] = (String)MTRLS[i, settings.ITEM_PRICE + "08"].ToString(); j++; } } if (settings.ITEM_PRICE != "") { if (!DBNull.Value.Equals(MTRLS[i, settings.ITEM_PRICE + "09"])) { PRICERPRC[j, 1] = (String)MTRLS[i, settings.ITEM_PRICE + "09"].ToString(); j++; } } if (settings.ITEM_PRICE != "") { if (!DBNull.Value.Equals(MTRLS[i, settings.ITEM_PRICE + "10"])) { PRICERPRC[j, 1] = (String)MTRLS[i, settings.ITEM_PRICE + "10"].ToString(); j++; } } if (settings.ITEM_PRICE != "") { if (!DBNull.Value.Equals(MTRLS[i, settings.ITEM_PRICE + "11"])) { PRICERPRC[j, 1] = (String)MTRLS[i, settings.ITEM_PRICE + "11"].ToString(); j++; } } if (settings.ITEM_PRICE != "") { if (!DBNull.Value.Equals(MTRLS[i, settings.ITEM_PRICE + "12"])) { PRICERPRC[j, 1] = (String)MTRLS[i, settings.ITEM_PRICE + "12"].ToString(); j++; } } itemHttp.syncMTRL(CODE, NAME, NAME2, DESCR, DESCR2, ITEM_PRICE, PRICERPRC, j, CATEG_NAME, CATEG_ID, QTY, MTRMANFCTR, WEIGHT, ItemExtra1, ItemExtra2, ItemExtra3, MTRUNIT1, VAT, SODISCOUNT, RELITEM, EXPN1, EXPN2, EXPN3, EXPVAL1, EXPVAL2, EXPVAL3); // GlobalFunctions.updateCharQTYS(MTRL); imageUp.uploadItemImage(MTRL, CODE); } if (loadingProgressBar != null) { loadingProgressBar.Value = 0; } }
private void btnCreateCustomer_Click(object sender, EventArgs e) { Customer = Prg.CreateModule("CUSTOMER"); CustTbl = Customer.GetTable("TRDR"); }
private void MtrlSyncButton_Click(object sender, EventArgs e) { Io.HttpWeb.ItemHttp itemHttp = new Io.HttpWeb.ItemHttp(); string[,] PRICERPRC = new string[12, 2]; String CODE = "", NAME = "", ITEM_PRICE = ""; String CATEG_NAME = "-1", CATEG_ID = "-1"; Settings settings = Settings.getInstance(); String FILTER_CHECKBOX = ""; XTable pRCCategories = Model.S1Init.myXSupport.GetSQLDataSet( "SELECT A.COMPANY,A.PRCCATEGORY,A.CODE,A.NAME,A.ACNMSK,A.ISACTIVE,A.PRICEZONE " + "FROM PRCCATEGORY A WHERE A.COMPANY=" + Model.S1Init.myXSupport.ConnectionInfo.CompanyId + " ORDER BY A.PRCCATEGORY" ); if (!settings.ITEM_ON_WEB.Equals("")) { FILTER_CHECKBOX = " AND ME." + settings.ITEM_ON_WEB + " = 1"; } XTable MTRLS = Model.S1Init.myXSupport.GetSQLDataSet( " SELECT " + " M.CODE , " + " M.NAME , " + " M." + settings.ITEM_PRICE + ", " + " M." + settings.ITEM_PRICE + "01, " + " M." + settings.ITEM_PRICE + "02, " + " M." + settings.ITEM_PRICE + "03, " + " M." + settings.ITEM_PRICE + "04, " + " M." + settings.ITEM_PRICE + "05, " + " M." + settings.ITEM_PRICE + "06, " + " M." + settings.ITEM_PRICE + "07, " + " M." + settings.ITEM_PRICE + "08, " + " M." + settings.ITEM_PRICE + "09, " + " M." + settings.ITEM_PRICE + "10, " + " M." + settings.ITEM_PRICE + "11, " + " M." + settings.ITEM_PRICE + "12, " + " G.CODE , " + " G.NAME " + " FROM ( MTRL M LEFT OUTER JOIN MTRGROUP G ON M.MTRGROUP = G.MTRGROUP " + " AND G.SODTYPE = 51 " + " AND G.COMPANY = " + Model.S1Init.myXSupport.ConnectionInfo.CompanyId + " ) " + " LEFT OUTER JOIN MTREXTRA ME ON M.MTRL = ME.MTRL " + " WHERE M.SODTYPE = 51 " + " AND M.COMPANY = " + Model.S1Init.myXSupport.ConnectionInfo.CompanyId + FILTER_CHECKBOX ); this.LoadingProgressBar.Maximum = MTRLS.Count; this.LoadingProgressBar.Step = 1; int zone; for (int j = 0; j < pRCCategories.Count; j++) { zone = int.Parse(pRCCategories[j, 7].ToString()); PRICERPRC[zone - 1, 0] = pRCCategories[j, 2].ToString(); } for (int i = 0; i < MTRLS.Count; i++) { int j = 0; CATEG_NAME = "-1"; CATEG_ID = "-1"; if (!DBNull.Value.Equals(MTRLS[i, "CODE"])) { CODE = (String)MTRLS[i, "CODE"]; } if (!DBNull.Value.Equals(MTRLS[i, "NAME"])) { NAME = (String)MTRLS[i, "NAME"]; } if (!DBNull.Value.Equals(MTRLS[i, settings.ITEM_PRICE])) { ITEM_PRICE = (String)MTRLS[i, settings.ITEM_PRICE].ToString(); } if (!DBNull.Value.Equals(MTRLS[i, settings.ITEM_PRICE + "01"])) { PRICERPRC[j, 1] = (String)MTRLS[i, settings.ITEM_PRICE + "01"].ToString(); j++; } if (!DBNull.Value.Equals(MTRLS[i, settings.ITEM_PRICE + "02"])) { PRICERPRC[j, 1] = (String)MTRLS[i, settings.ITEM_PRICE + "02"].ToString(); j++; } if (!DBNull.Value.Equals(MTRLS[j, settings.ITEM_PRICE + "03"])) { PRICERPRC[i, 1] = (String)MTRLS[i, settings.ITEM_PRICE + "03"].ToString(); j++; } if (!DBNull.Value.Equals(MTRLS[j, settings.ITEM_PRICE + "04"])) { PRICERPRC[i, 1] = (String)MTRLS[i, settings.ITEM_PRICE + "04"].ToString(); j++; } if (!DBNull.Value.Equals(MTRLS[i, settings.ITEM_PRICE + "05"])) { PRICERPRC[j, 1] = (String)MTRLS[i, settings.ITEM_PRICE + "05"].ToString(); j++; } if (!DBNull.Value.Equals(MTRLS[i, settings.ITEM_PRICE + "06"])) { PRICERPRC[j, 1] = (String)MTRLS[i, settings.ITEM_PRICE + "06"].ToString(); j++; } if (!DBNull.Value.Equals(MTRLS[i, settings.ITEM_PRICE + "07"])) { PRICERPRC[j, 1] = (String)MTRLS[i, settings.ITEM_PRICE + "07"].ToString(); j++; } if (!DBNull.Value.Equals(MTRLS[i, settings.ITEM_PRICE + "08"])) { PRICERPRC[j, 1] = (String)MTRLS[i, settings.ITEM_PRICE + "08"].ToString(); j++; } if (!DBNull.Value.Equals(MTRLS[i, settings.ITEM_PRICE + "09"])) { PRICERPRC[j, 1] = (String)MTRLS[i, settings.ITEM_PRICE + "09"].ToString(); j++; } if (!DBNull.Value.Equals(MTRLS[i, settings.ITEM_PRICE + "10"])) { PRICERPRC[j, 1] = (String)MTRLS[i, settings.ITEM_PRICE + "10"].ToString(); j++; } if (!DBNull.Value.Equals(MTRLS[i, settings.ITEM_PRICE + "11"])) { PRICERPRC[j, 1] = (String)MTRLS[i, settings.ITEM_PRICE + "11"].ToString(); j++; } if (!DBNull.Value.Equals(MTRLS[i, settings.ITEM_PRICE + "12"])) { PRICERPRC[j, 1] = (String)MTRLS[i, settings.ITEM_PRICE + "12"].ToString(); j++; } itemHttp.syncMTRL(CODE, NAME, ITEM_PRICE, PRICERPRC, j, CATEG_NAME, CATEG_ID); this.LoadingProgressBar.PerformStep(); } this.LoadingProgressBar.Value = 0; MessageBox.Show("Διαδικασία ολοκληρώθηκε."); }
private void button1_Click_1(object sender, EventArgs e) { Io.HttpWeb.CustomerHttp customerHttp = new Io.HttpWeb.CustomerHttp(); Settings settings = Settings.getInstance(); String TRDR_NAME_FIELD = ""; String TRDR_LNAME_FIELD = ""; String TRDR_PASSWORD_FIELD = ""; String FILTER_CHECKBOX = ""; if (settings.TRDR_NAME_FIELD.Contains("VARCHAR")) { TRDR_NAME_FIELD = "TE." + settings.TRDR_NAME_FIELD; } else { TRDR_NAME_FIELD = settings.TRDR_NAME_FIELD; } if (settings.TRDR_LNAME_FIELD.Contains("VARCHAR")) { TRDR_LNAME_FIELD = "TE." + settings.TRDR_LNAME_FIELD; } else { TRDR_LNAME_FIELD = settings.TRDR_LNAME_FIELD; } if (settings.TRDR_PASSWORD_FIELD.Contains("VARCHAR")) { TRDR_PASSWORD_FIELD = "TE." + settings.TRDR_PASSWORD_FIELD; } else { TRDR_PASSWORD_FIELD = settings.TRDR_PASSWORD_FIELD; } if (!settings.TRDR_ON_WEB.Equals("")) { FILTER_CHECKBOX = " AND TE." + settings.TRDR_ON_WEB + " = 1"; } XTable TRDRGROUP = Model.S1Init.myXSupport.GetSQLDataSet( " SELECT " + " " + TRDR_NAME_FIELD + ", " + " " + TRDR_LNAME_FIELD + ", " + " " + TRDR_PASSWORD_FIELD + ", " + " T.CODE, " + " T.JOBTYPETRD, " + " T.ADDRESS, " + " T.ZIP, " + " T.CITY, " + " T.PHONE01, " + " T.FAX, " + " T.EMAIL, " + " T.PRCCATEGORY " + " FROM TRDR T " + " LEFT OUTER JOIN TRDEXTRA TE ON TE.TRDR = T.TRDR " + " WHERE T.SODTYPE = 13 " + " AND ISACTIVE = 1 " + " AND T.COMPANY = " + Model.S1Init.myXSupport.ConnectionInfo.CompanyId.ToString() + FILTER_CHECKBOX ); this.LoadingProgressBar.Maximum = TRDRGROUP.Count; this.LoadingProgressBar.Step = 1; for (int i = 0; i < TRDRGROUP.Count; i++) { customerHttp.syncCustomer( TRDRGROUP[i, "CODE"].ToString(), TRDRGROUP[i, settings.TRDR_NAME_FIELD].ToString(), TRDRGROUP[i, settings.TRDR_LNAME_FIELD].ToString(), TRDRGROUP[i, "JOBTYPETRD"].ToString(), TRDRGROUP[i, "ADDRESS"].ToString(), TRDRGROUP[i, "ZIP"].ToString(), TRDRGROUP[i, "CITY"].ToString(), TRDRGROUP[i, "PHONE01"].ToString(), TRDRGROUP[i, settings.TRDR_PASSWORD_FIELD].ToString(), TRDRGROUP[i, "FAX"].ToString(), TRDRGROUP[i, "EMAIL"].ToString(), TRDRGROUP[i, "PRCCATEGORY"].ToString() ); this.LoadingProgressBar.PerformStep(); } this.LoadingProgressBar.Value = 0; MessageBox.Show("Διαδικασία ολοκληρώθηκε."); }
private static void OnTimerElapsed(object source, EventArgs e) { try { Settings settings = Settings.getInstance(); // myXSupport.ExecuteSQL(); XTable pRCCategories = myXSupport.GetSQLDataSet( " SELECT " + " A.SODTYPE, " + " A.MTRL, " + " B.MTRL AS X_15BE3FA0, " + " B.FISCPRD AS X_15BE46F0, " + " ISNULL(B.QTY1,0) AS X_15BE2C20, " + " C.SODTYPE AS X_15BE3AC0, " + " C.MTRL AS X_15BE2E90, " + " C.VARCHAR01 AS X_15BE2F60, " + " C.UTBL01 AS UTBL01, " + " T1.NAME, " + " C.UTBL02 AS UTBL02," + " T2.NAME, " + " C.UTBL03 AS UTBL03, " + " T3.NAME, " + " C.UTBL04 AS UTBL04, " + " T4.NAME, " + " A.CODE, " + " A.NAME, " + " A.CODE1, " + " A.CODE2, " + " A.MTRTYPE, " + " A.MTRTYPE1, " + " A.VAT, " + " A.MTRUNIT1, " + " ISNULL(A.SODISCOUNT,0) AS SODISCOUNT, " + " ISNULL(A.PRICER,0) AS PRICER, " + "((ISNULL(A.SODISCOUNT,0)/100)* ISNULL(A.PRICER,0)) AS DISCOUNTVALUE, " + " ISNULL(A.PRICER,0) - ((ISNULL(A.SODISCOUNT,0)/100)* ISNULL(A.PRICER,0)) AS RETAILWITHDISCOUNT " + " FROM (((((MTRL A LEFT OUTER JOIN MTRDATA B ON A.MTRL=B.MTRL AND B.FISCPRD=2015) " + " LEFT OUTER JOIN MTREXTRA C ON A.MTRL=C.MTRL) " + " LEFT OUTER JOIN UTBL01 T1 ON T1.CODE = C.UTBL01) " + " LEFT OUTER JOIN UTBL02 T2 ON T2.CODE = C.UTBL02) " + " LEFT OUTER JOIN UTBL03 T3 ON T3.CODE = C.UTBL03) " + " LEFT OUTER JOIN UTBL04 T4 ON T4.CODE = C.UTBL04 " + " WHERE A.COMPANY=1003 AND A.SODTYPE=51 AND A.ISACTIVE = 1 " + " ORDER BY A.CODE,A.MTRL"); DataTable dTtoXml = new DataTable("PRODUCT"); // DataColumn idColumn = dTtoXml.Columns.Add("SKU", typeof(System.String)); dTtoXml.Columns.Add("TITLE", typeof(System.String)); dTtoXml.Columns.Add("TITLE2", typeof(System.String)); dTtoXml.Columns.Add("FEATURE1_ID", typeof(System.String)); dTtoXml.Columns.Add("FEATURE1_NAME", typeof(System.String)); dTtoXml.Columns.Add("FEATURE2_ID", typeof(System.String)); dTtoXml.Columns.Add("FEATURE2_NAME", typeof(System.String)); dTtoXml.Columns.Add("FEATURE3_ID", typeof(System.String)); dTtoXml.Columns.Add("FEATURE3_NAME", typeof(System.String)); dTtoXml.Columns.Add("FEATURE4_ID", typeof(System.String)); dTtoXml.Columns.Add("FEATURE4_NAME", typeof(System.String)); dTtoXml.Columns.Add("DISCOUT_PERCENT", typeof(System.String)); dTtoXml.Columns.Add("RETAIL_PRICE", typeof(System.String)); dTtoXml.Columns.Add("DISCOUNT_VALUE", typeof(System.String)); dTtoXml.Columns.Add("RETAIL_WITH_DISCOUNT", typeof(System.String)); dTtoXml.Columns.Add("STOCK_QTY", typeof(System.String)); for (int j = 0; j < pRCCategories.Count; j++) { dTtoXml.Rows.Add( new object[] { pRCCategories[j, 17].ToString(), pRCCategories[j, 18].ToString(), pRCCategories[j, 8].ToString(), pRCCategories[j, 9].ToString(), pRCCategories[j, 10].ToString(), pRCCategories[j, 11].ToString(), pRCCategories[j, 12].ToString(), pRCCategories[j, 13].ToString(), pRCCategories[j, 14].ToString(), pRCCategories[j, 15].ToString(), pRCCategories[j, 16].ToString(), pRCCategories[j, 25].ToString(), pRCCategories[j, 26].ToString(), pRCCategories[j, 27].ToString(), pRCCategories[j, 28].ToString(), pRCCategories[j, 5].ToString() }); } // dTtoXml.AcceptChanges(); // dTtoXml.WriteXml(settings.outputPath); /* if (settings.ftpDomain != " " && settings.ftpDomain != "" && settings.ftpDomain != "~") * { * using (WebClient client = new WebClient()) * { * client.Credentials = new NetworkCredential(settings.user, settings.password); * client.UploadFile(settings.ftpDomain, settings.outputPath); * } * } */ } catch (Exception ex) { // String path = "sdsds"; // path = System.IO.Path.GetTempPath() + "productsXml.xml"; // MessageBox.Show(System.IO.Path.GetTempPath() + "Productslog.xml"); // using (StreamWriter w = File.AppendText(@"C:\products_log.txt")) // using (StreamWriter w = File.AppendText(System.IO.Path.GetTempPath() + "productsLog.xml")) // { // w.WriteLine(ex.Message); // } } }
public void InsSalDocToS1(int FinDocID, int CustID, ArrayList items, double shippingPrice, int EXPN) { XModule ModuleSALDOC = Model.S1Init.myXSupport.CreateModule("SALDOC"); XTable FinDoc = ModuleSALDOC.GetTable("FINDOC"); XTable IteLines = ModuleSALDOC.GetTable("ITELINES"); XTable MtrDoc = ModuleSALDOC.GetTable("MTRDOC"); XTable EXPANAL = ModuleSALDOC.GetTable("EXPANAL"); try { ModuleSALDOC.InsertData(); FinDoc.Current["SERIES"] = FinDocID; FinDoc.Current["FPRMS"] = FinDocID; FinDoc.Current["TFPRMS"] = 202; FinDoc.Current["SOSOURCE"] = 1351; FinDoc.Current["TRNDATE"] = DateTime.Today; FinDoc.Current["TRDR"] = CustID; FinDoc.Current["VATSTS"] = 1; FinDoc.Current["FISCPRD"] = 2015; FinDoc.Current["BRANCH"] = 1000; // FinDoc.Current["VAT"] = 1; //FinDoc.Current.Post(); //MtrDoc.Current.Insert(); MtrDoc.Current["WHOUSE"] = 1000; //MtrDoc.Current.Post(); int linenum = 1; foreach (ArrayList item in items) { IteLines.Current.Insert(); IteLines.Current["LINENUM"] = linenum; IteLines.Current["SODTYPE"] = 51; // IteLines.Current["SOSOURCE"] = 1351; IteLines.Current["MTRL"] = (int)item[5]; IteLines.Current["MTRUNIT"] = 1; //Your code IteLines.Current["QTY1"] = Convert.ToDouble(item[2].ToString().Replace(".", ",")); // IteLines.Current["QTY1"] = 1.00; // IteLines.Current["VAT"] = 1310; //Your Code IteLines.Current["LINEVAL"] = Convert.ToDouble(item[4].ToString().Replace(".", ",")); IteLines.Current["PRICE"] = Convert.ToDouble(item[3].ToString().Replace(".", ",")); IteLines.Current["DISC1PRC"] = 0.00; IteLines.Current.Post(); linenum++; } if (shippingPrice > 0) { EXPANAL.Current.Insert(); EXPANAL.Current["EXPN"] = EXPN; EXPANAL.Current["EXPVAL"] = shippingPrice; //EXPANAL.Current[""] = //EXPANAL.Current[""] = EXPANAL.Current.Post(); } FinDoc.Current.Post(); ModuleSALDOC.PostData(); } catch (Exception ex) { throw ex; // MessageBox.Show(e.Message); } }