예제 #1
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (ValidateItem())
     {
         CATEGORIES rec = new CATEGORIES();
         if (RECid > 0)
         {
             rec = DALCategories.Get(RECid);
             if (!string.IsNullOrEmpty(Title))
             {
                 rec.TITLE = Title;
             }
             rec.ISACTIVE = chkActive.Checked;
             rec.TITLE    = txtTitle.Text;
             rec.URLSEO   = Code.Helper.SEOUrl(txtTitle.Text);
             DALCategories.Update(rec);
         }
         else
         {
             rec.SORT     = Convert.ToInt16(DALCategories.GetLastSort() + 1);
             rec.ISACTIVE = chkActive.Checked;
             rec.TITLE    = txtTitle.Text;
             rec.URLSEO   = Code.Helper.SEOUrl(txtTitle.Text);
             DALCategories.Insert(rec);
         }
         ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ClosePage", "CloseModal(true);", true);
         btnDelete.Visible = false;
         btnCancel.Visible = false;
     }
 }
예제 #2
0
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         CATEGORIES rec = DALCategories.Get(Int32.Parse(Request.QueryString["ID"]));
         if (rec != null)
         {
             if (!GetCountBlog(rec.ID))
             {
                 DALCategories.Delete(rec.ID);
             }
             else
             {
                 NotificationAdd(NotificationType.error, "Kategoriyi Silmek için bağlı olan yazıları silin!");
             }
         }
         ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ClosePage", "CloseModal(true);", true);
         NotificationAdd(NotificationType.success, "Kayıt Silindi.");
     }
     catch (Exception ex)
     {
         if (ex is SqlException)
         {
             if ((ex as SqlException).Number == 547)
             {
                 NotificationAdd(NotificationType.error, "Kayıt başka yerlerde kullanıdı.");
             }
         }
         else
         {
             throw ex;
         }
     }
 }
예제 #3
0
        protected void rptCategories_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            switch (e.CommandName)
            {
            case "Down":
            {
                CATEGORIES self  = DALCategories.Get(Int32.Parse(e.CommandArgument.ToString()));
                CATEGORIES upper = DALCategories.GetBySort(self.SORT + 1);
                self.SORT++;
                upper.SORT--;
                DALCategories.Update(self);
                DALCategories.Update(upper);
                fillCategories();
                break;
            }

            case "Up":
            {
                CATEGORIES self  = DALCategories.Get(Int32.Parse(e.CommandArgument.ToString()));
                CATEGORIES upper = DALCategories.GetBySort(self.SORT - 1);
                self.SORT--;
                upper.SORT++;
                DALCategories.Update(self);
                DALCategories.Update(upper);
                fillCategories();
                break;
            }
            }
        }
예제 #4
0
        public override global::System.Data.DataSet Clone()
        {
            CATEGORIES cln = ((CATEGORIES)(base.Clone()));

            cln.InitVars();
            cln.SchemaSerializationMode = this.SchemaSerializationMode;
            return(cln);
        }
예제 #5
0
        public ActionResult DeleteConfirmed(int id)
        {
            CATEGORIES cATEGORIES = db.CATEGORIES.Find(id);

            db.CATEGORIES.Remove(cATEGORIES);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #6
0
        private static void ShowByCategory(CATEGORIES category)
        {
            // extension method
            var query = _movies.Where(m => m.Category == category).OrderBy(m => m.Title);

            foreach (var movie in query)
            {
                Console.WriteLine(ToJson(movie as object));
            }
        }
예제 #7
0
 public ActionResult Edit([Bind(Include = "CATEGORYID,CATEGORYNAME")] CATEGORIES cATEGORIES)
 {
     if (ModelState.IsValid)
     {
         db.Entry(cATEGORIES).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(cATEGORIES));
 }
예제 #8
0
 public ActionResult Edit([Bind(Include = "ID,NAME,ACTIVE,DATE_CREATION,DATE_MODIFI")] CATEGORIES cATEGORY)
 {
     if (ModelState.IsValid)
     {
         db.Entry(cATEGORY).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(cATEGORY));
 }
예제 #9
0
        public ActionResult Create([Bind(Include = "ID,NAME,ACTIVE,DATE_CREATION,DATE_MODIFI")] CATEGORIES cATEGORY)
        {
            if (ModelState.IsValid)
            {
                db.CATEGORIES.Add(cATEGORY);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(cATEGORY));
        }
예제 #10
0
        public ActionResult Create([Bind(Include = "CATEGORYID,CATEGORYNAME")] CATEGORIES cATEGORIES)
        {
            if (ModelState.IsValid)
            {
                db.CATEGORIES.Add(cATEGORIES);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(cATEGORIES));
        }
예제 #11
0
        public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs)
        {
            CATEGORIES ds = new CATEGORIES();

            global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
            global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
            global::System.Xml.Schema.XmlSchemaAny         any      = new global::System.Xml.Schema.XmlSchemaAny();
            any.Namespace = ds.Namespace;
            sequence.Items.Add(any);
            type.Particle = sequence;
            global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
            if (xs.Contains(dsSchema.TargetNamespace))
            {
                global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                try {
                    global::System.Xml.Schema.XmlSchema schema = null;
                    dsSchema.Write(s1);
                    for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                    {
                        schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                        s2.SetLength(0);
                        schema.Write(s2);
                        if ((s1.Length == s2.Length))
                        {
                            s1.Position = 0;
                            s2.Position = 0;
                            for (; ((s1.Position != s1.Length) &&
                                    (s1.ReadByte() == s2.ReadByte()));)
                            {
                                ;
                            }
                            if ((s1.Position == s1.Length))
                            {
                                return(type);
                            }
                        }
                    }
                }
                finally {
                    if ((s1 != null))
                    {
                        s1.Close();
                    }
                    if ((s2 != null))
                    {
                        s2.Close();
                    }
                }
            }
            xs.Add(dsSchema);
            return(type);
        }
