Beispiel #1
0
        private static void AddParms(ref DBAccess db, Korrespondance k)
        {
            var with_1 = k;

            db.Parameters.Add(new SqlParameter("@Type", Funktioner.ToInt(k.Type)));
            db.Parameters.Add(new SqlParameter("@CompanyID", Funktioner.ToInt(k.CompanyID)));
            db.Parameters.Add(new SqlParameter("@MedarbejderID", Funktioner.ToInt(k.MedarbejderID)));
            db.Parameters.Add(new SqlParameter("@Status", Funktioner.ToInt(k.Status)));

            db.Parameters.Add(new SqlParameter("@Overskrift", SQLfunctions.SQLstr(k.Overskrift)));
            db.Parameters.Add(new SqlParameter("@Ekstern", Funktioner.ToBool(k.Ekstern)));

            db.Parameters.Add(new SqlParameter("@Mime", SQLfunctions.SQLstr(k.Mime)));
            db.Parameters.Add(new SqlParameter("@Filename", SQLfunctions.SQLstr(k.Filename)));
            db.Parameters.Add(new SqlParameter("@Ext", SQLfunctions.SQLstr(k.Ext)));
            db.Parameters.Add(new SqlParameter("@Size", Funktioner.ToInt(k.Size)));

            SqlParameter pictureParameter = new SqlParameter("@Blob", SqlDbType.Image);

            pictureParameter.Value = k.Blob;
            db.Parameters.Add(pictureParameter);
            //	db.AddParameter("@Blob", Blob)

            AddParmsStandard(db, k);
        }
