コード例 #1
0
 public Form_myOrg_Person_Edit(long xOffice_ID,NavigationButtons.Navigation xnav)
 {
     InitializeComponent();
     nav = xnav;
     usrc_NavigationButtons1.Init(nav);
     m_Office_ID = xOffice_ID;
     tbl_myOrganisation_Person = new SQLTable(DBSync.DBSync.DB_for_Tangenta.m_DBTables.GetTable(typeof(myOrganisation_Person)));
     lngRPM.s_myOrganisation_Person_Data.Text(this);
     this.Icon = Properties.Resources.Person;
     this.usrc_EditTable1.Title = lngRPM.s_Edit_Office_Data.s;
     string selection = @"  myOrganisation_Person_$_per_$_cfn_$$FirstName,
                             myOrganisation_Person_$_per_$_cln_$$LastName,
                             myOrganisation_Person_$_per_$$DateOfBirth,
                             myOrganisation_Person_$_per_$$Tax_ID,
                             myOrganisation_Person_$_per_$$Registration_ID,
                             myOrganisation_Person_$_office_$_mo_$_orgd_$_org_$$Name,
                             myOrganisation_Person_$_office_$$Name,
                             myOrganisation_Person_$_office_$$ShortName,
                             ID
     ";
     long_v Office_ID_v = null;
     if (m_Office_ID >= 0)
     {
         Office_ID_v = new long_v(m_Office_ID);
     }
     if (usrc_EditTable1.Init(DBSync.DBSync.DB_for_Tangenta.m_DBTables, tbl_myOrganisation_Person, selection, ColumnToOrderBy, false, " where  myOrganisation_Person_$_office_$$ID = " + m_Office_ID.ToString() + " ", null, false,nav))
     {
         usrc_EditTable1.FillInitialData();
     }
     else
     {
         bclose = true;
     }
 }
コード例 #2
0
 public Form_myOrg_Office(NavigationButtons.Navigation xnav)
 {
     InitializeComponent();
     nav = xnav;
     usrc_NavigationButtons1.Init(nav);
     lngRPM.s_Edit_Office_Data.Text(btn_Office_Data_And_FVI_SLO_RealEstateBP);
     if (myOrg.ID_v != null)
     {
         myOrganisation_ID = myOrg.ID_v.v;
         tbl_Office = new SQLTable(DBSync.DBSync.DB_for_Tangenta.m_DBTables.GetTable(typeof(Office)));
         this.Text = lngRPM.s_Edit_Offices.s;
         this.usrc_EditTable1.Title = lngRPM.s_Edit_Offices.s;
         long_v myOrganisation_ID_v = new long_v(myOrganisation_ID);
         string selection = "Office_$$Name,Office_$$ShortName,Office_$_mo_$_orgd_$_org_$$Name,Office_$_mo_$_orgd_$_orgt_$$OrganisationTYPE,Office_$_mo_$_orgd_$_org_$$Tax_ID,ID";
         string where_condition = " where Office_$_mo_$$ID = " + myOrganisation_ID.ToString() + " ";
         if (usrc_EditTable1.Init(DBSync.DBSync.DB_for_Tangenta.m_DBTables, tbl_Office, selection, ColumnToOrderBy, false, null, null, false,nav))
         {
             usrc_EditTable1.FillInitialData();
         }
         else
         {
             bclose = true;
         }
     }
     else
     {
         LogFile.Error.Show("ERROR:Tangenta:Form_myOrg_Offices_Edit():myOrg.ID_v is not defined!");
         bclose = true;
     }
 }
コード例 #3
0
 public Form_ShopC_Item_Edit(CodeTables.DBTableControl xdbTables, SQLTable xtbl, string xColumnOrderBy, long ID, Control xParentControl)
 {
     InitializeComponent();
     dbTables = xdbTables;
     tbl = xtbl;
     ColumnOrderBy = xColumnOrderBy;
     ID_v = new long_v();
     ID_v.v = ID;
     ParentControl = xParentControl;
     if (ParentControl != null)
     {
         if (ParentControl is usrc_StockEditForSelectedStockTake)
         {
             m_usrc_StockEditForSelectedStockTake = (usrc_StockEditForSelectedStockTake)ParentControl;
         }
     }
     this.Text = lngRPM.s_Items.s;
     rdb_OnlyInOffer.Checked = true;
     lngRPM.s_OnlyInOffer.Text(this.rdb_OnlyInOffer);
     lngRPM.s_AllItems.Text(this.rdb_All);
     lngRPM.s_OnlyNotInOffer.Text(this.rdb_OnlyNotInOffer);
     if (nav==null)
     {
         nav = new NavigationButtons.Navigation();
         nav.m_eButtons = NavigationButtons.Navigation.eButtons.OkCancel;
         nav.eExitResult = NavigationButtons.Navigation.eEvent.NOTHING;
         usrc_NavigationButtons1.Init(nav);
     }
 }
