Beispiel #1
0
        public static System.Collections.Generic.List <IncassoSag> GetIncassoList(int CompanyID, Invoice_StatusEnum Status)
        {
            System.Collections.Generic.List <IncassoSag> result = new System.Collections.Generic.List <IncassoSag>();
            DBAccess db = new DBAccess();

            db.AddInt("CompanyID", CompanyID);
            db.AddInt("Status", System.Convert.ToInt32(Status));

            SqlDataReader dr = default(SqlDataReader);

            dr = (System.Data.SqlClient.SqlDataReader)(db.ExecuteReader(_SQLSelectByStatusCompany));
            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    result.Add(IncassoSag.GetIncasso(System.Convert.ToInt32(dr.DBtoInt("ID"))));
                }
            }

            if (!dr.IsClosed)
            {
                dr.Close();
            }
            return(result);
        }
Beispiel #2
0
        public static int Delete(int ID)
        {
            IncassoSag IH = new IncassoSag();

            IH.ID = ID;
            return(Delete(IH));
        }
Beispiel #3
0
        private static void Populate(SqlDataReader dr, IncassoSag i)
        {
            PopulateStandard(dr, i);
            var with_1 = i;

            with_1.ContactEmail = dr.DBtoString("ContactEmail");
            with_1.ContactName  = dr.DBtoString("ContactName");

            with_1.Status      = (RescueTekniq.BOL.Incasso_StatusEnum)(dr.DBtoInt("Status"));
            with_1.CompanyID   = System.Convert.ToInt32(dr.DBtoInt("CompanyID"));
            with_1.InvoiceID   = System.Convert.ToInt32(dr.DBtoInt("InvoiceID"));
            with_1.IncassoDate = System.Convert.ToDateTime(dr.DBtoDateTime("IncassoDate"));
            with_1.Notes       = dr.DBtoString("Notes");

            with_1._InvoiceTotal                      = System.Convert.ToDouble(dr.DBtoDouble("InvoiceTotal"));
            with_1.RenterOpgjortAfKreditor            = System.Convert.ToDouble(dr.DBtoDouble("RenterOpgjortAfKreditor"));
            with_1.GebyrOpgjortAfKreditor             = System.Convert.ToDouble(dr.DBtoDouble("GebyrOpgjortAfKreditor"));
            with_1.RenteTilskrevetFraPaymentDatetilDD = System.Convert.ToDouble(dr.DBtoDouble("RenteTilskrevetFraPaymentDatetilDD"));
            with_1.GebyrForDenneRykkerskrivelse       = System.Convert.ToDouble(dr.DBtoDouble("GebyrForDenneRykkerskrivelse"));
            with_1._IncassoTotal                      = System.Convert.ToDouble(dr.DBtoDouble("IncassoTotal"));

            with_1.IncassoSalaer      = dr.DBtoDouble("IncassoSalaer");
            with_1.Oversendelsesgebyr = System.Convert.ToDouble(dr.DBtoDouble("Oversendelsesgebyr"));

            with_1.Paid     = System.Convert.ToBoolean(dr.DBtoBoolean("Paid"));
            with_1.PaidDate = dr.DBtoDateTime("PaidDate");
        }
Beispiel #4
0
        private static void AddParms(ref DBAccess db, IncassoSag i)
        {
            var with_1 = i;

            db.AddNVarChar("ContactEmail", with_1.ContactEmail, 250);
            db.AddNVarChar("ContactName", with_1.ContactName, 50);

            db.AddInt("Status", (System.Int32)with_1.Status);
            db.AddInt("CompanyID", with_1.CompanyID);
            db.AddInt("InvoiceID", with_1.InvoiceID);
            db.AddDateTime("IncassoDate", with_1.IncassoDate);
            db.AddNVarChar("Notes", with_1.Notes, -1);

            db.AddFloat("InvoiceTotal", with_1.InvoiceTotal);
            db.AddFloat("RenterOpgjortAfKreditor", with_1.RenterOpgjortAfKreditor);
            db.AddFloat("GebyrOpgjortAfKreditor", with_1.GebyrOpgjortAfKreditor);
            db.AddFloat("RenteTilskrevetFraPaymentDatetilDD", with_1.RenteTilskrevetFraPaymentDatetilDD);
            db.AddFloat("GebyrForDenneRykkerskrivelse", with_1.GebyrForDenneRykkerskrivelse);
            db.AddFloat("IncassoTotal", with_1.IncassoTotal);

            db.AddFloat("IncassoSalaer", with_1.IncassoSalaer);
            db.AddFloat("Oversendelsesgebyr", with_1.Oversendelsesgebyr);

            db.AddBoolean("Paid", with_1.Paid);
            db.AddDateTime("PaidDate", with_1.PaidDate);


            AddParmsStandard(db, i);
        }
Beispiel #5
0
        public static int Delete(IncassoSag IH)
        {
            DBAccess db = new DBAccess();

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

            AddLog(Status: "Incasso", Logtext: string.Format("Delete Incasso: ID:{0}", IH.ID), Metode: "Delete");
            return(retval);
        }
Beispiel #6
0
        public static int Update(IncassoSag c)
        {
            DBAccess db = new DBAccess();

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

            int retval = db.ExecuteNonQuery(_SQLUpdate);

            AddLog(Status: "Incasso", Logtext: string.Format("Update Incasso: ID:{0}", c.ID), Metode: "Update");
            return(retval);
        }
Beispiel #7
0
        public static int Save(IncassoSag i)
        {
            int retval = 0;

            if (i.ID > 0)
            {
                retval = Update(i);
            }
            else
            {
                retval = Insert(i);
            }
            return(retval);
        }
Beispiel #8
0
        public static int SetStatus(int ID, Invoice_StatusEnum Status)
        {
            DBAccess db = new DBAccess();

            IncassoSag c = new IncassoSag(ID);

            db.AddInt("ID", ID);
            db.AddInt("Status", System.Convert.ToInt32(Status));
            AddParmsStandard(db, c);

            int retval = db.ExecuteNonQuery(_SQLSetStatus);

            AddLog(Status: "Incasso", Logtext: string.Format("SetStatus Incasso: ID:{0} Status:{1}", c.ID, c.StatusText), Metode: "SetStatus");
            return(retval);
        }
Beispiel #9
0
        public static IncassoSag GetIncassoByInvoiceID(int InvoiceID)
        {
            DBAccess   db = new DBAccess();
            IncassoSag c  = new IncassoSag();

            db.AddInt("InvoiceID", InvoiceID);
            SqlDataReader dr = (SqlDataReader)(db.ExecuteReader(_SQLSelectByInvoiceID));

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    Populate(dr, c);
                }
            }
            if (!dr.IsClosed)
            {
                dr.Close();
            }
            return(c);
        }
Beispiel #10
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);
            }
        }
Beispiel #11
0
 public static int SetStatus(IncassoSag c)
 {
     return(SetStatus(c.ID, (Invoice_StatusEnum)c.Status));
 }
Beispiel #12
0
 public static int Purge(IncassoSag c)
 {
     return(Purge(c.ID));
 }