示例#1
0
 public static void UpdateCategoryById(int id, CanonCategory newValues)
 {
     CanonDataContext db = Cdb.Instance;
     Category cat = db.Categories.First(u => u.CategoryId == id);
     cat.CategoryName = newValues.CategoryName;
     cat.InternalId = newValues.InternalId;
     db.SubmitChanges();
 }
示例#2
0
        public static void UpdateCategoryById(int id, CanonCategory newValues)
        {
            CanonDataContext db  = Cdb.Instance;
            Category         cat = db.Categories.First(u => u.CategoryId == id);

            cat.CategoryName = newValues.CategoryName;
            cat.InternalId   = newValues.InternalId;
            db.SubmitChanges();
        }
示例#3
0
 public static void InsertCategory(CanonCategory newValues)
 {
     CanonDataContext db = Cdb.Instance;
     Category cat = new Category();
     cat.CategoryName = newValues.CategoryName;
     cat.InternalId = newValues.InternalId;
     db.Categories.InsertOnSubmit(cat);
     db.SubmitChanges();
 }
示例#4
0
        public static void InsertCategory(CanonCategory newValues)
        {
            CanonDataContext db  = Cdb.Instance;
            Category         cat = new Category();

            cat.CategoryName = newValues.CategoryName;
            cat.InternalId   = newValues.InternalId;
            db.Categories.InsertOnSubmit(cat);
            db.SubmitChanges();
        }
示例#5
0
        protected void gridCategories_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            try
            {
                SessionManager.IsEditFormCreated = false;
                int keyToUpdate = int.Parse(e.Keys[0].ToString());
                //update category
                CanonCategory cc = new CanonCategory();
                cc.CategoryName = e.NewValues["CategoryName"].ToString();
                cc.InternalId = e.NewValues["InternalId"].ToString();
                CanonCategory.UpdateCategoryById(keyToUpdate, cc);

                e.Cancel = true;
                gridCategories.CancelEdit();
                this.BindData();
            }
            catch (Exception ex)
            {
                Logger.Log(string.Format("exception {0}", ex.ToString()), LogLevel.Error);
            }
        }
示例#6
0
        protected void gridCategories_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            try
            {
                SessionManager.IsEditFormCreated = false;
                //insert category
                CanonCategory cc = new CanonCategory();
                cc.CategoryName = e.NewValues["CategoryName"].ToString();
                cc.InternalId = e.NewValues["InternalId"].ToString();
                CanonCategory.InsertCategory(cc);

                e.Cancel = true;
                gridCategories.CancelEdit();
                this.BindData();
            }
            catch (Exception ex)
            {
                Logger.Log(string.Format("exception {0}", ex.ToString()), LogLevel.Error);
            }
        }