コード例 #4
0
        public static bool GetOneFrom_Item_ID(long Item_ID, ref long_v PurchasePrice_Item_ID)
        {
            string Err = null;
            int iLimit = 1;

            string sql = @"select " + DBSync.DBSync.sTop(iLimit) + @"ppi.ID
                            from PurchasePrice_Item  ppi
                            inner join PurchasePrice pp on pp.ID = ppi.PurchasePrice_ID
                            where ppi.Item_ID = " + Item_ID.ToString() + " order by pp.PurchasePriceDate desc " + DBSync.DBSync.sLimit(iLimit);
            DataTable dt = new DataTable();
            if (DBSync.DBSync.ReadDataTable(ref dt, sql, ref Err))
            {
                if (dt.Rows.Count > 0)
                {
                    if (PurchasePrice_Item_ID == null)
                    {
                        PurchasePrice_Item_ID = new long_v();
                    }
                    PurchasePrice_Item_ID.v = (long)dt.Rows[0]["ID"];
                }
                else
                {
                    PurchasePrice_Item_ID = null;
                }
                return true;
            }
            else
            {
                LogFile.Error.Show("ERROR:f_PurchasePrice_Item:GetOneFrom_Item_ID:sql=" + sql + "\r\nErr=" + Err);
                return false;
            }
        }
コード例 #5
0
        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;
            }
        }
コード例 #6
0
 public PersonAccount_EditForm(CodeTables.DBTableControl xdbTables, SQLTable xtbl, string xColumnOrderBy, long ID)
 {
     InitializeComponent();
     dbTables = xdbTables;
     tbl = xtbl;
     ColumnOrderBy = xColumnOrderBy;
     ID_v = new long_v();
     ID_v.v = ID;
     this.Text = lngRPM.s_Items.s;
 }
コード例 #7
0
ファイル: f_cOrgTYPE.cs プロジェクト: dstrucl/Tangenta40
 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;
     }
 }
コード例 #8
0
ファイル: f_Bank.cs プロジェクト: dstrucl/Tangenta40
        public static bool Get(
                long_v Organisation_ID_v,
                ref long_v Bank_ID_v)
        {
            string Err = null;

            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();
            }

            string sql_select = "select ID from Bank where " + Organisation_ID_v_cond;
            DataTable dt = new DataTable();
            if (DBSync.DBSync.ReadDataTable(ref dt, sql_select, null, ref Err))
            {
                if (dt.Rows.Count > 0)
                {
                    if (Bank_ID_v == null)
                    {
                        Bank_ID_v = new long_v();
                    }
                    Bank_ID_v.v = (long)dt.Rows[0]["ID"];
                    return true;
                }
                else
                {
                    string sql_insert = @"insert into Bank (Organisation_ID) values (
                                                                            " + Organisation_ID_v_Value + ")";
                    object oret = null;
                    long Bank_ID = -1;
                    if (DBSync.DBSync.ExecuteNonQuerySQLReturnID(sql_insert, null, ref Bank_ID, ref oret, ref Err, "Bank"))
                    {
                        if (Bank_ID_v == null)
                        {
                            Bank_ID_v = new long_v();
                        }
                        Bank_ID_v.v = Bank_ID;
                        return true;
                    }
                    else
                    {
                        LogFile.Error.Show("ERROR:f_Bank:Get:sql=" + sql_insert + "\r\nErr=" + Err);
                    }
                }
            }
            else
            {
                LogFile.Error.Show("ERROR:f_Bank:Get:sql=" + sql_select + "\r\nErr=" + Err);
            }
            return false;
        }
コード例 #9
0
ファイル: f_cState_Person.cs プロジェクト: dstrucl/Tangenta40
 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;
     }
 }
コード例 #10
0
 public Form_Customer_Person_Edit(CodeTables.DBTableControl xdbTables, SQLTable xtbl, string xColumnOrderBy, long ID)
 {
     InitializeComponent();
     dbTables = xdbTables;
     tbl = xtbl;
     ColumnOrderBy = xColumnOrderBy;
     ID_v = new long_v();
     ID_v.v = ID;
     this.Text = lngRPM.s_Items.s;
     this.usrc_EditTable.Title = xtbl.lngTableName.s;
 }
コード例 #11
0
 public Form_PersonData_Edit(CodeTables.DBTableControl xdbTables, SQLTable xtbl, string xColumnOrderBy, long ID, NavigationButtons.Navigation xnav)
 {
     InitializeComponent();
     nav = xnav;
     dbTables = xdbTables;
     tbl = xtbl;
     ColumnOrderBy = xColumnOrderBy;
     ID_v = new long_v();
     ID_v.v = ID;
     this.Text = lngRPM.s_Items.s;
 }
コード例 #12
0
ファイル: Form_Templates.cs プロジェクト: dstrucl/Tangenta40
 public Form_Templates(CodeTables.DBTableControl xdbTables, SQLTable xtbl, string xColumnOrderBy, long ID, NavigationButtons.Navigation xnav)
 {
     InitializeComponent();
     nav = xnav;
     dbTables = xdbTables;
     tbl = xtbl;
     ColumnOrderBy = xColumnOrderBy;
     ID_v = new long_v();
     ID_v.v = ID;
     this.Text = lngRPM.s_Items.s;
     rdb_OnlyInOffer.Checked = true;
     this.rdb_OnlyInOffer.Text = lngRPM.s_OnlyInOffer.s;
     this.rdb_All.Text = lngRPM.s_AllItems.s;
     this.rdb_OnlyNotInOffer.Text = lngRPM.s_OnlyNotInOffer.s;
 }