Beispiel #2
0
        public static int Update(Korrespondance n)
        {
            DBAccess db = new DBAccess();

            db.Parameters.Add(new SqlParameter("@ID", n.ID));

            db.Parameters.Add(new SqlParameter("@Type", Funktioner.ToInt(n.Type)));
            db.Parameters.Add(new SqlParameter("@CompanyID", Funktioner.ToInt(n.CompanyID)));
            db.Parameters.Add(new SqlParameter("@MedarbejderID", Funktioner.ToInt(n.MedarbejderID)));
            db.Parameters.Add(new SqlParameter("@Status", Funktioner.ToInt(n.Status)));

            db.Parameters.Add(new SqlParameter("@Overskrift", SQLfunctions.SQLstr(n.Overskrift)));
            db.Parameters.Add(new SqlParameter("@Extern", Funktioner.ToBool(n.Ekstern)));


            db.Parameters.Add(new SqlParameter("@Mime", SQLfunctions.SQLstr(n.Mime)));
            db.Parameters.Add(new SqlParameter("@Filename", SQLfunctions.SQLstr(n.Filename)));
            db.Parameters.Add(new SqlParameter("@Ext", SQLfunctions.SQLstr(n.Ext)));
            db.Parameters.Add(new SqlParameter("@Size", Funktioner.ToInt(n.Size)));
            //Dim pictureParameter As SqlParameter = New SqlParameter("@Blob", SqlDbType.Image)
            //pictureParameter.Value = n.Blob
            //db.Parameters.Add(pictureParameter)
            //	db.AddParameter("@Blob", Blob)

            db.Parameters.Add(new SqlParameter("@RettetAf", SQLfunctions.SQLstr(CurrentUserName)));
            db.Parameters.Add(new SqlParameter("@RettetIP", SQLfunctions.SQLstr(CurrentUserIP)));
            int retval = db.ExecuteNonQuery("Co2Db_Korrespondance_Update");

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

            c.Dato = DateTime.Now;

            if (c.Status <= (int)KundeGrpStatusEnum.Opret)
            {
                c.Status = KundeGrpStatusEnum.Aktiv;
            }
            AddParms(ref db, c);

            SqlParameter objParam = new SqlParameter("@ID", 0);

            objParam.Direction = ParameterDirection.Output;
            db.Parameters.Add(objParam);
            int retval = db.ExecuteNonQuery(_SQLInsert);

            if (retval == 1)
            {
                c.ID = Funktioner.ToInt(objParam.Value, -1); //Integer.Parse(objParam.Value.ToString)
                return(c.ID);                                //Integer.Parse(objParam.Value.ToString)
            }
            else
            {
                return(-1);
            }
        }
        public static int Insert(MedarbejderGruppe mg)
        {
            DBAccess     db       = new DBAccess();
            SqlParameter objParam = new SqlParameter("@ID", 0);

            objParam.Direction = ParameterDirection.Output;
            db.Parameters.Add(new SqlParameter("@CompanyID", mg.CompanyID));

            db.Parameters.Add(new SqlParameter("@Navn", SQLfunctions.SQLstr(mg.Navn)));
            db.Parameters.Add(new SqlParameter("@Brugernavn", SQLfunctions.SQLstr(mg.Brugernavn)));
            db.Parameters.Add(new SqlParameter("@Kodeord", SQLfunctions.SQLstr(mg.Kodeord)));
            db.Parameters.Add(new SqlParameter("@Password", mg.Password));
            db.Parameters.Add(new SqlParameter("@IP", SQLfunctions.SQLstr(mg.IP)));
            db.Parameters.Add(new SqlParameter("@Dato", SQLfunctions.SQLdate(mg.Dato)));

            db.Parameters.Add(new SqlParameter("@Informationssite", Funktioner.ToBool(mg.Informationssite)));
            db.Parameters.Add(new SqlParameter("@Administrationssite", Funktioner.ToBool(mg.Administrationssite)));

            db.Parameters.Add(new SqlParameter("@RettetAf", SQLfunctions.SQLstr(mg.CurUser)));
            db.Parameters.Add(new SqlParameter("@RettetIP", SQLfunctions.SQLstr(mg.CurIP)));

            db.Parameters.Add(objParam);
            int retval = db.ExecuteNonQuery("Co2Db_MedarbejderGruppe_Insert");

            if (retval == 1)
            {
                return(int.Parse(objParam.Value.ToString()));
            }
            else
            {
                return(-1);
            }
        }
        public static int Insert(PurchaseOrderItem rec)
        {
            DBAccess db = new DBAccess();

            if (rec.Status <= (int)PurchaseOrderItem_StatusEnum.Create)
            {
                rec.Status = PurchaseOrderItem_StatusEnum.Active;
            }
            AddParms(ref db, rec);
            SqlParameter objParam = new SqlParameter("@ID", 0);

            objParam.Direction = ParameterDirection.Output;
            db.Parameters.Add(objParam);

            int retval = db.ExecuteNonQuery(_SQLInsert);

            if (retval == 1)
            {
                int res = -1;
                res = Funktioner.ToInteger(objParam.Value);
                AddLog(Status: "PurchaseOrderItem", Logtext: string.Format("Create PurchaseOrderItem: ID:{0}", rec.ID), Metode: "Insert");
                return(res);
            }
            else
            {
                AddLog(Status: "PurchaseOrderItem", Logtext: string.Format("Failure to create PurchaseOrderItem:"), logtype: LogTypeEnum.Error, Metode: "Insert");
                return(-1);
            }
        }
        public static int Insert(AED_Redning R)
        {
            DBAccess db = new DBAccess();

            AddParms(ref db, R);

            SqlParameter objParam = new SqlParameter("@ID", 0);

            objParam.Direction = ParameterDirection.Output;
            db.Parameters.Add(objParam);
            int retval = db.ExecuteNonQuery(_SQLInsert);

            if (retval == 1)
            {
                int res = Funktioner.ToInt(objParam.Value.ToString());
                R.ID = res;
                AddLog(Status: "AED_Redning", Logtext: string.Format("Create AED_Redning: ID:{0}", R.ID), Metode: "Insert");
                return(res);
            }
            else
            {
                AddLog(Status: "AED_Redning", Logtext: string.Format("Failure to Create AED_Redning:"), logtype: LogTypeEnum.Error, Metode: "Insert");
                return(-1);
            }
        }
        public static int Insert(KursusDeltager c)
        {
            DBAccess db = new DBAccess();

            if (c.Status == KursusKursistStatusEnum.Initialize)
            {
                c.Status = KursusKursistStatusEnum.Aktiv;
            }
            AddParms(ref db, c);
            SqlParameter objParam = new SqlParameter("@ID", 0);

            objParam.Direction = ParameterDirection.Output;
            db.Parameters.Add(objParam);

            int retval = db.ExecuteNonQuery(_SQLInsert);

            if (retval == 1)
            {
                c.ID = Funktioner.ToInteger(objParam.Value.ToString(), -1);
                return(c.ID);
            }
            else
            {
                return(-1);
            }
        }
