public bool Get(long_v xOffice_Data_ID_v) { string Err = null; ID_v = null; Office_Data_ID_v = null; BuildingNumber_v = null; BuildingSectionNumber_v = null; Community_v = null; CadastralNumber_v = null; ValidityDate_v = null; ClosingTag_v = null; SoftwareSupplier_TaxNumber_v = null; PremiseType_v = null; if (xOffice_Data_ID_v != null) { string sql = @"SELECT ID, Office_Data_ID, BuildingNumber, BuildingSectionNumber, Community, CadastralNumber, ValidityDate, ClosingTag, SoftwareSupplier_TaxNumber, PremiseType FROM FVI_SLO_RealEstateBP where Office_Data_ID = " + xOffice_Data_ID_v.v.ToString(); DataTable dt = new DataTable(); if (DBSync.DBSync.ReadDataTable(ref dt, sql, ref Err)) { if (dt.Rows.Count > 0) { ID_v = tf.set_long(dt.Rows[0]["ID"]); Office_Data_ID_v = tf.set_long(dt.Rows[0]["Office_Data_ID"]); BuildingNumber_v = tf.set_int(dt.Rows[0]["BuildingNumber"]); BuildingSectionNumber_v = tf.set_int(dt.Rows[0]["BuildingSectionNumber"]); Community_v = tf.set_string(dt.Rows[0]["Community"]); CadastralNumber_v = tf.set_int(dt.Rows[0]["CadastralNumber"]); ValidityDate_v = tf.set_DateTime(dt.Rows[0]["ValidityDate"]); ClosingTag_v = tf.set_string(dt.Rows[0]["ClosingTag"]); SoftwareSupplier_TaxNumber_v = tf.set_string(dt.Rows[0]["SoftwareSupplier_TaxNumber"]); PremiseType_v = tf.set_string(dt.Rows[0]["PremiseType"]); } return true; } else { LogFile.Error.Show("ERROR:myOrg_Office:Get:sql=" + sql + "\r\nErr=" + Err); return false; } } else { LogFile.Error.Show("ERROR:myOrg_Office:Get:(Office_ID_v == null)"); return false; } }
internal static bool Get(string_v OrgTYPE_v, ref long_v cOrgTYPE_ID_v) { if (OrgTYPE_v != null) { List<SQL_Parameter> lpar = new List<SQL_Parameter>(); string spar = "@par"; SQL_Parameter par = new SQL_Parameter(spar, SQL_Parameter.eSQL_Parameter.Nvarchar, false, OrgTYPE_v.v); lpar.Add(par); string sql = @"select ID from cOrgTYPE where OrganisationTYPE = @par"; DataTable dt = new DataTable(); string Err = null; if (DBSync.DBSync.ReadDataTable(ref dt, sql, lpar, ref Err)) { if (dt.Rows.Count > 0) { if (cOrgTYPE_ID_v == null) { cOrgTYPE_ID_v = new long_v(); } cOrgTYPE_ID_v.v = (long)dt.Rows[0]["ID"]; return true; } else { sql = @"insert into cOrgTYPE (OrganisationTYPE) values (@par)"; long cOrgTYPE_ID = -1; object oret = null; if (DBSync.DBSync.ExecuteNonQuerySQLReturnID(sql, lpar, ref cOrgTYPE_ID, ref oret, ref Err, "cOrgTYPE")) { if (cOrgTYPE_ID_v == null) { cOrgTYPE_ID_v = new long_v(); } cOrgTYPE_ID_v.v = cOrgTYPE_ID; return true; } else { LogFile.Error.Show("ERROR:TangentaDB:f_cOrgTYPE:Get(string_v OrgTYPE_v, ref long_v cOrgTYPE_ID_v) sql=" + sql + "\r\nErr=" + Err); return false; } } } else { LogFile.Error.Show("ERROR:TangentaDB:f_cOrgTYPE:Get(string_v OrgTYPE_v, ref long_v cOrgTYPE_ID_v) sql=" + sql + "\r\nErr=" + Err); return false; } } else { LogFile.Error.Show("ERROR:TangentaDB:f_cOrgTYPE:Get(string_v OrgTYPE_v, ref long_v cOrgTYPE_ID_v) OrgTYPE_v may not be null!"); return false; } }
internal static bool Get(string_v country_v, ref long_v cState_Person_ID_v) { if (country_v != null) { List<SQL_Parameter> lpar = new List<SQL_Parameter>(); string spar = "@par"; SQL_Parameter par = new SQL_Parameter(spar, SQL_Parameter.eSQL_Parameter.Nvarchar, false, country_v.v); lpar.Add(par); string sql = @"select ID from cState_Person where State = @par"; DataTable dt = new DataTable(); string Err = null; if (DBSync.DBSync.ReadDataTable(ref dt, sql, lpar, ref Err)) { if (dt.Rows.Count > 0) { if (cState_Person_ID_v == null) { cState_Person_ID_v = new long_v(); } cState_Person_ID_v.v = (long)dt.Rows[0]["ID"]; return true; } else { sql = @"insert into cState_Person (State) values (@par)"; long cState_Person_ID = -1; object oret = null; if (DBSync.DBSync.ExecuteNonQuerySQLReturnID(sql, lpar, ref cState_Person_ID, ref oret, ref Err, "cState_Person")) { if (cState_Person_ID_v == null) { cState_Person_ID_v = new long_v(); } cState_Person_ID_v.v = cState_Person_ID; return true; } else { LogFile.Error.Show("ERROR:TangentaDB:f_cState_Person:Get(string_v country_v, ref long_v atom_cState_Person_ID_v) sql=" + sql + "\r\nErr=" + Err); return false; } } } else { LogFile.Error.Show("ERROR:TangentaDB:f_cState_Person:Get(string_v country_v, ref long_v atom_cState_Person_ID_v) sql=" + sql + "\r\nErr=" + Err); return false; } } else { cState_Person_ID_v = null; return true; } }
internal void SetControls(string_v type_v) { this.txt_ItemName.Text = ""; if (type_v!=null) { if (type_v is string_v) { this.txt_ItemName.Text = type_v.v; } } }
public static bool Get(string_v FirstName_v, ref long cFirstName_ID) { string Err = null; string sql = null; List<SQL_Parameter> lpar = new List<SQL_Parameter>(); string scond_FirstName = null; string sval_FirstName = "null"; if (FirstName_v != null) { string spar_FirstName = "@par_FirstName"; SQL_Parameter par_FirstName = new SQL_Parameter(spar_FirstName, SQL_Parameter.eSQL_Parameter.Nvarchar, false, FirstName_v.v); lpar.Add(par_FirstName); scond_FirstName = "FirstName = " + spar_FirstName; sval_FirstName = spar_FirstName; } else { scond_FirstName = "FirstName is null"; sval_FirstName = "null"; } DataTable dt = new DataTable(); dt.Columns.Clear(); dt.Clear(); sql = @"select ID from cFirstName where " + scond_FirstName; if (DBSync.DBSync.ReadDataTable(ref dt, sql, lpar, ref Err)) { if (dt.Rows.Count > 0) { cFirstName_ID = (long)dt.Rows[0]["ID"]; return true; } else { sql = @"insert into cFirstName (FirstName) values (" + sval_FirstName + ")"; object objretx = null; if (DBSync.DBSync.ExecuteNonQuerySQLReturnID(sql, lpar, ref cFirstName_ID, ref objretx, ref Err, "cFirstName")) { return true; } else { LogFile.Error.Show("ERROR:f_cFirstName:Get:sql=" + sql + "\r\nErr=" + Err); return false; } } } else { LogFile.Error.Show("ERROR:f_cFirstName:Get:sql=" + sql + "\r\nErr=" + Err); return false; } }
public static bool Get(string Name,string_v Description_v,ref long Language_ID) { List<SQL_Parameter> lpar = new List<SQL_Parameter>(); //Table Language string spar_Name = "@par_Name"; SQL_Parameter par_Name = new SQL_Parameter(spar_Name, SQL_Parameter.eSQL_Parameter.Nvarchar, false, Name); lpar.Add(par_Name); string spar_Description = "@par_Description"; string sval_Description = "null"; if (Description_v != null) { SQL_Parameter par_Description = new SQL_Parameter(spar_Description, SQL_Parameter.eSQL_Parameter.Nvarchar, false, Description_v.v); lpar.Add(par_Description); sval_Description = spar_Description; } string sql = "select ID from Language where Name = " + spar_Name + " and Description = " + sval_Description; DataTable dt = new DataTable(); string Err = null; if (DBSync.DBSync.ReadDataTable(ref dt, sql, lpar, ref Err)) { if (dt.Rows.Count > 0) { Language_ID = (long)dt.Rows[0]["ID"]; return true; } else { sql = "insert into Language (Name,Description,bDefault)values(" + spar_Name + "," + sval_Description + ",0)"; object oret = null; if (DBSync.DBSync.ExecuteNonQuerySQLReturnID(sql, lpar, ref Language_ID, ref oret, ref Err, "Language")) { return true; } else { LogFile.Error.Show("ERROR:f_doc:InsertDefault:sql=" + sql + "\r\nErr=" + Err); return false; } } } else { LogFile.Error.Show("ERROR:f_Language:Get:sql=" + sql + "\r\nErr=" + Err); return false; } }
public static bool Get(long_v Language_ID_v, string doc_page_type_Name, string doc_page_type_Description, decimal Page_Width, decimal Page_Height, ref long doc_page_type_ID, string doc_type_Name, string doc_type_Description, ref long doc_type_ID, string doc_Name, string doc_Description, byte[] doc, bool Compressed, bool Active, bool Default, ref long doc_ID ) { string_v doc_page_type_Description_v = new string_v(doc_page_type_Description); decimal_v Width_v = new decimal_v(Page_Width); decimal_v Height_v = new decimal_v(Page_Height); if (f_doc_page_type.Get(doc_page_type_Name, doc_page_type_Description_v, Width_v, Height_v, ref doc_page_type_ID)) { string_v doc_type_Description_v = new string_v(doc_type_Description); long_v doc_page_type_ID_v = new long_v(doc_page_type_ID); if (f_doc_type.Get(doc_type_Name, doc_type_Description_v, Language_ID_v, doc_page_type_ID_v, ref doc_type_ID)) { long_v doc_type_ID_v = new long_v(doc_type_ID); string_v doc_Description_v = new string_v(doc_Description); if (Get(doc_Name, doc_Description_v, doc, doc_type_ID_v, Compressed, Active, Default, ref doc_ID)) { return true; } } } return false; }
public static bool Get(string_v StreetName_v, string_v HouseNumber_v, string_v ZIP_v, string_v City_v, string_v Country_v, string_v Country_ISO_3166_a2_v, string_v Country_ISO_3166_a3_v, short_v Country_ISO_3166_num_v, string_v State_v, ref long_v cAddress_Person_ID_v) { if ((StreetName_v == null) || (HouseNumber_v == null) || (ZIP_v == null) || (City_v == null) || (Country_v == null)) { cAddress_Person_ID_v = null; return true; } List<SQL_Parameter> lpar = new List<SQL_Parameter>(); long_v cStreetName_Person_ID_v = null; if (!f_cStreetName_Person.Get(StreetName_v, ref cStreetName_Person_ID_v)) { return false; } string cStreetName_Person_ID_cond = null; string cStreetName_Person_ID_value = null; if (!fs.AddPar("cStreetName_Person_ID", ref lpar, cStreetName_Person_ID_v, ref cStreetName_Person_ID_cond, ref cStreetName_Person_ID_value)) { return false; } long_v cHouseNumber_Person_ID_v = null; if (!f_cHouseNumber_Person.Get(HouseNumber_v, ref cHouseNumber_Person_ID_v)) { return false; } string cHouseNumber_Person_ID_cond = null; string cHouseNumber_Person_ID_value = null; if (!fs.AddPar("cHouseNumber_Person_ID", ref lpar, cHouseNumber_Person_ID_v, ref cHouseNumber_Person_ID_cond, ref cHouseNumber_Person_ID_value)) { return false; } long_v cZIP_Person_ID_v = null; if (!f_cZIP_Person.Get(ZIP_v, ref cZIP_Person_ID_v)) { return false; } string cZIP_Person_ID_cond = null; string cZIP_Person_ID_value = null; if (!fs.AddPar("cZIP_Person_ID", ref lpar, cZIP_Person_ID_v, ref cZIP_Person_ID_cond, ref cZIP_Person_ID_value)) { return false; } long_v cCity_Person_ID_v = null; if (!f_cCity_Person.Get(City_v, ref cCity_Person_ID_v)) { return false; } string cCity_Person_ID_cond = null; string cCity_Person_ID_value = null; if (!fs.AddPar("cCity_Person_ID", ref lpar, cCity_Person_ID_v, ref cCity_Person_ID_cond, ref cCity_Person_ID_value)) { return false; } long_v cCountry_Person_ID_v = null; if (!f_cCountry_Person.Get(Country_v, Country_ISO_3166_a2_v, Country_ISO_3166_a3_v, Country_ISO_3166_num_v, ref cCountry_Person_ID_v)) { return false; } string cCountry_Person_ID_cond = null; string cCountry_Person_ID_value = null; if (!fs.AddPar("cCountry_Person_ID", ref lpar, cCountry_Person_ID_v, ref cCountry_Person_ID_cond, ref cCountry_Person_ID_value)) { return false; } long_v cState_Person_ID_v = null; if (!f_cState_Person.Get(State_v, ref cState_Person_ID_v)) { return false; } string cState_Person_ID_cond = null; string cState_Person_ID_value = null; if (!fs.AddPar("cState_Person_ID", ref lpar, cState_Person_ID_v, ref cState_Person_ID_cond, ref cState_Person_ID_value)) { return false; } string sql = "select ID from cAddress_Person where " + cStreetName_Person_ID_cond + " and " + cHouseNumber_Person_ID_cond + " and " + cZIP_Person_ID_cond + " and " + cCity_Person_ID_cond + " and " + cCountry_Person_ID_cond + " and " + cState_Person_ID_cond + " order by ID desc"; DataTable dt = new DataTable(); string Err = null; if (DBSync.DBSync.ReadDataTable(ref dt, sql, lpar, ref Err)) { if (dt.Rows.Count > 0) { if (cAddress_Person_ID_v == null) { cAddress_Person_ID_v = new long_v(); } cAddress_Person_ID_v.v = (long)dt.Rows[0]["ID"]; return true; } else { sql = " insert into cAddress_Person (cStreetName_Person_ID,cHouseNumber_Person_ID,cZIP_Person_ID,cCity_Person_ID,cCountry_Person_ID,cState_Person_ID)values(" + cStreetName_Person_ID_value + "," + cHouseNumber_Person_ID_value + "," + cZIP_Person_ID_value + "," + cCity_Person_ID_value + "," + cCountry_Person_ID_value + "," + cState_Person_ID_value + ")"; long id = -1; object ores = null; if (DBSync.DBSync.ExecuteNonQuerySQLReturnID(sql, lpar, ref id, ref ores, ref Err, "cAddress_Person")) { if (cAddress_Person_ID_v == null) { cAddress_Person_ID_v = new long_v(); } cAddress_Person_ID_v.v = id; return true; } else { LogFile.Error.Show("ERROR:f_Customer_Person:Get_cAddress_Person_ID:\r\nsql=" + sql + "\r\nErr=" + Err); return false; } } } else { LogFile.Error.Show("ERROR:f_Customer_Person:Get_cAddress_Person_ID:\r\nsql=" + sql + "\r\nErr=" + Err); return false; } }
public static bool Get(string Name, string_v Description_v, byte[] xDocument, long_v doc_type_ID_v,bool commpressed,bool Active,bool Default, ref long doc_ID) { string Err = null; List<SQL_Parameter> lpar = new List<SQL_Parameter>(); //Table doc_page_type if (xDocument != null) { string xDocument_HASH = DBtypesFunc.GetHash_SHA1(xDocument); string spar_Name = "@par_Name"; SQL_Parameter par_Name = new SQL_Parameter(spar_Name, SQL_Parameter.eSQL_Parameter.Nvarchar, false, Name); lpar.Add(par_Name); string sval_Description = "null"; if (Description_v != null) { string spar_Description = "@par_Description"; SQL_Parameter par_Description = new SQL_Parameter(spar_Description, SQL_Parameter.eSQL_Parameter.Nvarchar, false, Description_v.v); lpar.Add(par_Description); sval_Description = spar_Description; } string sval_doc_type_ID = "null"; if (doc_type_ID_v != null) { string spar_doc_type_ID = "@par_doc_type_ID"; SQL_Parameter par_doc_type_ID = new SQL_Parameter(spar_doc_type_ID, SQL_Parameter.eSQL_Parameter.Bigint, false, doc_type_ID_v.v); lpar.Add(par_doc_type_ID); sval_doc_type_ID = spar_doc_type_ID; } xDocument_HASH = DBtypesFunc.GetHash_SHA1(xDocument); string spar_xDocument_HASH = "@par_xDocument_HASH"; SQL_Parameter par_xDocument_HASH = new SQL_Parameter(spar_xDocument_HASH, SQL_Parameter.eSQL_Parameter.Nvarchar, false, xDocument_HASH); lpar.Add(par_xDocument_HASH); string sql = "select ID from doc where Name = " + spar_Name + " and Description = " + sval_Description + " and doc_type_ID = " + sval_doc_type_ID + " and xDocument_HASH = " + spar_xDocument_HASH; DataTable dt = new DataTable(); if (DBSync.DBSync.ReadDataTable(ref dt, sql, lpar, ref Err)) { if (dt.Rows.Count > 0) { doc_ID = (long)dt.Rows[0]["ID"]; return true; } else { byte[] byte_data = xDocument; string sCompressed = "0"; if (commpressed) { sCompressed = "1"; byte_data = fs.Compress(xDocument); } string spar_xDocument = "@par_xDocument"; SQL_Parameter par_xDocument = new SQL_Parameter(spar_xDocument, SQL_Parameter.eSQL_Parameter.Varbinary, false, byte_data); lpar.Add(par_xDocument); string spar_bDefault = "@par_bDefault"; SQL_Parameter par_bDefault = new SQL_Parameter(spar_bDefault, SQL_Parameter.eSQL_Parameter.Bit, false, Default); lpar.Add(par_bDefault); sql = @"insert into doc (Name, Description, xDocument, xDocument_Hash, doc_type_ID, Compressed, Active, bDefault) values(" + spar_Name + "," + sval_Description + "," + spar_xDocument + "," + spar_xDocument_HASH + "," + sval_doc_type_ID + "," + sCompressed +@", 1,"+ spar_bDefault + ")"; object oret = null; if (DBSync.DBSync.ExecuteNonQuerySQLReturnID(sql, lpar, ref doc_ID, ref oret, ref Err, "doc")) { return true; } else { LogFile.Error.Show("ERROR:f_doc:Get:sql=" + sql + "\r\nErr=" + Err); return false; } } } else { LogFile.Error.Show("ERROR:f_doc:Get:sql=" + sql + "\r\nErr=" + Err); return false; } } else { LogFile.Error.Show("ERROR:f_doc:Get:Error xDocument may not be null!"); return false; } }
bool Get_Atom_Expiry(int_v Expiry_ExpectedShelfLifeInDays, int_v Expiry_SaleBeforeExpiryDateInDays, int_v Expiry_DiscardBeforeExpiryDateInDays, string_v Expiry_ExpiryDescription, ref long Atom_Expiry_ID, ref string Err) { string scond_ExpectedShelfLifeInDays = null; string sv_ExpectedShelfLifeInDays = null; List<DBConnectionControl40.SQL_Parameter> lpar = new List<DBConnectionControl40.SQL_Parameter>(); if (Expiry_ExpectedShelfLifeInDays != null) { string spar_ExpectedShelfLifeInDays = "@par_ExpectedShelfLifeInDays"; DBConnectionControl40.SQL_Parameter par_ExpectedShelfLifeInDays = new DBConnectionControl40.SQL_Parameter(spar_ExpectedShelfLifeInDays, DBConnectionControl40.SQL_Parameter.eSQL_Parameter.Int, false, Expiry_ExpectedShelfLifeInDays.v); lpar.Add(par_ExpectedShelfLifeInDays); scond_ExpectedShelfLifeInDays = "(ExpectedShelfLifeInDays = " + spar_ExpectedShelfLifeInDays + ")"; sv_ExpectedShelfLifeInDays = spar_ExpectedShelfLifeInDays; } else { scond_ExpectedShelfLifeInDays = "(ExpectedShelfLifeInDays is null)"; sv_ExpectedShelfLifeInDays = "null"; } string scond_Expiry_SaleBeforeExpiryDateInDays = null; string sv_Expiry_SaleBeforeExpiryDateInDays = null; if (Expiry_SaleBeforeExpiryDateInDays != null) { string spar_SaleBeforeExpiryDateInDays = "@par_SaleBeforeExpiryDateInDays"; DBConnectionControl40.SQL_Parameter par_SaleBeforeExpiryDateInDays = new DBConnectionControl40.SQL_Parameter(spar_SaleBeforeExpiryDateInDays, DBConnectionControl40.SQL_Parameter.eSQL_Parameter.Int, false, Expiry_SaleBeforeExpiryDateInDays.v); lpar.Add(par_SaleBeforeExpiryDateInDays); scond_Expiry_SaleBeforeExpiryDateInDays = "(SaleBeforeExpiryDateInDays = " + spar_SaleBeforeExpiryDateInDays + ")"; sv_Expiry_SaleBeforeExpiryDateInDays = spar_SaleBeforeExpiryDateInDays; } else { scond_Expiry_SaleBeforeExpiryDateInDays = "(SaleBeforeExpiryDateInDays is null)"; sv_Expiry_SaleBeforeExpiryDateInDays = "null"; } string scond_Expiry_DiscardBeforeExpiryDateInDays = null; string sv_Expiry_DiscardBeforeExpiryDateInDays = null; if (Expiry_DiscardBeforeExpiryDateInDays != null) { string spar_DiscardBeforeExpiryDateInDays = "@par_DiscardBeforeExpiryDateInDays"; DBConnectionControl40.SQL_Parameter par_DiscardBeforeExpiryDateInDays = new DBConnectionControl40.SQL_Parameter(spar_DiscardBeforeExpiryDateInDays, DBConnectionControl40.SQL_Parameter.eSQL_Parameter.Int, false, Expiry_DiscardBeforeExpiryDateInDays.v); lpar.Add(par_DiscardBeforeExpiryDateInDays); scond_Expiry_DiscardBeforeExpiryDateInDays = "(DiscardBeforeExpiryDateInDays = " + spar_DiscardBeforeExpiryDateInDays + ")"; sv_Expiry_DiscardBeforeExpiryDateInDays = spar_DiscardBeforeExpiryDateInDays; } else { scond_Expiry_DiscardBeforeExpiryDateInDays = "(DiscardBeforeExpiryDateInDays is null)"; sv_Expiry_DiscardBeforeExpiryDateInDays = "null"; } string scond_Expiry_ExpiryDescription = null; string sv_Expiry_ExpiryDescription = null; if (Expiry_ExpiryDescription != null) { string spar_ExpiryDescription = "@par_ExpiryDescription"; DBConnectionControl40.SQL_Parameter par_ExpiryDescription = new DBConnectionControl40.SQL_Parameter(spar_ExpiryDescription, DBConnectionControl40.SQL_Parameter.eSQL_Parameter.Varchar, false, Expiry_ExpiryDescription.v); lpar.Add(par_ExpiryDescription); scond_Expiry_ExpiryDescription = "(ExpiryDescription = " + spar_ExpiryDescription + ")"; sv_Expiry_ExpiryDescription = spar_ExpiryDescription; } else { scond_Expiry_ExpiryDescription = "(ExpiryDescription is null)"; sv_Expiry_ExpiryDescription = "null"; } string sql_select_Atom_Expiry_ID = @"select ID as Atom_Expiry_ID from Atom_Expiry where " + scond_ExpectedShelfLifeInDays + " and " + scond_Expiry_SaleBeforeExpiryDateInDays + " and " + scond_Expiry_DiscardBeforeExpiryDateInDays + " and " + scond_Expiry_ExpiryDescription; DataTable dt = new DataTable(); if (DBSync.DBSync.ReadDataTable(ref dt, sql_select_Atom_Expiry_ID, lpar, ref Err)) { if (dt.Rows.Count > 0) { Atom_Expiry_ID = (long)dt.Rows[0]["Atom_Expiry_ID"]; return true; } else { string sql_Insert_Atom_Item_ExpiryDescription = @"insert into Atom_Expiry (ExpectedShelfLifeInDays, SaleBeforeExpiryDateInDays, DiscardBeforeExpiryDateInDays, ExpiryDescription)values(" + sv_ExpectedShelfLifeInDays + "," + sv_Expiry_SaleBeforeExpiryDateInDays + "," + sv_Expiry_DiscardBeforeExpiryDateInDays + "," + sv_Expiry_ExpiryDescription + ")"; object objret = null; if (DBSync.DBSync.ExecuteNonQuerySQLReturnID(sql_Insert_Atom_Item_ExpiryDescription, lpar, ref Atom_Expiry_ID, ref objret, ref Err, DBtcn.stbl_Atom_Item_ExpiryDescription_TableName)) { return true; } else { LogFile.Error.Show("ERROR:Get_Atom_Expiry:insert into Atom_Expiry failed!\r\nErr=" + Err); return false; } } } else { LogFile.Error.Show("ERROR:Get_Atom_Expiry:select ID as Atom_Expiry_ID from Atom_Expiry failed!\r\nErr=" + Err); return false; } }
public static bool Get(string Name, string_v Description_v, decimal_v Width_v,decimal_v Height_v, ref long doc_page_type_ID) { string Err = null; List<SQL_Parameter> lpar = new List<SQL_Parameter>(); //Table doc_page_type //Table Language string spar_Name = "@par_Name"; SQL_Parameter par_Name = new SQL_Parameter(spar_Name, SQL_Parameter.eSQL_Parameter.Nvarchar, false, Name); lpar.Add(par_Name); string sval_Description = "null"; if (Description_v != null) { string spar_Description = "@par_Description"; SQL_Parameter par_Description = new SQL_Parameter(spar_Description, SQL_Parameter.eSQL_Parameter.Nvarchar, false, Description_v.v); lpar.Add(par_Description); sval_Description = spar_Description; } string spar_Width = "@par_Width"; string sval_Width = "null"; if (Width_v != null) { SQL_Parameter par_Width = new SQL_Parameter(spar_Width, SQL_Parameter.eSQL_Parameter.Decimal, false, Width_v.v); lpar.Add(par_Width); sval_Width = spar_Width; } string spar_Height = "@par_Height"; string sval_Height = "null"; if (Height_v != null) { SQL_Parameter par_Height = new SQL_Parameter(spar_Height, SQL_Parameter.eSQL_Parameter.Decimal, false, Height_v.v); lpar.Add(par_Height); sval_Height = spar_Height; } string sql = "select ID from doc_page_type where Name = " + spar_Name + " and Description = " + sval_Description + " and Width = " + sval_Width + " and Height = " + sval_Height; DataTable dt = new DataTable(); if (DBSync.DBSync.ReadDataTable(ref dt, sql, lpar, ref Err)) { if (dt.Rows.Count > 0) { doc_page_type_ID = (long)dt.Rows[0]["ID"]; return true; } else { sql = "insert into doc_page_type (Name,Description,Width,Height)values(" + spar_Name + "," + sval_Description + "," + sval_Width + "," + sval_Height + ")"; object oret = null; if (DBSync.DBSync.ExecuteNonQuerySQLReturnID(sql, lpar, ref doc_page_type_ID, ref oret, ref Err, "doc_page_type")) { return true; } else { LogFile.Error.Show("ERROR:f_doc_page_type:Get:sql=" + sql + "\r\nErr=" + Err); return false; } } } else { LogFile.Error.Show("ERROR:f_doc_page_type:Get:sql=" + sql + "\r\nErr=" + Err); return false; } }
public void set(object o) { this.type_v = null; if (o == null) return; if (o is string) { this.type_v = new string_v((string)o); } else if (o is System.DBNull) { return; } else { LogFile.Error.Show("ERROR:DB_Types:set:WRONG TYPE:" + o.GetType().ToString() + " should be " + this.GetType().ToString()); } }
private bool Get_Atom_Taxation_ID(string_v Taxation_Name, decimal_v Taxation_Rate, ref long Atom_Taxation_ID) { string Err = null; if ((Taxation_Name != null) && (Taxation_Rate != null)) { List<DBConnectionControl40.SQL_Parameter> lpar = new List<DBConnectionControl40.SQL_Parameter>(); string spar_Taxation_Name = "@par_Taxation_Name"; DBConnectionControl40.SQL_Parameter par_Taxation_Name = new DBConnectionControl40.SQL_Parameter(spar_Taxation_Name, DBConnectionControl40.SQL_Parameter.eSQL_Parameter.Varchar, false, Taxation_Name.v); lpar.Add(par_Taxation_Name); string spar_Taxation_Rate = "@par_Taxation_Rate"; DBConnectionControl40.SQL_Parameter par_Taxation_Rate = new DBConnectionControl40.SQL_Parameter(spar_Taxation_Rate, DBConnectionControl40.SQL_Parameter.eSQL_Parameter.Decimal, false, Taxation_Rate.v); lpar.Add(par_Taxation_Rate); string sql_select_Atom_Item_barcode_ID = @"select ID as Atom_Taxation_ID from Atom_Taxation where Name = " + spar_Taxation_Name + " and Rate = " + spar_Taxation_Rate; DataTable dt = new DataTable(); if (DBSync.DBSync.ReadDataTable(ref dt, sql_select_Atom_Item_barcode_ID, lpar, ref Err)) { if (dt.Rows.Count > 0) { Atom_Taxation_ID = (long)dt.Rows[0]["Atom_Taxation_ID"]; return true; } else { string sql_Insert_Atom_Item_Taxation = @"insert into Atom_Taxation (Name,Rate)values(" + spar_Taxation_Name + "," + spar_Taxation_Rate + ")"; object objret = null; if (DBSync.DBSync.ExecuteNonQuerySQLReturnID(sql_Insert_Atom_Item_Taxation, lpar, ref Atom_Taxation_ID, ref objret, ref Err, DBtcn.stbl_Atom_Taxation_TableName)) { return true; } else { LogFile.Error.Show("ERROR:Get_Atom_Item_Taxation:insert into Atom_Taxation failed!\r\nErr=" + Err); return false; } } } else { LogFile.Error.Show("ERROR:Get_Atom_Item_Taxation:select ID as Atom_Taxation_ID from Atom_Taxation failed!\r\nErr=" + Err); return false; } } else { Err = "ERROR:Get_Atom_Item_Taxation:Taxation_Name can not be null!"; LogFile.Error.Show(Err); return false; } }
public static bool Get(string_v Organisation_Name_v, string_v Tax_ID_v, string_v Registration_ID_v, ref long_v Atom_Organisation_ID_v) { string Err = null; string Name_condition = null; string Tax_ID_condition = null; string Registration_ID_condition = null; string sName_value = null; string sTaxID_value = null; string sRegistration_ID_value = null; List<SQL_Parameter> lpar = new List<SQL_Parameter>(); if (Organisation_Name_v != null) { SQL_Parameter par_Name = new SQL_Parameter("@par_Name", SQL_Parameter.eSQL_Parameter.Nvarchar, false, Organisation_Name_v.v); lpar.Add(par_Name); Name_condition = " Name = " + par_Name.Name + " "; sName_value = "@par_Name"; } else { Name_condition = " Name is null "; sName_value = "null"; } if (Tax_ID_v != null) { SQL_Parameter par_Tax_ID = new SQL_Parameter("@par_Tax_ID", SQL_Parameter.eSQL_Parameter.Nvarchar, false, Tax_ID_v.v); lpar.Add(par_Tax_ID); Tax_ID_condition = " Tax_ID = " + par_Tax_ID.Name + " "; sTaxID_value = "@par_Tax_ID"; } else { Tax_ID_condition = " Tax_ID is null "; sTaxID_value = "null"; } if (Registration_ID_v != null) { SQL_Parameter par_Registration_ID = new SQL_Parameter("@par_Registration_ID", SQL_Parameter.eSQL_Parameter.Nvarchar, false, Registration_ID_v.v); lpar.Add(par_Registration_ID); Registration_ID_condition = " Registration_id = " + par_Registration_ID.Name + " "; sRegistration_ID_value = "@par_Registration_ID"; } else { Registration_ID_condition = " Registration_ID is null "; sRegistration_ID_value = "null"; } string sql_select = "select ID from Atom_Organisation where " + Name_condition + @" and " + Tax_ID_condition + @" and " + Registration_ID_condition; DataTable dt = new DataTable(); if (DBSync.DBSync.ReadDataTable(ref dt, sql_select, lpar, ref Err)) { if (dt.Rows.Count > 0) { if (Atom_Organisation_ID_v == null) { Atom_Organisation_ID_v = new long_v(); } Atom_Organisation_ID_v.v = (long)dt.Rows[0]["ID"]; return true; } else { string sql_insert = " insert into Atom_Organisation (Name,Tax_ID,Registration_ID) values (" + sName_value + "," + sTaxID_value + "," + sRegistration_ID_value + ")"; object oret = null; long Atom_Organisation_ID = -1; if (DBSync.DBSync.ExecuteNonQuerySQLReturnID(sql_insert, lpar, ref Atom_Organisation_ID, ref oret, ref Err, "Atom_Organisation")) { if (Atom_Organisation_ID_v == null) { Atom_Organisation_ID_v = new long_v(); } Atom_Organisation_ID_v.v = Atom_Organisation_ID; return true; } else { LogFile.Error.Show("ERROR:f_Atom_Organisation:Get_Atom_Organisation:sql=" + sql_select + "\r\nErr=" + Err); return false; } } } else { LogFile.Error.Show("ERROR:f_Atom_Organisation:Get_Atom_Organisation:sql=" + sql_select + "\r\nErr=" + Err); return false; } }
public bool Get(long_v Office_ID_v) { string Err = null; ID_v = null; ID_v = null; Name_v = null; Address_v.StreetName_v = null; Address_v.HouseNumber_v = null; Address_v.ZIP_v = null; Address_v.City_v = null; Address_v.Country_v = null; Address_v.Country_ISO_3166_a2_v = null; Address_v.Country_ISO_3166_a3_v = null; Address_v.Country_ISO_3166_num_v = null; myOrg_Office_FVI_SLO_RealEstate.ID_v = null; myOrg_Office_FVI_SLO_RealEstate.Office_Data_ID_v = null; myOrg_Office_FVI_SLO_RealEstate.BuildingNumber_v = null; myOrg_Office_FVI_SLO_RealEstate.BuildingSectionNumber_v = null; myOrg_Office_FVI_SLO_RealEstate.Community_v = null; myOrg_Office_FVI_SLO_RealEstate.CadastralNumber_v = null; myOrg_Office_FVI_SLO_RealEstate.ValidityDate_v = null; myOrg_Office_FVI_SLO_RealEstate.ClosingTag_v = null; myOrg_Office_FVI_SLO_RealEstate.SoftwareSupplier_TaxNumber_v = null; myOrg_Office_FVI_SLO_RealEstate.PremiseType_v = null; if (Office_ID_v != null) { string sql = @"SELECT ID, Name, ShortName FROM Office where ID = " + Office_ID_v.v.ToString(); DataTable dt = new DataTable(); if (DBSync.DBSync.ReadDataTable(ref dt, sql, ref Err)) { if (dt.Rows.Count > 0) { ID_v = tf.set_long(dt.Rows[0]["ID"]); Name_v = tf.set_string(dt.Rows[0]["Name"]); ShortName_v = tf.set_string(dt.Rows[0]["ShortName"]); dt.Columns.Clear(); dt.Clear(); sql = @"SELECT Office_Data.ID, Office_Data_$_office.ID AS Office_Data_$_office_$$ID, Office_Data_$_office.Name AS Office_Data_$_office_$$Name, Office_Data_$_office.Name AS Office_Data_$_office_$$ShortName, Office_Data_$_cadrorg.ID AS Office_Data_$_cadrorg_$$ID, Office_Data_$_cadrorg_$_cstrnorg.StreetName AS Office_Data_$_cadrorg_$_cstrnorg_$$StreetName, Office_Data_$_cadrorg_$_chounorg.HouseNumber AS Office_Data_$_cadrorg_$_chounorg_$$HouseNumber, Office_Data_$_cadrorg_$_ccitorg.City AS Office_Data_$_cadrorg_$_ccitorg_$$City, Office_Data_$_cadrorg_$_cziporg.ZIP AS Office_Data_$_cadrorg_$_cziporg_$$ZIP, Office_Data_$_cadrorg_$_cstorg.Country AS Office_Data_$_cadrorg_$_ccouorg_$$Country, Office_Data_$_cadrorg_$_cstorg.Country_ISO_3166_a2 AS Office_Data_$_cadrorg_$_ccouorg_$$Country_ISO_3166_a2, Office_Data_$_cadrorg_$_cstorg.Country_ISO_3166_a3 AS Office_Data_$_cadrorg_$_ccouorg_$$Country_ISO_3166_a3, Office_Data_$_cadrorg_$_cstorg.Country_ISO_3166_num AS Office_Data_$_cadrorg_$_ccouorg_$$Country_ISO_3166_num, Office_Data_$_cadrorg_$_ccouorg.State AS Office_Data_$_cadrorg_$_cstorg_$$State, Office_Data.Description AS Office_Data_$$Description FROM Office_Data INNER JOIN Office Office_Data_$_office ON Office_Data.Office_ID = Office_Data_$_office.ID LEFT JOIN cAddress_Org Office_Data_$_cadrorg ON Office_Data.cAddress_Org_ID = Office_Data_$_cadrorg.ID LEFT JOIN cStreetName_Org Office_Data_$_cadrorg_$_cstrnorg ON Office_Data_$_cadrorg.cStreetName_Org_ID = Office_Data_$_cadrorg_$_cstrnorg.ID LEFT JOIN cHouseNumber_Org Office_Data_$_cadrorg_$_chounorg ON Office_Data_$_cadrorg.cHouseNumber_Org_ID = Office_Data_$_cadrorg_$_chounorg.ID LEFT JOIN cCity_Org Office_Data_$_cadrorg_$_ccitorg ON Office_Data_$_cadrorg.cCity_Org_ID = Office_Data_$_cadrorg_$_ccitorg.ID LEFT JOIN cZIP_Org Office_Data_$_cadrorg_$_cziporg ON Office_Data_$_cadrorg.cZIP_Org_ID = Office_Data_$_cadrorg_$_cziporg.ID LEFT JOIN cCountry_Org Office_Data_$_cadrorg_$_cstorg ON Office_Data_$_cadrorg.cCountry_Org_ID = Office_Data_$_cadrorg_$_cstorg.ID LEFT JOIN cState_Org Office_Data_$_cadrorg_$_ccouorg ON Office_Data_$_cadrorg.cState_Org_ID = Office_Data_$_cadrorg_$_ccouorg.ID where Office_Data_$_office.ID = " + Office_ID_v.v.ToString(); if (DBSync.DBSync.ReadDataTable(ref dt, sql, ref Err)) { if (dt.Rows.Count > 0) { Office_Data_ID_v = tf.set_long(dt.Rows[0]["ID"]); Description_v = tf.set_string(dt.Rows[0]["Office_Data_$$Description"]); Address_v.StreetName_v = tf.set_dstring(dt.Rows[0]["Office_Data_$_office_$$Name"]); Address_v.HouseNumber_v = tf.set_dstring(dt.Rows[0]["Office_Data_$_cadrorg_$_chounorg_$$HouseNumber"]); Address_v.ZIP_v = tf.set_dstring(dt.Rows[0]["Office_Data_$_cadrorg_$_cziporg_$$ZIP"]); Address_v.City_v = tf.set_dstring(dt.Rows[0]["Office_Data_$_cadrorg_$_ccitorg_$$City"]); Address_v.Country_v = tf.set_dstring(dt.Rows[0]["Office_Data_$_cadrorg_$_ccouorg_$$Country"]); Address_v.Country_ISO_3166_a2_v = tf.set_dstring(dt.Rows[0]["Office_Data_$_cadrorg_$_ccouorg_$$Country_ISO_3166_a2"]); Address_v.Country_ISO_3166_a3_v = tf.set_dstring(dt.Rows[0]["Office_Data_$_cadrorg_$_ccouorg_$$Country_ISO_3166_a3"]); Address_v.Country_ISO_3166_num_v = tf.set_dshort(fs.MyConvertToShort(dt.Rows[0]["Office_Data_$_cadrorg_$_ccouorg_$$Country_ISO_3166_num"])); myOrg_Office_FVI_SLO_RealEstate.Get(Office_Data_ID_v); } return true; } else { LogFile.Error.Show("ERROR:myOrg_Office:Get:sql=" + sql + "\r\nErr=" + Err); return false; } } else { LogFile.Error.Show("ERROR:myOrg_Office:Get:sql=" + sql + "\r\nErr=" + Err); return false; } } else { LogFile.Error.Show("ERROR:myOrg_Office:Get:sql=" + sql + "\r\nErr=" + Err); return false; } } else { return false; } }
public static bool Get( long_v BankAccount_ID_v, long_v Organisation_ID_v, string_v Organisation_BankAccount_Description_v, ref long_v OrganisationAccount_ID_v) { string Err = null; string BankAccount_ID_v_cond = "BankAccount_ID is null"; string BankAccount_ID_v_Value = "null"; if (BankAccount_ID_v != null) { BankAccount_ID_v_Value = BankAccount_ID_v.v.ToString(); BankAccount_ID_v_cond = "BankAccount_ID = " + BankAccount_ID_v.v.ToString(); } string Organisation_ID_v_cond = "Organisation_ID is null"; string Organisation_ID_v_Value = "null"; if (Organisation_ID_v != null) { Organisation_ID_v_Value = Organisation_ID_v.v.ToString(); Organisation_ID_v_cond = "Organisation_ID = " + Organisation_ID_v.v.ToString(); } List<SQL_Parameter> lpar = new List<SQL_Parameter>(); string Organisation_BankAccount_Description_v_ID_v_cond = "Organisation_BankAccount_Description_v_ID is null"; string Organisation_BankAccount_Description_v_ID_v_Value = "null"; if (Organisation_BankAccount_Description_v != null) { Organisation_BankAccount_Description_v_ID_v_Value = "@par_Organisation_BankAccount_Description"; SQL_Parameter par_Organisation_BankAccount_Description = new SQL_Parameter(Organisation_BankAccount_Description_v_ID_v_Value, SQL_Parameter.eSQL_Parameter.Nvarchar, false, Organisation_BankAccount_Description_v.v); lpar.Add(par_Organisation_BankAccount_Description); Organisation_BankAccount_Description_v_ID_v_cond = " Description = " + Organisation_BankAccount_Description_v_ID_v_Value; } string sql_select = "select ID from OrganisationAccount where " + BankAccount_ID_v_cond + @" and " + Organisation_ID_v_cond + @" and " + Organisation_BankAccount_Description_v_ID_v_cond; DataTable dt = new DataTable(); if (DBSync.DBSync.ReadDataTable(ref dt, sql_select, lpar, ref Err)) { if (dt.Rows.Count > 0) { if (OrganisationAccount_ID_v == null) { OrganisationAccount_ID_v = new long_v(); } OrganisationAccount_ID_v.v = (long)dt.Rows[0]["ID"]; return true; } else { string sql_insert = @"insert into OrganisationAccount (BankAccount_ID,Organisation_ID,Description) values ( " + BankAccount_ID_v_Value.ToString() + @", " + Organisation_ID_v_Value + @", " + Organisation_BankAccount_Description_v_ID_v_Value + ")"; object oret = null; long OrganisationAccount_ID = -1; if (DBSync.DBSync.ExecuteNonQuerySQLReturnID(sql_insert, lpar, ref OrganisationAccount_ID, ref oret, ref Err, "OrganisationAccount")) { if (OrganisationAccount_ID_v == null) { OrganisationAccount_ID_v = new long_v(); } OrganisationAccount_ID_v.v = OrganisationAccount_ID; return true; } else { LogFile.Error.Show("ERROR:f_OrganisationAccount:Get:sql=" + sql_insert + "\r\nErr=" + Err); } } } else { LogFile.Error.Show("ERROR:f_OrganisationAccount:Get:sql=" + sql_select + "\r\nErr=" + Err); } return false; }
internal static bool Get(string_v state_v, string_v state_ISO_3166_a2_v, string_v state_ISO_3166_a3_v, short_v state_ISO_3166_num_v, ref long_v atom_cCountry_Org_ID_v) { if ((state_v != null)&& (state_ISO_3166_a2_v != null)&&(state_ISO_3166_a3_v!=null) && (state_ISO_3166_num_v!=null)) { List<SQL_Parameter> lpar = new List<SQL_Parameter>(); string spar_state_v = "@par_state_v"; SQL_Parameter par_state_v = new SQL_Parameter(spar_state_v, SQL_Parameter.eSQL_Parameter.Nvarchar, false, state_v.v); lpar.Add(par_state_v); string spar_state_ISO_3166_a2_v = "@par_state_ISO_3166_a2_v"; SQL_Parameter par_state_ISO_3166_a2_v = new SQL_Parameter(spar_state_ISO_3166_a2_v, SQL_Parameter.eSQL_Parameter.Nvarchar, false, state_ISO_3166_a2_v.v); lpar.Add(par_state_ISO_3166_a2_v); string spar_state_ISO_3166_a3_v = "@par_state_ISO_3166_a3_v"; SQL_Parameter par_state_ISO_3166_a3_v = new SQL_Parameter(spar_state_ISO_3166_a3_v, SQL_Parameter.eSQL_Parameter.Nvarchar, false, state_ISO_3166_a3_v.v); lpar.Add(par_state_ISO_3166_a3_v); string spar_state_ISO_3166_num_v = "@par_state_ISO_3166_num_v"; SQL_Parameter par_state_ISO_3166_num_v = new SQL_Parameter(spar_state_ISO_3166_num_v, SQL_Parameter.eSQL_Parameter.Smallint, false, state_ISO_3166_num_v.v); lpar.Add(par_state_ISO_3166_num_v); string sql = @"select ID from Atom_cCountry_Org where Country= "+ spar_state_v + " and Country_ISO_3166_a2 = " + spar_state_ISO_3166_a2_v + " and Country_ISO_3166_a3 =" + spar_state_ISO_3166_a3_v + " and Country_ISO_3166_num =" + spar_state_ISO_3166_num_v; DataTable dt = new DataTable(); string Err = null; if (DBSync.DBSync.ReadDataTable(ref dt, sql, lpar, ref Err)) { if (dt.Rows.Count > 0) { if (atom_cCountry_Org_ID_v == null) { atom_cCountry_Org_ID_v = new long_v(); } atom_cCountry_Org_ID_v.v = (long)dt.Rows[0]["ID"]; return true; } else { sql = @"insert into Atom_cCountry_Org (Country,Country_ISO_3166_a2,Country_ISO_3166_a3,Country_ISO_3166_num) values ("+ spar_state_v + "," + spar_state_ISO_3166_a2_v + "," + spar_state_ISO_3166_a3_v + "," + spar_state_ISO_3166_num_v +")"; long Atom_cCountry_Org_ID = -1; object oret = null; if (DBSync.DBSync.ExecuteNonQuerySQLReturnID(sql, lpar, ref Atom_cCountry_Org_ID, ref oret, ref Err, "Atom_cCountry_Org")) { if (atom_cCountry_Org_ID_v == null) { atom_cCountry_Org_ID_v = new long_v(); } atom_cCountry_Org_ID_v.v = Atom_cCountry_Org_ID; return true; } else { LogFile.Error.Show("ERROR:TangentaDB:f_Atom_cCountry_Org:Get(string_v state_v, string_v state_ISO_3166_a2_v, string_v state_ISO_3166_a3_v, short_v state_ISO_3166_num_v, ref long_v atom_cCountry_Org_ID_v)\r\nsql=" + sql + "\r\nErr=" + Err); return false; } } } else { LogFile.Error.Show("ERROR:TangentaDB:f_Atom_cCountry_Org:Get(string_v state_v, string_v state_ISO_3166_a2_v, string_v state_ISO_3166_a3_v, short_v state_ISO_3166_num_v, ref long_v atom_cCountry_Org_ID_v)\r\nsql=" + sql + "\r\nErr=" + Err); return false; } } else { LogFile.Error.Show("ERROR:TangentaDB:f_Atom_cCountry_Org:Get(string_v state_v, string_v state_ISO_3166_a2_v, string_v state_ISO_3166_a3_v, short_v state_ISO_3166_num_v, ref long_v atom_cCountry_Org_ID_v)\r\n state_v may not be null!"); return false; } }
public static bool Get(string Name, string_v Description_v, long_v Language_ID_v, long_v doc_page_type_ID_v, ref long doc_page_type_ID) { string Err = null; List<SQL_Parameter> lpar = new List<SQL_Parameter>(); //Table doc_page_type string spar_Name = "@par_Name"; SQL_Parameter par_Name = new SQL_Parameter(spar_Name, SQL_Parameter.eSQL_Parameter.Nvarchar, false, Name); lpar.Add(par_Name); string sval_Description = "null"; if (Description_v != null) { string spar_Description = "@par_Description"; SQL_Parameter par_Description = new SQL_Parameter(spar_Description, SQL_Parameter.eSQL_Parameter.Nvarchar, false, Description_v.v); lpar.Add(par_Description); sval_Description = spar_Description; } string sval_Language_ID = "null"; if (Language_ID_v != null) { string spar_Language_ID = "@par_Language_ID"; SQL_Parameter par_Language_ID = new SQL_Parameter(spar_Language_ID, SQL_Parameter.eSQL_Parameter.Bigint, false, Language_ID_v.v); lpar.Add(par_Language_ID); sval_Language_ID = spar_Language_ID; } string sval_doc_page_type_ID = "null"; if (doc_page_type_ID_v != null) { string spar_doc_page_type_ID = "@par_doc_page_type_ID"; SQL_Parameter par_doc_page_type_ID = new SQL_Parameter(spar_doc_page_type_ID, SQL_Parameter.eSQL_Parameter.Bigint, false, doc_page_type_ID_v.v); lpar.Add(par_doc_page_type_ID); sval_doc_page_type_ID = spar_doc_page_type_ID; } string sql = "select ID from doc_type where Name = " + spar_Name + " and Description = " + sval_Description + " and Language_ID = " + sval_Language_ID + " and doc_page_type_ID = " + sval_doc_page_type_ID; DataTable dt = new DataTable(); if (DBSync.DBSync.ReadDataTable(ref dt, sql, lpar, ref Err)) { if (dt.Rows.Count > 0) { doc_page_type_ID = (long)dt.Rows[0]["ID"]; return true; } else { sql = "insert into doc_type (Name,Description,Language_ID,doc_page_type_ID)values(" + spar_Name + "," + sval_Description +","+ sval_Language_ID + "," + sval_doc_page_type_ID + ")"; object oret = null; if (DBSync.DBSync.ExecuteNonQuerySQLReturnID(sql, lpar, ref doc_page_type_ID, ref oret, ref Err, "doc_page_type")) { return true; } else { LogFile.Error.Show("ERROR:f_doc_page_type:Get:sql=" + sql + "\r\nErr=" + Err); return false; } } } else { LogFile.Error.Show("ERROR:f_doc_page_type:Get:sql=" + sql + "\r\nErr=" + Err); return false; } }
public void Set(string DocInvoice, DataRow dria, ref List<object> DocInvoice_ShopC_Item_Data_list) { Stock_Data stock_data = null; int i = 0; int iCount = DocInvoice_ShopC_Item_Data_list.Count; Atom_Item_ID = tf.set_long(dria["Atom_Item_ID"]); if (Atom_Item_ID != null) { for (i = 0; i < iCount; i++) { if (((Atom_DocInvoice_ShopC_Item_Price_Stock_Data)DocInvoice_ShopC_Item_Data_list[i]).Atom_Item_ID.v == Atom_Item_ID.v) { stock_data = new Stock_Data(); stock_data.Set(dria); ((Atom_DocInvoice_ShopC_Item_Price_Stock_Data)DocInvoice_ShopC_Item_Data_list[i]).m_ShopShelf_Source.Stock_Data_List.Add(stock_data); return; } } m_ShopShelf_Source.Clear(); DocInvoice_ShopC_Item_ID = tf.set_long(dria[DocInvoice+"_ShopC_Item_ID"]); DocInvoice_ID = tf.set_long(dria[DocInvoice+"_ID"]); Atom_Price_Item_ID = tf.set_long(dria["Atom_Price_Item_ID"]); dQuantity_all = tf.set_decimal(dria["dQuantity"]); RetailPricePerUnit = tf.set_decimal(dria["RetailPricePerUnit"]); Discount = tf.set_decimal(dria["Discount"]); RetailPriceWithDiscount = tf.set_decimal(dria["RetailPriceWithDiscount"]); TaxPrice = tf.set_decimal(dria["TaxPrice"]); ExtraDiscount = tf.set_decimal(dria["ExtraDiscount"]); //dQuantity = tf.set_decimal(dria["dQuantity"]); Atom_Item_UniqueName = tf.set_string(dria["Atom_Item_UniqueName"]); Atom_Item_Name_Name = tf.set_string(dria["Atom_Item_Name_Name"]); Atom_Item_barcode_barcode = tf.set_string(dria["Atom_Item_barcode_barcode"]); Atom_Taxation_Name = tf.set_string(dria["Atom_Taxation_Name"]); Atom_Taxation_Rate = tf.set_decimal(dria["Atom_Taxation_Rate"]); Atom_Item_Description_Description = tf.set_string(dria["Atom_Item_Description_Description"]); Atom_Warranty_ID = tf.set_long(dria["Atom_Warranty_ID"]); Atom_Warranty_WarrantyDurationType = tf.set_short(dria["Atom_Warranty_WarrantyDurationType"]); Atom_Warranty_WarrantyDuration = tf.set_int(dria["Atom_Warranty_WarrantyDuration"]); Atom_Warranty_WarrantyConditions = tf.set_string(dria["Atom_Warranty_WarrantyConditions"]); Atom_Expiry_ID = tf.set_long(dria["Atom_Expiry_ID"]); Atom_Expiry_ExpectedShelfLifeInDays = tf.set_int(dria["Atom_Expiry_ExpectedShelfLifeInDays"]); Atom_Expiry_SaleBeforeExpiryDateInDays = tf.set_int(dria["Atom_Expiry_SaleBeforeExpiryDateInDays"]); Atom_Expiry_DiscardBeforeExpiryDateInDays = tf.set_int(dria["Atom_Expiry_DiscardBeforeExpiryDateInDays"]); Atom_Expiry_ExpiryDescription = tf.set_string(dria["Atom_Expiry_ExpiryDescription"]); Item_ID = tf.set_long(dria["Item_ID"]); Atom_Unit_Name = tf.set_string(dria["Atom_Unit_Name"]); Atom_Unit_Symbol = tf.set_string(dria["Atom_Unit_Symbol"]); Atom_Unit_DecimalPlaces = tf.set_int(dria["Atom_Unit_DecimalPlaces"]); Atom_Unit_Description = tf.set_string(dria["Atom_Unit_Description"]); Atom_Unit_StorageOption = tf.set_bool(dria["Atom_Unit_StorageOption"]); Atom_PriceList_Name = tf.set_string(dria["Atom_PriceList_Name"]); Atom_Currency_Name = tf.set_string(dria["Atom_Currency_Name"]); Atom_Currency_Abbreviation = tf.set_string(dria["Atom_Currency_Abbreviation"]); Atom_Currency_Symbol = tf.set_string(dria["Atom_Currency_Symbol"]); Atom_Currency_DecimalPlaces = tf.set_int(dria["Atom_Currency_DecimalPlaces"]); Atom_Item_Image_Hash = tf.set_string(dria["Atom_Item_Image_Hash"]); Atom_Item_Image_Data = tf.set_byte_array(dria["Atom_Item_Image_Data"]); if (dria["s1_name"] is string) { s1_name = (string)dria["s1_name"]; } if (dria["s2_name"] is string) { s2_name = (string)dria["s2_name"]; } if (dria["s3_name"] is string) { s3_name = (string)dria["s3_name"]; } stock_data = new Stock_Data(); stock_data.Set(dria); m_ShopShelf_Source.Stock_Data_List.Add(stock_data); DocInvoice_ShopC_Item_Data_list.Add(this); } else { LogFile.Error.Show("ERROR:DocInvoice_ShopC_Item_Data:Set(DataRow dria,..):Atom_Item_ID == null"); } }
public void Set(object xusrc_Item, Item_Data xItem_Data,long xDocInvoice_ID, decimal xFactoryQuantity, decimal xStockQuantity, bool b_from_factory) { m_ShopShelf_Source.Clear(); DocInvoice_ShopC_Item_ID = null; DocInvoice_ID = new long_v(); DocInvoice_ID.v = xDocInvoice_ID; Atom_Price_Item_ID = null; // tf.set_long(dria["Atom_Price_Item_ID"]); RetailPricePerUnit = (decimal_v)tf.Copy(xItem_Data.RetailPricePerUnit); //tf.set_decimal(dr[cpis.icol_RetailPricePerUnit]); Discount = (decimal_v)tf.Copy(xItem_Data.Price_Item_Discount); // tf.set_decimal(dr[cpis.icol_Discount]); decimal retail_price_with_discount = 0; RetailPriceWithDiscount = tf.set_decimal(retail_price_with_discount); //$$TODO decimal tax_price = 0; TaxPrice = tf.set_decimal(tax_price); ExtraDiscount = tf.set_decimal(xItem_Data.ExtraDiscount); Atom_Item_UniqueName = (string_v)tf.Copy(xItem_Data.Item_UniqueName);// tf.set_string(dr[cpis.icol_Item_UniqueName]); Atom_Item_Name_Name = (string_v)tf.Copy(xItem_Data.Item_Name);//tf.set_string(dr[cpis.icol_Item_Name]); Atom_Item_barcode_barcode = (string_v)tf.Copy(xItem_Data.Item_barcode);//tf.set_string(dr[cpis.icol_Item_barcode]); Atom_Taxation_Name = (string_v)tf.Copy(xItem_Data.Taxation_Name);//tf.set_string(dr[cpis.icol_Taxation_Name]); Atom_Taxation_Rate = (decimal_v)tf.Copy(xItem_Data.Taxation_Rate);//tf.set_decimal(dr[cpis.icol_Taxation_Rate]); Atom_Item_Description_Description = (string_v)tf.Copy(xItem_Data.Item_Description);//tf.set_string(dr[cpis.icol_Item_Description]); Atom_Warranty_ID = null; //tf.set_long(dria["Atom_Warranty_ID"]); Atom_Warranty_WarrantyDurationType = (short_v)tf.Copy(xItem_Data.Warranty_WarrantyDurationType);//tf.set_short(dr[cpis.icol_Warranty_WarrantyDurationType]); Atom_Warranty_WarrantyDuration = (int_v)tf.Copy(xItem_Data.Warranty_WarrantyDuration);//tf.set_int(dr[cpis.icol_Warranty_WarrantyDuration]); Atom_Warranty_WarrantyConditions = (string_v)tf.Copy(xItem_Data.Warranty_WarrantyConditions);//tf.set_string(dr[cpis.icol_Warranty_WarrantyConditions]); Atom_Expiry_ID = null; //tf.set_long(dr["Atom_Expiry_ID"]); Atom_Expiry_ExpectedShelfLifeInDays = (int_v)tf.Copy(xItem_Data.Expiry_ExpectedShelfLifeInDays);//tf.set_int(dr[cpis.icol_Expiry_ExpectedShelfLifeInDays]); Atom_Expiry_SaleBeforeExpiryDateInDays = (int_v)tf.Copy(xItem_Data.Expiry_SaleBeforeExpiryDateInDays);//tf.set_int(dr[cpis.icol_Expiry_SaleBeforeExpiryDateInDays]); Atom_Expiry_DiscardBeforeExpiryDateInDays = (int_v)tf.Copy(xItem_Data.Expiry_DiscardBeforeExpiryDateInDays);//tf.set_int(dr[cpis.icol_Expiry_DiscardBeforeExpiryDateInDays]); Atom_Expiry_ExpiryDescription = (string_v)tf.Copy(xItem_Data.Expiry_Description);//tf.set_string(dr[cpis.icol_Expiry_ExpiryDescription]); Item_ID = (long_v)tf.Copy(xItem_Data.Item_ID);//tf.set_long(dr["Item_ID"]); Atom_Unit_Name = (string_v)tf.Copy(xItem_Data.Unit_Name);//tf.set_string(dr[cpis.icol_Unit_Name]); Atom_Unit_Symbol = (string_v)tf.Copy(xItem_Data.Unit_Symbol);//tf.set_string(dr[cpis.icol_Unit_Symbol]); Atom_Unit_DecimalPlaces = (int_v)tf.Copy(xItem_Data.Unit_DecimalPlaces);//tf.set_int(dr[cpis.icol_Unit_DecimalPlaces]); Atom_Unit_Description = (string_v)tf.Copy(xItem_Data.Unit_Description);//tf.set_string(dr[cpis.icol_Unit_Description]); Atom_Unit_StorageOption = (bool_v)tf.Copy(xItem_Data.Unit_StorageOption);//tf.set_bool(dr[cpis.icol_Unit_StorageOption]); Atom_PriceList_Name = (string_v)tf.Copy(xItem_Data.PriceList_Name);//tf.set_string(dr[cpis.icol_PriceList_Name]); Atom_Currency_Name = (string_v)tf.Copy(xItem_Data.Currency_Name);// tf.set_string(dr[cpis.icol_Currency_Name]); Atom_Currency_Abbreviation = (string_v)tf.Copy(xItem_Data.Currency_Abbreviation);//tf.set_string(dr[cpis.icol_Currency_Abbreviation]); Atom_Currency_Symbol = (string_v)tf.Copy(xItem_Data.Currency_Symbol);//tf.set_string(dr[cpis.icol_Currency_Symbol]); Atom_Currency_DecimalPlaces = (int_v)tf.Copy(xItem_Data.Currency_DecimalPlaces);//tf.set_int(dr[cpis.icol_Currency_DecimalPlaces]); Atom_Item_Image_Hash = (string_v)tf.Copy(xItem_Data.Item_Image_Image_Hash);//tf.set_string(dr[cpis.icol_Currency_Symbol]); Atom_Item_Image_Data = (byte_array_v)tf.Copy(xItem_Data.Item_Image_Image_Data);//Itemtf.set_byte_array(dr[cpis.icol_Item_Image_Image_Data]); s1_name = xItem_Data.s1_name; s2_name = xItem_Data.s2_name; s3_name = xItem_Data.s3_name; m_ShopShelf_Source.Add_Stock_Data(xItem_Data, xFactoryQuantity, xStockQuantity, b_from_factory); }
internal static bool Get(string_v houseNumber_v, ref long_v atom_cHouseNumber_Person_ID_v) { if (houseNumber_v != null) { List<SQL_Parameter> lpar = new List<SQL_Parameter>(); string spar = "@par"; SQL_Parameter par = new SQL_Parameter(spar, SQL_Parameter.eSQL_Parameter.Nvarchar, false, houseNumber_v.v); lpar.Add(par); string sql = @"select ID from Atom_cHouseNumber_Person where HouseNumber = @par"; DataTable dt = new DataTable(); string Err = null; if (DBSync.DBSync.ReadDataTable(ref dt, sql, lpar, ref Err)) { if (dt.Rows.Count > 0) { if (atom_cHouseNumber_Person_ID_v == null) { atom_cHouseNumber_Person_ID_v = new long_v(); } atom_cHouseNumber_Person_ID_v.v = (long)dt.Rows[0]["ID"]; return true; } else { sql = @"insert into Atom_cHouseNumber_Person (HouseNumber) values (@par)"; long Atom_cHouseNumber_Person_ID = -1; object oret = null; if (DBSync.DBSync.ExecuteNonQuerySQLReturnID(sql, lpar, ref Atom_cHouseNumber_Person_ID, ref oret, ref Err, "Atom_cHouseNumber_Person")) { if (atom_cHouseNumber_Person_ID_v == null) { atom_cHouseNumber_Person_ID_v = new long_v(); } atom_cHouseNumber_Person_ID_v.v = Atom_cHouseNumber_Person_ID; return true; } else { LogFile.Error.Show("ERROR:TangentaDB:f_Atom_cHouseNumber_Person:Get(string_v houseNumber_v, ref long_v atom_cHouseNumber_Person_ID_v) sql=" + sql + "\r\nErr=" + Err); return false; } } } else { LogFile.Error.Show("ERROR:TangentaDB:f_Atom_cHouseNumber_Person:Get(string_v houseNumber_v, ref long_v atom_cHouseNumber_Person_ID_v) sql=" + sql + "\r\nErr=" + Err); return false; } } else { LogFile.Error.Show("ERROR:TangentaDB:f_Atom_cHouseNumber_Person:Get(string_v houseNumber_v, ref long_v atom_cHouseNumber_Person_ID_v) houseNumber_v may not be null!"); return false; } }
public static bool Get(long myOrg_id) { DataTable dt_myOrganisation = new DataTable(); myOrg.ID_v = null; myOrg.Name_v = null; myOrg.Tax_ID_v = null; myOrg.Registration_ID_v = null; myOrg.OrganisationTYPE_v = null; myOrg.PhoneNumber_v = null; myOrg.FaxNumber_v = null; myOrg.HomePage_v = null; myOrg.Email_v = null; myOrg.Logo_Image_Data_v = null; myOrg.Logo_Hash_v = null; myOrg.Address_v.StreetName_v = null; myOrg.Address_v.HouseNumber_v = null; myOrg.Address_v.ZIP_v = null; myOrg.Address_v.City_v = null; myOrg.Address_v.Country_v = null; myOrg.Address_v.Country_ISO_3166_a2_v = null; myOrg.Address_v.Country_ISO_3166_a3_v = null; myOrg.Address_v.Country_ISO_3166_num_v = null; myOrg.Address_v.State_v = null; string sql = null; if (myOrg_id >= 0) { sql = @"Select ID, myOrganisation_$_orgd_$$ID, myOrganisation_$_orgd_$_org_$$ID, myOrganisation_$_orgd_$_org_$$Name, myOrganisation_$_orgd_$_org_$$Tax_ID, myOrganisation_$_orgd_$_org_$$Registration_ID, myOrganisation_$_orgd_$_orgt_$$OrganisationTYPE, myOrganisation_$_orgd_$_cadrorg_$_cstrnorg_$$StreetName, myOrganisation_$_orgd_$_cadrorg_$_chounorg_$$HouseNumber, myOrganisation_$_orgd_$_cadrorg_$_ccitorg_$$City, myOrganisation_$_orgd_$_cadrorg_$_cziporg_$$ZIP, myOrganisation_$_orgd_$_cadrorg_$_ccouorg_$$Country, myOrganisation_$_orgd_$_cadrorg_$_ccouorg_$$Country_ISO_3166_a2, myOrganisation_$_orgd_$_cadrorg_$_ccouorg_$$Country_ISO_3166_a3, myOrganisation_$_orgd_$_cadrorg_$_ccouorg_$$Country_ISO_3166_num, myOrganisation_$_orgd_$_cadrorg_$_cstorg_$$State, myOrganisation_$_orgd_$_cphnnorg_$$PhoneNumber, myOrganisation_$_orgd_$_cfaxnorg_$$FaxNumber, myOrganisation_$_orgd_$_cemailorg_$$Email, myOrganisation_$_orgd_$_chomepgorg_$$HomePage, myOrganisation_$_orgd_$_logo_$$Image_Hash, myOrganisation_$_orgd_$_logo_$$Image_Data, myOrganisation_$_orgd_$_logo_$$Description from myOrganisation_VIEW where ID = " + myOrg_id.ToString(); } else { sql = @"Select ID, myOrganisation_$_orgd_$$ID, myOrganisation_$_orgd_$_org_$$ID, myOrganisation_$_orgd_$_org_$$Name, myOrganisation_$_orgd_$_org_$$Tax_ID, myOrganisation_$_orgd_$_org_$$Registration_ID, myOrganisation_$_orgd_$_orgt_$$OrganisationTYPE, myOrganisation_$_orgd_$_cadrorg_$_cstrnorg_$$StreetName, myOrganisation_$_orgd_$_cadrorg_$_chounorg_$$HouseNumber, myOrganisation_$_orgd_$_cadrorg_$_ccitorg_$$City, myOrganisation_$_orgd_$_cadrorg_$_cziporg_$$ZIP, myOrganisation_$_orgd_$_cadrorg_$_ccouorg_$$Country, myOrganisation_$_orgd_$_cadrorg_$_ccouorg_$$Country_ISO_3166_a2, myOrganisation_$_orgd_$_cadrorg_$_ccouorg_$$Country_ISO_3166_a3, myOrganisation_$_orgd_$_cadrorg_$_ccouorg_$$Country_ISO_3166_num, myOrganisation_$_orgd_$_cadrorg_$_cstorg_$$State, myOrganisation_$_orgd_$_cphnnorg_$$PhoneNumber, myOrganisation_$_orgd_$_cfaxnorg_$$FaxNumber, myOrganisation_$_orgd_$_cemailorg_$$Email, myOrganisation_$_orgd_$_chomepgorg_$$HomePage, myOrganisation_$_orgd_$_logo_$$Image_Hash, myOrganisation_$_orgd_$_logo_$$Image_Data, myOrganisation_$_orgd_$_logo_$$Description from myOrganisation_VIEW"; } string Err = null; dt_myOrganisation.Clear(); if (DBSync.DBSync.ReadDataTable(ref dt_myOrganisation, sql, ref Err)) { if (dt_myOrganisation.Rows.Count > 0) { myOrg.ID_v = tf.set_long(dt_myOrganisation.Rows[0]["ID"]); myOrg.Name_v = tf.set_string(dt_myOrganisation.Rows[0]["myOrganisation_$_orgd_$_org_$$Name"]); myOrg.Tax_ID_v = tf.set_string(dt_myOrganisation.Rows[0]["myOrganisation_$_orgd_$_org_$$Tax_ID"]); myOrg.Registration_ID_v = tf.set_string(dt_myOrganisation.Rows[0]["myOrganisation_$_orgd_$_org_$$Registration_ID"]); myOrg.OrganisationTYPE_v = tf.set_string(dt_myOrganisation.Rows[0]["myOrganisation_$_orgd_$_orgt_$$OrganisationTYPE"]); myOrg.PhoneNumber_v = tf.set_string(dt_myOrganisation.Rows[0]["myOrganisation_$_orgd_$_cphnnorg_$$PhoneNumber"]); myOrg.FaxNumber_v = tf.set_string(dt_myOrganisation.Rows[0]["myOrganisation_$_orgd_$_cfaxnorg_$$FaxNumber"]); myOrg.HomePage_v = tf.set_string(dt_myOrganisation.Rows[0]["myOrganisation_$_orgd_$_chomepgorg_$$HomePage"]); myOrg.Email_v = tf.set_string(dt_myOrganisation.Rows[0]["myOrganisation_$_orgd_$_cemailorg_$$Email"]); myOrg.Logo_Image_Data_v = tf.set_byte_array(dt_myOrganisation.Rows[0]["myOrganisation_$_orgd_$_logo_$$Image_Data"]); myOrg.Logo_Hash_v = tf.set_string(dt_myOrganisation.Rows[0]["myOrganisation_$_orgd_$_logo_$$Image_Hash"]); if (myOrg.Logo_Image_Data_v != null) { ImageConverter ic = new ImageConverter(); myOrg.Logo = (Image)ic.ConvertFrom(myOrg.Logo_Image_Data_v.v); } myOrg.Address_v.StreetName_v = tf.set_dstring(dt_myOrganisation.Rows[0]["myOrganisation_$_orgd_$_cadrorg_$_cstrnorg_$$StreetName"]); myOrg.Address_v.HouseNumber_v = tf.set_dstring(dt_myOrganisation.Rows[0]["myOrganisation_$_orgd_$_cadrorg_$_chounorg_$$HouseNumber"]); myOrg.Address_v.ZIP_v = tf.set_dstring(dt_myOrganisation.Rows[0]["myOrganisation_$_orgd_$_cadrorg_$_cziporg_$$ZIP"]); myOrg.Address_v.City_v = tf.set_dstring(dt_myOrganisation.Rows[0]["myOrganisation_$_orgd_$_cadrorg_$_ccitorg_$$City"]); myOrg.Address_v.Country_v = tf.set_dstring(dt_myOrganisation.Rows[0]["myOrganisation_$_orgd_$_cadrorg_$_ccouorg_$$Country"]); myOrg.Address_v.Country_ISO_3166_a2_v = tf.set_dstring(dt_myOrganisation.Rows[0]["myOrganisation_$_orgd_$_cadrorg_$_ccouorg_$$Country_ISO_3166_a2"]); myOrg.Address_v.Country_ISO_3166_a3_v = tf.set_dstring(dt_myOrganisation.Rows[0]["myOrganisation_$_orgd_$_cadrorg_$_ccouorg_$$Country_ISO_3166_a3"]); myOrg.Address_v.Country_ISO_3166_num_v = tf.set_dshort(fs.MyConvertToShort(dt_myOrganisation.Rows[0]["myOrganisation_$_orgd_$_cadrorg_$_ccouorg_$$Country_ISO_3166_num"])); myOrg.Address_v.State_v = tf.set_dstring(dt_myOrganisation.Rows[0]["myOrganisation_$_orgd_$_cadrorg_$_cstorg_$$State"]); if (myOrg.ID_v != null) { myOrg_Office_List.Get(myOrg.ID_v.v, ref myOrg.myOrg_Office_list); myOrg_Person_List.Get(myOrg.ID_v.v, ref myOrg.myOrg_Person_list); } } return true; } else { LogFile.Error.Show("ERROR:MyOrg:Get:sql=" + sql+"\r\nErr="+Err); return false; } }
public static bool Get( string_v TRR_v, bool_v Active_v, string_v BankAccount_Description_v, long_v Bank_ID_v, ref long_v BankAccount_ID_v) { string Err = null; List<SQL_Parameter> lpar = new List<SQL_Parameter>(); string TRR_v_cond = "TRR is null"; string TRR_v_Value = "null"; if (TRR_v != null) { TRR_v_Value = "@par_TRR"; SQL_Parameter par_Organisation_BankAccount_Description = new SQL_Parameter(TRR_v_Value, SQL_Parameter.eSQL_Parameter.Nvarchar, false, TRR_v.v); lpar.Add(par_Organisation_BankAccount_Description); TRR_v_cond = " TRR = " + TRR_v_Value; } string BankAccount_Description_v_cond = "Description is null"; string BankAccount_Description_v_Value = "null"; if (BankAccount_Description_v != null) { BankAccount_Description_v_Value = "@par_BankAccount_Description"; SQL_Parameter par_Organisation_BankAccount_BankAccount_Description = new SQL_Parameter(BankAccount_Description_v_Value, SQL_Parameter.eSQL_Parameter.Nvarchar, false, BankAccount_Description_v.v); lpar.Add(par_Organisation_BankAccount_BankAccount_Description); BankAccount_Description_v_cond = " Description = " + BankAccount_Description_v_Value; } string Active_v_cond = "Active is null"; string Active_v_Value = "null"; if (Active_v != null) { string sbinVal = "0"; if (Active_v.v) { sbinVal = "1"; } Active_v_Value = sbinVal; Active_v_cond = "Active = " + Active_v_Value; } string Bank_ID_v_cond = "Bank_ID is null"; string Bank_ID_v_Value = "null"; if (Bank_ID_v != null) { Bank_ID_v_Value = Bank_ID_v.v.ToString(); Bank_ID_v_cond = "Bank_ID = " + Bank_ID_v.v.ToString(); } string sql_select = "select ID from BankAccount where " + Bank_ID_v_cond + @" and " + TRR_v_cond + @" and " + BankAccount_Description_v_cond + @" and " + Active_v_cond; DataTable dt = new DataTable(); if (DBSync.DBSync.ReadDataTable(ref dt, sql_select, lpar, ref Err)) { if (dt.Rows.Count > 0) { if (BankAccount_ID_v == null) { BankAccount_ID_v = new long_v(); } BankAccount_ID_v.v = (long)dt.Rows[0]["ID"]; return true; } else { string sql_insert = @"insert into BankAccount (TRR,Active,Description,Bank_ID) values ( " + TRR_v_Value + @", " + Active_v_Value + @", " + BankAccount_Description_v_Value + @", " + Bank_ID_v_Value + ")"; object oret = null; long BankAccount_ID = -1; if (DBSync.DBSync.ExecuteNonQuerySQLReturnID(sql_insert, lpar, ref BankAccount_ID, ref oret, ref Err, "BankAccount")) { if (BankAccount_ID_v == null) { BankAccount_ID_v = new long_v(); } BankAccount_ID_v.v = BankAccount_ID; return true; } else { LogFile.Error.Show("ERROR:f_BankAccount:Get:sql=" + sql_insert + "\r\nErr=" + Err); } } } else { LogFile.Error.Show("ERROR:f_BankAccount:Get:sql=" + sql_select + "\r\nErr=" + Err); } return false; }
public static bool Get(long Organisation_ID, string_v OrganisationTYPE_v, PostAddress_v Address_v, string_v PhoneNumber_v, string_v FaxNumber_v, string_v Email_v, string_v HomePage_v, string_v Logo_Hash_v, byte_array_v Image_Data_v, string_v Logo_Description_v, ref ID_v cAdressAtom_Org_iD_v, ref long_v OrganisationData_ID_v) { string Err = null; // long_v Atom_Organisation_ID_v = null; long_v OrganisationTYPE_ID_v = null; if (f_cOrgTYPE.Get(OrganisationTYPE_v, ref OrganisationTYPE_ID_v)) { if (f_cAddress_Org.Get(Address_v, ref cAdressAtom_Org_iD_v)) { ID_v cHomePage_Org_ID_v = null; string cHomePage_Org_ID_v_cond = "cHomePage_Org_ID is null"; string cHomePage_Org_ID_v_Value = "null"; if (fs.Get_ID("cHomePage_Org", "HomePage", HomePage_v, ref cHomePage_Org_ID_v, ref Err)) { if (cHomePage_Org_ID_v != null) { cHomePage_Org_ID_v_Value = cHomePage_Org_ID_v.v.ToString(); cHomePage_Org_ID_v_cond = "cHomePage_Org_ID = " + cHomePage_Org_ID_v_Value; } } ID_v cEmail_Org_ID_v = null; string cEmail_Org_ID_v_cond = "cEmail_Org_ID is null"; string cEmail_Org_ID_v_Value = "null"; if (fs.Get_ID("cEmail_Org", "Email", Email_v, ref cEmail_Org_ID_v, ref Err)) { if (cEmail_Org_ID_v != null) { cEmail_Org_ID_v_Value = cEmail_Org_ID_v.v.ToString(); cEmail_Org_ID_v_cond = "cEmail_Org_ID = " + cEmail_Org_ID_v_Value; } } ID_v cPhoneNumber_Org_ID_v = null; string cPhoneNumber_Org_ID_v_cond = "cPhoneNumber_Org_ID is null"; string cPhoneNumber_Org_ID_v_Value = "null"; if (fs.Get_ID("cPhoneNumber_Org", "PhoneNumber", PhoneNumber_v, ref cPhoneNumber_Org_ID_v, ref Err)) { if (cPhoneNumber_Org_ID_v != null) { cPhoneNumber_Org_ID_v_Value = cPhoneNumber_Org_ID_v.v.ToString(); cPhoneNumber_Org_ID_v_cond = "cPhoneNumber_Org_ID = " + cPhoneNumber_Org_ID_v_Value; } } ID_v cFaxNumber_Org_ID_v = null; string cFaxNumber_Org_ID_v_cond = "cFaxNumber_Org_ID is null"; string cFaxNumber_Org_ID_v_Value = "null"; if (fs.Get_ID("cFaxNumber_Org", "FaxNumber", FaxNumber_v, ref cFaxNumber_Org_ID_v, ref Err)) { if (cFaxNumber_Org_ID_v != null) { cFaxNumber_Org_ID_v_Value = cFaxNumber_Org_ID_v.v.ToString(); cFaxNumber_Org_ID_v_cond = "cFaxNumber_Org_ID = " + cFaxNumber_Org_ID_v_Value; } } long_v Logo_ID_v = null; string Logo_ID_cond = "Logo_ID is null"; string Logo_ID_Value = "null"; // = null; //if (Logo != null) //{ // Image_Data_v = new byte_array_v(); // Image_Data_v.v = DBtypesFunc.imageToByteArray(Logo, Logo.RawFormat); //} if (f_Logo.Get(Logo_Hash_v, Image_Data_v, Logo_Description_v, ref Logo_ID_v)) { if (Logo_ID_v != null) { Logo_ID_Value = Logo_ID_v.v.ToString(); Logo_ID_cond = "Logo_ID = " + Logo_ID_Value; } } List<SQL_Parameter> lpar = new List<SQL_Parameter>(); //if (BankName_v != null) //{ // BankName_Value = "@par_BankName"; // SQL_Parameter par_BankName = new SQL_Parameter(BankName_Value, SQL_Parameter.eSQL_Parameter.Nvarchar, false, BankName_v.v); // lpar.Add(par_BankName); // BankName_condition = " BankName = " + par_BankName.Name + " "; //} //else //{ // BankName_condition = " BankName is null "; // BankName_Value = "null"; //} //if (TRR_v != null) //{ // TRR_Value = "@par_TRR"; // SQL_Parameter par_TRR = new SQL_Parameter(TRR_Value, SQL_Parameter.eSQL_Parameter.Nvarchar, false, TRR_v.v); // lpar.Add(par_TRR); // TRR_condition = " TRR = " + par_TRR.Name + " "; //} //else //{ // TRR_condition = " TRR is null "; // TRR_Value = "null"; //} string cOrgTYPE_ID_condition = null; string cOrgTYPE_ID_value = null; if (OrganisationTYPE_ID_v != null) { cOrgTYPE_ID_condition = " cOrgTYPE_ID = " + cAdressAtom_Org_iD_v.v.ToString(); cOrgTYPE_ID_value = cAdressAtom_Org_iD_v.v.ToString(); } else { cOrgTYPE_ID_condition = " cOrgTYPE_ID is null "; cOrgTYPE_ID_value = "null"; } string cAddress_Org_ID_condition = null; if (cAdressAtom_Org_iD_v != null) { cAddress_Org_ID_condition = " cAddress_Org_ID = " + cAdressAtom_Org_iD_v.v.ToString(); } else { cAddress_Org_ID_condition = " cAddress_Org_ID is null "; } string sql_select = "select ID from OrganisationData where Organisation_ID =" + Organisation_ID.ToString() + @" and " + cOrgTYPE_ID_condition + @" and " + cAddress_Org_ID_condition + @" and " + cHomePage_Org_ID_v_cond + @" and " + cEmail_Org_ID_v_cond + @" and " + cPhoneNumber_Org_ID_v_cond + @" and " + cFaxNumber_Org_ID_v_cond + @" and " + Logo_ID_cond; DataTable dt = new DataTable(); if (DBSync.DBSync.ReadDataTable(ref dt, sql_select, lpar, ref Err)) { if (dt.Rows.Count > 0) { if (OrganisationData_ID_v == null) { OrganisationData_ID_v = new long_v(); } OrganisationData_ID_v.v = (long)dt.Rows[0]["ID"]; return true; } else { string sql_insert = @"insert into OrganisationData (Organisation_ID,cOrgTYPE_ID,cAddress_Org_ID,cHomePage_Org_ID,cEmail_Org_ID,cPhoneNumber_Org_ID,cFaxNumber_Org_ID,Logo_ID) values ( " + Organisation_ID.ToString() + @", " + cOrgTYPE_ID_value + @", " + cAdressAtom_Org_iD_v.v.ToString() + @", " + cHomePage_Org_ID_v_Value + @", " + cEmail_Org_ID_v_Value + @", " + cPhoneNumber_Org_ID_v_Value + @", " + cFaxNumber_Org_ID_v_Value + @", " + Logo_ID_Value + ")"; object oret = null; long OrganisationData_ID = -1; if (DBSync.DBSync.ExecuteNonQuerySQLReturnID(sql_insert, lpar, ref OrganisationData_ID, ref oret, ref Err, "OrganisationData")) { if (OrganisationData_ID_v == null) { OrganisationData_ID_v = new long_v(); } OrganisationData_ID_v.v = OrganisationData_ID; return true; } else { LogFile.Error.Show("ERROR:f_OrganisationData:Get:sql=" + sql_insert + "\r\nErr=" + Err); } } } else { LogFile.Error.Show("ERROR:f_OrganisationData:Get:sql=" + sql_select + "\r\nErr=" + Err); } } } return false; }
private bool Get_Atom_Item_Image(long Atom_Item_ID, string_v Atom_Item_Image_Hash, byte_array_v Atom_Item_Image_Data, ref long Atom_Item_Image_ID) { string Err = null; if (Atom_Item_Image_Hash != null) { List<DBConnectionControl40.SQL_Parameter> lpar = new List<DBConnectionControl40.SQL_Parameter>(); string spar_Item_Image_Hash = "@par_Item_Image_Image_Hash"; DBConnectionControl40.SQL_Parameter par_Item_Image_Hash = new DBConnectionControl40.SQL_Parameter(spar_Item_Image_Hash, DBConnectionControl40.SQL_Parameter.eSQL_Parameter.Varchar, false, Atom_Item_Image_Hash.v); lpar.Add(par_Item_Image_Hash); string sql_select_Atom_Item_Item_Image_Hash_ID = @"select Atom_Item_Image.ID as Atom_Item_Image_ID from Atom_Item_Image inner join Atom_Item_ImageLib on Atom_Item_ImageLib.ID = Atom_Item_Image.Atom_Item_ImageLib_ID where (Atom_Item_ImageLib.Image_Hash = " + spar_Item_Image_Hash + ") and (Atom_Item_Image.Atom_Item_ID = " + Atom_Item_ID.ToString() + ")"; DataTable dt = new DataTable(); if (DBSync.DBSync.ReadDataTable(ref dt, sql_select_Atom_Item_Item_Image_Hash_ID, lpar, ref Err)) { if (dt.Rows.Count > 0) { Atom_Item_Image_ID = (long)dt.Rows[0]["Atom_Item_Image_ID"]; return true; } else { long Atom_Item_ImageLib_ID = -1; string sql_select_Atom_Item_ImageLib_ID = @"select ID as Atom_Item_ImageLib_ID from Atom_Item_ImageLib where Atom_Item_ImageLib.Image_Hash = " + spar_Item_Image_Hash; DataTable dt2 = new DataTable(); object objret = null; if (DBSync.DBSync.ReadDataTable(ref dt2, sql_select_Atom_Item_ImageLib_ID, lpar, ref Err)) { if (dt2.Rows.Count > 0) { Atom_Item_ImageLib_ID = (long)dt2.Rows[0]["Atom_Item_ImageLib_ID"]; } else { string spar_Item_Image_Data = "@par_Item_Image_Image_Data"; DBConnectionControl40.SQL_Parameter par_Item_Image_Data = new DBConnectionControl40.SQL_Parameter(spar_Item_Image_Data, DBConnectionControl40.SQL_Parameter.eSQL_Parameter.Varbinary, false, Atom_Item_Image_Data.v); lpar.Add(par_Item_Image_Data); string sql_Insert_Atom_Item_Item_Image_Hash = @"insert into Atom_Item_ImageLib (Image_Hash,Image_Data)values(" + spar_Item_Image_Hash + "," + spar_Item_Image_Data + ")"; if (!DBSync.DBSync.ExecuteNonQuerySQLReturnID(sql_Insert_Atom_Item_Item_Image_Hash, lpar, ref Atom_Item_ImageLib_ID, ref objret, ref Err, DBtcn.stbl_Atom_Item_ImageLib_TableName)) { LogFile.Error.Show("ERROR:Get_Atom_Item_Image:insert into Atom_Item_ImageLib failed!\r\nErr=" + Err); return false; } } } else { LogFile.Error.Show("ERROR:Get_Atom_Item_Image:select ID as Atom_Item_ImageLib_ID from Atom_Item_ImageLib failed!\r\nErr=" + Err); return false; } string sql_Insert_Atom_Item_Image = @"insert into Atom_Item_Image (Atom_Item_ID,Atom_Item_ImageLib_ID)values(" + Atom_Item_ID.ToString() + "," + Atom_Item_ImageLib_ID.ToString() + ")"; if (!DBSync.DBSync.ExecuteNonQuerySQLReturnID(sql_Insert_Atom_Item_Image, null, ref Atom_Item_Image_ID, ref objret, ref Err, DBtcn.stbl_Atom_Item_Image_TableName)) { LogFile.Error.Show("ERROR:Get_Atom_Item_Image:insert into Atom_Item_ImageLib failed!\r\nErr=" + Err); return false; } return true; } } else { LogFile.Error.Show("ERROR:Get_Atom_Item_Image:select ID as Atom_Item_Image_ID from Atom_Item_Image failed!\r\nErr=" + Err); return false; } } else { return true; } }
//string_v StreetName_v = tf.set_string(Address.StreetName); //string_v HouseNumber_v = tf.set_string(Address.HouseNumber); //string_v ZIP_v = tf.set_string(Address.ZIP); //string_v City_v = tf.set_string(Address.City); //string_v Country_v = tf.set_string(Address.Country); //string_v State_v = tf.set_string(Address.State); //string_v PhoneNumber_v = tf.set_string(PhoneNumber); //string_v FaxNumber_v = tf.set_string(FaxNumber); //string_v Email_v = tf.set_string(Email); //string_v HomePage_v = tf.set_string(HomePage); //string_v Logo_Hash_v = tf.set_string(Logo_Hash); //byte_array_v Logo_Image_Data_v = tf.set_byte_array(Logo); //string_v Logo_Description_v = tf.set_string(Logo_Description); public static bool Get( string_v Organisation_Name_v, string_v Tax_ID_v, string_v Registration_ID_v, string_v OrganisationTYPE_v, PostAddress_v Address_v, string_v PhoneNumber_v, string_v FaxNumber_v, string_v Email_v, string_v HomePage_v, string_v BankName_v, string_v TRR_v, string_v Logo_Hash_v, byte_array_v Logo_Image_Data_v, string_v Logo_Description_v, ref ID_v iD_v) { string Err = null; long_v Atom_Organisation_ID_v = null; long_v Atom_OrganisationData_ID_v = null; if (f_Atom_Organisation.Get( Organisation_Name_v, Tax_ID_v, Registration_ID_v, OrganisationTYPE_v, Address_v, PhoneNumber_v, FaxNumber_v, Email_v, HomePage_v, BankName_v, TRR_v, Logo_Hash_v, Logo_Image_Data_v, Logo_Description_v, ref Atom_Organisation_ID_v, ref Atom_OrganisationData_ID_v )) { DataTable dt = new DataTable(); string sql_select = "select ID from Atom_myOrganisation where Atom_OrganisationData_ID = " + Atom_OrganisationData_ID_v.v.ToString(); if (DBSync.DBSync.ReadDataTable(ref dt, sql_select, null, ref Err)) { if (dt.Rows.Count > 0) { if (iD_v == null) { iD_v = new ID_v(); } iD_v.v = (long)dt.Rows[0]["ID"]; return true; } else { long Atom_myOrganisation_id = -1; string sql_insert = " insert into Atom_myOrganisation (Atom_OrganisationData_ID) values (" + Atom_OrganisationData_ID_v.v.ToString() + ")"; object oret = null; if (DBSync.DBSync.ExecuteNonQuerySQLReturnID(sql_insert, null, ref Atom_myOrganisation_id, ref oret, ref Err, "Atom_myOrganisation")) { if (iD_v == null) { iD_v = new ID_v(); } iD_v.v = Atom_myOrganisation_id; return true; } else { LogFile.Error.Show("ERROR:Insert_Atom_myOrganisation:sql_insert:Err=" + Err); return false; } } } else { LogFile.Error.Show("ERROR:myOrg:Insert_Atom_myOrganisation:sql_select=" + sql_select + "\r\nErr=" + Err); return false; } } else { return false; } }
bool Get_Atom_Warranty(short_v Warranty_WarrantyDurationType, int_v Warranty_WarrantyDuration, string_v Warranty_WarrantyConditions, ref Atom_DocInvoice_ShopC_Item_Price_Stock_Data pias, ref long Atom_Warranty_ID, ref string Err) { string scond_WarrantyDurationType = null; string sv_WarrantyDurationType = null; List<DBConnectionControl40.SQL_Parameter> lpar = new List<DBConnectionControl40.SQL_Parameter>(); if (Warranty_WarrantyDurationType != null) { string spar_WarrantyDurationType = "@par_WarrantyDurationType"; DBConnectionControl40.SQL_Parameter par_WarrantyDurationType = new DBConnectionControl40.SQL_Parameter(spar_WarrantyDurationType, DBConnectionControl40.SQL_Parameter.eSQL_Parameter.Smallint, false, Warranty_WarrantyDurationType.v); lpar.Add(par_WarrantyDurationType); scond_WarrantyDurationType = "(WarrantyDurationType = " + spar_WarrantyDurationType + ")"; sv_WarrantyDurationType = spar_WarrantyDurationType; } else { scond_WarrantyDurationType = "(WarrantyDurationType is null)"; sv_WarrantyDurationType = "null"; } string scond_WarrantyDuration = null; string sv_WarrantyDuration = null; if (Warranty_WarrantyDuration != null) { string spar_WarrantyDuration = "@par_WarrantyDuration"; DBConnectionControl40.SQL_Parameter par_WarrantyDuration = new DBConnectionControl40.SQL_Parameter(spar_WarrantyDuration, DBConnectionControl40.SQL_Parameter.eSQL_Parameter.Int, false, Warranty_WarrantyDuration.v); lpar.Add(par_WarrantyDuration); scond_WarrantyDuration = "(WarrantyDuration = " + spar_WarrantyDuration + ")"; sv_WarrantyDuration = spar_WarrantyDuration; } else { scond_WarrantyDuration = "(WarrantyDuration is null)"; sv_WarrantyDuration = "null"; } string scond_WarrantyConditions = null; string sv_WarrantyConditions = null; if (Warranty_WarrantyConditions != null) { string spar_WarrantyConditions = "@par_WarrantyConditions"; DBConnectionControl40.SQL_Parameter par_WarrantyConditions = new DBConnectionControl40.SQL_Parameter(spar_WarrantyConditions, DBConnectionControl40.SQL_Parameter.eSQL_Parameter.Varchar, false, Warranty_WarrantyConditions.v); lpar.Add(par_WarrantyConditions); scond_WarrantyConditions = "(WarrantyConditions = " + spar_WarrantyConditions + ")"; sv_WarrantyConditions = spar_WarrantyConditions; } else { scond_WarrantyConditions = "(WarrantyConditions is null)"; sv_WarrantyConditions = "null"; } string sql_select_Atom_Warranty_ID = @"select ID as Atom_Warranty_ID from Atom_Warranty where " + scond_WarrantyDurationType + " and " + scond_WarrantyDuration + " and " + scond_WarrantyConditions; DataTable dt = new DataTable(); if (DBSync.DBSync.ReadDataTable(ref dt, sql_select_Atom_Warranty_ID, lpar, ref Err)) { if (dt.Rows.Count > 0) { Atom_Warranty_ID = (long)dt.Rows[0]["Atom_Warranty_ID"]; return true; } else { string sql_Insert_Atom_Warranty = @"insert into Atom_Warranty (WarrantyDurationType, WarrantyDuration, WarrantyConditions)values(" + sv_WarrantyDurationType + "," + sv_WarrantyDuration + "," + sv_WarrantyConditions + ")"; object objret = null; if (DBSync.DBSync.ExecuteNonQuerySQLReturnID(sql_Insert_Atom_Warranty, lpar, ref Atom_Warranty_ID, ref objret, ref Err, DBtcn.stbl_Atom_Warranty_TableName)) { return true; } else { LogFile.Error.Show("ERROR:Get_Atom_Warranty:insert into Atom_Warranty failed!\r\nErr=" + Err); return false; } } } else { LogFile.Error.Show("ERROR:Get_Atom_Warranty:select ID as Atom_Warranty_ID from Atom_Warranty failed!\r\nErr=" + Err); return false; } }
public static bool Get(string_v Logo_Hash_v, byte_array_v Logo_v, string_v Logo_Description_v, ref long_v Atom_Logo_ID_v) { string Err = null; if (Logo_Hash_v == null) { Atom_Logo_ID_v = null; return true; } if (Atom_Logo_ID_v == null) { Atom_Logo_ID_v = new long_v(); } List<SQL_Parameter> lpar = new List<SQL_Parameter>(); string Image_Hash_Value = "null"; string Image_Hash_cond = "Image_Hash is null"; if (Logo_Hash_v != null) { if (Logo_Hash_v.v != null) { Image_Hash_Value = "@par_Image_Hash"; Image_Hash_cond = "Image_Hash = " + Image_Hash_Value; SQL_Parameter par_Image_Hash = new SQL_Parameter(Image_Hash_Value, SQL_Parameter.eSQL_Parameter.Nvarchar, false, Logo_Hash_v.v); lpar.Add(par_Image_Hash); } } string Image_Data_Value = "null"; if (Logo_v != null) { if (Logo_v.v != null) { Image_Data_Value = "@par_Image_Data"; SQL_Parameter par_Image_Data = new SQL_Parameter(Image_Data_Value, SQL_Parameter.eSQL_Parameter.Varbinary, false, Logo_v.v); lpar.Add(par_Image_Data); } } string Description_Value = "null"; string Description_cond = "Description is null"; if (Logo_Description_v != null) { if (Logo_Description_v.v != null) { Description_Value = "@par_Description"; Description_cond = "Description = " + Description_Value; SQL_Parameter par_Description = new SQL_Parameter(Description_Value, SQL_Parameter.eSQL_Parameter.Nvarchar, false, Logo_Description_v.v); lpar.Add(par_Description); } } string sql = " select ID, Image_Hash,Image_Data,Description from Atom_Logo where " + Image_Hash_cond + " and " + Description_cond; DataTable dt = new DataTable(); if (DBSync.DBSync.ReadDataTable(ref dt, sql, lpar, ref Err)) { if (dt.Rows.Count > 0) { Atom_Logo_ID_v.v = (long)dt.Rows[0]["ID"]; return true; } else { sql = " insert into Atom_Logo (Image_Hash,Image_Data,Description) values (" + Image_Hash_Value + "," + Image_Data_Value + "," + Description_Value + ")"; object oRet = null; if (DBSync.DBSync.ExecuteNonQuerySQLReturnID(sql, lpar, ref Atom_Logo_ID_v.v_, ref oRet, ref Err, "Atom_Logo")) { return true; } else { LogFile.Error.Show("ERROR:f_Atom_Logo:sql=" + sql + "\r\nErr=" + Err); return false; } } } else { LogFile.Error.Show("ERROR:f_Atom_Logo:sql=" + sql + "\r\nErr=" + Err); return false; } }
private bool Get_Atom_Item_barcode(string_v Item_barcode, ref long Atom_Item_barcode_ID, ref string Err) { if (Item_barcode != null) { List<DBConnectionControl40.SQL_Parameter> lpar = new List<DBConnectionControl40.SQL_Parameter>(); string spar_barcode = "@par_barcode"; DBConnectionControl40.SQL_Parameter par_barcode = new DBConnectionControl40.SQL_Parameter(spar_barcode, DBConnectionControl40.SQL_Parameter.eSQL_Parameter.Varchar, false, Item_barcode.v); lpar.Add(par_barcode); string sql_select_Atom_Item_barcode_ID = @"select ID as Atom_Item_barcode_ID from Atom_Item_barcode where barcode = " + spar_barcode; DataTable dt = new DataTable(); if (DBSync.DBSync.ReadDataTable(ref dt, sql_select_Atom_Item_barcode_ID, lpar, ref Err)) { if (dt.Rows.Count > 0) { Atom_Item_barcode_ID = (long)dt.Rows[0]["Atom_Item_barcode_ID"]; return true; } else { string sql_Insert_Atom_Item_barcode = @"insert into Atom_Item_barcode (barcode)values(" + spar_barcode + ")"; object objret = null; if (DBSync.DBSync.ExecuteNonQuerySQLReturnID(sql_Insert_Atom_Item_barcode, lpar, ref Atom_Item_barcode_ID, ref objret, ref Err, DBtcn.stbl_Atom_Item_barcode_TableName)) { return true; } else { LogFile.Error.Show("ERROR:Get_Atom_Item_barcode:insert into Atom_Item_barcode failed!\r\nErr=" + Err); return false; } } } else { return false; } } else { Atom_Item_barcode_ID = -1; return true; } }
public static bool InsertDefault() { string[] doc_page_type_A4_Name = new string[] { "A4", "A4" }; string[] doc_page_type_A4_Description = new string[] { "A4", "A4" }; string[] doc_page_type_Roll_80_Name = new string[] { "Roll 80mm", "Rola 80mm" }; string[] doc_page_type_Roll_80_Description = new string[] { "Roll 80mm", "Rola 80mm" }; string[] doc_page_type_Roll_58_Name = new string[] { "Roll 58mm", "Rola 58mm" }; string[] doc_page_type_Roll_58_Description = new string[] { "Roll 58mm", "Rola 58mm" }; string[] doc_type_Html_Invoice_Template_A4_Name = new string[] { "HTML Template Invoice A4", "HTML predloga računi A4" }; string[] doc_type_Html_Invoice_Template_A4_Description = new string[] { "HTML Template Invoice A4", "HTML predloga računi A4" }; string[] doc_type_Html_Proforma_Invoice_Template_A4_Name = new string[] { "HTML Template Proforma Invoice A4", "HTML predloga predračuni" }; string[] doc_type_Html_Proforma_Invoice_Template_A4_Description = new string[] { "HTML Template Proforma Invoice", "HTML predloga predračuni" }; string[] doc_Html_Invoice_Template_A4_Name = new string[] { "English HTML Template Invoice A4", "Slovenska HTML predloga računi A4" }; string[] doc_Html_Invoice_Template_A4_Description = new string[] { "English HTML Template Invoice", "Slovenska HTML predloga računi A4" }; string[] doc_Html_Proforma_Invoice_Template_A4_Name = new string[] { "English HTML Template Proforma Invoice A4", "Slovenska HTML predloga pred računi A4"}; string[] doc_Html_Proforma_Invoice_Template_A4_Description = new string[] { "English HTML Template Proforma Invoice A4", "Slovenska HTML predloga pred računi A4"}; string[] doc_type_Html_Invoice_Template_Roll58_Name = new string[] { "HTML Template Invoice Roll58", "HTML predloga računi Roll58" }; string[] doc_type_Html_Invoice_Template_Roll58_Description = new string[] { "HTML Template Invoice Roll58", "HTML predloga računi Roll58" }; string[] doc_type_Html_Proforma_Invoice_Template_Roll58_Name = new string[] { "HTML Template Proforma Invoice Roll58", "HTML predloga predračuni" }; string[] doc_type_Html_Proforma_Invoice_Template_Roll58_Description = new string[] { "HTML Template Proforma Invoice", "HTML predloga predračuni" }; string[] doc_Html_Invoice_Template_Roll58_Name = new string[] { "English HTML Template Invoice Roll58", "Slovenska HTML predloga računi Roll58" }; string[] doc_Html_Invoice_Template_Roll58_Description = new string[] { "English HTML Template Invoice", "Slovenska HTML predloga računi Roll58" }; string[] doc_Html_Proforma_Invoice_Template_Roll58_Name = new string[] { "English HTML Template Proforma Invoice Roll58", "Slovenska HTML predloga pred računi Roll58" }; string[] doc_Html_Proforma_Invoice_Template_Roll58_Description = new string[] { "English HTML Template Proforma Invoice Roll58", "Slovenska HTML predloga pred računi Roll58" }; string[] doc_type_Html_Invoice_Template_Roll80_Name = new string[] { "HTML Template Invoice Roll80", "HTML predloga računi Roll80" }; string[] doc_type_Html_Invoice_Template_Roll80_Description = new string[] { "HTML Template Invoice Roll80", "HTML predloga računi Roll80" }; string[] doc_type_Html_Proforma_Invoice_Template_Roll80_Name = new string[] { "HTML Template Proforma Invoice Roll80", "HTML predloga predračuni" }; string[] doc_type_Html_Proforma_Invoice_Template_Roll80_Description = new string[] { "HTML Template Proforma Invoice", "HTML predloga predračuni" }; string[] doc_Html_Invoice_Template_Roll80_Name = new string[] { "English HTML Template Invoice Roll80", "Slovenska HTML predloga računi Roll80" }; string[] doc_Html_Invoice_Template_Roll80_Description = new string[] { "English HTML Template Invoice", "Slovenska HTML predloga računi Roll80" }; string[] doc_Html_Proforma_Invoice_Template_Roll80_Name = new string[] { "English HTML Template Proforma Invoice Roll80", "Slovenska HTML predloga pred računi Roll80" }; string[] doc_Html_Proforma_Invoice_Template_Roll80_Description = new string[] { "English HTML Template Proforma Invoice Roll80", "Slovenska HTML predloga pred računi Roll80" }; long[] doc_type_A4_ID = new long[2]; long[] doc_ID_inv = new long[2]; long[] doc_ID_pinv = new long[2]; long[] languageID = new long[2]; long[] doc_page_type_A4_ID = new long[2]; int i =0; for (i = 0; i < LanguageControl.DynSettings.s_language.sTextArr.Length; i++) { if (LanguageControl.DynSettings.s_language.sTextArr[i] != null) { string_v Description_v = new string_v(LanguageControl.DynSettings.s_language.sTextArr[i]); if (f_Language.Get(LanguageControl.DynSettings.s_language.sTextArr[i], Description_v, ref languageID[i])) { long_v Language_ID_v = new long_v(languageID[i]); byte[] xDoc = null; if (i == 0) { byte[] bytes = Encoding.Default.GetBytes(Properties.Resources.htmlt_ENG_inv1_A4); string myString = Encoding.UTF8.GetString(bytes); xDoc = fs.GetBytes(myString); } else { byte[] bytes = Encoding.Default.GetBytes(Properties.Resources.htmlt_SLO_inv1_A4); string myString = Encoding.UTF8.GetString(bytes); xDoc = fs.GetBytes(myString); } long doc_page_type_ID = 0; long doc_type_ID = 0; long doc_ID = 0; if (!Get(Language_ID_v, doc_page_type_A4_Name[i], doc_page_type_A4_Description[i], 210, 297, ref doc_page_type_ID, doc_type_Html_Invoice_Template_A4_Name[i], doc_type_Html_Invoice_Template_A4_Description[i], ref doc_type_ID, doc_Html_Invoice_Template_A4_Name[i], doc_Html_Invoice_Template_A4_Description[i], xDoc, true, true, true, ref doc_ID ) ) { return false; } } else { return false; } } } return true; }