コード例 #13
0
ファイル: f_JOURNAL_Stock.cs プロジェクト: dstrucl/Tangenta40
        public static bool Get(long Stock_id, long stock_type_id, DateTime dEventTime, decimal dQuantity, ref long_v JOURNAL_Stock_ID)
        {
            List<SQL_Parameter> lpar = new List<SQL_Parameter>();
            string spar_JOURNAL_Stock_Type_ID = "@par_JOURNAL_Stock_Type_ID";
            SQL_Parameter par_JOURNAL_Stock_Type_ID = new SQL_Parameter(spar_JOURNAL_Stock_Type_ID, SQL_Parameter.eSQL_Parameter.Bigint, false, stock_type_id);
            lpar.Add(par_JOURNAL_Stock_Type_ID);

            string spar_Stock_ID = "@par_Stock_ID";
            SQL_Parameter par_Stock_ID = new SQL_Parameter(spar_Stock_ID, SQL_Parameter.eSQL_Parameter.Bigint, false, Stock_id);
            lpar.Add(par_Stock_ID);

            string spar_EventTime = "@par_EventTime";
            SQL_Parameter par_EventTime = new SQL_Parameter(spar_EventTime, SQL_Parameter.eSQL_Parameter.Datetime, false, dEventTime);
            lpar.Add(par_EventTime);

            long Atom_WorkPeriod_id = GlobalData.Atom_WorkPeriod_ID;
            string spar_Atom_WorkPeriod_ID = "@par_Atom_WorkPeriod_ID";
            SQL_Parameter par_Atom_WorkPeriod_ID = new SQL_Parameter(spar_Atom_WorkPeriod_ID, SQL_Parameter.eSQL_Parameter.Bigint, false, Atom_WorkPeriod_id);
            lpar.Add(par_Atom_WorkPeriod_ID);

            string spar_dQuantity = "@par_dQuantity";
            SQL_Parameter par_dQuantity = new SQL_Parameter(spar_dQuantity, SQL_Parameter.eSQL_Parameter.Decimal, false, dQuantity);
            lpar.Add(par_dQuantity);

            string table_name = "JOURNAL_Stock";
            string sql = "insert into " + table_name + " (JOURNAL_Stock_Type_ID,Stock_ID,EventTime,Atom_WorkPeriod_ID,dQuantity)values(" + spar_JOURNAL_Stock_Type_ID + "," + spar_Stock_ID + "," + spar_EventTime + "," + spar_Atom_WorkPeriod_ID + "," + spar_dQuantity + ")";
            long id = -1;
            object oret = null;
            string Err = null;
            if (DBSync.DBSync.ExecuteNonQuerySQLReturnID(sql, lpar, ref id, ref oret, ref Err, table_name))
            {
                if (JOURNAL_Stock_ID == null)
                {
                    JOURNAL_Stock_ID = new long_v();
                }
                JOURNAL_Stock_ID.v = id;
                return true;
            }
            else
            {
                LogFile.Error.Show("ERROR:f_JOURNAL_Stock:Get:sql=" + sql + "\r\nErr=" + Err);
                return false;
            }
        }
コード例 #14
0
ファイル: f_doc.cs プロジェクト: dstrucl/Tangenta40
 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;
 }
コード例 #15
0
        public static bool Get(long myOrganisation_id, ref List<myOrg_Office> myOrg_Office_list)
        {
            DataTable dt = new DataTable();
            myOrg_Office_list.Clear();
            string sql = null;
            sql = @"select
                        ID
                        FROM Office where myOrganisation_ID = " + myOrganisation_id.ToString();

            string Err = null;
            if (DBSync.DBSync.ReadDataTable(ref dt, sql, ref Err))
            {
                if (dt.Rows.Count > 0)
                {
                    int i = 0;
                    int iCount = dt.Rows.Count;
                    for (i = 0; i < iCount; i++)
                    {
                        DataRow dr = dt.Rows[i];
                        long Office_ID = (long)dr["ID"];
                        myOrg_Office moffice = new myOrg_Office();
                        long_v Office_ID_v = new long_v(Office_ID);

                        if (moffice.Get(Office_ID_v))
                        {
                            myOrg_Office_list.Add(moffice);
                        }
                    }
                }
                return true;
            }
            else
            {
                LogFile.Error.Show("ERROR:TangentaDB:myOrg_Office_List:Get:sql=" + sql + "\r\nErr=" + Err);
                return false;
            }
        }