Beispiel #8
0
        public static int Insert(Campaign rec)
        {
            DBAccess db = new DBAccess();

            if (System.Convert.ToInt32(rec.Status) < (int)Campaign_StatusEnum.Active)
            {
                rec.Status = Campaign_StatusEnum.Active;
            }

            AddParms(ref db, rec);

            SqlParameter objParam = new SqlParameter("@ID", 0);

            objParam.Direction = ParameterDirection.Output;
            db.Parameters.Add(objParam);
            int retval = db.ExecuteNonQuery(_SQLInsert);

            if (retval == 1)
            {
                rec.ID = Funktioner.ToInt(objParam.Value, -1);
                AddLog(Status: "Campaign", Logtext: string.Format("Create Campaign: ID:{0}", rec.ID), Metode: "Insert");
                return(rec.ID);
            }
            else
            {
                AddLog(Status: "Campaign", Logtext: string.Format("Failure to Create Campaign:"), logtype: LogTypeEnum.Error, Metode: "Insert");
                return(-1);
            }
        }
Beispiel #9
0
        public static int Insert(Invoiceline c)
        {
            DBAccess db = new DBAccess();

            if (c.Status <= (int)Invoiceline_StatusEnum.Create)
            {
                c.Status = Invoiceline_StatusEnum.Active;
            }
            AddParms(ref db, c);
            SqlParameter objParam = new SqlParameter("@ID", 0);

            objParam.Direction = ParameterDirection.Output;
            db.Parameters.Add(objParam);

            int retval = db.ExecuteNonQuery(_SQLInsert);

            if (retval == 1)
            {
                int res = -1;
                res = Funktioner.ToInteger(objParam.Value);
                AddLog(Status: "Invoiceline", Logtext: string.Format("Create Invoiceline: ID:{0}", c.ID), Metode: "Insert");
                return(res);
            }
            else
            {
                AddLog(Status: "Invoiceline", Logtext: string.Format("Failure to Invoiceline AED_Battery:"), logtype: LogTypeEnum.Error, Metode: "Insert");
                return(-1);
            }
        }
Beispiel #10
0
        public static DataSet Search_Incasso(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));

                if (CompanyID != -1)
                {
                    db.AddInt("CompanyID", CompanyID);
                }
                dsTemp = db.ExecuteDataSet(_SQLSelectByStatusCompany);
                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);
        }
Beispiel #11
0
        public static DataSet Search_Campaign(string skills, int SupplierID = -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));

                if (SupplierID == -1)
                {
                    //db.AddParameter("@CompanyID", DBNull.Value)
                }
                else
                {
                    db.AddInt("SupplierID", SupplierID);
                }
                dsTemp = db.ExecuteDataSet(_SQLSelectByStatusSupplier); //"Co2Db_Campaign_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);
        }
        public static int Insert(Noter n)
        {
            DBAccess     db = new DBAccess();
            SqlParameter ID = new SqlParameter("@ID", 0);

            ID.Direction = ParameterDirection.Output;

            db.Parameters.Add(new SqlParameter("@Type", Funktioner.ToInt(n.Type)));
            db.Parameters.Add(new SqlParameter("@CompanyID", Funktioner.ToInt(n.CompanyID)));
            db.Parameters.Add(new SqlParameter("@MedarbejderID", Funktioner.ToInt(n.MedarbejderID)));
            db.Parameters.Add(new SqlParameter("@Status", Funktioner.ToInt(n.Status)));

            db.Parameters.Add(new SqlParameter("@Overskrift", SQLfunctions.SQLstr(n.Overskrift)));
            db.Parameters.Add(new SqlParameter("@Tekst", SQLfunctions.SQLstr(n.Tekst)));

            db.Parameters.Add(new SqlParameter("@RettetAf", SQLfunctions.SQLstr(CurrentUserName)));
            db.Parameters.Add(new SqlParameter("@RettetIP", SQLfunctions.SQLstr(CurrentUserIP)));
            db.Parameters.Add(ID);
            int retval = db.ExecuteNonQuery("Co2Db_Noter_Insert");

            if (retval == 1)
            {
                n.ID = int.Parse(ID.Value.ToString());
                AddLog(Status: "Noter", Logtext: string.Format("Create Noter: ID:{0}", n.ID), Metode: "Insert");
                return(n.ID); //Integer.Parse(ID.Value.ToString)
            }
            else
            {
                AddLog(Status: "Noter", Logtext: string.Format("Failure to Create Noter:"), logtype: LogTypeEnum.Error, Metode: "Insert");
                return(-1);
            }
        }
        public static int GetKursusPolicyCountByCompany(int CompanyID)
        {
            int      res = 0;
            DBAccess db  = new DBAccess();

            db.AddInt("CompanyID", CompanyID);
            res = Funktioner.ToInt(db.ExecuteScalar(_SQLCountByCompany));
            return(res);
        }
