Ejemplo n.º 1
0
        public static int Update(InvoiceHeader c)
        {
            DBAccess db = new DBAccess();

            db.AddInt("ID", c.ID);
            AddParms(ref db, c);

            int retval = db.ExecuteNonQuery(_SQLUpdate);

            AddLog(Status: "InvoiceHeader", Logtext: string.Format("Update InvoiceHeader: ID:{0}", c.ID), Metode: "Update");
            return(retval);
        }
Ejemplo n.º 2
0
        public static int Update(tilbudHeader c)
        {
            DBAccess db = new DBAccess();

            db.AddInt("ID", c.ID);
            AddParms(ref db, c);

            int retval = db.ExecuteNonQuery(_SQLUpdate);

            AddLog(Status: "tilbudHeader", Logtext: string.Format("Update tilbudHeader: ID:{0} KontaktPerson:{1} ", c.ID, c.KontaktPerson), Metode: "Update");
            return(retval);
        }
        public static int Update(KundeGrp_Pris c)
        {
            DBAccess db = new DBAccess();

            c.Dato = DateTime.Now;
            db.AddInt("ID", c.ID);
            AddParms(ref db, c);

            int retval = db.ExecuteNonQuery(_SQLUpdate);

            return(retval);
        }
        public static KundeGrp_Pris GetKundeGrp_VarePris(int KundeGrpID, int VareID)
        {
            KundeGrp_Pris c = new KundeGrp_Pris();

            DBAccess db = new DBAccess();

            db.AddInt("KundeGrpID", KundeGrpID);
            db.AddInt("VareID", VareID);
            SqlDataReader dr = (SqlDataReader)(db.ExecuteReader(_SQLSelectByKundeGrpVareID));

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    Populate(dr, c);
                }
            }
            dr.Close();

            return(c);
        }
Ejemplo n.º 5
0
        private static void PopulateDBwithInfositePages(DBAccess db, Infosites po)
        {
            var with_1 = po;

            db.AddBoolean("@Aktiv", with_1.Aktiv);
            db.AddInt("Site_FK", with_1.Site_FK);
            db.AddInt("Parent_ID", with_1.Parent_ID);
            //	db.AddInt("Sort", .Sort)
            db.AddBoolean("@IncludeInMenu", with_1.IncludeInMenu);
            db.AddBoolean("@Forside", with_1.Forside);

            db.AddBoolean("@IsDisabled", with_1.IsDisabled);
            db.AddBoolean("@IsDeleted", with_1.IsDeleted);

            db.AddNVarChar("PageName", with_1.PageName, 50);
            db.AddNVarChar("PageTitle", with_1.PageTitle, 50);
            db.AddNVarChar("Description", with_1.Description, 250);
            db.AddNVarChar("Keywords", with_1.Keywords, 250);
            db.AddInt("Template_ID", with_1.Template_ID);
            db.AddInt("Category_ID", with_1.Category_ID);
            db.AddInt("LinkType_ID", with_1.LinkType_ID);
            db.AddNVarChar("LinkUrl", with_1.LinkUrl, 250);
            db.AddInt("LinkPage_ID", with_1.LinkPage_ID);
            db.AddNVarChar("LinkTarget", with_1.LinkTarget, 50);
            db.AddDateTime("OpenDate", with_1.OpenDate);
            db.AddDateTime("ExpireDate", with_1.ExpireDate);
            db.AddNVarChar("RettetAf", with_1.CurUser);
            db.AddNVarChar("RettetIP", with_1.CurIP);
        }
Ejemplo n.º 6
0
        public static System.Collections.Generic.List <News> Search_NewsList(string search, NewsStatusEnum status, int NewsGrpID)
        {
            System.Collections.Generic.List <News> result = new System.Collections.Generic.List <News>();
            int      ID     = -1;
            DBAccess db     = new DBAccess();
            DataSet  ds     = new DataSet();
            DataSet  dsTemp = new DataSet();
            bool     flag   = false;

            db.AddInt("NewsGrpID", NewsGrpID);

            string[] arr = search.Split(' ');
            foreach (string s in arr)
            {
                db.AddNVarChar("Search", s, 250);
                db.AddInt("Status", System.Convert.ToInt32(status));
                db.AddInt("NewsGrpID", NewsGrpID);

                dsTemp = db.ExecuteDataSet(_SQLSelectIDBySearch);
                db.Parameters.Clear();
                //If dsTemp.Tables.Count > 0 Then
                ds.Merge(dsTemp);
                if (flag == false)
                {
                    DataColumn[] pk = new DataColumn[2];
                    pk[0] = ds.Tables[0].Columns["ID"];
                    ds.Tables[0].PrimaryKey = pk;
                    flag = true;
                }
                //End If
            }

            foreach (DataRow row in ds.Tables[0].Rows)
            {
                ID = System.Convert.ToInt32(row["ID"]);
                result.Add(News.GetNews(ID));
            }

            return(result);
        }