コード例 #16
0
ファイル: CurrentInvoice.cs プロジェクト: dstrucl/Tangenta40
 public bool Update_Customer_Remove()
 {
     string sql = "update DocInvoice set Atom_Customer_Org_ID = null,Atom_Customer_Person_ID = null where ID = " + this.Doc_ID.ToString();
     string Err = null;
     object ores = null;
     if (DBSync.DBSync.ExecuteNonQuerySQL(sql, null, ref ores, ref Err))
     {
         this.Atom_Customer_Org_ID_v = null;
         this.Atom_Customer_Person_ID_v = null;
         return true;
     }
     else
     {
         LogFile.Error.Show("ERROR:CurrentInvoice:Update_Customer_Remove:\r\nsql=" + sql + "\r\nErr=" + Err);
         return false;
     }
 }
コード例 #17
0
ファイル: CurrentInvoice.cs プロジェクト: dstrucl/Tangenta40
 public bool Update_Customer_Person(string DocInvoice, long Customer_Person_ID, ref long_v xAtom_Customer_Person_ID_v)
 {
     if (f_Atom_Customer_Person.Get(Customer_Person_ID, ref xAtom_Customer_Person_ID_v))
     {
         if (xAtom_Customer_Person_ID_v != null)
         {
             string sql = "update "+DocInvoice+" set Atom_Customer_Person_ID = " + xAtom_Customer_Person_ID_v.v.ToString() + ",Atom_Customer_Org_ID = null where ID = " + this.Doc_ID.ToString();
             string Err = null;
             object ores = null;
             if (DBSync.DBSync.ExecuteNonQuerySQL(sql, null, ref ores, ref Err))
             {
                 if (Atom_Customer_Person_ID_v == null)
                 {
                     Atom_Customer_Person_ID_v = new long_v();
                 }
                 Atom_Customer_Person_ID_v.v = xAtom_Customer_Person_ID_v.v;
                 Atom_Customer_Org_ID_v = null;
                 return true;
             }
             else
             {
                 LogFile.Error.Show("ERROR:CurrentInvoice:Update_Customer_Person:\r\nsql=" + sql + "\r\nErr=" + Err);
             }
         }
     }
     return false;
 }
