Пример #1
0
        //Select statement
        //Select statement
        public List <SalesAreas> SelectA()
        {
            string query = "SELECT * FROM 0_areas";

            List <SalesAreas> sArs = new List <SalesAreas>();

            //Open connection
            if (this.OpenConnection() == true)
            {
                MySqlDataAdapter adapter = new MySqlDataAdapter(query, connection);
                DataSet          ds      = new DataSet();


                adapter.Fill(ds, "0_areas");

                this.CloseConnection();

                //return list to be displayed

                foreach (DataRow pRow in ds.Tables["0_areas"].Rows)
                {
                    SalesAreas s = new SalesAreas();
                    s.area_code   = (int)pRow["area_code"];
                    s.description = pRow["description"].ToString();
                    s.inactive    = (bool)pRow["inactive"];
                    sArs.Add(s);
                }
                return(sArs);
            }
            return(null);
        }
        public ActionResult DeleteConfirmed(int id)
        {
            SalesAreas salesAreas = db.SalesAreas.Find(id);

            db.SalesAreas.Remove(salesAreas);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #3
0
        public object Clone()
        {
            var model = (CampaignProgrammeModel)MemberwiseClone();

            model.SalesAreas          = SalesAreas?.ToList();
            model.CategoryOrProgramme = CategoryOrProgramme?.ToList();
            model.Timeband            = Timeband?.Select(x => (TimesliceModel)x.Clone()).ToList();

            return(model);
        }
 public ActionResult Edit([Bind(Include = "area_code,description,inactive")] SalesAreas salesAreas)
 {
     if (ModelState.IsValid)
     {
         db.Entry(salesAreas).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(salesAreas));
 }
        public ActionResult Create([Bind(Include = "area_code,description,inactive")] SalesAreas salesAreas)
        {
            if (ModelState.IsValid)
            {
                db.SalesAreas.Add(salesAreas);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(salesAreas));
        }
        // GET: SalesAreas/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SalesAreas salesAreas = db.SalesAreas.Find(id);

            if (salesAreas == null)
            {
                return(HttpNotFound());
            }
            return(View(salesAreas));
        }
Пример #7
0
        public object Clone()
        {
            ProgrammeRestriction programmeRestriction = (ProgrammeRestriction)MemberwiseClone();

            if (SalesAreas != null)
            {
                programmeRestriction.SalesAreas = new List <string>();
                SalesAreas.ForEach(sa => programmeRestriction.SalesAreas.Add((string)sa.Clone()));
            }
            if (CategoryOrProgramme != null)
            {
                programmeRestriction.CategoryOrProgramme = new List <string>();
                CategoryOrProgramme.ForEach(sa => programmeRestriction.CategoryOrProgramme.Add((string)sa.Clone()));
            }

            return(programmeRestriction);
        }
Пример #8
0
        public object Clone()
        {
            TimeRestriction timeRestriction = (TimeRestriction)MemberwiseClone();

            if (SalesAreas != null)
            {
                timeRestriction.SalesAreas = new List <string>();
                SalesAreas.ForEach(sa => timeRestriction.SalesAreas.Add((string)sa.Clone()));
            }
            if (DowPattern != null)
            {
                timeRestriction.DowPattern = new List <string>();
                DowPattern.ForEach(dp => timeRestriction.DowPattern.Add((string)dp.Clone()));
            }

            return(timeRestriction);
        }