Ejemplo n.º 7
0
        public static DataSet GetAEDbyCompany(int CompanyID)
        {
            DBAccess db = new DBAccess();

            db.AddInt("CompanyID", CompanyID);

            db.AddBoolean("IsAgent", AdgangsKontrol.IsAgent());
            db.AddGuid("AgentID", CurrentUserID);

            DataSet ds = db.ExecuteDataSet(_SQLSelectByCompany);

            return(ds);
        }
Ejemplo n.º 8
0
        public static int Update(Vare c)
        {
            DBAccess db = new DBAccess();

            db.AddInt("ID", c.ID);
            AddParms(ref db, c);

            int retval = db.ExecuteNonQuery("Co2Db_Vare_Update");

            AddLog(Status: "Vare", Logtext: string.Format("Update Vare: ID:{0} No:{1} ", c.ID, c.VareNr), Metode: "Update");

            return(retval);
        }
Ejemplo n.º 9
0
        public static DataSet GetEyeWash_DS(int ID)
        {
            DBAccess db = new DBAccess();

            db.AddInt("ID", ID);

            db.AddBoolean("IsAgent", AdgangsKontrol.IsAgent());
            db.AddGuid("AgentID", CurrentUserID);

            DataSet ds = db.ExecuteDataSet(_SQLSelectID);

            return(ds);
        }
Ejemplo n.º 10
0
        public static DataSet GetAllTilbud(TilbudStatusEnum status)
        {
            DBAccess db = new DBAccess();

            db.AddInt("status", System.Convert.ToInt32(status));

            db.AddBoolean("IsAgent", AdgangsKontrol.IsAgent());
            db.AddGuid("AgentID", CurrentUserID);

            DataSet ds = db.ExecuteDataSet(_SQLSelectByStatus);

            return(ds);
        }
Ejemplo n.º 11
0
        public static int GetEyeWashcountByCompany(int CompanyID)
        {
            int      res = 0;
            DBAccess db  = new DBAccess();

            db.AddInt("CompanyID", CompanyID);

            db.AddBoolean("IsAgent", AdgangsKontrol.IsAgent());
            db.AddGuid("AgentID", CurrentUserID);

            res = Funktioner.ToInt(db.ExecuteScalar(_SQLCountByCompany));
            return(res);
        }
Ejemplo n.º 12
0
        private static void AddParms(ref DBAccess db, AED_Trainer c)
        {
            var with_1 = c;

            db.AddInt("Status", (System.Int32)with_1.Status);
            db.AddInt("CompanyID", with_1.CompanyID);

            db.AddInt("ModelID", with_1.ModelID);
            db.AddNVarChar("SerialNo", with_1.SerialNo, 50);
            db.AddNVarChar("FirmwareVersion", with_1.FirmwareVersion, 50);
            db.AddNVarChar("FirmwareLanguage", with_1._FirmwareLanguage, 50);

            db.AddDateTime("DeleveryDate", with_1.DeleveryDate);
            db.AddDateTime("WarencyExpireDate", with_1.WarencyExpireDate);
            db.AddDateTime("BatteryActivationDate", with_1.BatteryActivationDate);
            db.AddDateTime("BatteryWarencyExpireDate", with_1.BatteryWarencyExpireDate);

            db.AddInt("BilagStatus", (System.Int32)with_1.BilagStatus);
            db.AddDateTime("BilagSendtDato", with_1.BilagSendtDato);
            db.AddDateTime("BilagModtagetDato", with_1.BilagModtagetDato);

            db.AddNVarChar("ResponsibleName", with_1.ResponsibleName, 50);
            db.AddNVarChar("ResponsiblePhone", with_1.ResponsiblePhone, 16);
            db.AddNVarChar("ResponsibleEmail", with_1.ResponsibleEmail, 250);

            db.AddNVarChar("LocationAdresse", with_1.LocationAdresse, 50);
            db.AddNVarChar("LocationPostnr", with_1.LocationPostnr, 16);
            db.AddNVarChar("LocationBy", with_1.LocationBy, 50);
            db.AddNVarChar("LocationState", with_1.LocationState, 50);
            db.AddInt("LocationLandID", with_1.LocationLandID);
            db.AddNVarChar("Location", with_1.Location, -1);

            db.AddDateTime("RegisterretCSI", with_1.RegisterretCSI);
            db.AddNVarChar("RegisterretAF", with_1.RegisterretAF, 50);

            db.AddNVarChar("Note", with_1.Note, -1);

            AddParmsStandard(db, c);
        }
        public static DataSet GetBottleByEYE(int EYE_FK)
        {
            DBAccess db = new DBAccess();

            db.AddInt("EYE_FK", EYE_FK);

            db.AddBoolean("IsAgent", AdgangsKontrol.IsAgent());
            db.AddGuid("AgentID", CurrentUserID);

            DataSet ds = db.ExecuteDataSet(_SQLSelectByEYE);

            return(ds);
        }
