예제 #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);
        }
예제 #2
0
        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 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);
            }
        }
예제 #4
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);
            }
        }
예제 #5
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);
        }
예제 #6
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);
        }
예제 #7
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);
        }
        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 GetKursusPolicyCountByCompany(int CompanyID)
        {
            int      res = 0;
            DBAccess db  = new DBAccess();

            db.AddInt("CompanyID", CompanyID);
            res = Funktioner.ToInt(db.ExecuteScalar(_SQLCountByCompany));
            return(res);
        }
예제 #10
0
        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);
        }
예제 #11
0
        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);
        }
예제 #12
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);
        }
예제 #13
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);
        }
예제 #14
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);
            }
        }
예제 #15
0
        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));
        }
예제 #16
0
        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);
        }
        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);
        }
예제 #18
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);
        }
예제 #19
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);
        }
예제 #20
0
        public static int Insert(Korrespondance k)
        {
            DBAccess     db = new DBAccess();
            SqlParameter ID = new SqlParameter("@ID", 0);

            ID.Direction = ParameterDirection.Output;

            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)

            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_Korrespondance_Insert");

            if (retval == 1)
            {
                k.ID = int.Parse(ID.Value.ToString());
                AddLog(Status: "Korrespondance", Logtext: string.Format("Create Korrespondance: ID:{0}", k.ID), Metode: "Insert");
                return(k.ID); //Integer.Parse(ID.Value.ToString)
            }
            else
            {
                AddLog(Status: "Korrespondance", Logtext: string.Format("Failure to Create Korrespondance:"), logtype: LogTypeEnum.Error, Metode: "Insert");
                return(-1);
            }
        }
예제 #21
0
        public static int GetCompanyTilbudCount(int CompanyID)
        {
            DBAccess db = new DBAccess();

            db.AddInt("CompanyID", CompanyID);

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

            int res = 0;

            try
            {
                res = Funktioner.ToInt(db.ExecuteScalar(_SQLSelectByCompanyCount));
            }
            catch (Exception)
            {
                res = 0;
            }
            return(res);
        }
예제 #22
0
        public static int Update(Noter 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("@Tekst", SQLfunctions.SQLstr(n.Tekst)));

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

            AddLog(Status: "Noter", Logtext: string.Format("Update Noter: ID:{0}", n.ID), Metode: "Update");
            return(retval);
        }
예제 #23
0
        //Public Shared Function Insert(ByVal CompanyID As Integer, ByVal Navn As String, ByVal Brugernavn As String, ByVal Kodeord As String, ByVal IP As String, ByVal Dato As Date) As Integer
        //	Dim mg As Medarbejder = New Medarbejder(CompanyID, Navn, Brugernavn, Kodeord, IP, Dato)
        //	Return Insert(mg)
        //End Function

        public static int Update(Medarbejder mg)
        {
            DBAccess db = new DBAccess();

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

            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)))

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

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

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

            return(retval);
        }
예제 #24
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);
        }
예제 #25
0
        public static int Insert(EyeWash rec)
        {
            DBAccess db = new DBAccess();

            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); //Integer.Parse(objParam.Value.ToString)
                AddLog(Status: "EyeWash", Logtext: string.Format("Create EyeWash: ID:{0} SNo:{1} ", rec.ID, rec.SerialNo), Metode: "Insert");
                return(rec.ID);                                //Integer.Parse(objParam.Value.ToString)
            }
            else
            {
                AddLog(Status: "EyeWash", Logtext: string.Format("Failure to Create EyeWash: SNo:{0}", rec.SerialNo), logtype: LogTypeEnum.Error, Metode: "Insert");
                return(-1);
            }
        }
예제 #26
0
        public static int Insert(IncassoSag c)
        {
            DBAccess db = new DBAccess();

            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);
                AddLog(Status: "Incasso", Logtext: string.Format("Create Incasso: ID:{0}", c.ID), Metode: "Insert");
                return(c.ID);
            }
            else
            {
                AddLog(Status: "Incasso", Logtext: string.Format("Failure to Create Incasso:"), logtype: LogTypeEnum.Error, Metode: "Insert");
                return(-1);
            }
        }
예제 #27
0
        public static int Insert(Agents A)
        {
            DBAccess db = new DBAccess();

            AddParms(ref db, A);

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

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

            if (retval == 1)
            {
                A.ID = Funktioner.ToInt(objParam.Value, -1);
                AddLog(Status: "Agents", Logtext: string.Format("Create Agent: ID:{0} Name:{1} ", A.ID, A.Name), Metode: "Insert");
                return(A.ID);
            }
            else
            {
                AddLog(Status: "Agents", Logtext: string.Format("Failure to Create Agent: Name:{0}", A.Name), logtype: LogTypeEnum.Error, Metode: "Insert");
                return(-1);
            }
        }
예제 #28
0
        public static int Insert(tilbudHeader c)
        {
            DBAccess db = new DBAccess();

            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);
                AddLog(Status: "tilbudHeader", Logtext: string.Format("Create tilbudHeader: ID:{0} KontaktPerson:{1} ", c.ID, c.KontaktPerson), Metode: "Insert");
                return(c.ID); //Integer.Parse(objParam.Value.ToString)
            }
            else
            {
                AddLog(Status: "tilbudHeader", Logtext: string.Format("Failure to Create tilbudHeader: KontaktPerson:{0}", c.KontaktPerson), logtype: LogTypeEnum.Error, Metode: "Insert");
                return(-1);
            }
        }