public ActionResult Submit(FileApply model) { model.INSTANCEID = bwfs.Start(model.STRUCTUREID); model.STATUS = 1; fileApplyService.Persistent(model); return(RedirectToAction("FileApplyList")); }
/// <summary> /// 获得分页列表,无论是否是缓存实体都从数据库直接拿取数据 /// </summary> /// <param name="pPageIndex">页数</param> /// <param name="pPageSize">每页列表</param> /// <param name="pOrderBy">排序</param> /// <param name="pSortExpression">排序字段</param> /// <param name="pRecordCount">列表行数</param> /// <returns>数据分页</returns> public static List <FileApplyInfo> GetPagedList(int pPageIndex, int pPageSize, SortDirection pOrderBy, string pSortExpression, out int pRecordCount) { if (pPageIndex <= 1) { pPageIndex = 1; } List <FileApplyInfo> list = new List <FileApplyInfo>(); Query q = FileApply.CreateQuery(); q.PageIndex = pPageIndex; q.PageSize = pPageSize; q.ORDER_BY(pSortExpression, pOrderBy.ToString()); FileApplyCollection collection = new FileApplyCollection(); collection.LoadAndCloseReader(q.ExecuteReader()); foreach (FileApply fileApply in collection) { FileApplyInfo fileApplyInfo = new FileApplyInfo(); LoadFromDAL(fileApplyInfo, fileApply); list.Add(fileApplyInfo); } pRecordCount = q.GetRecordCount(); return(list); }
public ActionResult FileApply(string id) { if (string.IsNullOrEmpty(id)) { GenerateSecretViewData(string.Empty); GenerateWFViewData(string.Empty); return(View()); } else { FileApply mdl = fileApplyService.Get(long.Parse(id)); GenerateSecretViewData(mdl.SECRETGRADE); GenerateWFViewData(mdl.STRUCTUREID); if (mdl.STATUS == 1) { var executeNode = bwfs.GetCurrentPrevNode(mdl.INSTANCEID); var current = bwfs.GetCurrent(mdl.INSTANCEID); ViewBag.ButtonName = current.Name; ViewBag.PreviousButtonName = executeNode == null ? String.Empty : executeNode.Name; ViewBag.UndoCheck = CommonMethods.CheckUndoButton(mdl.INSTANCEID); ViewBag.UndoAuth = executeNode == null ? true : CommonMethods.CheckUndoAuth(mdl.INSTANCEID, UserInfo); ViewBag.JumpAuth = current.Name == "开始" ? true : CommonMethods.CheckAuth(current.NID, mdl.INSTANCEID, UserInfo); ViewBag.UserList = new UserService().GetPendingUserList(current.NID, mdl.INSTANCEID); } return(View(mdl)); } }
public JsonResult Save(FileApply model) { if (model.IDENTIFICATION == 0) { fileApplyService.Persistent(model); } else { fileApplyService.Update(model); } return(Json(true)); }
//从后台获取数据 internal static void LoadFromDAL(FileApplyInfo pFileApplyInfo, FileApply pFileApply) { pFileApplyInfo.fileApplyId = pFileApply.FileApplyId; pFileApplyInfo.applyTime = pFileApply.ApplyTime; pFileApplyInfo.filesName = pFileApply.FilesName; pFileApplyInfo.fileType = pFileApply.FileType; pFileApplyInfo.fileDes = pFileApply.FileDes; pFileApplyInfo.departView = pFileApply.DepartView; pFileApplyInfo.managerView = pFileApply.ManagerView; pFileApplyInfo.fileOfApplyId = pFileApply.FileOfApplyId; pFileApplyInfo.state = pFileApply.State; pFileApplyInfo.departName = pFileApply.DepartName; pFileApplyInfo.applyName = pFileApply.ApplyName; pFileApplyInfo.Loaded = true; }
public ActionResult FileApply(string id) { if (string.IsNullOrEmpty(id)) { GenerateWFViewData(string.Empty); GenerateSecretViewData(string.Empty); return(View()); } else { FileApply mdl = fileApplyService.GetByInstanceID(id); GenerateSecretViewData(mdl.SECRETGRADE); GenerateWFViewData(mdl.STRUCTUREID); return(View(mdl)); } }
/// <summary> /// 保存 /// </summary> public override void Save() { if (!m_Loaded) //新增 { FileApply fileApply = new FileApply(); SaveToDb(this, fileApply, true); } else //修改 { FileApply fileApply = new FileApply(fileApplyId); if (fileApply.IsNew) { throw new AppException("该数据已经不存在了"); } SaveToDb(this, fileApply, false); } }
/// <summary> /// 删除 /// </summary> /// <returns>是否成功</returns> public override void Delete() { if (!m_Loaded) { throw new AppException("尚未初始化"); } bool result = (FileApply.Delete(FileApplyId) == 1); //更新缓存 if (result && CachedEntityCommander.IsTypeRegistered(typeof(FileApplyInfo))) { ResetCache(); } if (!result) { throw new AppException("删除失败,数据可能被删除"); } }
private void LoadFromId(int fileApplyId) { if (CachedEntityCommander.IsTypeRegistered(typeof(FileApplyInfo))) { FileApplyInfo fileApplyInfo = Find(GetList(), fileApplyId); if (fileApplyInfo == null) { throw new AppException("未能在缓存中找到相应的键值对象"); } Copy(fileApplyInfo, this); } else { FileApply fileApply = new FileApply(fileApplyId); if (fileApply.IsNew) { throw new AppException("尚未初始化"); } LoadFromDAL(this, fileApply); } }
//数据持久化 internal static void SaveToDb(FileApplyInfo pFileApplyInfo, FileApply pFileApply, bool pIsNew) { pFileApply.FileApplyId = pFileApplyInfo.fileApplyId; pFileApply.ApplyTime = pFileApplyInfo.applyTime; pFileApply.FilesName = pFileApplyInfo.filesName; pFileApply.FileType = pFileApplyInfo.fileType; pFileApply.FileDes = pFileApplyInfo.fileDes; pFileApply.DepartView = pFileApplyInfo.departView; pFileApply.ManagerView = pFileApplyInfo.managerView; pFileApply.FileOfApplyId = pFileApplyInfo.fileOfApplyId; pFileApply.State = pFileApplyInfo.state; pFileApply.DepartName = pFileApplyInfo.departName; pFileApply.ApplyName = pFileApplyInfo.applyName; pFileApply.IsNew = pIsNew; string UserName = SubsonicHelper.GetUserName(); try { pFileApply.Save(UserName); } catch (Exception ex) { LogManager.getInstance().getLogger(typeof(FileApplyInfo)).Error(ex); if (ex.Message.Contains("插入重复键")) //违反了唯一键 { throw new AppException("此对象已经存在"); //此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示 } throw new AppException("保存失败"); } pFileApplyInfo.fileApplyId = pFileApply.FileApplyId; //如果缓存存在,更新缓存 if (CachedEntityCommander.IsTypeRegistered(typeof(FileApplyInfo))) { ResetCache(); } }
public static void FileApplyDel(int fileid) { FileApply.Delete(fileid); }
public JsonResult Save(FileApply model) { fileApplyService.Persistent(model); return(Json(true)); }
public ActionResult Save(FileApply model) { model.STATUS = 0; fileApplyService.Persistent(model); return(RedirectToAction("FileApplyList")); }
private void tsbSave_Click(object sender, EventArgs e) { txtRemark.Focus(); gridView1.UpdateCurrentRow(); if (dtpFileApplyDate.Text == "") { this.ShowAlertMessage("必须输入申请单日期!"); return; } if (rdoPerson.Checked == true) { if (txtFileApplyPerson.Text.Trim() == "") { this.ShowAlertMessage("必须输入申请人!"); return; } } if (rdoDept.Checked == true) { if (txtFileApplyDept.Text.Trim() == "") { this.ShowAlertMessage("必须输入申请部门!"); return; } } if (gridView1.RowCount <= 0) { this.ShowAlertMessage("必须增加明细数据!"); return; } FileApply FileApply = new FileApply(); FileApply.FileApplyGuID = txtFileApplyGuID.Text; FileApply.FileApplyID = txtFileApplyID.Text; FileApply.FileApplyDate = DateTime.Parse(dtpFileApplyDate.Text); if (rdoPerson.Checked == true) { FileApply.FileApplyType = "1"; } else if (rdoDept.Checked == true) { FileApply.FileApplyType = "2"; } if (txtFileApplyPerson.Tag != null) { FileApply.FileApplyPerson = txtFileApplyPerson.Text; } if (txtFileApplyDept.Tag != null) { FileApply.FileApplyDept = txtFileApplyDept.Tag.ToString(); } FileApply.Remark = txtRemark.Text.Replace("'", "''"); FileApply.CreateGuid = txtCreateGuid.Tag.ToString(); FileApply.CreateDate = DateTime.Now; FileApply.CheckGuid = ""; FileApply.CheckDate = DateTime.Parse("1900-01-01"); FileApply.CheckGuid = ""; List <FileApplyDetail> list = new List <FileApplyDetail>(); FileApplyDetail FileApplyDetail = new FileApplyDetail(); for (int i = 0; i < gridView1.RowCount; i++) { DataRowView dr = (DataRowView)(gridView1.GetRow(i)); FileApplyDetail = new FileApplyDetail(); FileApplyDetail.FileApplyDetailGuID = Guid.NewGuid().ToString(); FileApplyDetail.FileApplyGuID = txtFileApplyGuID.Text; FileApplyDetail.FileGuID = dr["FileGuID"].ToString(); if (dr["IsDownload"].ToString().ToUpper() == "TRUE") { FileApplyDetail.IsDownload = "1"; //有下载权限 } else { FileApplyDetail.IsDownload = "0";//无下载权限 } FileApplyDetail.SortID = i; list.Add(FileApplyDetail); } List <FileApplyPersonDetail> lst2 = new List <FileApplyPersonDetail>(); FileApplyPersonDetail FileApplyPersonDetail = new FileApplyPersonDetail(); if (txtFileApplyPerson.Text.Trim() != null) { List <SelectEmployee> lstSelect = txtFileApplyPerson.Tag as List <SelectEmployee>; if (lstSelect != null) { for (int i = 0; i < lstSelect.Count; i++) { FileApplyPersonDetail = new FileApplyPersonDetail(); FileApplyPersonDetail.FileApplyPersonDetailGuID = Guid.NewGuid().ToString(); FileApplyPersonDetail.FileApplyGuID = txtFileApplyGuID.Text; FileApplyPersonDetail.PersonGuID = lstSelect[i].EmpGuid; FileApplyPersonDetail.SortID = i; lst2.Add(FileApplyPersonDetail); } } } //保存 FileApplyManage.SaveBill(FileApply, list, lst2); tsbCheck.Enabled = true; tsbUnCheck.Enabled = false; SetRight(); //写日志 SysLog.AddOperateLog(SysParams.UserName, "文件申请单保存", "保存", SysParams.UserName + "用户保存文件申请单,唯一号:" + txtFileApplyGuID.Text + ",文件申请单号:" + txtFileApplyID.Text); //用于打印 DataTable dtl3 = base.GetDataTable((DataView)gridView1.DataSource); ds.Tables.Clear(); ds.Tables.Add(dtl3.Copy()); ds.Tables[0].TableName = "FileApplyDetail"; this.Tag = "edit"; this.ShowMessage("保存成功"); frmFileApply.frmfileapply.LoadData(); }
private void LoadFromId(int fileApplyId) { if (CachedEntityCommander.IsTypeRegistered(typeof(FileApplyInfo))) { FileApplyInfo fileApplyInfo=Find(GetList(), fileApplyId); if(fileApplyInfo==null) throw new AppException("未能在缓存中找到相应的键值对象"); Copy(fileApplyInfo, this); } else { FileApply fileApply=new FileApply( fileApplyId); if(fileApply.IsNew) throw new AppException("尚未初始化"); LoadFromDAL(this, fileApply); } }
//数据持久化 internal static void SaveToDb(FileApplyInfo pFileApplyInfo, FileApply pFileApply,bool pIsNew) { pFileApply.FileApplyId = pFileApplyInfo.fileApplyId; pFileApply.ApplyTime = pFileApplyInfo.applyTime; pFileApply.FilesName = pFileApplyInfo.filesName; pFileApply.FileType = pFileApplyInfo.fileType; pFileApply.FileDes = pFileApplyInfo.fileDes; pFileApply.DepartView = pFileApplyInfo.departView; pFileApply.ManagerView = pFileApplyInfo.managerView; pFileApply.FileOfApplyId = pFileApplyInfo.fileOfApplyId; pFileApply.State = pFileApplyInfo.state; pFileApply.DepartName = pFileApplyInfo.departName; pFileApply.ApplyName = pFileApplyInfo.applyName; pFileApply.IsNew=pIsNew; string UserName = SubsonicHelper.GetUserName(); try { pFileApply.Save(UserName); } catch(Exception ex) { LogManager.getInstance().getLogger(typeof(FileApplyInfo)).Error(ex); if(ex.Message.Contains("插入重复键"))//违反了唯一键 { throw new AppException("此对象已经存在");//此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示 } throw new AppException("保存失败"); } pFileApplyInfo.fileApplyId = pFileApply.FileApplyId; //如果缓存存在,更新缓存 if (CachedEntityCommander.IsTypeRegistered(typeof(FileApplyInfo))) { ResetCache(); } }
//从后台获取数据 internal static void LoadFromDAL(FileApplyInfo pFileApplyInfo, FileApply pFileApply) { pFileApplyInfo.fileApplyId = pFileApply.FileApplyId; pFileApplyInfo.applyTime = pFileApply.ApplyTime; pFileApplyInfo.filesName = pFileApply.FilesName; pFileApplyInfo.fileType = pFileApply.FileType; pFileApplyInfo.fileDes = pFileApply.FileDes; pFileApplyInfo.departView = pFileApply.DepartView; pFileApplyInfo.managerView = pFileApply.ManagerView; pFileApplyInfo.fileOfApplyId = pFileApply.FileOfApplyId; pFileApplyInfo.state = pFileApply.State; pFileApplyInfo.departName = pFileApply.DepartName; pFileApplyInfo.applyName = pFileApply.ApplyName; pFileApplyInfo.Loaded=true; }
/// <summary> /// 保存 /// </summary> public override void Save() { if(!m_Loaded)//新增 { FileApply fileApply=new FileApply(); SaveToDb(this, fileApply,true); } else//修改 { FileApply fileApply=new FileApply(fileApplyId); if(fileApply.IsNew) throw new AppException("该数据已经不存在了"); SaveToDb(this, fileApply,false); } }