/// <summary> /// 保存数据。如果保存成功则返回空字符串,如果不成功,返回说明信息。 /// 如果是添加数据,成功的话,可以使用 DataID 获得新纪录的主键值(限于SQL数据库、自增ID) /// </summary> /// <returns></returns> public string SaveData(ManagerLogOperate operateLog, ManagerLogDataChange managerLogDataChange) { var debugInfo = new NatureDebugInfo { Title = "webform的保存数据" }; //提取用户输入的信息,检查信息是否安全 string msg = GetInputValue(); if (msg.Length != 0) { //输入的信息格式不正确,不能继续 return("<BR>填写的信息格式不正确<BR>" + msg); } ManagerData.DataID = DataID; ManagerData.DictFormColumnMeta = DicBaseCols; ManagerData.DictColumnsValue = DicColumnsValue; ManagerData.TypeOperationData = OpenButonType; ManagerData.ManagerLogDataChange = managerLogDataChange; string err = ManagerData.SaveData(operateLog, debugInfo.DetailList); return(err); }
/// <summary> /// 添加、修改记录,添加后可以继续添加新纪录 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected virtual void BtnSaveContinueClick(object sender, EventArgs e) { var operateLog = new ManagerLogOperate { AddUserID = Int32.Parse(MyUser.BaseUser.UserID), Dal = Dal.DalCustomer, ModuleID = ModuleID, ButtonID = ButtonID, PageViewID = MasterPageViewID }; //定义数据变更日志 var dataChangeLog = new ManagerLogDataChange { AddUserID = Int32.Parse(MyUser.BaseUser.UserID), Dal = Dal }; //保存数据 string err = FrmCommonForm.SaveData(operateLog, dataChangeLog); if (err.Length > 0) { //有错误发生不能继续。 LblMsg.ForeColor = System.Drawing.Color.Red; LblMsg.Text = err; } else { switch (ButonType) { case ButonType.AddData: //添加后继续 Functions.PageRegisterJavascript(Page, "ReloadFirst(false)"); break; case ButonType.UpdateData: //修改后关闭 Functions.PageRegisterJavascript(Page, "ReloadForUpdate(true)"); break; } LblMsg.ForeColor = System.Drawing.Color.Blue; LblMsg.Text = "保存成功!您可以继续添加记录。"; FrmCommonForm.Reset(); } }
/// <summary> /// 添加、修改记录,添加后关闭 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected virtual void BtnSaveClick(object sender, EventArgs e) { var operateLog = new ManagerLogOperate { AddUserID = Int32.Parse(MyUser.BaseUser.UserID), Dal = Dal.DalCustomer, ModuleID = ModuleID, ButtonID = ButtonID, PageViewID = MasterPageViewID }; //定义数据变更日志 var dataChangeLog = new ManagerLogDataChange { AddUserID = Int32.Parse(MyUser.BaseUser.UserID), Dal = Dal }; //保存数据 string err = FrmCommonForm.SaveData(operateLog, dataChangeLog); if (err.Length > 0) { //有错误发生不能继续。 Response.Write(err); } else { switch (ButonType) { case ButonType.AddData: //添加后关闭 Functions.PageRegisterJavascript(Page, "ReloadFirst(true)"); break; case ButonType.UpdateData: //保存后关闭 Functions.PageRegisterJavascript(Page, "ReloadForUpdate(true)"); break; } } }
protected override void BtnSaveClick(object sender, EventArgs e) { var operateLog = new ManagerLogOperate { AddUserID = Int32.Parse(MyUser.BaseUser.UserID), Dal = Dal.DalCustomer, ModuleID = ModuleID, ButtonID = ButtonID, PageViewID = MasterPageViewID }; //定义数据变更日志 var dataChangeLog = new ManagerLogDataChange { AddUserID = Int32.Parse(MyUser.BaseUser.UserID), Dal = Dal }; //保存数据 string err = FrmCommonForm.SaveData(operateLog, dataChangeLog); if (err.Length > 0) { //有错误发生不能继续。 Response.Write(err); Functions.PageRegisterAlert(Page, "保存字段基本信息时发生意外!"); return; } err = FrmColumn.SaveData(operateLog, dataChangeLog); if (err.Length > 0) { //有错误发生不能继续。 Response.Write(err); Functions.PageRegisterAlert(Page, "保存字段表单信息时发生意外!"); return; } //保存后关闭 Functions.PageRegisterJavascript(Page, "ReloadForUpdate(true)"); }
private string Save() { //获取用户输入的数据 string tmp = FrmCommonForm.GetInputValue(); bool isTure = tmp.Length == 0; if (isTure == false) { //录入的信息的格式不正确。 return "录入的信息的格式不正确"; } //把用户输入的数据填充到节点的实例。 var module = new EntityModule(); FrmCommonForm.ControlToEntity(module); //判断序号是否重复的。 module.DisOrderIsSample(Dal.DalCustomer,DataID ); var operateLog = new ManagerLogOperate { AddUserID = Int32.Parse(MyUser.BaseUser.UserID), Dal = Dal.DalCustomer, ModuleID = ModuleID, ButtonID = ButtonID, PageViewID = MasterPageViewID }; //定义数据变更日志 var dataChangeLog = new ManagerLogDataChange { AddUserID = Int32.Parse(MyUser.BaseUser.UserID), Dal = Dal, PageViewMeta = PageViewMeta }; //保存数据 string err = FrmCommonForm.SaveData(operateLog, dataChangeLog); if (err.Length > 0) { //有错误发生不能继续。 Response.Write(err); return "保存数据是发生意外!"; } #region 创建视图和按钮 //string viewIDs = lstView.SelectedValue; string width = txtWindowWidth.TextTrimNone; if (!Functions.IsInt(width)) { Functions.PageRegisterAlert(Page, "宽度必须是数字!"); return "宽度必须是数字!"; } string height = txtWindowHeight.TextTrimNone; if (!Functions.IsInt(height)) { Functions.PageRegisterAlert(Page, "高度必须是数字!"); return "高度必须是数字!"; } string userID = MyUser.BaseUser.UserID; module.CreatePageView(Dal.DalCustomer, lstView, lstTableID.SelectedValue , userID); //创建按钮 module.CreateButton(Dal.DalCustomer, lstButton, userID, width, height); #endregion return ""; }
/// <summary> /// 保存数据。如果保存成功则返回空字符串,如果不成功,返回说明信息。 /// 如果是添加数据,成功的话,可以使用 DataID 获得新纪录的主键值(限于SQL数据库、自增ID) /// </summary> /// <returns></returns> public string SaveData(ManagerLogOperate operateLog,ManagerLogDataChange managerLogDataChange) { var debugInfo = new NatureDebugInfo { Title = "webform的保存数据" }; //提取用户输入的信息,检查信息是否安全 string msg = GetInputValue(); if (msg.Length != 0) { //输入的信息格式不正确,不能继续 return "<BR>填写的信息格式不正确<BR>" + msg; } ManagerData.DataID = DataID; ManagerData.DictFormColumnMeta = DicBaseCols; ManagerData.DictColumnsValue = DicColumnsValue; ManagerData.TypeOperationData = OpenButonType; ManagerData.ManagerLogDataChange = managerLogDataChange; string err = ManagerData.SaveData(operateLog, debugInfo.DetailList); return err; }
private string Save() { //获取用户输入的数据 string tmp = FrmCommonForm.GetInputValue(); bool isTure = tmp.Length == 0; if (isTure == false) { //录入的信息的格式不正确。 return("录入的信息的格式不正确"); } //把用户输入的数据填充到节点的实例。 var module = new EntityModule(); FrmCommonForm.ControlToEntity(module); //判断序号是否重复的。 module.DisOrderIsSample(Dal.DalCustomer, DataID); var operateLog = new ManagerLogOperate { AddUserID = Int32.Parse(MyUser.BaseUser.UserID), Dal = Dal.DalCustomer, ModuleID = ModuleID, ButtonID = ButtonID, PageViewID = MasterPageViewID }; //定义数据变更日志 var dataChangeLog = new ManagerLogDataChange { AddUserID = Int32.Parse(MyUser.BaseUser.UserID), Dal = Dal, PageViewMeta = PageViewMeta }; //保存数据 string err = FrmCommonForm.SaveData(operateLog, dataChangeLog); if (err.Length > 0) { //有错误发生不能继续。 Response.Write(err); return("保存数据是发生意外!"); } #region 创建视图和按钮 //string viewIDs = lstView.SelectedValue; string width = txtWindowWidth.TextTrimNone; if (!Functions.IsInt(width)) { Functions.PageRegisterAlert(Page, "宽度必须是数字!"); return("宽度必须是数字!"); } string height = txtWindowHeight.TextTrimNone; if (!Functions.IsInt(height)) { Functions.PageRegisterAlert(Page, "高度必须是数字!"); return("高度必须是数字!"); } string userID = MyUser.BaseUser.UserID; module.CreatePageView(Dal.DalCustomer, lstView, lstTableID.SelectedValue, userID); //创建按钮 module.CreateButton(Dal.DalCustomer, lstButton, userID, width, height); #endregion return(""); }