Ejemplo n.º 14
0
        public static int Delete(Campaign rec)
        {
            //For Each POI As CampaignItem In rec.CampaignItems
            //    POI.Delete()
            //Next
            DBAccess db = new DBAccess();

            db.AddInt("ID", rec.ID);
            int retval = db.ExecuteNonQuery(_SQLDelete);

            AddLog(Status: "Campaign", Logtext: string.Format("Delete Campaign: ID:{0}", rec.ID), Metode: "Delete");
            return(retval);
        }
Ejemplo n.º 15
0
        public static DataSet GetKoncernEyeWash(int CompanyID)
        {
            DBAccess db = new DBAccess();

            db.AddInt("CompanyID", CompanyID);

            db.AddBoolean("IsAgent", AdgangsKontrol.IsAgent());
            db.AddGuid("AgentID", CurrentUserID);

            DataSet ds = db.ExecuteDataSet(_SQLSearchConcernEyeWash);

            return(ds);
        }
Ejemplo n.º 16
0
        public static DataSet GetBatteryBySoonExpired(int CompanyID)
        {
            DBAccess db = new DBAccess();

            db.AddInt("CompanyID", CompanyID);

            db.AddBoolean("IsAgent", AdgangsKontrol.IsAgent());
            db.AddGuid("AgentID", CurrentUserID);

            DataSet ds = db.ExecuteDataSet(_SQLSelectAllSoonExpired);

            return(ds);
        }
Ejemplo n.º 17
0
        public static DataSet GetBatteryByAED(int AED_FK)
        {
            DBAccess db = new DBAccess();

            db.AddInt("AED_FK", AED_FK);

            db.AddBoolean("IsAgent", AdgangsKontrol.IsAgent());
            db.AddGuid("AgentID", CurrentUserID);

            DataSet ds = db.ExecuteDataSet(_SQLSelectByAED);

            return(ds);
        }
Ejemplo n.º 18
0
        public static int Delete(InvoiceHeader IH)
        {
            foreach (Invoiceline IL in IH.Invoiceslinier)
            {
                IL.Delete();
            }
            DBAccess db = new DBAccess();

            db.AddInt("ID", IH.ID);
            int retval = db.ExecuteNonQuery(_SQLDelete);

            AddLog(Status: "InvoiceHeader", Logtext: string.Format("Delete InvoiceHeader: ID:{0}", IH.ID), Metode: "Delete");
            return(retval);
        }
        public static int Delete(PurchaseOrder PO)
        {
            foreach (PurchaseOrderItem POI in PO.PurchaseOrderItems)
            {
                POI.Delete();
            }
            DBAccess db = new DBAccess();

            db.AddInt("ID", PO.ID);
            int retval = db.ExecuteNonQuery(_SQLDelete);

            AddLog(Status: "PurchaseOrder", Logtext: string.Format("Delete PurchaseOrder: ID:{0}", PO.ID), Metode: "Delete");
            return(retval);
        }
        private static void AddParms(ref DBAccess db, PurchaseOrderItem rec)
        {
            var with_1 = rec;

            db.AddInt("PurchaseOrderID", with_1.PurchaseOrderID);
            db.AddInt("Pos", with_1.Pos);
            db.AddInt("Status", (System.Int32)with_1.Status);

            db.AddInt("ItemID", with_1.ItemID);
            db.AddNVarChar("ItemName", with_1.ItemName, 100);

            db.AddNVarChar("SupplierItemID", with_1.SupplierItemID, 50);
            db.AddNVarChar("SupplierItemName", with_1.SupplierItemName, 250);

            db.AddDecimal("Quantity", with_1.Quantity);
            db.AddMoney("ItemPrice", (double)with_1.ItemPrice);
            db.AddMoney("LinePrice", (double)with_1.LinePrice);

            db.AddDateTime("ExpectedReceiptDate", with_1.ExpectedReceiptDate);
            db.AddDateTime("ReceiptDate", with_1.ReceiptDate);

            AddParmsStandard(db, rec);
        }