コード例 #18
0
ファイル: CurrentInvoice.cs プロジェクト: dstrucl/Tangenta40
        public bool Storno(ref long Storno_DocInvoice_ID,  bool bStorno, string sReason,ref  DateTime retissue_time)
        {
            object ores = null;
            string Err = null;
            DataTable dt_ProfInv = new DataTable();
            string sql = @"select
                        Draft,
                        DraftNumber,
                        FinancialYear,
                        NumberInFinancialYear,
                        NetSum,
                        Discount,
                        EndSum,
                        TaxSum,
                        GrossSum,
                        Atom_Customer_Person_ID,
                        Atom_Customer_Org_ID,
                        WarrantyExist,
                        WarrantyConditions,
                        WarrantyDurationType,
                        WarrantyDuration,
                        DocDuration,
                        DocDurationType,
                        TermsOfPayment_ID,
                        PaymentDeadline,
                        MethodOfPayment_ID
                        Paid,
                        Storno,
                        Invoice_Reference_ID,
                        Invoice_Reference_Type from DocInvoice where DocInvoice.ID  = " + Doc_ID.ToString();
            if (DBSync.DBSync.ReadDataTable(ref dt_ProfInv, sql, ref Err))
            {
                int_v DraftNumber_v = tf.set_int(dt_ProfInv.Rows[0]["DraftNumber"]);
                int_v FinancialYear_v = tf.set_int(dt_ProfInv.Rows[0]["FinancialYear"]);
                decimal_v NetSum_v = tf.set_decimal(dt_ProfInv.Rows[0]["NetSum"]);
                decimal_v Discount_v = tf.set_decimal(dt_ProfInv.Rows[0]["Discount"]);
                decimal_v EndSum_v = tf.set_decimal(dt_ProfInv.Rows[0]["EndSum"]);
                decimal_v TaxSum_v = tf.set_decimal(dt_ProfInv.Rows[0]["TaxSum"]);
                decimal_v GrossSum_v = tf.set_decimal(dt_ProfInv.Rows[0]["GrossSum"]);
                long_v Atom_Customer_Person_ID_v = tf.set_long(dt_ProfInv.Rows[0]["Atom_Customer_Person_ID"]);
                long_v Atom_Customer_Org_ID_v = tf.set_long(dt_ProfInv.Rows[0]["Atom_Customer_Org_ID"]);
                bool_v WarrantyExist_v = tf.set_bool(dt_ProfInv.Rows[0]["WarrantyExist"]);
                string_v WarrantyConditions_v = tf.set_string(dt_ProfInv.Rows[0]["WarrantyConditions"]);
                int_v WarrantyDurationType_v = tf.set_int(dt_ProfInv.Rows[0]["WarrantyDurationType"]);
                int_v WarrantyDuration_v = tf.set_int(dt_ProfInv.Rows[0]["WarrantyDuration"]);
                long_v DocDuration_v = tf.set_long(dt_ProfInv.Rows[0]["DocDuration"]);
                int_v DocDurationType_v = tf.set_int(dt_ProfInv.Rows[0]["DocDurationType"]);
                long_v TermsOfPayment_ID_v = tf.set_long(dt_ProfInv.Rows[0]["TermsOfPayment_ID"]);
                int iNewNumberInFinancialYear = -1;
                GetNewNumberInFinancialYear(ref iNewNumberInFinancialYear);
                int_v iNewNumberInFinancialYear_v = new int_v(iNewNumberInFinancialYear);

                long_v Storno_Invoice_ID_v = new long_v(Doc_ID);

                NetSum_v.v = -NetSum_v.v;
                TaxSum_v.v = -TaxSum_v.v;
                GrossSum_v.v = -GrossSum_v.v;

                List<SQL_Parameter> lpar = new List<SQL_Parameter>();
                sql = @"insert into DocInvoice (
                                                Draft,
                                                DraftNumber,
                                                FinancialYear,
                                                NumberInFinancialYear,
                                                NetSum,
                                                Discount,
                                                EndSum,
                                                TaxSum,
                                                GrossSum,
                                                Atom_Customer_Person_ID,
                                                Atom_Customer_Org_ID,
                                                WarrantyExist,
                                                WarrantyConditions,
                                                WarrantyDurationType,
                                                WarrantyDuration,
                                                DocDuration,
                                                DocDurationType,
                                                TermsOfPayment_ID,
                                                Invoice_Reference_ID,
                                                Storno,
                                                Invoice_Reference_Type
                                                )
                                                values
                                                (
                                                    0,"
                                                            + GetParam("DraftNumber", ref lpar, DraftNumber_v) + ","
                                                            + GetParam("FinancialYear", ref lpar, FinancialYear_v) + ","
                                                            + GetParam("NumberInFinancialYear", ref lpar, iNewNumberInFinancialYear_v) + ","
                                                            + GetParam("NetSum", ref lpar, NetSum_v) + ","
                                                            + GetParam("Discount", ref lpar, Discount_v) + ","
                                                            + GetParam("EndSum", ref lpar, EndSum_v) + ","
                                                            + GetParam("TaxSum", ref lpar, TaxSum_v) + ","
                                                            + GetParam("GrossSum", ref lpar, GrossSum_v) + ","
                                                            + GetParam("Atom_Customer_Person_ID", ref lpar, Atom_Customer_Person_ID_v) + ","
                                                            + GetParam("Atom_Customer_Org_ID", ref lpar, Atom_Customer_Org_ID_v) + ","
                                                            + GetParam("WarrantyExist", ref lpar, WarrantyExist_v) + ","
                                                            + GetParam("WarrantyConditions", ref lpar, WarrantyConditions_v) + ","
                                                            + GetParam("WarrantyDurationType", ref lpar, WarrantyDurationType_v) + ","
                                                            + GetParam("WarrantyDuration", ref lpar, WarrantyDuration_v) + ","
                                                            + GetParam("DocDuration", ref lpar, DocDuration_v) + ","
                                                            + GetParam("DocDurationType", ref lpar, DocDurationType_v) + ","
                                                            + GetParam("TermsOfPayment_ID", ref lpar, TermsOfPayment_ID_v) + ","
                                                            + GetParam("Invoice_Reference_ID", ref lpar, Storno_Invoice_ID_v) + @",
                                                            1,
                                                            'STORNO'
                                                            )";

                        if (DBSync.DBSync.ExecuteNonQuerySQLReturnID(sql, lpar, ref Storno_DocInvoice_ID, ref ores, ref Err, "DocInvoice"))
                        {
                            string sBit = "0";
                            if (bStorno)
                            {
                                sBit = "1";
                            }
                            sql = " update Docinvoice set Storno  = " + sBit + @",
                                                   Invoice_Reference_ID = " + Storno_DocInvoice_ID.ToString() + @",
                                                   Invoice_Reference_Type = 'STORNO' where ID = " + this.Doc_ID.ToString();

                        if (DBSync.DBSync.ExecuteNonQuerySQL(sql, null, ref ores, ref Err))
                        {
                            long Journal_DocInvoice_ID = -1;
                            DateTime_v issue_time = new DateTime_v(DateTime.Now);

                            retissue_time = issue_time.v;

                            if (f_Journal_DocInvoice.Write(Storno_DocInvoice_ID, GlobalData.Atom_WorkPeriod_ID, GlobalData.JOURNAL_DocInvoice_Type_definitions.InvoiceStornoTime.ID, issue_time, ref Journal_DocInvoice_ID))
                            {
                                  return true;
                            }
                            return false;
                        }
                        else
                        {
                            LogFile.Error.Show("ERROR:CurrentInvoice:Storno:sql=" + sql + "\r\nErr=" + Err);
                            return false;
                        }
                    }
                    else
                    {
                        LogFile.Error.Show("ERROR:CurrentInvoice:Storno:sql=" + sql + "\r\nErr=" + Err);
                        return false;
                    }
                }
                else
                {
                    LogFile.Error.Show("ERROR:CurrentInvoice:Storno:sql=" + sql + "\r\nErr=" + Err);
                    return false;
                }
        }
