/// <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.forder.Add_Time = addTime; this.forder.Forder_Modify_Time = modifyTime.Ticks; this.forder.UserName = createUser.UserName; this.forder.Title = name; BLL.ForderBll bll = new BLL.ForderBll(); bll.Update(this.forder); 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); } }