示例#1
0
        private void Save(string type)
        {
            if (Validate())
            {
                #region Insert SanPham

                if (_id != 0)
                {
                    ServiceDAO.Find(_id).Name = txtSystem.Text;
                    if (LocalizedPropertyDAO.Find(_id, 1, "Service", "Title") != null)
                    {
                        LocalizedPropertyDAO.Find(_id, 1, "Service", "Title").LocaleValue = txten.Text;
                    }
                    if (LocalizedPropertyDAO.Find(_id, 2, "Service", "Title") != null)
                    {
                        LocalizedPropertyDAO.Find(_id, 2, "Service", "Title").LocaleValue = txtjp.Text;
                    }
                    if (LocalizedPropertyDAO.Find(_id, 3, "Service", "Title") != null)
                    {
                        LocalizedPropertyDAO.Find(_id, 3, "Service", "Title").LocaleValue = txtvi.Text;
                    }
                    if (LocalizedPropertyDAO.Find(_id, 1, "Service", "Body") != null)
                    {
                        LocalizedPropertyDAO.Find(_id, 1, "Service", "Body").LocaleValue = ckFullen.Text;
                    }
                    if (LocalizedPropertyDAO.Find(_id, 2, "Service", "Body") != null)
                    {
                        LocalizedPropertyDAO.Find(_id, 2, "Service", "Body").LocaleValue = ckFulljp.Text;
                    }
                    if (LocalizedPropertyDAO.Find(_id, 3, "Service", "Body") != null)
                    {
                        LocalizedPropertyDAO.Find(_id, 3, "Service", "Body").LocaleValue = ckFullvi.Text;
                    }
                    ArticleDAO.Update();
                }
                else
                {
                    var x = new DAO.Service
                    {
                        Name = txtSystem.Text
                    };
                    ServiceDAO.Insert(x);
                    LocalizedPropertyDAO.Insert(new LocalizedProperty
                    {
                        EntityId       = x.Id,
                        LanguageId     = 1,
                        LocaleKeyGroup = "Service",
                        LocaleKey      = "Title",
                        LocaleValue    = txten.Text
                    });
                    LocalizedPropertyDAO.Insert(new LocalizedProperty
                    {
                        EntityId       = x.Id,
                        LanguageId     = 2,
                        LocaleKeyGroup = "Service",
                        LocaleKey      = "Title",
                        LocaleValue    = txtjp.Text
                    });
                    LocalizedPropertyDAO.Insert(new LocalizedProperty
                    {
                        EntityId       = x.Id,
                        LanguageId     = 3,
                        LocaleKeyGroup = "Service",
                        LocaleKey      = "Title",
                        LocaleValue    = txtvi.Text
                    });
                    LocalizedPropertyDAO.Insert(new LocalizedProperty
                    {
                        EntityId       = x.Id,
                        LanguageId     = 1,
                        LocaleKeyGroup = "Service",
                        LocaleKey      = "Body",
                        LocaleValue    = ckFullen.Text
                    });
                    LocalizedPropertyDAO.Insert(new LocalizedProperty
                    {
                        EntityId       = x.Id,
                        LanguageId     = 2,
                        LocaleKeyGroup = "Service",
                        LocaleKey      = "Body",
                        LocaleValue    = ckFulljp.Text
                    });
                    LocalizedPropertyDAO.Insert(new LocalizedProperty
                    {
                        EntityId       = x.Id,
                        LanguageId     = 3,
                        LocaleKeyGroup = "Service",
                        LocaleKey      = "Body",
                        LocaleValue    = ckFullvi.Text
                    });
                }

                #endregion

                if (type == "Publish")
                {
                    Response.Redirect("/AppAdmin/Service/Index.aspx");
                }
                else if (type == "Save")
                {
                    Response.Redirect("/AppAdmin/Service/Index.aspx");
                }
            }
            else
            {
                iRightAccess.Visible = false;
                ObjControl.LoadMyControl(idNotPermissionAccess, NotPermissControl);
            }
        }