Example #1
0
    public void SaveInfo()
    {
        List <int> objApplicationIDList = new List <int>();

        if (chkChild.Checked)
        {
            string IDPath = objLogRule.loger_application.FirstOrDefault(s => s.ApplicationID == ApplicationID).IDPath;
            objApplicationIDList = objLogRule.loger_application.Where("it.IDPath like '" + IDPath + "%'").Select(s => s.ApplicationID).ToList();
        }
        else
        {
            objApplicationIDList.Add(ApplicationID);
        }
        if (dropCategoryType.SelectedValue == "")
        {
            foreach (loger_category objLog_Category in objLogRule.loger_category.Where(s => objApplicationIDList.Contains(s.ApplicationID)))
            {
                objLog_Category.LogWriteType = chkLogWriteType.SelectValueString;
            }
        }
        else
        {
            string categoryTypeCode = dropCategoryType.SelectedValue;
            foreach (loger_category objLog_Category in objLogRule.loger_category.Where(s => objApplicationIDList.Contains(s.ApplicationID) && s.CategoryTypeCode == categoryTypeCode))
            {
                objLog_Category.LogWriteType = chkLogWriteType.SelectValueString;
            }
        }

        objLogRule.SaveChanges();
        MessageDialog("设置成功");
    }
Example #2
0
    public void SaveInfo()
    {
        if (CategoryID.IsNoNull())
        {
            objCategory = objLogRule.loger_category.First(p => p.CategoryID == CategoryID);
            objCategory.CategoryName     = txtCategoryName.Text;
            objCategory.LogWriteType     = chkLogWriteType.SelectValueString;
            objCategory.CategoryTypeCode = txtCategoryTypeCode.Text.Trim();

            if (objLogRule.loger_category.Any(s => s.ApplicationID == objCategory.ApplicationID && s.CategoryID != objCategory.CategoryID && s.CategoryTypeCode == objCategory.CategoryTypeCode))
            {
                MessageDialog("输入的日志类型代码已经存在");
                return;
            }
            objLogRule.SaveChanges();
            MessageDialog("修改成功", "ApplicationInfo.aspx?ApplicationID=" + ApplicationID);
        }
        else
        {
            objCategory = new loger_category();
            objCategory.CategoryName     = txtCategoryName.Text;
            objCategory.LogWriteType     = chkLogWriteType.SelectValueString;
            objCategory.CategoryTypeCode = txtCategoryTypeCode.Text.Trim();
            objCategory.ApplicationID    = ApplicationID;
            objLogRule.InsertCategory(objCategory);
            MessageDialog("新增成功", "ApplicationInfo.aspx?ApplicationID=" + ApplicationID);
        }
    }