public static void FileLog(Model.FileVersion fileVerModel, Model.FileModel fileModel, string actionCode, ActionType logType) { if (fileVerModel == null && fileModel == null) { return; } string remark = string.Empty; Model.UserModel UserInfo = SystemBll.UserInfo; if (logType == ActionType.RENAME) { remark = string.Format("{0}({1})重命名文件:{2}为==>:", UserInfo.UserName, UserInfo.RealName, fileModel.File_Name); fileModel = new BLL.FileBll().GetModel(fileModel.ID); remark = remark + fileModel.File_Name; } if (logType == ActionType.ONEDELFILE) { remark = string.Format("{0}({1})删除文件:{2}:", UserInfo.UserName, UserInfo.RealName, fileModel.File_Name); } if (fileModel == null && fileVerModel != null) { fileModel = new BLL.FileBll().GetModel(fileVerModel.File_Id); } if (fileModel != null && fileVerModel == null) { FileBll fileBll = new FileBll(); fileVerModel = fileBll.GetFileLastVer(fileModel.ID); } ActionLogAsyn(fileVerModel, fileModel, remark, actionCode, logType); }
/// <summary> /// 文件操作日志 /// </summary> /// <param name="logType"></param> /// <param name="fileModel"></param> public static void FileLog(Model.FileVersion fileVerModel, Model.FileModel fileModel, ActionType logType) { if (fileVerModel == null && fileModel == null) { return; } string remark = string.Empty; if (logType == ActionType.RENAME) { remark = string.Format("文件:{0}重命名为:", fileModel.File_Name); fileModel = new BLL.FileBll().GetModel(fileModel.ID); remark = remark + fileModel.File_Name; } if (fileModel == null && fileVerModel != null) { fileModel = new BLL.FileBll().GetModel(fileVerModel.File_Id); } if (fileModel != null && fileVerModel == null) { FileBll fileBll = new FileBll(); fileVerModel = fileBll.GetFileLastVer(fileModel.ID); } ActionLogAsyn(fileVerModel, fileModel, remark, string.Empty, logType); }
/// <summary> /// 修改属性 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOK_Click(object sender, EventArgs e) { try { string addTimeStr = this.skinTextBox_addTime.SkinTxt.Text.Trim(); string modifyTimeStr = this.skinTextBox_modifyTime.SkinTxt.Text.Trim(); string name = this.skinTextBox_name.SkinTxt.Text.Trim(); ListItem selectItem = (ListItem)this.skinComboBox_createUser.SelectedItem; Model.UserModel createUser = (Model.UserModel)selectItem.Value; DateTime addTime = DateTime.Now; DateTime modifyTime = DateTime.Now; if (createUser == null || string.IsNullOrEmpty(createUser.UserName)) { MessageBoxEx.Show("所选用户信息不正确!"); return; } if (string.IsNullOrEmpty(name)) { MessageBoxEx.Show("名称不能为空!"); return; } if (string.IsNullOrEmpty(addTimeStr) || !DateTime.TryParse(addTimeStr, out addTime)) { MessageBoxEx.Show("添加时间不正确!"); return; } if (string.IsNullOrEmpty(modifyTimeStr) || !DateTime.TryParse(modifyTimeStr, out modifyTime)) { MessageBoxEx.Show("修改时间不正确!"); return; } this.file.Add_Time = addTime; this.file.File_Modify_Time = modifyTime.Ticks; this.file.File_Name = name; this.file.UserId = createUser.ID; this.file.UserName = createUser.UserName; BLL.FileBll bll = new BLL.FileBll(); //string updateValue = string.Format(" name = {0},modifyTime = {1} ,createUser = {2} , addTime={3}"); //bll.UpdateField(this.file.ID, updateValue); bool ret = bll.Update(file); this.DialogResult = System.Windows.Forms.DialogResult.OK; MessageBoxEx.Show("修改成功!"); } catch (Exception ee) { this.DialogResult = System.Windows.Forms.DialogResult.None; MessageBoxEx.Show("修改失败!" + ee.Message); } }
/// <summary> /// 确定修改 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOk_Click(object sender, EventArgs e) { try { string newName = this.skinTextBox_newName.SkinTxt.Text.Trim(); string oldName = this.skinTextBox_oldName.SkinTxt.Text; if (string.IsNullOrEmpty(newName)) { MessageBoxEx.Show("名称不能为空!"); return; } if (newName == oldName) { MessageBoxEx.Show("名称不能和旧名称一样!"); return; } if (this.type == 1) { BLL.ForderBll bll = new BLL.ForderBll(); bll.UpdateField(this.forder.ID, string.Format(" Title = '{0}' ", newName)); } else { BLL.FileBll bll = new BLL.FileBll(); bll.UpdateField(this.file.ID, string.Format(" File_Name ='{0}' ", newName)); } this.DialogResult = System.Windows.Forms.DialogResult.OK; } catch (Exception ee) { this.DialogResult = System.Windows.Forms.DialogResult.None; MessageBoxEx.Show("修改失败!" + ee.Message); } }