예제 #1
0
        public static System.Collections.Generic.List <AED_Battery> GetBatteryListExpiredEmail(int CompanyID)
        {
            System.Collections.Generic.List <AED_Battery> result = new System.Collections.Generic.List <AED_Battery>();
            int      ID = -1;
            DBAccess db = new DBAccess();

            db.AddInt("CompanyID", CompanyID);

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

            SqlDataReader dr = default(SqlDataReader);

            try
            {
                dr = (System.Data.SqlClient.SqlDataReader)(db.ExecuteReader(_SQLSelectAllExpiredEmail));
                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        ID = System.Convert.ToInt32(dr.DBtoInt("ID"));
                        result.Add(AED_Battery.GetBattery(ID));
                    }
                }
                dr.Close();
            }
            catch (Exception ex)
            {
                throw (ex);
            }

            return(result);
        }
예제 #2
0
        public static string Tags(string tekst, RescueTekniq.BOL.AED_Battery item)
        {
            string        res = "";
            StringBuilder sb  = new StringBuilder();

            sb.Append(tekst);
            sb.Replace("[VARE.TYPE]", "Batteri");
            sb.Replace("[BATTERI.TYPE]", "[VARE.NAVN]");

            sb.Replace("[EXPIREDATE]", item.BatteryExpireDate.ToString("d. MMMM yyyy"));
            sb.Replace("[BATTERI.EXPIREDATE]", item.BatteryExpireDate.ToString("d. MMMM yyyy"));
            sb.Replace("[BATTERI.UDLØBSDATO]", item.BatteryExpireDate.ToString("d. MMMM yyyy"));

            sb.Replace("[BATTERI.DELEVERYDATE]", item.BatteryDeleveryDate.ToString("d. MMMM yyyy"));
            sb.Replace("[BATTERI.EMAILSENDT]", item.BatteryEmailSendt.ToString());
            sb.Replace("[BATTERI.GUID]", item.Guid.ToString());

            sb.Replace("[BATTERI.VARENR]", "[VARE.VARENR]");
            sb.Replace("[BATTERI.SALGSPRIS]", "[VARE.SALGSPRIS]");
            sb.Replace("[BATTERI.RABAT]", "[VARE.RABAT]");
            sb.Replace("[BATTERI.PRIS]", "[VARE.PRIS]");
            sb.Replace("[BATTERI.KUNDEPRIS]", "[VARE.KUNDEPRIS]");
            sb.Replace("[BATTERI.FRAGTGEBYR]", "[VARE.FRAGTGEBYR]");
            sb.Replace("[BATTERI.FRAGTPRIS]", "[VARE.FRAGTPRIS]");
            sb.Replace("[BATTERI.MOMS]", "[VARE.MOMS]");
            sb.Replace("[BATTERI.TOTAL]", "[VARE.TOTAL]");

            res = sb.ToString();
            res = item.KundeGrpPris.Tags(res);
            res = item.AED.Tags(res);

            return(res);
        }
예제 #3
0
        public static int Delete(int ID)
        {
            AED_Battery B = new AED_Battery();

            B.ID = ID;
            return(Delete(B));
        }
예제 #4
0
        public static System.Collections.Generic.List <AED_Battery> GetBatteryList(int AED_FK)
        {
            System.Collections.Generic.List <AED_Battery> result = new System.Collections.Generic.List <AED_Battery>();
            int      ID = -1;
            DBAccess db = new DBAccess();

            db.AddInt("AED_FK", AED_FK);

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

            SqlDataReader dr = default(SqlDataReader);

            //Try
            dr = (System.Data.SqlClient.SqlDataReader)(db.ExecuteReader(_SQLSelectByAED));
            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    ID = System.Convert.ToInt32(dr.DBtoInt("ID"));
                    result.Add(AED_Battery.GetBattery(ID));
                }
            }
            dr.Close();
            //Catch ex As Exception
            //Throw ex
            //End Try

            return(result);
        }
예제 #5
0
        public static int Delete(AED_Battery B)
        {
            DBAccess db = new DBAccess();

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

            AddLog(Status: "AED_Battery", Logtext: string.Format("Delete AED_Battery: ID:{0}", B.ID), Metode: "Delete");
            return(retval);
        }
예제 #6
0
        private static void AddParms(ref DBAccess db, AED_Battery c)
        {
            var with_1 = c;

            db.AddInt("Status", (System.Int32)with_1.Status);
            db.AddInt("AED_FK", with_1.AED_FK);
            db.AddInt("BatteryType", with_1.BatteryType);
            db.AddDateTime("BatteryDeleveryDate", with_1.BatteryDeleveryDate);
            db.AddDateTime("BatteryExpireDate", with_1.BatteryExpireDate);
            db.AddDateTime("BatteryEmailSendt", with_1.BatteryEmailSendt);
            AddParmsStandard(db, c);
        }
예제 #7
0
        private static void Populate(SqlDataReader dr, AED_Battery c)
        {
            PopulateStandard(dr, c);
            var with_1 = c;

            with_1.Status = (RescueTekniq.BOL.AEDStatusEnum)(dr.DBtoInt("Status"));
            with_1.AED_FK = System.Convert.ToInt32(dr.DBtoInt("AED_FK"));

            with_1.BatteryType         = System.Convert.ToInt32(dr.DBtoInt("BatteryType"));
            with_1.BatteryDeleveryDate = System.Convert.ToDateTime(dr.DBtoDate("BatteryDeleveryDate"));
            with_1.BatteryExpireDate   = System.Convert.ToDateTime(dr.DBtoDate("BatteryExpireDate"));
            with_1.BatteryEmailSendt   = dr.DBtoDate("BatteryEmailSendt");
        }
예제 #8
0
        public static int Save(AED_Battery B)
        {
            int retval = 0;

            if (B.ID > 0)
            {
                retval = Update(B);
            }
            else
            {
                retval = Insert(B);
            }
            return(retval);
        }
예제 #9
0
        public static int Update(int ID, AEDStatusEnum Status, int AED_FK, int BatteryType, DateTime BatteryDeleveryDate, DateTime BatteryExpireDate, DateTime BatteryEmailSendt)
        {
            AED_Battery c = new AED_Battery(ID);

            c.Status = Status;
            c.AED_FK = AED_FK;

            c.BatteryType         = BatteryType;
            c.BatteryDeleveryDate = BatteryDeleveryDate;
            c.BatteryExpireDate   = BatteryExpireDate;
            c.BatteryEmailSendt   = BatteryEmailSendt;

            return(Update(c));
        }
예제 #10
0
        public static AED_Battery GetBattery(System.Guid Guid)
        {
            AED_Battery c  = new AED_Battery();
            DBAccess    db = new DBAccess();

            db.AddGuid("Guid", Guid);

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

            SqlDataReader dr = (SqlDataReader)(db.ExecuteReader(_SQLSelectByGuid));

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    Populate(dr, c);
                }
            }
            dr.Close();
            return(c);
        }
예제 #11
0
        public static int Insert(AED_Battery B)
        {
            DBAccess db = new DBAccess();

            AddParms(ref db, B);

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

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

            if (retval == 1)
            {
                B.ID = int.Parse(objParam.Value.ToString());
                AddLog(Status: "AED_Battery", Logtext: string.Format("Create AED_Battery: ID:{0}", B.ID), Metode: "Insert");
                return(B.ID);
            }
            else
            {
                AddLog(Status: "AED_Battery", Logtext: string.Format("Failure to Create AED_Battery:"), logtype: LogTypeEnum.Error, Metode: "Insert");
                return(-1);
            }
        }