Beispiel #14
0
        public static int GetCompanyIncassoCount(int CompanyID)
        {
            DBAccess db = new DBAccess();

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

            res = Funktioner.ToInt(db.ExecuteScalar(_SQLSelectByCompanyCount), -1);
            return(res);
        }
        public static int GetIndexByTitle(string Field, string Title)
        {
            DBAccess db = new DBAccess();

            db.AddParameter("@Field", Field);
            db.AddParameter("@Title", Title);
            int res = Funktioner.ToInt(db.ExecuteScalar(_SQLSelectGetIdxByTitle)); //"Co2Db_Combobox_GetIdxByTitle"

            return(res);
        }
        public static DataSet GetNoterSet(int CompanyID = -1, int MedarbejderID = -1)
        {
            DBAccess db = new DBAccess();

            db.Parameters.Add(new SqlParameter("@CompanyID", Funktioner.ToInt(CompanyID)));
            db.Parameters.Add(new SqlParameter("@MedarbejderID", Funktioner.ToInt(MedarbejderID)));
            DataSet ds = db.ExecuteDataSet("Co2Db_Noter_SelectAll");

            return(ds);
        }
Beispiel #17
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);
        }
Beispiel #18
0
        public static int Insert(Medarbejder mg)
        {
            DBAccess     db = new DBAccess();
            SqlParameter ID = new SqlParameter("@ID", 0);

            ID.Direction = ParameterDirection.Output;

            db.Parameters.Add(new SqlParameter("@mgID", mg.mgID));
            db.Parameters.Add(new SqlParameter("@CompanyID", mg.CompanyID));
            //db.Parameters.Add(New SqlParameter("@status", ToInt(mg.Status)))
            mg.Status = MedarbejderStatus.opret;

            db.Parameters.Add(new SqlParameter("@Cprnr", SQLfunctions.SQLstr(mg.Cprnr)));
            db.Parameters.Add(new SqlParameter("@Birthday", SQLfunctions.SQLdate(mg.Birthday)));

            //cmd.Parameters.Add("@Description", SqlDbType.NVarChar).Value = category.Description

            db.Parameters.Add(new SqlParameter("@Navn", SQLfunctions.SQLstr(mg.Navn)));
            db.Parameters.Add(new SqlParameter("@Adresse1", SQLfunctions.SQLstr(mg.Adresse1)));
            db.Parameters.Add(new SqlParameter("@Adresse2", SQLfunctions.SQLstr(mg.Adresse2)));
            db.Parameters.Add(new SqlParameter("@Postnr", SQLfunctions.SQLstr(mg.Postnr)));
            db.Parameters.Add(new SqlParameter("@Bynavn", SQLfunctions.SQLstr(mg.Bynavn)));
            db.Parameters.Add(new SqlParameter("@LandID", Funktioner.ToInt(mg.LandID)));

            db.Parameters.Add(new SqlParameter("@Telefon", SQLfunctions.SQLstr(mg.Telefon)));
            db.Parameters.Add(new SqlParameter("@Mobil", SQLfunctions.SQLstr(mg.Mobil)));
            db.Parameters.Add(new SqlParameter("@Fax", SQLfunctions.SQLstr(mg.Fax)));
            db.Parameters.Add(new SqlParameter("@Email", SQLfunctions.SQLstr(mg.Email)));

            db.Parameters.Add(new SqlParameter("@HospitalsforsikringIndmeldsDato", SQLfunctions.SQLdate(mg.HospitalsforsikringIndmeldsDato)));
            db.Parameters.Add(new SqlParameter("@AfkaldserklaringsDato", SQLfunctions.SQLdate(mg.AfkaldserklaringsDato)));
            db.Parameters.Add(new SqlParameter("@FratradelsesDato", SQLfunctions.SQLdate(mg.FratradelsesDato)));
            db.Parameters.Add(new SqlParameter("@OrlovStart", SQLfunctions.SQLdate(mg.OrlovStart)));
            db.Parameters.Add(new SqlParameter("@OrlovSlut", SQLfunctions.SQLdate(mg.OrlovSlut)));

            db.Parameters.Add(new SqlParameter("@RettetAf", SQLfunctions.SQLstr(CurrentUserName)));
            db.Parameters.Add(new SqlParameter("@RettetIP", SQLfunctions.SQLstr(CurrentUserIP)));

            db.Parameters.Add(ID);
            int retval = db.ExecuteNonQuery("Co2Db_Medarbejder_Insert");

            if (retval == 1)
            {
                mg.ID = int.Parse(ID.Value.ToString());
                return(mg.ID); //Integer.Parse(ID.Value.ToString)
            }
            else
            {
                return(-1);
            }
        }
        public static string GetValueByTitle(string Field, string Title)
        {
            DBAccess db = new DBAccess();

            db.AddParameter("@Field", Field);
            db.AddParameter("@Title", Title);
            string res = Funktioner.ToDbString(db.ExecuteScalar(_SQLSelectGetValueByTitle)); //"Co2Db_Combobox_GetValueByTitle"

            if (res.Trim().Length < 1)
            {
                res = "&nbsp;";
            }
            return(res);
        }
        public static string GetContent(string Field, int idx)
        {
            DBAccess db = new DBAccess();

            db.AddParameter("@Field", Field);
            db.AddParameter("@Idx", idx);
            string res = Funktioner.ToDbString(db.ExecuteScalar(_SQLSelectGetContent)); //"Co2Db_Combobox_GetContent"

            if (res.Trim().Length < 1)
            {
                res = "&nbsp;";
            }
            return(res);
        }
        public static Combobox GetCombobox(string Field, int idx)
        {
            int      ID = -1;
            DBAccess db = new DBAccess();

            db.AddParameter("@Field", Field);
            db.AddParameter("@Idx", idx);
            string res = Funktioner.ToDbString(db.ExecuteScalar(_SQLSelectOne)); //"Co2Db_Combobox_SelectOne"

            if (Information.IsNumeric(res))
            {
                ID = Funktioner.ToInt(res);
            }
            return(GetCombobox(ID));
        }
        public static int GetNoterCount(int CompanyID = -1, int MedarbejderID = -1)
        {
            DBAccess db     = new DBAccess();
            object   res    = null;
            int      result = 0;

            db.Parameters.Add(new SqlParameter("@CompanyID", Funktioner.ToInt(CompanyID)));
            db.Parameters.Add(new SqlParameter("@MedarbejderID", Funktioner.ToInt(MedarbejderID)));

            res = db.ExecuteScalar("Co2Db_Noter_GetCount");
            if ((!ReferenceEquals(res, null)) && Information.IsNumeric(res))
            {
                result = System.Convert.ToInt32(res);
            }
            return(result);
        }
