public ActionResult MyFunds(BillsSearchModel info) { if (!User.Identity.IsAuthenticated) { return(RedirectToRoute(new { controller = "Login", action = "LogOut" })); } int user = PageValidate.FilterParam(User.Identity.Name); ApplyManager dal = new ApplyManager(db); if (!RoleCheck.CheckHasAuthority(user, db, "经费管理")) { info.userId = user; } info.PageSize = 0; info.userId = user; var bills = dal.GetApplyList(info).ToList(); foreach (var bill in bills) { bill.contents = dal.getContents(bill.reimbursementCode, 0).ToList(); bill.attachmentsCount = dal.getAttachments(bill.reimbursementCode, 0).Count(); } ViewData["Bills"] = bills; List <SelectOption> options = DropDownList.RespondStateSelect(); ViewData["RState"] = DropDownList.SetDropDownList(options); return(View(info)); }
public void Submit_OnClick(object sender, EventArgs e) { var isChanged = false; try { if (string.IsNullOrEmpty(tbCommentRemark.Text)) { LtlMessage.Text = Utils.GetMessageHtml("批示失败,必须填写意见!", false); return; } foreach (int contentID in _idArrayList) { var remarkInfo = new RemarkInfo(0, SiteId, _channelId, contentID, ERemarkTypeUtils.GetValue(ERemarkType.Comment), tbCommentRemark.Text, _adminInfo.DepartmentId, AuthRequest.AdminName, DateTime.Now); RemarkDao.Insert(remarkInfo); ApplyManager.Log(SiteId, _channelId, contentID, ELogTypeUtils.GetValue(ELogType.Comment), AuthRequest.AdminName, _adminInfo.DepartmentId); } isChanged = true; } catch (Exception ex) { LtlMessage.Text = Utils.GetMessageHtml(ex.Message, false); isChanged = false; } if (isChanged) { LayerUtils.Close(Page); } }
// GET: ApplyManager/Edit/5 public ActionResult Edit(string id) { if (!User.Identity.IsAuthenticated) { return(RedirectToRoute(new { controller = "Login", action = "LogOut" })); } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SetSelect(0); if (!User.Identity.IsAuthenticated) { return(RedirectToRoute(new { controller = "Login", action = "LogOut" })); } int user = PageValidate.FilterParam(User.Identity.Name); ApplyManager dal = new ApplyManager(db); ApplyListModel bill = dal.GetReimbursement(id, user).FirstOrDefault(); bill.contents = dal.getContents(bill.reimbursementCode, 0).ToList(); foreach (var item in bill.contents) { item.details = dal.getContentDetails((int)item.contentId, 0).ToList(); item.attachments = dal.getAttachments(bill.reimbursementCode, 0, (int)item.contentId).ToList(); } bill.attachments = dal.getAttachments(bill.reimbursementCode, 0, 0).ToList(); var responds = dal.getResponds(bill.reimbursementCode, 0).OrderBy(x => x.num).FirstOrDefault(); if (responds != null) { bill.next = (int)responds.thisRespondUser; } return(View(bill)); }
public void Comment_OnClick(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(TbCommentRemark.Text)) { LtlMessage.Text = Utils.GetMessageHtml("批示失败,必须填写意见", false); return; } var remarkInfo = new RemarkInfo(0, SiteId, _contentInfo.ChannelId, _contentInfo.Id, ERemarkTypeUtils.GetValue(ERemarkType.Comment), TbCommentRemark.Text, _adminInfo.DepartmentId, AuthRequest.AdminName, DateTime.Now); RemarkDao.Insert(remarkInfo); ApplyManager.Log(SiteId, _contentInfo.ChannelId, _contentInfo.Id, ELogTypeUtils.GetValue(ELogType.Comment), AuthRequest.AdminName, _adminInfo.DepartmentId); LtlMessage.Text = Utils.GetMessageHtml("办件批示成功", true); if (!ConfigInfo.ApplyIsOpenWindow) { Utils.SwalSuccess("办件批示成功", "", "确 认", $"location.href = '{ListPageUrl}'"); } } catch (Exception ex) { LtlMessage.Text = Utils.GetMessageHtml(ex.Message, false); } }
public void Check_OnClick(object sender, EventArgs e) { try { var contentInfo = Main.ContentApi.GetContentInfo(SiteId, _channelId, _contentId); ApplyManager.Log(SiteId, contentInfo.ChannelId, contentInfo.Id, ELogTypeUtils.GetValue(ELogType.Check), AuthRequest.AdminName, _adminInfo.DepartmentId); contentInfo.Set(ContentAttribute.State, EStateUtils.GetValue(EState.Checked)); Main.ContentApi.Update(SiteId, contentInfo.ChannelId, contentInfo); LtlMessage.Text = Utils.GetMessageHtml("审核申请成功", true); var configInfo = Main.GetConfigInfo(SiteId); if (!configInfo.ApplyIsOpenWindow) { Utils.Redirect(_returnUrl); } } catch (Exception ex) { LtlMessage.Text = Utils.GetMessageHtml(ex.Message, false); } }
public void Submit_OnClick(object sender, EventArgs e) { var isChanged = false; ReplyDao.DeleteByContentId(SiteId, _contentInfo.Id); var fileUrl = UploadFile(HtmlFileUrl.PostedFile); var replyInfo = new ReplyInfo(0, SiteId, _contentInfo.ChannelId, _contentInfo.Id, TbReply.Text, string.Empty, _adminInfo.DepartmentId, AuthRequest.AdminName, DateTime.Now); ReplyDao.Insert(replyInfo); ApplyManager.Log(SiteId, _contentInfo.ChannelId, _contentInfo.Id, ELogTypeUtils.GetValue(ELogType.Reply), AuthRequest.AdminName, _adminInfo.DepartmentId); _contentInfo.Set(ContentAttribute.State, EStateUtils.GetValue(EState.Replied)); _contentInfo.Set(ContentAttribute.ReplyContent, replyInfo.Reply); _contentInfo.Set(ContentAttribute.ReplyFileUrl, replyInfo.FileUrl); if (_adminInfo.DepartmentId > 0) { _contentInfo.Set(ContentAttribute.DepartmentId, _adminInfo.DepartmentId.ToString()); _contentInfo.Set(ContentAttribute.ReplyDepartmentName, DepartmentManager.GetDepartmentName(_adminInfo.DepartmentId)); } _contentInfo.Set(ContentAttribute.ReplyUserName, _adminInfo.DisplayName); _contentInfo.Set(ContentAttribute.ReplyAddDate, replyInfo.AddDate); Main.ContentApi.Update(SiteId, _contentInfo.ChannelId, _contentInfo); isChanged = true; if (isChanged) { LayerUtils.Close(Page); } }
public ActionResult Responded(BillsSearchModel info) { if (!User.Identity.IsAuthenticated) { return(RedirectToRoute(new { controller = "Login", action = "Index" })); } ApplyManager dal = new ApplyManager(db); int userId = PageValidate.FilterParam(User.Identity.Name); if (!RoleCheck.CheckHasAuthority(userId, db, "批复管理", "批复")) { return(RedirectToRoute(new { controller = "Error", action = "Index", err = "没有权限。" })); } if (RoleCheck.CheckHasAuthority(userId, db, "批复管理")) { if (info.userId == null) { info.userId = 0; } } else { info.userId = userId; } SetSelect(); var list = getResponseDetail((int)info.userId, 1, 2, 3, 4); ViewData["Bills"] = list; return(View(info)); }
public void Translate_OnClick(object sender, EventArgs e) { var translateChannelId = Utils.ToInt(DdlTranslateChannelId.SelectedValue); if (translateChannelId == 0) { LtlMessage.Text = Utils.GetMessageHtml("转移失败,必须选择转移目标", false); return; } try { _contentInfo.Set(ContentAttribute.TranslateFromChannelId, _contentInfo.ChannelId.ToString()); _contentInfo.ChannelId = translateChannelId; Main.ContentApi.Update(SiteId, _contentInfo.ChannelId, _contentInfo); if (!string.IsNullOrEmpty(TbTranslateRemark.Text)) { var remarkInfo = new RemarkInfo(0, SiteId, _contentInfo.ChannelId, _contentInfo.Id, ERemarkTypeUtils.GetValue(ERemarkType.Translate), TbTranslateRemark.Text, _adminInfo.DepartmentId, AuthRequest.AdminName, DateTime.Now); RemarkDao.Insert(remarkInfo); } ApplyManager.LogTranslate(SiteId, _contentInfo.ChannelId, _contentInfo.Id, Main.ChannelApi.GetChannelName(SiteId, _contentInfo.ChannelId), AuthRequest.AdminName, _adminInfo.DepartmentId); LtlMessage.Text = Utils.GetMessageHtml("办件转移成功", true); if (!ConfigInfo.ApplyIsOpenWindow) { Utils.SwalSuccess("办件转移成功", "", "确 认", $"location.href = '{ListPageUrl}'"); } } catch (Exception ex) { LtlMessage.Text = Utils.GetMessageHtml(ex.Message, false); } }
public void SwitchTo_OnClick(object sender, EventArgs e) { var switchToDepartmentId = Utils.ToInt(Request.Form["switchToDepartmentId"]); if (switchToDepartmentId == 0) { LtlMessage.Text = Utils.GetMessageHtml("转办失败,必须选择转办部门", false); return; } var switchToDepartmentName = DepartmentManager.GetDepartmentName(switchToDepartmentId); try { ContentDao.UpdateDepartmentId(SiteId, _contentInfo.ChannelId, _contentInfo.Id, switchToDepartmentId); var remarkInfo = new RemarkInfo(0, SiteId, _contentInfo.ChannelId, _contentInfo.Id, ERemarkTypeUtils.GetValue(ERemarkType.SwitchTo), TbSwitchToRemark.Text, _adminInfo.DepartmentId, AuthRequest.AdminName, DateTime.Now); RemarkDao.Insert(remarkInfo); ApplyManager.LogSwitchTo(SiteId, _contentInfo.ChannelId, _contentInfo.Id, switchToDepartmentName, AuthRequest.AdminName, _adminInfo.DepartmentId); LtlMessage.Text = Utils.GetMessageHtml("办件转办成功", true); if (!ConfigInfo.ApplyIsOpenWindow) { Utils.SwalSuccess("办件转办成功", "", "确 认", $"location.href = '{ListPageUrl}'"); } } catch (Exception ex) { LtlMessage.Text = Utils.GetMessageHtml(ex.Message, false); } }
public void Reply_OnClick(object sender, EventArgs e) { if (string.IsNullOrEmpty(TbReply.Text)) { LtlMessage.Text = Utils.GetMessageHtml("回复失败,必须填写答复内容", false); return; } try { ReplyDao.DeleteByContentId(SiteId, _contentInfo.Id); var fileUrl = UploadFile(HifFileUrl.PostedFile); var replyInfo = new ReplyInfo(0, SiteId, _contentInfo.ChannelId, _contentInfo.Id, TbReply.Text, fileUrl, _adminInfo.DepartmentId, AuthRequest.AdminName, DateTime.Now); ReplyDao.Insert(replyInfo); ApplyManager.Log(SiteId, _contentInfo.ChannelId, _contentInfo.Id, ELogTypeUtils.GetValue(ELogType.Reply), AuthRequest.AdminName, _adminInfo.DepartmentId); if (_adminInfo.DepartmentId > 0) { ContentDao.UpdateDepartmentId(SiteId, _contentInfo.ChannelId, _contentInfo.Id, _adminInfo.DepartmentId); } ContentDao.UpdateState(SiteId, _contentInfo.ChannelId, _contentInfo.Id, EState.Replied); LtlMessage.Text = Utils.GetMessageHtml("办件回复成功", true); if (!ConfigInfo.ApplyIsOpenWindow) { Utils.SwalSuccess("办件回复成功", "", "确 认", $"location.href = '{ListPageUrl}'"); } } catch (Exception ex) { LtlMessage.Text = Utils.GetMessageHtml(ex.Message, false); } }
public void Redo_OnClick(object sender, EventArgs e) { if (string.IsNullOrEmpty(TbRedoRemark.Text)) { LtlMessage.Text = Utils.GetMessageHtml("要求返工失败,必须填写意见!", false); return; } try { var contentInfo = Main.ContentApi.GetContentInfo(SiteId, _channelId, _contentId); var remarkInfo = new RemarkInfo(0, SiteId, contentInfo.ChannelId, contentInfo.Id, ERemarkTypeUtils.GetValue(ERemarkType.Redo), TbRedoRemark.Text, _adminInfo.DepartmentId, AuthRequest.AdminName, DateTime.Now); RemarkDao.Insert(remarkInfo); ApplyManager.Log(SiteId, contentInfo.ChannelId, contentInfo.Id, ELogTypeUtils.GetValue(ELogType.Redo), AuthRequest.AdminName, _adminInfo.DepartmentId); contentInfo.Set(ContentAttribute.State, EStateUtils.GetValue(EState.Redo)); Main.ContentApi.Update(SiteId, contentInfo.ChannelId, contentInfo); LtlMessage.Text = Utils.GetMessageHtml("要求返工成功", true); var configInfo = Main.GetConfigInfo(SiteId); if (!configInfo.ApplyIsOpenWindow) { Utils.Redirect(_returnUrl); } } catch (Exception ex) { LtlMessage.Text = Utils.GetMessageHtml(ex.Message, false); } }
public void Deny_OnClick(object sender, EventArgs e) { if (string.IsNullOrEmpty(TbDenyReply.Text)) { LtlMessage.Text = Utils.GetMessageHtml("拒绝失败,必须填写拒绝理由", false); return; } var contentInfo = Main.ContentApi.GetContentInfo(SiteId, _channelId, _contentId); ReplyDao.DeleteByContentId(SiteId, contentInfo.Id); var replyInfo = new ReplyInfo(0, SiteId, contentInfo.ChannelId, contentInfo.Id, TbDenyReply.Text, string.Empty, _adminInfo.DepartmentId, AuthRequest.AdminName, DateTime.Now); ReplyDao.Insert(replyInfo); ApplyManager.Log(SiteId, contentInfo.ChannelId, contentInfo.Id, ELogTypeUtils.GetValue(ELogType.Deny), AuthRequest.AdminName, _adminInfo.DepartmentId); contentInfo.Set(ContentAttribute.State, EStateUtils.GetValue(EState.Denied)); Main.ContentApi.Update(SiteId, contentInfo.ChannelId, contentInfo); LtlMessage.Text = Utils.GetMessageHtml("拒绝申请成功", true); var configInfo = Main.GetConfigInfo(SiteId); if (!configInfo.ApplyIsOpenWindow) { Utils.Redirect(_returnUrl); } }
/// <summary> /// Applies the operation to the output array /// </summary> /// <typeparam name="T">The type of data to operate on</typeparam> /// <typeparam name="C">The type of operation to perform</typeparam> /// <param name="op">The function to apply</param> /// <param name="out">The output target</param> private static void Apply_Entry_Nullary <T, C>(C op, NdArray <T> @out) where C : struct, INullaryOp <T> { if (@out.DataAccessor is ILazyAccessor <T> ) { ((ILazyAccessor <T>)@out.DataAccessor).AddOperation(op, @out); } else { ApplyManager.ApplyNullaryOp <T, C>(op, @out); } }
List <ApplyListModel> getResponseDetail(int userId, params int[] state) { if (!User.Identity.IsAuthenticated) { return(new List <ApplyListModel>()); } int uid = PageValidate.FilterParam(User.Identity.Name); ApplyManager dal = new ApplyManager(db); var query = from bill in db.Reimbursement join pr in db.Process_Respond on new { code = bill.reimbursement_code, id = uid } equals new{ code = pr.pr_reimbursement_code, id = pr.pr_user_id } into T1 from respond in T1.DefaultIfEmpty() join res in db.Dic_Respond_State on respond.pr_state equals res.drs_state_id into T2 from resSt in T2.DefaultIfEmpty() join user in db.User_Info on bill.r_add_user_id equals user.user_id join s in db.Dic_Respond_State on bill.r_bill_state equals s.drs_state_id join f in db.Funds on bill.r_funds_id equals f.f_id where state.Contains(bill.r_bill_state) orderby bill.r_add_date descending select new ApplyListModel { amount = bill.r_bill_amount, reimbursementCode = bill.reimbursement_code, state = bill.r_bill_state, strState = s.drs_state_name, time = bill.r_add_date, fundsCode = f.f_code, fundsName = f.f_name, userName = user.real_name, info = bill.reimbursement_info, userId = bill.r_add_user_id, manager = respond.pr_user_id, myRespond = resSt.drs_state_name }; if (userId > 0) { query = query.Where(x => x.manager == userId); } var list = query.ToList(); if (list != null) { foreach (var item in list) { item.attachmentsCount = dal.getAttachments(item.reimbursementCode, 0).Count(); item.contents = dal.getContents(item.reimbursementCode, 0).ToList(); item.userName = AESEncrypt.Decrypt(item.userName); } } return(list); }
public ActionResult Detail(StatisticsSearch search) { if (!User.Identity.IsAuthenticated) { return(RedirectToRoute(new { controller = "Login", action = "LogOut" })); } int user = PageValidate.FilterParam(User.Identity.Name); setSearchSelect(user); if (!RoleCheck.CheckHasAuthority(user, db, "经费管理")) { search.manager = user; search.userId = user; } if (search.userId == null) { search.userId = 0; } ApplyManager dal = new ApplyManager(db); var query = dal.GetReimbursement("", (int)search.userId).Where(x => x.state == 1); if (search.manager > 0) { query = query.Where(x => x.manager == search.manager); } if (search.beginDate != null) { search.beginDate = DateTime.Parse(((DateTime)search.beginDate).ToString("yyyy-MM-dd 00:00:00.000")); query = query.Where(x => x.time >= search.beginDate); } if (search.endDate != null) { search.endDate = DateTime.Parse(((DateTime)search.endDate).ToString("yyyy-MM-dd 23:59:59.999")); query = query.Where(x => x.time <= search.endDate); } search.Amount = query.Count(); query = query.OrderByDescending(x => x.time).Skip(search.PageSize * (search.PageIndex - 1)).Take(search.PageSize); var list = query.ToList(); foreach (var item in list) { item.userName = AESEncrypt.Decrypt(item.userName); item.attachmentsCount = (from content in db.Reimbursement_Content join detail in db.Reimbursement_Detail on content.content_id equals detail.detail_content_id where content.c_reimbursement_code == item.reimbursementCode select content.content_id).Count(); } ViewData["Details"] = list; return(View(search)); }
/// <summary> /// Calculates the scalar result of applying the binary operation to all elements /// </summary> /// <typeparam name="T">The value to operate on</typeparam> /// <typeparam name="C">The operation to perform</typeparam> /// <param name="op">The operation to perform</param> /// <param name="in1">The array to aggregate</param> /// <returns>A scalar value that is the result of aggregating all elements</returns> private static T Aggregate_Entry <T, C>(C op, NdArray <T> in1) where C : struct, IBinaryOp <T> { if (in1.DataAccessor is ILazyAccessor <T> ) { var v = new NumCIL.Generic.NdArray <T>((IDataAccessor <T>)Activator.CreateInstance(in1.DataAccessor.GetType(), 1L)); ((ILazyAccessor <T>)v.DataAccessor).AddOperation(new LazyAggregateOperation <T>(new C()), v, in1); return(v.Value[0]); } else { T result; ApplyManager.ApplyAggregate <T, C>(op, in1, out result); return(result); } }
/// <summary> /// Applies the operation to the input array /// </summary> /// <typeparam name="Ta">The type of input data to operate on</typeparam> /// <typeparam name="Tb">The type of output data to generate</typeparam> /// <typeparam name="C">The operation type to perform</typeparam> /// <param name="op">The operation to perform</param> /// <param name="in1">The input argument</param> /// <param name="out">The output target</param> private static NdArray <Tb> Apply_Entry_Unary_Conv <Ta, Tb, C>(C op, NdArray <Ta> in1, NdArray <Tb> @out = null) where C : struct, IUnaryConvOp <Ta, Tb> { NdArray <Tb> v = SetupApplyHelper(in1, @out); if (v.DataAccessor is ILazyAccessor <Tb> ) { ((ILazyAccessor <Tb>)v.DataAccessor).AddConversionOperation <Ta>(op, v, in1); } else { ApplyManager.ApplyUnaryConvOp <Ta, Tb, C>(op, in1, v); } return(v); }
/// <summary> /// Function that is used as the entry point for applying a unary operator. /// It will setup the output array and then call the evaluation method /// It has a unique name because it is faster to look up the method through reflection, /// if there is only one version of it. /// </summary> /// <typeparam name="T">The type of data to operate on</typeparam> /// <typeparam name="C">The operation type to perform</typeparam> /// <param name="op">The operation instance</param> /// <param name="in1">The input argument</param> /// <param name="out">The output target</param> /// <returns>The output value</returns> private static NdArray <T> Apply_Entry_Unary <T, C>(C op, NdArray <T> in1, NdArray <T> @out = null) where C : struct, IUnaryOp <T> { NdArray <T> v = SetupApplyHelper(in1, @out); if (v.DataAccessor is ILazyAccessor <T> ) { ((ILazyAccessor <T>)v.DataAccessor).AddOperation(op, v, in1); } else { ApplyManager.ApplyUnaryOp <T, C>(op, in1, v); } return(v); }
/// <summary> /// The entry function for a reduction. /// This method will determine if the accessor is a <see cref="T:NumCIL.Generic.ILazyAccessor{0}"/>, /// and defer execution by wrapping it in a <see cref="T:NumCIL.UFunc.LazyReduceOperation{0}"/>. /// Otherwise the reduce flush function is called /// </summary> /// <typeparam name="T">The type of data to operate on</typeparam> /// <typeparam name="C">The type of operation to reduce with</typeparam> /// <param name="op">The instance of the operation to reduce with</param> /// <param name="in1">The input argument</param> /// <param name="axis">The axis to reduce</param> /// <param name="out">The output target</param> /// <returns>The output target</returns> private static NdArray <T> Reduce_Entry <T, C>(C op, NdArray <T> in1, long axis = 0, NdArray <T> @out = null) where C : struct, IBinaryOp <T> { NdArray <T> v = SetupReduceHelper <T>(in1, axis, @out); if (v.DataAccessor is ILazyAccessor <T> ) { ((ILazyAccessor <T>)v.DataAccessor).AddOperation(new LazyReduceOperation <T>(new C(), axis), v, in1); } else { ApplyManager.ApplyReduce <T, C>(op, axis, in1, v); } return(v); }
public void Submit_OnClick(object sender, EventArgs e) { var isChanged = false; try { var switchToDepartmentID = Utils.ToInt(Request.Form["switchToDepartmentID"]); if (switchToDepartmentID == 0) { LtlMessage.Text = Utils.GetMessageHtml("转办失败,必须选择转办部门!", false); return; } var switchToDepartmentName = DepartmentManager.GetDepartmentName(switchToDepartmentID); foreach (int contentID in _idArrayList) { var contentInfo = Main.ContentApi.GetContentInfo(SiteId, _channelId, contentID); var state = EStateUtils.GetEnumType(contentInfo.GetString(ContentAttribute.State)); if (state != EState.Denied && state != EState.Checked) { contentInfo.Set(ContentAttribute.DepartmentId, switchToDepartmentID.ToString()); Main.ContentApi.Update(SiteId, contentInfo.ChannelId, contentInfo); if (!string.IsNullOrEmpty(tbSwitchToRemark.Text)) { var remarkInfo = new RemarkInfo(0, SiteId, contentInfo.ChannelId, contentID, ERemarkTypeUtils.GetValue(ERemarkType.SwitchTo), tbSwitchToRemark.Text, _adminInfo.DepartmentId, AuthRequest.AdminName, DateTime.Now); RemarkDao.Insert(remarkInfo); } ApplyManager.LogSwitchTo(SiteId, contentInfo.ChannelId, contentID, switchToDepartmentName, AuthRequest.AdminName, _adminInfo.DepartmentId); } } isChanged = true; } catch (Exception ex) { LtlMessage.Text = Utils.GetMessageHtml(ex.Message, false); isChanged = false; } if (isChanged) { LayerUtils.Close(Page); } }
/// <summary> /// Performs matrix multiplication on the two operands, using the supplied methods. /// This is the main entry point for detecting valid inputs, instanciating the output, /// and determining if the operation should be lazy evaluated. /// </summary> /// <typeparam name="T">The type of data to operate on</typeparam> /// <typeparam name="CADD">The typed add operator</typeparam> /// <typeparam name="CMUL">The typed multiply operator</typeparam> /// <param name="addop">The add operator</param> /// <param name="mulop">The multiply operator</param> /// <param name="in1">The left-hand-side argument</param> /// <param name="in2">The right-hand-side argument</param> /// <param name="out">An optional output argument, use for in-place operations</param> /// <returns>An array with the matrix multiplication result</returns> private static NdArray <T> Matmul_Entry <T, CADD, CMUL>(CADD addop, CMUL mulop, NdArray <T> in1, NdArray <T> in2, NdArray <T> @out = null) where CADD : struct, IBinaryOp <T> where CMUL : struct, IBinaryOp <T> { if (in1.Shape.Dimensions.LongLength != 2) { throw new ArgumentException("Input elements must be 2D", "in1"); } if (in2.Shape.Dimensions.LongLength > 2) { throw new ArgumentException("Input elements must be 2D", "in2"); } if (in1.Shape.Dimensions[1].Length != in2.Shape.Dimensions[0].Length) { throw new ArgumentException(string.Format("Input elements shape size must match for matrix multiplication")); } if (in2.Shape.Dimensions.LongLength < 2) { in2 = in2.Subview(Range.NewAxis, in2.Shape.Dimensions.LongLength); } long[] newDims = new long[] { in1.Shape.Dimensions[0].Length, in2.Shape.Dimensions[1].Length }; if (@out == null) { @out = new NdArray <T>(new Shape(newDims)); } else { if (@out.Shape.Dimensions.LongLength != 2 || @out.Shape.Dimensions[0].Length != newDims[0] || @out.Shape.Dimensions[1].Length != newDims[1]) { throw new Exception("The output array for matrix multiplication is not correctly shaped"); } } if (@out.DataAccessor is ILazyAccessor <T> ) { ((ILazyAccessor <T>)@out.DataAccessor).AddOperation(new LazyMatmulOperation <T>(addop, mulop), @out, in1, in2); } else { ApplyManager.ApplyMatmul <T, CADD, CMUL>(addop, mulop, in1, in2, @out); } return(@out); }
public void Submit_OnClick(object sender, EventArgs e) { var isChanged = false; try { var translateNodeID = Utils.ToInt(ddlNodeID.SelectedValue); if (translateNodeID == 0) { LtlMessage.Text = Utils.GetMessageHtml("转移失败,必须选择转移目标!", false); return; } var chananelInfo = Main.ChannelApi.GetChannelInfo(SiteId, _channelId); foreach (int contentID in _idArrayList) { var contentInfo = Main.ContentApi.GetContentInfo(SiteId, _channelId, contentID); contentInfo.Set(ContentAttribute.TranslateFromChannelId, contentInfo.ChannelId.ToString()); contentInfo.ChannelId = translateNodeID; Main.ContentApi.Update(SiteId, contentInfo.ChannelId, contentInfo); if (!string.IsNullOrEmpty(tbTranslateRemark.Text)) { var remarkInfo = new RemarkInfo(0, SiteId, contentInfo.ChannelId, contentID, ERemarkTypeUtils.GetValue(ERemarkType.Translate), tbTranslateRemark.Text, _adminInfo.DepartmentId, AuthRequest.AdminName, DateTime.Now); RemarkDao.Insert(remarkInfo); } ApplyManager.LogTranslate(SiteId, contentInfo.ChannelId, contentID, chananelInfo.ChannelName, AuthRequest.AdminName, _adminInfo.DepartmentId); } isChanged = true; } catch (Exception ex) { LtlMessage.Text = Utils.GetMessageHtml(ex.Message, false); isChanged = false; } if (isChanged) { LayerUtils.Close(Page); } }
public JsonResult GetRespondResult(string id) { BaseJsonData json = new BaseJsonData(); if (!User.Identity.IsAuthenticated) { json.msg_code = "nologin"; goto next; } int user = Common.PageValidate.FilterParam(User.Identity.Name); ApplyManager dal = new ApplyManager(db); var bill = dal.GetReimbursement(id, 0).FirstOrDefault(); if (bill == null) { json.msg_text = "没有找到该报销单。"; json.msg_code = "noData"; goto next; } if (bill.state != 1) { json.msg_text = "不能打印未批复报销单。"; json.msg_code = "noData"; goto next; } if (user != bill.userId) { json.msg_text = "不能操作他人报销单。"; json.msg_code = "noData"; goto next; } bill.userName = AESEncrypt.Decrypt(bill.userName); bill.contents = dal.getContents(bill.reimbursementCode, 0).ToList(); bill.attachmentsCount = dal.getAttachments(bill.reimbursementCode, 0).Count(); bill.detailsCount = (from content in db.Reimbursement_Content join detail in db.Reimbursement_Detail on content.content_id equals detail.detail_content_id where content.c_reimbursement_code == bill.reimbursementCode select content.content_id).Count(); json.state = 1; json.msg_code = "success"; json.data = bill; next: return(Json(json, JsonRequestBehavior.AllowGet)); }
/// <summary> /// Function that is used as the entry point for applying a binary conversion operator. /// It will setup the output array and then call the evaluation method /// It has a unique name because it is faster to look up the method through reflection, /// if there is only one version of it. /// </summary> /// <typeparam name="Ta">The type of input data to operate on</typeparam> /// <typeparam name="Tb">The type of output data to operate on</typeparam> /// <typeparam name="C">The operation type to perform</typeparam> /// <param name="op">The operation instance</param> /// <param name="in1">The left-hand-side input argument</param> /// <param name="in2">The right-hand-side input argument</param> /// <param name="out">The output target</param> /// <returns>The output value</returns> private static NdArray <Tb> Apply_Entry_BinaryConv <Ta, Tb, C>(C op, NdArray <Ta> in1, NdArray <Ta> in2, NdArray <Tb> @out = null) where C : struct, IBinaryConvOp <Ta, Tb> { Tuple <NdArray <Ta>, NdArray <Ta>, NdArray <Tb> > v = SetupApplyHelper(in1, in2, @out); @out = v.Item3; if (@out.DataAccessor is ILazyAccessor <Tb> ) { ((ILazyAccessor <Tb>)@out.DataAccessor).AddConversionOperation(op, @out, v.Item1, v.Item2); } else { ApplyManager.ApplyBinaryConvOp <Ta, Tb, C>(op, v.Item1, v.Item2, @out); } return(@out); }
public ActionResult SaveApply(Apply apply, string role, string applyType) { #region 保存申请 if (apply.ID == new Guid()) { apply.ID = Guid.NewGuid(); } apply.ApplyType = ApplyTypeManager.Get(new Guid(applyType)); apply.SendUser = UserInfoManager.GetUserSession(); apply.CreateTime = DateTime.Now; apply.CheckState = 0; apply.CheckStateName = "待审核"; ApplyManager.SaveOrUpdate(apply); #endregion #region 保存待审核用户的信息 // 读取需要进行审核角色的用户 IList <RoleUser> roleUser = RoleUserManager.LoadAll().Where(f => f.Role.ID == new Guid(role)).ToList(); Guid roleId = new Guid(role); Role checkRole = RoleManager.Get(roleId); if (roleUser.Count == 0) { return(Content("-1")); } for (int i = 0; i < roleUser.Count; i++) { CheckLog checkLog = new CheckLog(); checkLog.ID = Guid.NewGuid(); checkLog.Apply = apply; checkLog.CheckState = 0; checkLog.CheckTime = DateTime.Now; checkLog.CreateTime = DateTime.Now; checkLog.Remark = ""; checkLog.Role = checkRole; checkLog.UserInfo = roleUser[i].User; CheckLogManager.Save(checkLog); } #endregion return(Content("1")); }
public void Submit_OnClick(object sender, EventArgs e) { var isChanged = false; try { if (string.IsNullOrEmpty(tbRedoRemark.Text)) { LtlMessage.Text = Utils.GetMessageHtml("要求返工失败,必须填写意见!", false); return; } foreach (int contentID in _idArrayList) { var contentInfo = Main.ContentApi.GetContentInfo(SiteId, _channelId, contentID); var state = EStateUtils.GetEnumType(contentInfo.GetString(ContentAttribute.State)); if (state == EState.Replied || state == EState.Redo) { var remarkInfo = new RemarkInfo(0, SiteId, contentInfo.ChannelId, contentInfo.Id, ERemarkTypeUtils.GetValue(ERemarkType.Redo), tbRedoRemark.Text, _adminInfo.DepartmentId, AuthRequest.AdminName, DateTime.Now); RemarkDao.Insert(remarkInfo); ApplyManager.Log(SiteId, contentInfo.ChannelId, contentID, ELogTypeUtils.GetValue(ELogType.Redo), AuthRequest.AdminName, _adminInfo.DepartmentId); contentInfo.Set(ContentAttribute.State, EStateUtils.GetValue(EState.Redo)); Main.ContentApi.Update(SiteId, contentInfo.ChannelId, contentInfo); } } isChanged = true; } catch (Exception ex) { LtlMessage.Text = Utils.GetMessageHtml(ex.Message, false); isChanged = false; } if (isChanged) { LayerUtils.Close(Page); } }
public void Accept_OnClick(object sender, EventArgs e) { var contentInfo = Main.ContentApi.GetContentInfo(SiteId, _channelId, _contentId); var remarkInfo = new RemarkInfo(0, SiteId, contentInfo.ChannelId, contentInfo.Id, ERemarkTypeUtils.GetValue(ERemarkType.Accept), TbAcceptRemark.Text, _adminInfo.DepartmentId, AuthRequest.AdminName, DateTime.Now); RemarkDao.Insert(remarkInfo); ApplyManager.Log(SiteId, contentInfo.ChannelId, contentInfo.Id, ELogTypeUtils.GetValue(ELogType.Accept), AuthRequest.AdminName, _adminInfo.DepartmentId); contentInfo.Set(ContentAttribute.State, EStateUtils.GetValue(EState.Accepted)); Main.ContentApi.Update(SiteId, contentInfo.ChannelId, contentInfo); LtlMessage.Text = Utils.GetMessageHtml("申请受理成功", true); var configInfo = Main.GetConfigInfo(SiteId); if (!configInfo.ApplyIsOpenWindow) { Utils.Redirect(_returnUrl); } }
// GET: ApplyManager/Details/5 public ActionResult Details(string id) { if (!User.Identity.IsAuthenticated) { return(RedirectToRoute(new { controller = "Login", action = "LogOut" })); } int user = Common.PageValidate.FilterParam(User.Identity.Name); if (id == null) { return(RedirectToRoute(new { controller = "Error", action = "Index", err = "报销单号获取失败。" })); } ApplyManager dal = new ApplyManager(db); List <SelectOption> options = DropDownList.RespondUserSelect(); ViewData["ViewUsers"] = DropDownList.SetDropDownList(options); var bill = dal.GetReimbursement(id, 0).FirstOrDefault(); bill.contents = dal.getContents(bill.reimbursementCode, 0).ToList(); foreach (var item in bill.contents) { item.details = dal.getContentDetails((int)item.contentId, 0).ToList(); item.attachments = dal.getAttachments(bill.reimbursementCode, 0, (int)item.contentId).ToList(); } bill.attachments = dal.getAttachments(bill.reimbursementCode, 0, 0).ToList(); bill.responds = dal.getResponds(bill.reimbursementCode, 0).ToList(); bill.userName = AESEncrypt.Decrypt(bill.userName); if (bill.responds != null && bill.responds.Count() > 0) { foreach (var respond in bill.responds) { respond.respondUser = AESEncrypt.Decrypt(respond.respondUser); } } return(View(bill)); }
// GET: FundsManager public ActionResult Index(BillsSearchModel info) { if (!User.Identity.IsAuthenticated) { return(RedirectToRoute(new { controller = "Login", action = "LogOut" })); } int user = PageValidate.FilterParam(User.Identity.Name); bool isAdmin = RoleCheck.CheckHasAuthority(user, db, "经费管理", "添加经费"); if (!isAdmin) { return(RedirectToRoute(new { controller = "Error", action = "Index", err = "没有权限。" })); } ApplyManager dal = new ApplyManager(db); if (info.userId != 0) { if (!RoleCheck.CheckHasAuthority(user, db, "经费管理")) { info.userId = user; } } info.PageSize = 0; //管理的经费 var mfunds = from funds in db.Funds join u in db.User_Info on funds.f_manager equals u.user_id select new mFundsListModel { manager = funds.f_manager, code = funds.f_code, amount = funds.f_amount, balance = funds.f_balance, id = funds.f_id, name = funds.f_name, managerName = u.real_name, strState = funds.f_state == 0 ? "未启用" : (funds.f_state == 1 ? "正常" : "锁定"), userCount = (from bill in db.Reimbursement where bill.r_funds_id == funds.f_id && bill.r_bill_state == 1 select bill ).Count(), applyamount = ( from bill in db.Reimbursement where bill.r_funds_id == funds.f_id && bill.r_bill_state == 1 select bill.r_fact_amount ).DefaultIfEmpty(0).Sum() }; if (info.userId > 0) { mfunds = mfunds.Where(x => x.manager == info.userId); } var list = mfunds.ToList(); foreach (var item in list) { item.managerName = Common.DEncrypt.AESEncrypt.Decrypt(item.managerName); } ViewData["Funds"] = list; List <SelectOption> options = DropDownList.FundsManagerSelect(user); ViewData["ViewUsers"] = DropDownList.SetDropDownList(options); return(View(info)); }
private void RptContents_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem) { return; } var contentInfo = Main.ContentApi.NewInstance(SiteId, ChannelId); var rowView = (DataRowView)e.Item.DataItem; contentInfo.Load(rowView.Row); var ltlTr = (Literal)e.Item.FindControl("ltlTr"); var ltlId = (Literal)e.Item.FindControl("ltlID"); var ltlTitle = (Literal)e.Item.FindControl("ltlTitle"); var ltlAddDate = (Literal)e.Item.FindControl("ltlAddDate"); var ltlRemark = (Literal)e.Item.FindControl("ltlRemark"); var ltlDepartment = (Literal)e.Item.FindControl("ltlDepartment"); var ltlLimit = (Literal)e.Item.FindControl("ltlLimit"); var ltlState = (Literal)e.Item.FindControl("ltlState"); var ltlFlowUrl = (Literal)e.Item.FindControl("ltlFlowUrl"); var ltlViewUrl = (Literal)e.Item.FindControl("ltlViewUrl"); var ltlReplyUrl = (Literal)e.Item.FindControl("ltlReplyUrl"); var ltlEditUrl = (Literal)e.Item.FindControl("ltlEditUrl"); var limitType = ELimitType.Normal; ltlTr.Text = @"<tr>"; var state = EStateUtils.GetEnumType(contentInfo.GetString(ContentAttribute.State)); var textClass = string.Empty; if (state != EState.Denied && state != EState.Checked) { limitType = ApplyManager.GetLimitType(SiteId, contentInfo); if (limitType == ELimitType.Alert) { ltlTr.Text = @"<tr class=""bg-info text-white"">"; textClass = "text-white"; } else if (limitType == ELimitType.Yellow) { ltlTr.Text = @"<tr class=""bg-warning text-white"">"; textClass = "text-white"; } else if (limitType == ELimitType.Red) { ltlTr.Text = @"<tr class=""bg-danger text-white"">"; textClass = "text-white"; } } ltlId.Text = contentInfo.Id.ToString(); var title = contentInfo.Title; if (string.IsNullOrEmpty(title)) { title = Utils.MaxLengthText(contentInfo.GetString(ContentAttribute.Content), 30); } if (string.IsNullOrEmpty(title)) { title = contentInfo.GetString(ContentAttribute.QueryCode); } var target = ConfigInfo.ApplyIsOpenWindow ? @"target=""_blank""" : string.Empty; if (state == EState.Accepted || state == EState.Redo) { ltlTitle.Text = $@"<a class=""{textClass}"" href=""{PageContentReply.GetRedirectUrl(SiteId, contentInfo.ChannelId, contentInfo.Id, PageUrl)}"" {target}>{title}</a>"; } else if (state == EState.Checked || state == EState.Replied) { ltlTitle.Text = $@"<a class=""{textClass}"" href=""{PageContentCheck.GetRedirectUrl(SiteId, contentInfo.ChannelId, contentInfo.Id, PageUrl)}"" {target}>{title}</a>"; } else if (state == EState.Denied || state == EState.New) { ltlTitle.Text = $@"<a class=""{textClass}"" href=""{PageContentAccept.GetRedirectUrl(SiteId, contentInfo.ChannelId, contentInfo.Id, PageUrl)}"" {target}>{title}</a>"; } var departmentId = contentInfo.GetInt(ContentAttribute.DepartmentId); var departmentName = DepartmentManager.GetDepartmentName(departmentId); if (departmentId > 0 && departmentName != contentInfo.GetString(ContentAttribute.DepartmentName)) { ltlTitle.Text += "【转办】"; } else if (Utils.ToInt(contentInfo.GetString(ContentAttribute.TranslateFromChannelId)) > 0) { ltlTitle.Text += "【转移】"; } ltlAddDate.Text = Utils.GetDateString(contentInfo.AddDate, EDateFormatType.Day); ltlRemark.Text = ApplyManager.GetApplyRemark(SiteId, contentInfo.Id); ltlDepartment.Text = departmentName; ltlLimit.Text = ELimitTypeUtils.GetText(limitType); ltlState.Text = EStateUtils.GetText(EStateUtils.GetEnumType(contentInfo.GetString(ContentAttribute.State))); ltlFlowUrl.Text = $@"<a href=""javascript:;"" class=""{textClass}"" onclick=""{ModalApplyFlow.GetOpenWindowString( SiteId, contentInfo.ChannelId, contentInfo.Id)}"">轨迹</a>"; ltlViewUrl.Text = $@"<a href=""javascript:;"" class=""{textClass}"" onclick=""{ModalApplyView.GetOpenWindowString( SiteId, contentInfo.ChannelId, contentInfo.Id)}"">查看</a>"; if (_isPermissionReply) { ltlReplyUrl.Text = $@"<a href=""javascript:;"" class=""{textClass}"" onclick=""{ModalApplyReply.GetOpenWindowString( SiteId, contentInfo.ChannelId, contentInfo.Id)}"">办理</a>"; } if (_isPermissionEdit) { ltlEditUrl.Text = $@"<a class=""{textClass}"" href=""{Main.UtilsApi.GetAdminUrl( $"cms/pageContentAdd.aspx?siteId={SiteId}&channelId={contentInfo.ChannelId}&id={contentInfo.Id}&returnUrl={HttpUtility.UrlEncode(Main.PluginApi.GetPluginUrl(Main.PluginId, PageUrl))}")}"">编辑</a>"; } }