コード例 #19
0
ファイル: CurrentInvoice.cs プロジェクト: dstrucl/Tangenta40
        public void Set_SelectedShopB_Items(string DocInvoice,DataGridView dgv_SelectedSimpleItems,
                                           DataTable dt_SelectedSimpleItem,
                                           DataGridView dgv_SimpleItem,
                                           DataTable dt_SimpleItems)
        {
            long Atom_SimpleItem_ID;
            long DocInvoice_ShopB_Item_DocInvoice_ID;
            long DocInvoice_ShopB_Item_SimpleItem_ID;
            long DocInvoice_ShopB_Item_Atom_SimpleItem_Name_ID;
            long_v DocInvoice_ShopB_Item_Atom_SimpleItem_Image_ID_v;
            long DocInvoice_ShopB_Item_Atom_Taxation_ID;
            int DocInvoice_ShopB_Item_Quantity;
            string DocInvoice_ShopB_Item_Atom_SimpleItem_Atom_SimpleItem_Name;
            string DocInvoice_ShopB_Item_Atom_SimpleItem_Atom_SimpleItem_Abbreviation;
            decimal DocInvoice_ShopB_Item_RetailSimpleItemPrice;
            decimal DocInvoice_ShopB_Item_Discount;
            string DocInvoice_ShopB_Item_Atom_Taxation_Name;
            decimal DocInvoice_ShopB_Item_Atom_Taxation_Rate;
            decimal DocInvoice_ShopB_Item_TaxPrice;
            decimal DocInvoice_ShopB_Item_RetailSimpleItemPriceWithDiscount;
            decimal DocInvoice_ShopB_Item_PriceWithoutTax;
            decimal DocInvoice_ShopB_Item_ExtraDiscount;
            dt_SelectedSimpleItem.Clear();
            foreach (DataRow drsa in dtCurrent_Atom_Price_ShopBItem.Rows)
            {
                Atom_SimpleItem_ID = (long)drsa["ID"];
                DocInvoice_ShopB_Item_DocInvoice_ID = (long)drsa[DocInvoice+"_ID"];
                DocInvoice_ShopB_Item_SimpleItem_ID = (long)drsa["SimpleItem_ID"];
                DocInvoice_ShopB_Item_Atom_SimpleItem_Name_ID = (long)drsa["Atom_SimpleItem_Name_ID"];
                if (drsa["Atom_SimpleItem_Image_ID"] is long)
                {
                    DocInvoice_ShopB_Item_Atom_SimpleItem_Image_ID_v = new long_v();
                    DocInvoice_ShopB_Item_Atom_SimpleItem_Image_ID_v.v = (long)drsa["Atom_SimpleItem_Image_ID"];
                }
                else
                {
                    DocInvoice_ShopB_Item_Atom_SimpleItem_Image_ID_v = null;
                }
                DocInvoice_ShopB_Item_Atom_Taxation_ID = (long)drsa["Atom_Taxation_ID"];
                DocInvoice_ShopB_Item_Quantity = (int)drsa["iQuantity"];
                DocInvoice_ShopB_Item_Atom_SimpleItem_Atom_SimpleItem_Name = (string)drsa["Name"];
                DocInvoice_ShopB_Item_Atom_SimpleItem_Atom_SimpleItem_Abbreviation = (string)drsa["Abbreviation"];
                DocInvoice_ShopB_Item_RetailSimpleItemPrice = (decimal)drsa["RetailSimpleItemPrice"];
                DocInvoice_ShopB_Item_Discount = (decimal)drsa["Discount"];
                DocInvoice_ShopB_Item_ExtraDiscount = (decimal)drsa["ExtraDiscount"];
                DocInvoice_ShopB_Item_Atom_Taxation_Name = (string)drsa["Atom_Taxation_Name"];
                DocInvoice_ShopB_Item_Atom_Taxation_Rate = (decimal)drsa["Atom_Taxation_Rate"];
                DocInvoice_ShopB_Item_TaxPrice = (decimal)drsa["TaxPrice"];
                DocInvoice_ShopB_Item_RetailSimpleItemPriceWithDiscount = (decimal)drsa["RetailSimpleItemPriceWithDiscount"];

                DocInvoice_ShopB_Item_PriceWithoutTax = DocInvoice_ShopB_Item_RetailSimpleItemPriceWithDiscount - DocInvoice_ShopB_Item_TaxPrice;

                DataRow dr = dt_SelectedSimpleItem.NewRow();
                dr[DBtcn.column_SelectedShopBItem_dt_ShopBItem_Index] = Find_dt_SimpleItem_Index(dt_SimpleItems, DocInvoice_ShopB_Item_SimpleItem_ID);
                dr[DBtcn.column_Selected_Atom_Price_ShopBItem_ID] = Atom_SimpleItem_ID;
                dr[DBtcn.column_SelectedShopBItem_ShopBItem_ID] = DocInvoice_ShopB_Item_SimpleItem_ID;
                dr[DBtcn.column_SelectedShopBItem_Count] = DocInvoice_ShopB_Item_Quantity;
                dr[DBtcn.column_SelectedShopBItemName] = DocInvoice_ShopB_Item_Atom_SimpleItem_Atom_SimpleItem_Name;
                dr[DBtcn.column_SelectedShopBItemPriceWithoutTax] = DocInvoice_ShopB_Item_PriceWithoutTax;
                dr[DBtcn.column_SelectedShopBItemPriceTax] = DocInvoice_ShopB_Item_TaxPrice;
                dr[DBtcn.column_SelectedShopBItem_TaxName] = DocInvoice_ShopB_Item_Atom_Taxation_Name;
                dr[DBtcn.column_SelectedShopBItem_TaxRate] = DocInvoice_ShopB_Item_Atom_Taxation_Rate;
                dr[DBtcn.column_SelectedShopBItem_ExtraDiscount] = DocInvoice_ShopB_Item_ExtraDiscount;
                dr[DBtcn.column_SelectedShopBItemPrice] = DocInvoice_ShopB_Item_RetailSimpleItemPriceWithDiscount;
                dt_SelectedSimpleItem.Rows.Add(dr);
                int index = dt_SelectedSimpleItem.Rows.IndexOf(dr);
                if (DocInvoice_ShopB_Item_ExtraDiscount != 0)
                {
                    try
                    {
                        dgv_SelectedSimpleItems.Rows[index].Cells["btn_discount"].Value = DocInvoice_ShopB_Item_ExtraDiscount;
                    }
                    catch
                    {
                        dgv_SelectedSimpleItems.Rows[index].Cells["SelectedSimpleItem_ExtraDiscount"].Value = DocInvoice_ShopB_Item_ExtraDiscount;
                    }
                }
            }
            m_InvoiceDB.Set_dgv_selected_ShopB_Items_Columns(dgv_SelectedSimpleItems);
        }