Ejemplo n.º 21
0
        public static DataSet Search_Tilbud(string skills, int CompanyID = -1)
        {
            DataSet  ds     = new DataSet();
            DataSet  dsTemp = new DataSet();
            bool     flag   = false;
            DBAccess db     = new DBAccess();

            string[] arr = skills.Split(' ');
            foreach (string s in arr)
            {
                db.AddInt("Status", Funktioner.ToInt(s));
                db.AddBoolean("IsAgent", AdgangsKontrol.IsAgent());
                db.AddGuid("AgentID", CurrentUserID);

                if (CompanyID == -1)
                {
                    //db.AddParameter("@CompanyID", DBNull.Value)
                }
                else
                {
                    db.AddInt("CompanyID", CompanyID);
                }
                dsTemp = db.ExecuteDataSet("Co2Db_TilbudHeader_SelectByStatusCompany");
                db.Parameters.Clear();
                //If dsTemp.Tables.Count > 0 Then
                ds.Merge(dsTemp);
                if (flag == false)
                {
                    DataColumn[] pk = new DataColumn[2];
                    pk[0] = ds.Tables[0].Columns["ID"];
                    ds.Tables[0].PrimaryKey = pk;
                    flag = true;
                }
                //End If
            }
            return(ds);
        }
Ejemplo n.º 22
0
        //Public Shared Function GetInfositePagesListe(Optional ByVal CompanyID As Integer = -1, Optional ByVal MedarbejderID As Integer = -1) As DataSet
        //	Dim db As DBAccess = New DBAccess
        //	db.AddInt("CompanyID", CompanyID)
        //	db.AddInt("MedarbejderID", MedarbejderID)
        //	'db.Parameters.Add(New SqlParameter("@CompanyID", ToInt(CompanyID)))
        //	'db.Parameters.Add(New SqlParameter("@MedarbejderID", ToInt(MedarbejderID)))
        //	Dim ds As DataSet = db.ExecuteDataSet("Co2Db_InfositePages_SelectAll")
        //	Return ds
        //End Function


        //Public Shared Function GetInfositePagesSet(Optional ByVal CompanyID As Integer = -1, Optional ByVal MedarbejderID As Integer = -1) As DataSet
        //	Dim db As DBAccess = New DBAccess
        //	db.Parameters.Add(New SqlParameter("@CompanyID", ToInt(CompanyID)))
        //	db.Parameters.Add(New SqlParameter("@MedarbejderID", ToInt(MedarbejderID)))
        //	Dim ds As DataSet = db.ExecuteDataSet("Co2Db_InfositePages_SelectAll")
        //	Return ds
        //End Function

        //	EXEC	@return_value = [vicjos1_sysadm].[Co2Db_InfositePages_ListPages]
        //		@Site_FK = 1,
        //		@Parent_ID = 2
        //	EXEC	@return_value = [vicjos1_sysadm].[Co2Db_InfositePages_ListPages]
        //		@Site_FK = 1,
        //		@Parent_ID = 0

        public static DataSet GetInfositePagesSet(int Site_FK, int Parent_ID, int SelfID, bool TopPage)
        {
            DBAccess db = new DBAccess();

            if (Site_FK != 1)
            {
                db.AddInt("Site_FK", Site_FK);
            }
            if (Parent_ID != 0)
            {
                db.AddInt("Parent_ID", Parent_ID);
            }
            if (SelfID > 0)
            {
                db.AddInt("SelfID", SelfID);
            }
            if (TopPage)
            {
                db.AddInt("TopPage", 0);
            }
            DataSet ds = db.ExecuteDataSet("Co2Db_InfositePages_ListPages");

            return(ds);
        }
