Exemple #1
0
 public CurrentInvoice(ShopABC xInvoiceDB, DBTablesAndColumnNames xDBtcn)
 {
     m_InvoiceDB = xInvoiceDB;
     DBtcn = xDBtcn;
     FinancialYear = DateTime.Now.Year;
     NumberInFinancialYear = 1;
     Doc_ID = -1;
 }
Exemple #2
0
 public ShopABC(DBTablesAndColumnNames xDBtcn)
 {
     m_CurrentInvoice = new CurrentInvoice(this, xDBtcn);
     td = DBSync.DBSync.DB_for_Tangenta.mt;
     DBtcn = xDBtcn;
 }
Exemple #3
0
        public static bool Init_DB_SimpleItem(ref string Err)
        {
            DBTablesAndColumnNames DBtcn = new DBTablesAndColumnNames();
            string s_SimpleItem_Image_table_name = DBSync.DBSync.DB_for_Tangenta.m_DBTables.GetTable(typeof(TangentaTableClass.SimpleItem_Image)).TableName;
            string s_SimpleItem_table_name = DBSync.DBSync.DB_for_Tangenta.m_DBTables.GetTable(typeof(TangentaTableClass.SimpleItem)).TableName;
            string s_Image_Hash = DBSync.DBSync.DB_for_Tangenta.m_DBTables.GetTable(typeof(TangentaTableClass.SimpleItem_Image)).FindColumn(DBSync.DBSync.DB_for_Tangenta.mt.m_SimpleItem_Image.Image_Hash.GetType()).Name;
            string s_Image_Data = DBSync.DBSync.DB_for_Tangenta.m_DBTables.GetTable(typeof(TangentaTableClass.SimpleItem_Image)).FindColumn(DBSync.DBSync.DB_for_Tangenta.mt.m_SimpleItem_Image.Image_Data.GetType()).Name;
            string s_col_Name = DBSync.DBSync.DB_for_Tangenta.m_DBTables.GetTable(typeof(TangentaTableClass.SimpleItem)).FindColumn(DBSync.DBSync.DB_for_Tangenta.mt.m_SimpleItem.Name.GetType()).Name;
            string s_col_Code = DBSync.DBSync.DB_for_Tangenta.m_DBTables.GetTable(typeof(TangentaTableClass.SimpleItem)).FindColumn(DBSync.DBSync.DB_for_Tangenta.mt.m_SimpleItem.Code.GetType()).Name;
            string s_col_Abbreviation = DBSync.DBSync.DB_for_Tangenta.m_DBTables.GetTable(typeof(TangentaTableClass.SimpleItem)).FindColumn(DBSync.DBSync.DB_for_Tangenta.mt.m_SimpleItem.Abbreviation.GetType()).Name;
            string s_col_SimpleItemImage_ID = DBSync.DBSync.DB_for_Tangenta.m_DBTables.GetTable(typeof(TangentaTableClass.SimpleItem)).FindColumn(DBSync.DBSync.DB_for_Tangenta.mt.m_SimpleItem.m_SimpleItem_Image.GetType()).Name;
            string s_col_ToOffer = DBSync.DBSync.DB_for_Tangenta.m_DBTables.GetTable(typeof(TangentaTableClass.SimpleItem)).FindColumn(DBSync.DBSync.DB_for_Tangenta.mt.m_SimpleItem.ToOffer.GetType()).Name;

            foreach (TangentaTableClass.Price_SimpleItem pl_SimpleItem in m_List_Price_SimpleItem)
            {
                List<DBConnectionControl40.SQL_Parameter> lsql_par = null;
                Byte[] Image_Data = null;
                string Image_Hash = "null";
                if (pl_SimpleItem.m_SimpleItem.Abbreviation.val.Equals("PED"))
                {
                    lsql_par = new List<DBConnectionControl40.SQL_Parameter>();
                    //Image_Data = ImageToByte2(Properties.Resources.Pedikira);
                    Image_Hash = DBtypesFunc.GetHash_SHA1(Image_Data);
                    DBConnectionControl40.SQL_Parameter sql_par = new DBConnectionControl40.SQL_Parameter("@image", SQL_Parameter.eSQL_Parameter.Varbinary, false, Image_Data);
                    sql_par.SQLiteDbType = System.Data.DbType.Binary;
                    DBConnectionControl40.SQL_Parameter sql_par_hash = new DBConnectionControl40.SQL_Parameter("@hash", SQL_Parameter.eSQL_Parameter.Nvarchar, false, Image_Hash);
                    sql_par_hash.SQLiteDbType = System.Data.DbType.AnsiString;
                    lsql_par.Add(sql_par);
                    lsql_par.Add(sql_par_hash);
                }
                else if (pl_SimpleItem.m_SimpleItem.Abbreviation.val.Equals("MAN"))
                {
                    lsql_par = new List<DBConnectionControl40.SQL_Parameter>();
                    //Image_Data = ImageToByte2(Properties.Resources.Manikira);
                    Image_Hash = DBtypesFunc.GetHash_SHA1(Image_Data);
            //                    DBConnectionControl40.SQL_Parameter sql_par = new DBConnectionControl40.SQL_Parameter("@image", SQL_Parameter.eSQL_Parameter.Varbinary, false, ImageToByte2(Properties.Resources.Manikira));
                    //sql_par.SQLiteDbType = System.Data.DbType.Binary;
                    DBConnectionControl40.SQL_Parameter sql_par_hash = new DBConnectionControl40.SQL_Parameter("@hash", SQL_Parameter.eSQL_Parameter.Nvarchar, false, Image_Hash);
                    sql_par_hash.SQLiteDbType = System.Data.DbType.AnsiString;
                    //lsql_par.Add(sql_par);
                    lsql_par.Add(sql_par_hash);
                }
                else if (pl_SimpleItem.m_SimpleItem.Abbreviation.val.Equals("NOB"))
                {
                    lsql_par = new List<DBConnectionControl40.SQL_Parameter>();
                    //Image_Data = ImageToByte2(Properties.Resources.Nega_Obraza);
                    Image_Hash = DBtypesFunc.GetHash_SHA1(Image_Data);
                    DBConnectionControl40.SQL_Parameter sql_par = new DBConnectionControl40.SQL_Parameter("@image", SQL_Parameter.eSQL_Parameter.Varbinary, false, Image_Data);
                    DBConnectionControl40.SQL_Parameter sql_par_hash = new DBConnectionControl40.SQL_Parameter("@hash", SQL_Parameter.eSQL_Parameter.Nvarchar, false, Image_Hash);
                    sql_par_hash.SQLiteDbType = System.Data.DbType.AnsiString;
                    sql_par.SQLiteDbType = System.Data.DbType.Binary;
                    lsql_par.Add(sql_par);
                    lsql_par.Add(sql_par_hash);
                }

                string[] sColumn = null;
                string[] sValue = null;
                if (lsql_par != null)
                {
                    long SimpleItem_Image_ID = -1;

                    if (!fs.GetID(s_SimpleItem_Image_table_name,new string[]{s_Image_Hash,s_Image_Data},new string[]{"@hash","@image"},lsql_par,ref SimpleItem_Image_ID,ref Err))
                    {
                        LogFile.Error.Show("ERROR:Init_DB_SimpleItem:insert into  SimpleItem_Image:Err=" + Err);
                        return false;
                    }

                    sColumn = new string[] { s_col_Name, s_col_Code, s_col_Abbreviation, s_col_SimpleItemImage_ID, s_col_ToOffer };
                    sValue = new string[] { "'" + pl_SimpleItem.m_SimpleItem.Name.val + "'",
                                                     pl_SimpleItem.m_SimpleItem.Code.val.ToString(),
                                                     "'"+ pl_SimpleItem.m_SimpleItem.Abbreviation.val + "'",
                                                     SimpleItem_Image_ID.ToString(),
                                                     "1"
                                                    };

                }
                else
                {
                    sColumn = new string[] { s_col_Name, s_col_Code, s_col_Abbreviation,  s_col_ToOffer };
                    sValue = new string[] { "'" + pl_SimpleItem.m_SimpleItem.Name.val + "'",
                                                     pl_SimpleItem.m_SimpleItem.Code.val.ToString(),
                                                     "'"+ pl_SimpleItem.m_SimpleItem.Abbreviation.val + "'",
                                                     "1"
                                                    };
                }
                long id = -1;

                if (fs.GetID(s_SimpleItem_table_name,sColumn,sValue,lsql_par,ref id,ref Err))
                {
                    pl_SimpleItem.m_SimpleItem.ID.val = id;
                    pl_SimpleItem.m_Taxation.ID.val = 1;
                }
                else
                {
                    return false;
                }
            }
            return true;
        }