예제 #12
0
        public String GetCategorieName(int id)
        {
            CATEGORIES c = DALCategories.Get(id);

            if (c != null)
            {
                return(c.TITLE);
            }
            else
            {
                return("Boş");
            }
        }
예제 #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string title = "";

            if (RouteData.Values["TITLE"] != null)
            {
                title = RouteData.Values["TITLE"].ToString();
                CATEGORIES c = DALCategories.GetTitle(title);
                rptPostTitle.Bind(DALBlog.GetByCategoriesID(c.ID));
            }

            rptrCategories.Bind(DALCategories.GetAll());
            rptLastPost.Bind(DALBlog.GetLastCount(3));
        }
예제 #14
0
        // GET: Cat/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CATEGORIES cATEGORIES = db.CATEGORIES.Find(id);

            if (cATEGORIES == null)
            {
                return(HttpNotFound());
            }
            return(View(cATEGORIES));
        }
예제 #15
0
 private void InitializePage()
 {
     if (!string.IsNullOrEmpty(Request.QueryString["ID"]))
     {
         RECid = Convert.ToInt16(Request.QueryString["ID"]);
         CATEGORIES item = DALCategories.Get(RECid);
         if (item != null)
         {
             txtTitle.Text     = item.TITLE;
             chkActive.Checked = (bool)item.ISACTIVE;
             btnDelete.Visible = true;
             btnSave.Text      = "Güncelle";
         }
     }
 }
예제 #16
0
        /// <summary>
        /// I use this method when a user wants to create a new appointment.
        /// </summary>
        /// <param name="appointment"></param>
        /// <returns></returns>
        public static SchedulerReservations DataConverter(SchedulerReservations appointment)
        {
            CategoryBL categBL = new CategoryBL();
            CATEGORIES categ   = categBL.GetByID(appointment.CategoryName);

            appointment.CurrentPrice    = (int)categ.Price;
            appointment.End             = appointment.Start.AddMinutes((int)categ.ProcessLengthInMunites);
            appointment.TaskID          = CalculateAppointmentID();
            appointment.ReservationDate = DateTime.Now;

            UserBL userBL = new UserBL();

            appointment.Title       = userBL.GetByID(appointment.NickName).FullName + ", " + categ.CategoryName;
            appointment.Description = appointment.Title + ", " + appointment.CurrentPrice + ", " + appointment.ReservationDate;

            return(appointment);
        }
 /// <summary>
 /// If the model is valid, the user can create a new category.
 /// </summary>
 /// <param name="category"></param>
 /// <returns></returns>
 public ActionResult CreateCategory(CATEGORIES category)
 {
     try
     {
         if (ModelState.IsValid)
         {
             objBS.Insert(category);
             return(RedirectToAction("Index", new { afterCreateCageory = category.CategoryName + " kategória sikeresen létrehozva!" }));
         }
         return(View("Create"));
     }
     catch
     {
         TempData["Msg"] = "A kategória létrehozása sikertelen";
         return(RedirectToAction("Create"));
     }
 }