Ejemplo n.º 23
0
        public static int Update(KundeGrp c)
        {
            DBAccess db = new DBAccess();

            if (c.Status == KundeGrpStatusEnum.Opret)
            {
                c.Status = KundeGrpStatusEnum.Aktiv;
            }
            db.AddInt("ID", c.ID);
            AddParms(ref db, c);

            int retval = db.ExecuteNonQuery(_SQLUpdate);

            return(retval);
        }
        public static int Update(CampaignCompany rec)
        {
            DBAccess db = new DBAccess();

            db.AddInt("ID", rec.ID);
            AddParms(ref db, rec);

            int retval = 0;

            //Try
            retval = db.ExecuteNonQuery(_SQLUpdate);
            //Catch
            //End Try
            AddLog(Status: "CampaignCompany", Logtext: string.Format("Update CampaignCompany: ID:{0}", rec.ID), Metode: "Update");
            return(retval);
        }
Ejemplo n.º 25
0
        public static int GetCompanyInvoiceCount(int CompanyID)
        {
            DBAccess db = new DBAccess();

            db.AddInt("CompanyID", CompanyID);
            int res = 0;

            try
            {
                res = Funktioner.ToInt(db.ExecuteScalar(_SQLSelectByCompanyCount));
            }
            catch (Exception)
            {
                res = 0;
            }
            return(res);
        }
Ejemplo n.º 26
0
        public static int Update(Combobox c)
        {
            DBAccess db = new DBAccess();

            db.AddInt("ID", c.ID);
            AddParms(ref db, c);

            //db.AddParameter("@Field", SQLstr(c.Field))
            //db.AddParameter("@Title", SQLstr(c.Title))
            //db.AddParameter("@Value", SQLstr(c.Value))
            //db.AddParameter("@Content", SQLstr(c.Contents))
            //db.AddParameter("@Hidden", ToBool(c.Hidden))
            //db.AddParameter("@Index", ToInt(c.Idx))
            //db.AddParameter("@Valid", ToBool(c.Valid))

            return(db.ExecuteNonQuery(_SQLUpdate));
        }
        public static int GetSupplierPurchaseOrderCount(int SupplierID)
        {
            DBAccess db = new DBAccess();

            db.AddInt("SupplierID", SupplierID);
            int res = 0;

            try
            {
                res = Funktioner.ToInt(db.ExecuteScalar(_SQLSelectBySupplierCount));
            }
            catch (Exception)
            {
                res = 0;
            }
            return(res);
        }
Ejemplo n.º 28
0
        public static decimal GetCampaignTotalpris(int CampaignID)
        {
            DBAccess db = new DBAccess();

            db.AddInt("ID", CampaignID);
            decimal res = 0;

            try
            {
                res = Funktioner.ToDecimal(db.ExecuteScalar(_SQLGetTotalpris));
            }
            catch (Exception)
            {
                res = 0;
            }
            return(res);
        }
Ejemplo n.º 29
0
        private static void AddParms(ref DBAccess db, Campaign rec)
        {
            db.AddInt("Status", (System.Int32)rec.Status);
            db.AddBit("Active", rec.Active);

            db.AddNVarChar("CampaignNo", rec.CampaignNo, 50);
            db.AddNVarChar("Name", rec.Name, 255);
            db.AddNVarChar("Description", rec.Description);

            db.AddDateTime("StartDate", rec.StartDate);
            db.AddDateTime("EndDate", rec.EndDate);

            db.AddMoney("ExpectedImediateSale", (double)rec.ExpectedImediateSale);
            db.AddMoney("ExpectedFollowUpSale", (double)rec.ExpectedFollowUpSale);

            AddParmsStandard(db, rec);
        }
        public static decimal GetTotalTilbudsSalgsPris(int TilbudID)
        {
            DBAccess db = new DBAccess();

            db.AddInt("TilbudID", TilbudID);
            decimal res = 0;

            try
            {
                res = Funktioner.ToDecimal(db.ExecuteScalar(_SQLTotalTilbudsPris));
            }
            catch (Exception)
            {
                res = 0;
            }
            return(res);
        }