Beispiel #23
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);
        }
Beispiel #24
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);
        }
        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);
        }
        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);
        }
Beispiel #27
0
        public DateTime CprnrToDate(string cprnr)
        {
            DateTime res  = default(DateTime);
            int      dd   = 1;
            int      mm   = 1;
            int      yy   = 0;
            int      year = 1900;
            int      lbnr = 0;

            if (cprnr.Length == 11)
            {
                dd   = Funktioner.ToInt(cprnr.Substring(0, 2));
                mm   = Funktioner.ToInt(cprnr.Substring(2, 2));
                yy   = Funktioner.ToInt(cprnr.Substring(4, 2));
                lbnr = Funktioner.ToInt(cprnr.Substring(7, 4));
                if (lbnr <= 3999)
                {
                    year = 1900;
                }
                else if (lbnr >= 5000 & lbnr <= 8999)
                {
                    if (yy <= 57)
                    {
                        year = 2000;
                    }
                    else
                    {
                        year = 1800;
                    }
                }
                else if ((lbnr >= 4000 & lbnr <= 4999) || (lbnr >= 9000 & lbnr <= 9999))
                {
                    if (yy <= 36)
                    {
                        year = 2000;
                    }
                    else
                    {
                        year = 1900;
                    }
                }
            }
            res = DateAndTime.DateSerial(yy + year, mm, dd);

            return(res);
        }
Beispiel #28
0
        public static int GetCompanyID(int InvoiceID)
        {
            DBAccess db = new DBAccess();

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

            try
            {
                object obj = db.ExecuteScalar(_SQLGetCompanyID);
                res = Funktioner.ToInteger(obj);
            }
            catch
            {
                res = 0;
            }
            return(res);
        }
Beispiel #29
0
        public static decimal GetTotalInvoicesSalgsPris(int InvoiceID)
        {
            DBAccess db = new DBAccess();

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

            try
            {
                object obj = db.ExecuteScalar(_SQLTotalInvoicesPris);
                res = Funktioner.ToDecimal(obj);
            }
            catch
            {
                res = 0;
            }
            return(res);
        }
        public static int GetSupplierID(int PurchaseOrderID)
        {
            DBAccess db = new DBAccess();

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

            try
            {
                object obj = db.ExecuteScalar(_SQLGetSupplierID);
                res = Funktioner.ToInteger(obj);
            }
            catch
            {
                res = 0;
            }
            return(res);
        }