예제 #18
0
 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     dishesList.Items.Clear();
     categories        = CATEGORIES.SECOND_DISH;
     button0.IsChecked = false;
     button1.IsChecked = true;
     button2.IsChecked = false;
     button3.IsChecked = false;
     using (DishContext db = new DishContext())
     {
         var dishes = db.Dishes.ToList();
         foreach (Dish d in dishes)
         {
             if (d.Category == "Второе блюдо")
             {
                 dishesList.Items.Add(d);
             }
         }
     }
 }
        /// <summary>
        /// This method provides the cagetory editing. I take the original object from the DB, and change the propertys based on the given paramters.
        /// After that I update the DB with the new object, and I redirecting to the Index action.
        /// </summary>
        /// <param name="category"></param>
        /// <param name="originalName"></param>
        /// <returns></returns>
        public ActionResult EditCategory(CATEGORIES category, string originalName)
        {
            try
            {
                CATEGORIES originalCategory = objBS.GetByID(originalName);
                originalCategory.Price = category.Price;
                originalCategory.ProcessLengthInMunites = category.ProcessLengthInMunites;

                objBS.Update(originalCategory);

                return(RedirectToAction("Index", new { afterCreateCageory = "A kiválaszott kategória sikeresen szerkesztve!" }));
            }
            catch
            {
                TempData["Msg"] = "A kategória szerkesztése sikertelen";
                return(RedirectToAction("Edit", new
                {
                    id = originalName
                }));
            }
        }
예제 #20
0
        public void initialize()
        {
            if (Feed != null)
            {
                return;
            }
            if (System.IO.File.Exists(FILEPATH))
            {
                var reader = XmlReader.Create(System.IO.File.OpenRead(FILEPATH));
                Feed = SyndicationFeed.Load(reader);
                reader.Close();
            }
            else
            {
                Feed = new SyndicationFeed(
                    title: TITLE,
                    description: DESCRIPTION,
                    feedAlternateLink: new Uri(ALTERNATELINK)
                    );

                if (!string.IsNullOrWhiteSpace(AUTHORS))
                {
                    string[] authors = AUTHORS.Split(';');
                    foreach (var item in authors)
                    {
                        Feed.Authors.Add(new SyndicationPerson(item));
                    }
                }
                if (!string.IsNullOrWhiteSpace(CATEGORIES))
                {
                    string[] categories = CATEGORIES.Split(';');
                    foreach (var item in categories)
                    {
                        Feed.Categories.Add(new SyndicationCategory(item));
                    }
                }
            }
        }
예제 #21
0
 public void Insert(CATEGORIES category)
 {
     Db.CATEGORIES.Add(category);
     Db.SaveChanges();
 }
예제 #22
0
 public void Update(CATEGORIES category)
 {
     Db.Entry(category).State = System.Data.Entity.EntityState.Modified;
     Db.SaveChanges();
 }
예제 #23
0
 public void Insert(CATEGORIES category)
 {
     objDB.Insert(category);
 }
예제 #24
0
            public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs)
            {
                global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
                global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
                CATEGORIES ds = new CATEGORIES();

                global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
                any1.Namespace       = "http://www.w3.org/2001/XMLSchema";
                any1.MinOccurs       = new decimal(0);
                any1.MaxOccurs       = decimal.MaxValue;
                any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any1);
                global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
                any2.Namespace       = "urn:schemas-microsoft-com:xml-diffgram-v1";
                any2.MinOccurs       = new decimal(1);
                any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any2);
                global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute1.Name       = "namespace";
                attribute1.FixedValue = ds.Namespace;
                type.Attributes.Add(attribute1);
                global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute2.Name       = "tableTypeName";
                attribute2.FixedValue = "CATEGORYDataTable";
                type.Attributes.Add(attribute2);
                type.Particle = sequence;
                global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
                if (xs.Contains(dsSchema.TargetNamespace))
                {
                    global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                    global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                    try {
                        global::System.Xml.Schema.XmlSchema schema = null;
                        dsSchema.Write(s1);
                        for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                        {
                            schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                            s2.SetLength(0);
                            schema.Write(s2);
                            if ((s1.Length == s2.Length))
                            {
                                s1.Position = 0;
                                s2.Position = 0;
                                for (; ((s1.Position != s1.Length) &&
                                        (s1.ReadByte() == s2.ReadByte()));)
                                {
                                    ;
                                }
                                if ((s1.Position == s1.Length))
                                {
                                    return(type);
                                }
                            }
                        }
                    }
                    finally {
                        if ((s1 != null))
                        {
                            s1.Close();
                        }
                        if ((s2 != null))
                        {
                            s2.Close();
                        }
                    }
                }
                xs.Add(dsSchema);
                return(type);
            }
예제 #25
0
 public void Update(CATEGORIES category)
 {
     objDB.Update(category);
 }