コード例 #20
0
        public static bool Get(GlobalData.ePaymentType ePaymentType,
                              long_v BankAccount_ID_v,
                              ref long MethodOfPayment_ID)
        {
            string sPaymentType = null;
            MethodOfPayment_ID = -1;

            sPaymentType = GlobalData.Get_sPaymentType(ePaymentType);

            List<SQL_Parameter> lpar = new List<SQL_Parameter>();
            string Err = null;
            DataTable dt = new DataTable();

            string scond_PaymentType = " PaymentType is null ";
            string sval_PaymentType = " null ";

            string scond_Atom_BankAccount_ID = " Atom_BankAccount_ID is null ";
            string sval_Atom_BankAccount_ID = " null ";

            string spar_PaymentType = "@par_PaymentType";
            SQL_Parameter par_PaymentType = new SQL_Parameter(spar_PaymentType, SQL_Parameter.eSQL_Parameter.Nvarchar, false, sPaymentType);
            lpar.Add(par_PaymentType);
            scond_PaymentType = " PaymentType = " + spar_PaymentType;
            sval_PaymentType = " " + spar_PaymentType + " ";

            string spar_Atom_BankAccount_ID = "@par_Atom_BankAccount_ID";
            if (BankAccount_ID_v != null)
            {
                SQL_Parameter par_Atom_BankAccount_ID = new SQL_Parameter(spar_Atom_BankAccount_ID, SQL_Parameter.eSQL_Parameter.Bigint, false, BankAccount_ID_v.v);
                lpar.Add(par_Atom_BankAccount_ID);
                scond_Atom_BankAccount_ID = " Atom_BankAccount_ID = " + spar_Atom_BankAccount_ID;
                sval_Atom_BankAccount_ID = " " + spar_Atom_BankAccount_ID + " ";
            }

            string sql = " select ID from MethodOfPayment where " + scond_PaymentType + " and " + scond_Atom_BankAccount_ID;
            if (DBSync.DBSync.ReadDataTable(ref dt, sql, lpar, ref Err))
            {
                if (dt.Rows.Count > 0)
                {
                    MethodOfPayment_ID = (long)dt.Rows[0]["ID"];
                    return true;
                }
                else
                {

                    sql = @" insert into  MethodOfPayment (PaymentType,Atom_BankAccount_ID) values
                                                    (" + sval_PaymentType +","+ sval_Atom_BankAccount_ID + ")";
                    object oret = null;
                    if (DBSync.DBSync.ExecuteNonQuerySQLReturnID(sql, lpar, ref MethodOfPayment_ID, ref oret, ref Err, "MethodOfPayment"))
                    {
                        return true;
                    }
                    else
                    {
                        LogFile.Error.Show("ERROR:f_MethodOfPayment:Get:sql=" + sql + "\r\nErr=" + Err);
                        return false;
                    }
                }
            }
            else
            {
                LogFile.Error.Show("ERROR:f_MethodOfPayment:Get:sql=" + sql + "\r\nErr=" + Err);
                return false;
            }
        }
コード例 #21
0
ファイル: f_BankAccount.cs プロジェクト: dstrucl/Tangenta40
        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;
        }
コード例 #22
0
ファイル: myOrg_Office.cs プロジェクト: dstrucl/Tangenta40
        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;
            }
        }
コード例 #23
0
 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;
     }
 }