예제 #26
0
        /// <summary>
        /// Method used to add a property to the instance. Will be placed in the correct class Property.
        /// </summary>
        /// <param name="input">The vCard.Property to add.</param>
        public void AddProperty(Props.IProperty input)
        {
            if (input == null || input.IsValueNull)
            {
                return;
            }

            switch (input.Property)
            {
            case KnownProperties.ADR:
                ADR.AddIfNotNull(input as Props.ADR);
                break;

            case KnownProperties.ANNIVERSARY:
                ANNIVERSARY = input as Props.ANNIVERSARY;
                break;

            case KnownProperties.BDAY:
                BDAY = input as Props.BDAY;
                break;

            case KnownProperties.CALADRURI:
                CALADRURI.AddIfNotNull(input as Props.CALADRURI);
                break;

            case KnownProperties.CALURI:
                CALURI.AddIfNotNull(input as Props.CALURI);
                break;

            case KnownProperties.CATEGORIES:
                CATEGORIES.AddIfNotNull(input as Props.CATEGORIES);
                break;

            case KnownProperties.CLIENTPIDMAP:
                CLIENTPIDMAP.AddIfNotNull(input as Props.CLIENTPIDMAP);
                break;

            case KnownProperties.EMAIL:
                EMAIL.AddIfNotNull(input as Props.EMAIL);
                break;

            case KnownProperties.FBURL:
                FBURL.AddIfNotNull(input as Props.FBURL);
                break;

            case KnownProperties.FN:
                FN.AddIfNotNull(input as Props.FN);
                break;

            case KnownProperties.GENDER:
                GENDER = input as Props.GENDER;
                break;

            case KnownProperties.GEO:
                GEO.AddIfNotNull(input as Props.GEO);
                break;

            case KnownProperties.IMPP:
                IMPP.AddIfNotNull(input as Props.IMPP);
                break;

            case KnownProperties.KEY:
                KEY.AddIfNotNull(input as Props.KEY);
                break;

            case KnownProperties.KIND: {
                char k = (input as Props.KIND).Value.ToLower()[0];
                if (k == 'i')
                {
                    KIND = Kinds.Individual;
                }
                else if (k == 'g')
                {
                    KIND = Kinds.Group;
                }
                else if (k == 'o')
                {
                    KIND = Kinds.Org;
                }
                else if (k == 'l')
                {
                    KIND = Kinds.Location;
                }
                else
                {
                    KIND = Kinds.Individual;
                }
                break;
            }

            case KnownProperties.LANG:
                LANG.AddIfNotNull(input as Props.LANG);
                break;

            case KnownProperties.LOGO:
                LOGO.AddIfNotNull(input as Props.LOGO);
                break;

            case KnownProperties.MEMBER:
                MEMBER.AddIfNotNull(input as Props.MEMBER);
                break;

            case KnownProperties.N:
                N = input as Props.N;
                break;

            case KnownProperties.NICKNAME:
                NICKNAME.AddIfNotNull(input as Props.NICKNAME);
                break;

            case KnownProperties.NOTE:
                NOTE.AddIfNotNull(input as Props.NOTE);
                break;

            case KnownProperties.ORG:
                ORG.AddIfNotNull(input as Props.ORG);
                break;

            case KnownProperties.PHOTO:
                PHOTO.AddIfNotNull(input as Props.PHOTO);
                break;

            case KnownProperties.PRODID:
                PRODID = input as Props.PRODID;
                break;

            case KnownProperties.RELATED:
                RELATED.AddIfNotNull(input as Props.RELATED);
                break;

            case KnownProperties.REV:
                REV = input as Props.REV;
                break;

            case KnownProperties.ROLE:
                ROLE.AddIfNotNull(input as Props.ROLE);
                break;

            case KnownProperties.SOUND:
                SOUND.AddIfNotNull(input as Props.SOUND);
                break;

            case KnownProperties.SOURCE:
                SOURCE.AddIfNotNull(input as Props.SOURCE);
                break;

            case KnownProperties.TEL:
                TEL.AddIfNotNull(input as Props.TEL);
                break;

            case KnownProperties.TITLE:
                TITLE.AddIfNotNull(input as Props.TITLE);
                break;

            case KnownProperties.TZ:
                TZ.AddIfNotNull(input as Props.TZ);
                break;

            case KnownProperties.UID:
                UID = input as Props.UID;
                break;

            case KnownProperties.URL:
                URL.AddIfNotNull(input as Props.URL);
                break;

            case KnownProperties.VERSION:
                VERSION = input as Props.VERSION;
                break;

            case KnownProperties.XML:
                XML.AddIfNotNull(input as Props.XML);
                break;

            default:
                return;
            }
        }
        //+ HANDLING

        //+ SAVE HANDLING
        internal static bool IsCategoryRegistered(ExchangeDirector.Category category) => CATEGORIES.ContainsKey(category);