コード例 #24
0
 private static bool Find_Name_Abbreviation_ShopBItem_Image(long SimpleItem_ID, ref string Name,ref string Abbreviation, ref long_v SimpleItem_Image_id)
 {
     string Err = null;
     DataTable dt = new DataTable();
     string sql = "select Name,Abbreviation,SimpleItem_Image_ID from SimpleItem where ID = " + SimpleItem_ID.ToString();
     if (DBSync.DBSync.ReadDataTable(ref dt, sql, ref Err))
     {
         if (dt.Rows.Count > 0)
         {
             object oAtom_SimpleItem_ID = dt.Rows[0]["SimpleItem_Image_ID"];
             if (oAtom_SimpleItem_ID.GetType() == typeof(long))
             {
                 SimpleItem_Image_id = new long_v();
                 SimpleItem_Image_id.v = (long)oAtom_SimpleItem_ID;
             }
             Name = (string)dt.Rows[0]["Name"];
             Abbreviation = (string)dt.Rows[0]["Abbreviation"];
             return true;
         }
         else
         {
             LogFile.Error.Show("ERROR:f_Atom_SimpleItem:Find_SimpleItem_Image:No SimpleItem_Image Data for SimpleItem.ID = " + SimpleItem_ID.ToString());
             return false;
         }
     }
     else
     {
         LogFile.Error.Show("ERROR:f_Atom_SimpleItem:Find_SimpleItem_Image:Err = " + Err);
         return false;
     }
 }
コード例 #25
0
ファイル: f_Expiry.cs プロジェクト: dstrucl/Tangenta40
        public static bool Get(Expiry_v expiry_v,ref long_v Expiry_ID_v)
        {
            if (expiry_v != null)
            {
                List<SQL_Parameter> lpar = new List<SQL_Parameter>();
                string Err = null;
                DataTable dt = new DataTable();

                string scond_ExpiryDescription = " ExpiryDescription is null ";
                string sval_ExpiryDescription = " null ";

                if (expiry_v.ExpiryDescription != null)
                {
                    string spar_ExpiryDescription = "@par_ExpiryDescription";
                    SQL_Parameter par_ExpiryDescription = new SQL_Parameter(spar_ExpiryDescription, SQL_Parameter.eSQL_Parameter.Nvarchar,false, expiry_v.ExpiryDescription);
                    lpar.Add(par_ExpiryDescription);
                    scond_ExpiryDescription = " ExpiryDescription = "+ spar_ExpiryDescription;
                    sval_ExpiryDescription = " " + spar_ExpiryDescription + " ";
                }

                string sql = " select ID from Expiry where ExpectedShelfLifeInDays = " + expiry_v.ExpectedShelfLifeInDays.ToString() +
                                                           " and SaleBeforeExpiryDateInDays = " + expiry_v.SaleBeforeExpiryDateInDays.ToString() +
                                                           " and DiscardBeforeExpiryDateInDays = " + expiry_v.DiscardBeforeExpiryDateInDays.ToString() +
                                                           " and " + scond_ExpiryDescription;
                if (DBSync.DBSync.ReadDataTable(ref dt, sql, lpar, ref Err))
                {
                    if (dt.Rows.Count > 0)
                    {
                        if (Expiry_ID_v == null)
                        {
                            Expiry_ID_v = new long_v();
                        }
                        Expiry_ID_v.v = (long)dt.Rows[0]["ID"];
                        return true;
                    }
                    else
                    {

                        sql = @" insert into  Expiry (ExpectedShelfLifeInDays,
                                                      SaleBeforeExpiryDateInDays,
                                                      DiscardBeforeExpiryDateInDays,
                                                      ExpiryDescription) values
                                                      (" + expiry_v.ExpectedShelfLifeInDays.ToString() + ","
                                                         + expiry_v.SaleBeforeExpiryDateInDays.ToString() + ","
                                                         + expiry_v.DiscardBeforeExpiryDateInDays.ToString() + ","
                                                         + sval_ExpiryDescription + ")";
                        long Expiry_ID = -1;
                        object oret = null;
                        if (DBSync.DBSync.ExecuteNonQuerySQLReturnID(sql, lpar, ref Expiry_ID, ref oret, ref Err, "Expiry"))
                        {
                            if (Expiry_ID_v == null)
                            {
                                Expiry_ID_v = new long_v();
                            }
                            Expiry_ID_v.v = Expiry_ID;
                            return true;
                        }
                        else
                        {
                            LogFile.Error.Show("ERROR:f_Expiry:Get:sql=" + sql + "\r\nErr=" + Err);
                            return false;
                        }
                    }
                }
                else
                {
                    LogFile.Error.Show("ERROR:f_Expiry:Get:sql=" + sql + "\r\nErr=" + Err);
                    return false;
                }
            }
            else
            {
                Expiry_ID_v = null;
                return true;
            }
        }
コード例 #26
0
        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;
        }
コード例 #27
0
        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;
            }
        }
コード例 #28
0
ファイル: f_Atom_Logo.cs プロジェクト: dstrucl/Tangenta40
        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;
            }
        }
コード例 #29
0
ファイル: f_doc.cs プロジェクト: dstrucl/Tangenta40
        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;
            }
        }
コード例 #30
0
ファイル: f_doc.cs プロジェクト: dstrucl/Tangenta40
        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;
        }