Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string author = Request["p"];

            if (author == null || author.Equals(""))
            {
                author = UserTool.GetAccount(Session); // 获取登录的用户名
            }

            if (author != null && !author.Equals(""))
            {
                // 查询收益信息
                string url    = "http://" + Request.Params.Get("HTTP_HOST") + "/Pages/UserWithdraw.aspx" + "?" + "TYPE=Reward&author=" + author;
                string reward = ScTool.getWebData(url);

                LabelAccount.Text = author;
                LabelReward.Text  = reward;

                DataBase DB_Ali = new DataBase(ScTool.DBName(ScTool.PayTypeAli), ScTool.UserName, ScTool.Password);
                showTable(DivTable.Controls, DB_Ali, ScTool.ORDER, author, "True");

                showTable(DivTableHistory.Controls, DB_Ali, ScTool.ORDER, author, "TrueFinish");
            }
            else
            {
                LabelAccount.Text = "";
                LabelReward.Text  = "0";

                DivTable.InnerText = "示例:" + "http://" + Request.Params.Get("HTTP_HOST") + "/Pages/UserRewards.aspx" + "?" + "p=scimence";
            }
        }
        /// <summary>
        /// 执行
        /// </summary>
        /// <typeparam name="FormT">表单类型</typeparam>
        /// <param name="flowInit">流程初始</param>
        /// <param name="workflowInit">工作流初始</param>
        /// <param name="comData">通用数据</param>
        /// <returns>返回信息</returns>
        private ReturnInfo <WorkflowBasicInfo> Execute <FormT>(FlowInitInfo <FormT> flowInit, IWorkflowForm workflowInit, CommonUseData comData = null)
            where FormT : PersonTimeInfo <int>
        {
            var returnInfo = new ReturnInfo <WorkflowBasicInfo>();
            var currUser   = UserTool <int> .GetCurrUser(comData);

            if (string.IsNullOrWhiteSpace(flowInit.ApplyNo))
            {
                flowInit.ApplyNo = BuilderApplyNo(flowInit, returnInfo, comData);
                if (returnInfo.Failure())
                {
                    return(returnInfo);
                }
            }

            var flowInfo = flowInit.ToFlowIn();
            ReturnInfo <bool> reWorkflow = workflowInit.Execute(flowInfo, comData);

            returnInfo.FromBasic(reWorkflow);
            if (reWorkflow.Failure())
            {
                return(returnInfo);
            }

            returnInfo.Data = new WorkflowBasicInfo()
            {
                Id      = flowInit.Id,
                ApplyNo = flowInit.ApplyNo
            };

            return(returnInfo);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 执行流程后
        /// </summary>
        /// <param name="workflow">工作流</param>
        /// <param name="removeType">移除类型</param>
        /// <param name="isSuccess">是否成功</param>
        /// <param name="connectionId">连接ID</param>
        /// <param name="comData">通用数据</param>
        /// <returns>返回信息</returns>
        public override ReturnInfo <bool> AfterExecFlow(WorkflowInfo workflow, RemoveType removeType, bool isSuccess, CommonUseData comData = null, string connectionId = null)
        {
            if (isSuccess)
            {
                var currUser = UserTool <int> .GetCurrUser(comData);

                switch (removeType)
                {
                case RemoveType.REMOVE:
                case RemoveType.FORCE_REMOVE:

                    return(FormService.RemoveByWorkflowId(workflow.Id, connectionId: connectionId, comData: comData));

                case RemoveType.UNDO:
                    ConcreteFormInfoT form = typeof(ConcreteFormInfoT).CreateInstance <ConcreteFormInfoT>();
                    form.WorkflowId = workflow.Id;
                    form.FlowStatus = FlowStatusEnum.REVERSED;
                    form.SetModifyInfo(currUser);

                    return(FormService.ModifyFlowStatusByWorkflowId(form, connectionId: connectionId, comData: comData));
                }
            }

            return(new ReturnInfo <bool>());
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 主页
        /// </summary>
        /// <returns>动作结果</returns>
        public ActionResult Index()
        {
            var comData = HttpContext.CreateCommonUseData(ComUseDataFactory, menuCode: "Home", functionCodes: "Query");
            var user    = UserTool <int> .GetCurrUser(comData);

            return(View(UserMenuService.CanAccessMenus(user.Id, comData)));
        }
        /// <summary>
        /// 添加用户角色
        /// </summary>
        /// <param name="model">模型</param>
        /// <param name="connectionId">连接ID</param>
        /// <param name="comData">通用数据</param>
        /// <returns>影响行数</returns>
        private int AddUserRoles(UserInfo model, CommonUseData comData = null, string connectionId = null)
        {
            if (model.OwnRoles.IsNullOrCount0())
            {
                return(0);
            }

            IList <UserRoleInfo> userRoles = new List <UserRoleInfo>(model.OwnRoles.Count);

            foreach (RoleInfo r in model.OwnRoles)
            {
                UserRoleInfo ur = new UserRoleInfo()
                {
                    UserId = model.Id,
                    RoleId = r.Id
                };
                ur.SetCreateInfo(UserTool <int> .GetCurrUser(comData));

                userRoles.Add(ur);
            }
            if (userRoles.IsNullOrCount0())
            {
                return(0);
            }

            return(UserRolePersistence.Insert(userRoles, connectionId: connectionId, comData: comData));
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Gets userId from the session and pulls the row from the user table for the selected user to be used to dynamically
 /// populate the page with the user's information
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         userRow = UserTool.GetUserInfo(Session["User"].ToString());
         if (userRow == null)
         {
             Response.Redirect("default.aspx");
         }
         else
         {
             if (!Page.IsPostBack)
             {
                 tbFName.Text               = userRow["FirstName"].ToString();
                 tblName.Text               = userRow["LastName"].ToString();
                 tbAddress.Text             = userRow["Address"].ToString();
                 tbEmail.Text               = userRow["Email"].ToString();
                 ddProfilePic.SelectedIndex = Convert.ToInt32(userRow["ProfilePicture"].ToString());
                 imgProfilePic.ImageUrl     = "Images/" + userRow["ProfilePicture"].ToString() + ".png";
             }
         }
     }
     catch
     {
         Response.Redirect("default.aspx");
     }
 }
Ejemplo n.º 7
0
        public MainForm()
        {
            InitializeComponent();

            m_ConnectionTool                   = new ConnectionTool();
            m_SelectionTool                    = new ElementSelectionTool();
            m_ElementDeletionTool              = new ElementDeletionTool();
            m_DisconnectionTool                = new DisconnectionTool();
            m_SelectionTool.OnElementSelected += new ElementSelected(selectionTool_OnElementSelected);

            m_OffsetTool = new UserTool();
            m_OffsetTool.OnMouseClick += new MouseEventHandler(OffsetTool_OnMouseClick);

            (PartSelectionTool.Instance as PartSelectionTool).OnPartSelected += new PartSelected(partSelectionTool_OnPartSelected);

            //signalingForm.Show(dockPanel, DockState.DockRight);
            signalingForm.Height = (int)(Height * 0.5);
            signalingForm.Show(dockPanel, DockState.DockBottom);
            menuItem_SignalControl.Checked = signalingForm.Visible;
            signalingForm.VisibleChanged  += new EventHandler(toolForm_VisibleChanged);

            //propertyForm.Show(signalingForm.Pane, DockAlignment.Bottom, 0.5);
            propertyForm.Show(dockPanel, DockState.DockRight);
            propertyForm.VisibleChanged   += new EventHandler(toolForm_VisibleChanged);
            menuItem_SignalControl.Checked = propertyForm.Visible;

            simulationForm.Show(propertyForm.Pane, DockAlignment.Top, 0.4);
            menuItem_SimControl.Checked    = simulationForm.Visible;
            simulationForm.VisibleChanged += new EventHandler(toolForm_VisibleChanged);

            m_HelpFileName = Path.Combine(Application.StartupPath, "help.chm");

            //dockPanel.
        }
        public virtual ReturnInfo <bool> ModifyCurrUserPassword(CurrUserModifyPasswordInfo currUserModifyPassword)
        {
            var user = UserTool.GetCurrUser();

            currUserModifyPassword.LoginId = user.LoginId;
            return(Service.ModifyPasswordByLoginId(currUserModifyPassword));
        }
Ejemplo n.º 9
0
    /// <summary>
    /// Gets userId from the session and pulls the row from the user table for the selected user to be used to dynamically
    /// populate the users name for the greeting message, and decide which buttons to show the user based on their Account Type
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            DataRow dr = UserTool.GetUserInfo(Session["User"].ToString());
            if (dr == null)
            {
                Response.Redirect("default.aspx");
            }
            else
            {
                lblWelcome.Text = "Welcome " + dr["FirstName"].ToString() + ",";
            }

            if (dr["AccountType"].ToString() == "Administrator")
            {
                btnAdminPage.Visible = true;
            }
            else if (dr["AccountType"].ToString() == "Librarian")
            {
                btnLibrarianPage.Visible = true;
            }
            else
            {
                btnMemberPage.Visible = true;
            }
        }
        catch
        {
            Response.Redirect("default.aspx");
        }
    }
Ejemplo n.º 10
0
        public virtual ReturnInfo <bool> ModifyToReadedById([DisplayName2("ID"), Id] int id, string connectionId = null, BasicUserInfo currUser = null)
        {
            return(ExecReturnFuncAndConnectionId <bool>((reInfo, connId) =>
            {
                WorkflowHandleInfo wh = Persistence.Select(id, connId);
                if (wh == null)
                {
                    reInfo.SetFailureMsg("找不到该工作流处理记录");
                    return false;
                }

                var user = UserTool.GetCurrUser(currUser);
                if (wh.HandlerId != user.Id)
                {
                    reInfo.SetFailureMsg("Sorry!不是您处理的无权限修改");
                    return false;
                }
                if (wh.IsReaded)
                {
                    return false;
                }

                wh.IsReaded = true;
                wh.SetModifyInfo(currUser);

                return Persistence.UpdateIsReadedById(wh, connId) > 0;
            }, null, connectionId));
        }
Ejemplo n.º 11
0
        public virtual ReturnInfo <bool> ModifyCurrUserPassword(CurrUserModifyPasswordInfo currUserModifyPassword)
        {
            var comData = HttpContext.CreateCommonUseData(ComUseDataFactory, menuCode: MenuCode(), functionCodes: FunCodeDefine.RESET_PASSWORD_CODE);
            var user    = UserTool <int> .GetCurrUser(comData);

            currUserModifyPassword.LoginId = user.LoginId;
            return(Service.ModifyPasswordByLoginId(currUserModifyPassword, comData));
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 验证数据库参数
        /// </summary>
        /// <param name="returnInfo">返回信息</param>
        /// <param name="flowIn">流程输入</param>
        /// <param name="workflow">工作流</param>
        /// <param name="connectionId">连接ID</param>
        /// <param name="currUser">当前用户</param>
        private void ValiDbParam(ReturnInfo <bool> returnInfo, FlowInInfo <FlowInitInfo <PersonTimeInfo <int> > > flowIn, out WorkflowInfo workflow, string connectionId = null, BasicUserInfo <int> currUser = null)
        {
            workflow = null;
            ReturnInfo <WorkflowDefineInfo> reWorkFlowConfig = WorkflowConfigReader.ReaderAllConfig(flowIn.Flow.WorkflowCode, connectionId, currUser);

            if (reWorkFlowConfig.Failure())
            {
                returnInfo.FromBasic(reWorkFlowConfig);
                return;
            }

            var user = UserTool <int> .GetCurrUser(currUser);

            if (flowIn.Flow.Id > 0)
            {
                var reInfo = WorkflowService.Find(flowIn.Flow.Id, connectionId, currUser);
                if (reInfo.Failure())
                {
                    returnInfo.FromBasic(reInfo);

                    return;
                }
                if (reInfo.Data == null)
                {
                    returnInfo.SetFailureMsg($"找不到工作流ID[{flowIn.Flow.Id}]的数据");

                    return;
                }

                if (reInfo.Data.CreaterId != user.Id)
                {
                    returnInfo.SetFailureMsg($"Sorry,此流程不是您创建的,无权限操作");

                    return;
                }

                workflow = reInfo.Data;

                flowIn.Flow.Id      = workflow.Id;
                flowIn.Flow.ApplyNo = workflow.ApplyNo;
            }
            else
            {
                ReturnInfo <bool> reInfo = WorkflowService.ExistsByApplyNo(flowIn.Flow.ApplyNo, connectionId, currUser);
                if (reInfo.Failure())
                {
                    returnInfo.FromBasic(reInfo);

                    return;
                }
                if (reInfo.Data)
                {
                    returnInfo.SetFailureMsg($"申请单号[{flowIn.Flow.ApplyNo}]已存在");

                    return;
                }
            }
        }
        /// <summary>
        /// 验证
        /// </summary>
        /// <param name="returnInfo">返回信息</param>
        /// <param name="workflow">工作流</param>
        /// <param name="comData">通用数据</param>
        protected override void Vali(ReturnInfo <bool> returnInfo, WorkflowInfo workflow, CommonUseData comData = null)
        {
            var user = UserTool <int> .GetCurrUser(comData);

            if (workflow.CreaterId != user.Id)
            {
                returnInfo.SetFailureMsg("Sorry,您不是此流程的发起者,故不能撤消");

                return;
            }
            switch (workflow.FlowStatus)
            {
            case FlowStatusEnum.DRAFT:
                returnInfo.SetFailureMsg("Sorry,此流程是草稿状态不能撤消");

                return;

            case FlowStatusEnum.REVERSED:
                returnInfo.SetFailureMsg("Sorry,此流程已经撤消,不能重复撤消");

                return;

            case FlowStatusEnum.AUDIT_PASS:
                returnInfo.SetFailureMsg("Sorry,此流程已经审核通过,不能撤消");

                return;

            case FlowStatusEnum.AUDIT_NOPASS:
                returnInfo.SetFailureMsg("Sorry,此流程已经审核不通过,不能撤消");

                return;

            case FlowStatusEnum.AUDITING:
                // 只有所有审核者未读才允许撤消
                foreach (var h in workflow.Handles)
                {
                    // 本人处理忽略
                    if (h.HandlerId == user.Id)
                    {
                        continue;
                    }

                    if (h.IsReaded)
                    {
                        returnInfo.SetFailureMsg("Sorry,此流程已经被审核者读过,不能撤消");

                        return;
                    }
                }

                return;

            default:
                returnInfo.SetFailureMsg("Sorry,此流程未知状态,不能撤消");

                return;
            }
        }
Ejemplo n.º 14
0
        public SymbolEditorForm()
        {
            InitializeComponent();

            m_OffsetTool = new UserTool();
            m_OffsetTool.OnMouseClick += new MouseEventHandler(OffsetTool_OnMouseClick);

            LoadSymbols();
        }
Ejemplo n.º 15
0
    /// <summary>
    /// Sets the amount owing for the label to inform the user
    /// </summary>
    private void amountOwing()
    {
        try
        {
            DataRow dr = UserTool.GetUserInfo(Session["User"].ToString());
            if (dr == null)
            {
                Response.Redirect("default.aspx");
            }
            else
            {
                if (dr["AccountType"].ToString().Equals("Member"))
                {
                    string sqlCommand = "SELECT AmountOwing FROM [User] WHERE UserId = @UserId";
                    conn.ConnectionString = conString;
                    SqlCommand cmd    = conn.CreateCommand();
                    int        userId = Convert.ToInt32(dr["UserId"].ToString());

                    try
                    {
                        cmd.CommandText = sqlCommand;
                        conn.Open();
                        SqlParameter userIdParam = new SqlParameter();
                        userIdParam.ParameterName = "@UserId";
                        userIdParam.Value         = userId;
                        cmd.Parameters.Add(userIdParam);
                        SqlDataReader reader = cmd.ExecuteReader();
                        string        fee    = " ";
                        while (reader.Read())
                        {
                            fee           = reader.GetDouble(0).ToString();
                            lblOwing.Text = "Amount Owing: $" + fee;
                        }
                        reader.Close();
                    }
                    catch (Exception ex)
                    {
                        ClientScript.RegisterClientScriptBlock(this.GetType(), "Error", "alert('An Error has occoured')", true);
                    }
                    finally
                    {
                        cmd.Dispose();
                        conn.Close();
                    }
                }
                else
                {
                    Response.Redirect("default.aspx");
                }
            }
        }
        catch (Exception ex)
        {
            Response.Redirect("default.aspx");
        }
    }
        public ActionResult Save(UserTool userTool)
        {
            if (!ModelState.IsValid)
            {
                return View("Edit", userTool);
            }

            service.SaveEntity(userTool);
            return RedirectToAction("All");
        }
        public ActionResult Save(UserTool userTool)
        {
            if (!ModelState.IsValid)
            {
                return(View("Edit", userTool));
            }

            service.SaveEntity(userTool);
            return(RedirectToAction("All"));
        }
Ejemplo n.º 18
0
        /// <summary>
        /// 拦截
        /// </summary>
        /// <param name="basicReturn">基本返回</param>
        /// <param name="invocation">拦截参数</param>
        /// <param name="attr">特性</param>
        /// <param name="isExecProceeded">是否已执行</param>
        protected override void Intercept(BasicReturnInfo basicReturn, IInvocation invocation, AuthAttribute attr, out bool isExecProceeded)
        {
            isExecProceeded = false;
            var currUser = attr.CurrUserParamIndex == -1 ? null : invocation.Arguments[attr.CurrUserParamIndex];
            var user     = UserTool.GetCurrUser(currUser as BasicUserInfo);

            if (user == null)
            {
                basicReturn.SetCodeMsg(403, "您还未授权,无权限访问");
            }
        }
Ejemplo n.º 19
0
    /// <summary>
    /// Assigns the selected book from the grid view to the specific user in the row
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnAssign_Click(object sender, EventArgs e)
    {
        if (GridView1.SelectedIndex == -1)
        {
            ClientScript.RegisterClientScriptBlock(this.GetType(), "Error", "alert('An Error has occoured')", true);
        }
        else
        {
            int     requestId = Convert.ToInt32(GridView1.SelectedRow.Cells[1].Text);
            int     issueId   = Convert.ToInt32(GridView1.SelectedRow.Cells[12].Text);
            DataRow dr        = UserTool.GetUserInfo(Session["User"].ToString());
            if (dr["AccountType"].ToString().Equals("Librarian"))
            {
                if (dr == null)
                {
                    Response.Redirect("default.aspx");
                }
                else
                {
                    int[]    ids        = grabRequest(requestId); // grabs info to insert for rental
                    DateTime rentalDate = DateTime.Now;
                    DateTime dueDate    = rentalDate.AddDays(7);
                    string   sqlCommand = "INSERT INTO Rental (IssueId, UserId, RentalDate, DueDate, Fees) VALUES (" + ids[0] + "," + ids[1] + ",'" + rentalDate.ToString() + "','" + dueDate.ToString() + "'," + 0 + ")";
                    conn.ConnectionString = conString;
                    SqlCommand cmd = conn.CreateCommand();

                    try
                    {
                        cmd.CommandText = sqlCommand;
                        conn.Open();
                        cmd.ExecuteScalar();
                    }
                    catch (Exception ex)
                    {
                        ClientScript.RegisterClientScriptBlock(this.GetType(), "Error", "alert('An Error has occoured')", true);
                    }
                    finally
                    {
                        cmd.Dispose();
                        conn.Close();
                    }
                    issueStatusChange(issueId);
                    deleteRequest(requestId);
                    dataBindGrid();
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "Request has been Approved", "alert('The Book has been Approved!')", true);
                }
            }
            else
            {
                Response.Redirect("default.aspx");
            }
        }
    }
Ejemplo n.º 20
0
    /// <summary>
    /// Sets it up to request the book
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnRequest_Click(object sender, EventArgs e)
    {
        try
        {
            DataRow dr = UserTool.GetUserInfo(Session["User"].ToString());
            if (dr == null)
            {
                Response.Redirect("default.aspx");
            }
            else
            {
                int memberID    = Convert.ToInt32(dr["UserId"].ToString());
                int bookRentals = booksRented(memberID);
                if (bookRentals >= Convert.ToInt32(dr["BookLimit"].ToString()))
                {
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "Max Book Limit", "alert('You have reached the limit of books rented, please return a book to request this book')", true);
                }
                else
                {
                    DateTime dateReq = DateTime.Now;
                    int      bookId  = Convert.ToInt32(GridView1.SelectedRow.Cells[1].Text); //grabs the book id from the gridview
                    int      issueId = findIssue(bookId);                                    //grabs all issues that have an available issue for the corresponding book
                    //
                    string sqlCommand = "INSERT INTO Request VALUES ('" + dateReq.ToString() + "', " + issueId + ", " + memberID + ")";
                    conn.ConnectionString = conString;
                    SqlCommand cmd = conn.CreateCommand();

                    try
                    {
                        cmd.CommandText = sqlCommand;
                        conn.Open();
                        cmd.ExecuteScalar();
                    }
                    catch (Exception ex)
                    {
                        ClientScript.RegisterClientScriptBlock(this.GetType(), "Error", "alert('An Error has occoured')", true);
                    }
                    finally
                    {
                        cmd.Dispose();
                        conn.Close();
                    }
                    changeStatus(issueId);
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "Book Requested", "alert('The Book has been requested!')", true);
                }
            }
        }
        catch (Exception ex)
        {
            Response.Redirect("default.aspx");
        }
    }
        /// <summary>
        /// 设置创建信息
        /// </summary>
        /// <typeparam name="IdT">ID类型</typeparam>
        /// <param name="model">模型</param>
        /// <param name="currUser">当前用户</param>
        public static void SetCreateInfo <IdT>(this PersonTimeInfo <IdT> model, BasicUserInfo <IdT> currUser = null)
        {
            var user = UserTool <IdT> .GetCurrUser(currUser);

            if (user == null)
            {
                return;
            }

            model.CreaterId  = model.ModifierId = user.Id;
            model.Creater    = model.Modifier = user.Name;
            model.CreateTime = model.ModifyTime = DateTime.Now;
        }
        /// <summary>
        /// 设置修改信息
        /// </summary>
        /// <param name="model">模型</param>
        /// <param name="currUser">当前用户</param>
        public static void SetModifyInfo(this PersonTimeInfo model, BasicUserInfo currUser = null)
        {
            var user = UserTool.GetCurrUser(currUser);

            if (user == null)
            {
                return;
            }

            model.ModifierId = user.Id;
            model.Modifier   = user.Name;
            model.ModifyTime = DateTime.Now;
        }
        /// <summary>
        /// 查询当前用户的待办的工作流列表并分页
        /// </summary>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">每页记录数</param>
        /// <param name="filter">筛选</param>
        /// <param name="connectionId">连接ID</param>
        /// <param name="comData">通用数据</param>
        /// <returns>返回信息</returns>
        public virtual ReturnInfo <PagingInfo <WorkflowInfo> > QueryCurrUserWaitHandlePage(int pageIndex, int pageSize, WaitHandleFilterInfo filter, CommonUseData comData = null, string connectionId = null)
        {
            if (filter == null)
            {
                filter = new WaitHandleFilterInfo();
            }
            var user = UserTool <int> .GetCurrUser(comData);

            filter.HandlerId     = user.Id;
            filter.EndCreateTime = filter.EndCreateTime.AddThisDayLastTime();

            return(ExecReturnFuncAndConnectionId <PagingInfo <WorkflowInfo> >((reInfo, connId) =>
            {
                return Persistence.SelectWaitHandlePage(pageIndex, pageSize, filter, connId);
            }, null, connectionId, AccessMode.SLAVE));
        }
        public virtual ReturnInfo <PagingInfo <WorkflowInfo> > QueryCurrUserAuditedFlowPage(int pageIndex, int pageSize, AuditFlowFilterInfo filter, string connectionId = null, BasicUserInfo currUser = null)
        {
            if (filter == null)
            {
                filter = new AuditFlowFilterInfo();
            }
            var user = UserTool.GetCurrUser(currUser);

            filter.HandlerId     = user.Id;
            filter.EndCreateTime = filter.EndCreateTime.AddThisDayLastTime();

            return(ExecReturnFuncAndConnectionId <PagingInfo <WorkflowInfo> >((reInfo, connId) =>
            {
                return Persistence.SelectAuditedHandlePage(pageIndex, pageSize, filter, connId);
            }, null, connectionId, AccessMode.SLAVE));
        }
Ejemplo n.º 25
0
        /// <summary>
        /// 验证
        /// </summary>
        /// <param name="returnInfo">返回信息</param>
        /// <param name="workflow">工作流</param>
        /// <param name="comData">通用数据</param>
        protected override void Vali(ReturnInfo <bool> returnInfo, WorkflowInfo workflow, CommonUseData comData = null)
        {
            var user = UserTool <int> .GetCurrUser(comData);

            if (workflow.CreaterId != user.Id)
            {
                returnInfo.SetFailureMsg("Sorry,您不是此流程的发起者,故不能移除");

                return;
            }
            if (workflow.FlowStatus != FlowStatusEnum.DRAFT)
            {
                returnInfo.SetFailureMsg("Sorry,只有草稿状态才能移除");

                return;
            }
        }
Ejemplo n.º 26
0
    /// <summary>
    /// changes the status for the issue that its now loaned
    /// </summary>
    /// <param name="issueId"></param>
    private void issueStatusChange(int issueId)
    {
        DataRow dr = UserTool.GetUserInfo(Session["User"].ToString());

        if (dr["AccountType"].ToString().Equals("Librarian"))
        {
            if (dr == null)
            {
                Response.Redirect("default.aspx");
            }
            else
            {
                int[]    ids        = grabRequest(issueId);
                DateTime rentalDate = DateTime.Now;
                DateTime dueDate    = rentalDate.AddDays(7);
                string   sqlCommand = "UPDATE Issue SET Status = 'On Loan' WHERE IssueId = @issueId";
                conn.ConnectionString = conString;
                SqlCommand cmd = conn.CreateCommand();

                try
                {
                    cmd.CommandText = sqlCommand;
                    conn.Open();
                    SqlParameter issueIdParam = new SqlParameter();
                    issueIdParam.ParameterName = "@issueId";
                    issueIdParam.Value         = issueId;
                    cmd.Parameters.Add(issueIdParam);
                    cmd.ExecuteScalar();
                }
                catch (Exception ex)
                {
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "Error", "alert('An Error has occoured')", true);
                }
                finally
                {
                    cmd.Dispose();
                    conn.Close();
                }
            }
        }
        else
        {
            Response.Redirect("Default.aspx");
        }
    }
Ejemplo n.º 27
0
    /// <summary>
    /// finds the issues based off the bookId
    /// </summary>
    /// <param name="bookId"></param>
    /// <returns></returns>
    private int findIssue(int bookId)
    {
        int issueId = 0;

        try
        {
            DataRow dr = UserTool.GetUserInfo(Session["User"].ToString());
            if (dr == null)
            {
                Response.Redirect("default.aspx");
            }
            else
            {
                string sqlCommand = "SELECT * FROM Issue WHERE BookId =" + bookId + " AND Status = 'Available'";
                conn.ConnectionString = conString;
                SqlCommand cmd = conn.CreateCommand();

                try
                {
                    cmd.CommandText = sqlCommand;
                    conn.Open();
                    SqlDataReader reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        issueId = reader.GetInt32(0);
                    }
                }
                catch (Exception ex)
                {
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "Error", "alert('An Error has occoured')", true);
                }
                finally
                {
                    cmd.Dispose();
                    conn.Close();
                }
            }
        }
        catch (Exception ex)
        {
            Response.Redirect("default.aspx");
        }
        return(issueId);
    }
        public virtual ReturnInfo <WorkflowInfo> FindCurrUserApplyDetail([DisplayName2("ID"), Id] int id, string connectionId = null, BasicUserInfo currUser = null)
        {
            ReturnInfo <WorkflowInfo> returnInfo = FindContainHandlesAndAllConfigs(id, connectionId, currUser);

            if (returnInfo.Failure())
            {
                return(returnInfo);
            }

            var user = UserTool.GetCurrUser(currUser);

            if (returnInfo.Data.CreaterId != user.Id)
            {
                returnInfo.SetFailureMsg("此工作流不是您申请的,无权限查看");

                return(returnInfo);
            }

            return(returnInfo);
        }
        /// <summary>
        /// 重置用户密码
        /// </summary>
        /// <param name="modifyPassword">修改密码</param>
        /// <param name="connectionId">连接ID</param>
        /// <param name="comData">通用数据</param>
        /// <returns>返回信息</returns>
        public virtual ReturnInfo <bool> ResetUserPassword([Model] ModifyPasswordInfo modifyPassword, CommonUseData comData = null, string connectionId = null)
        {
            return(ExecReturnFuncAndConnectionId <bool>((reInfo, connId) =>
            {
                UserInfo user = new UserInfo()
                {
                    Id = modifyPassword.Id,
                    Password = MD5Util.Encryption16(modifyPassword.NewPassword)
                };
                user.SetModifyInfo(UserTool <int> .GetCurrUser(comData));

                bool result = Persistence.UpdatePasswordById(user, connId) > 0;
                if (result)
                {
                    reInfo.SetSuccessMsg("修改成功,请记住新密码!");
                }

                return result;
            }, null, connectionId));
        }
Ejemplo n.º 30
0
        /// <summary>
        /// 判断当前用户能否审核
        /// </summary>
        /// <param name="workflowHandle">工作流处理</param>
        /// <param name="currUser">当前用户</param>
        /// <returns>当前用户能否审核</returns>
        public static BasicReturnInfo CanCurrUserAudit(WorkflowHandleInfo workflowHandle, BasicUserInfo currUser = null)
        {
            BasicReturnInfo returnInfo = new BasicReturnInfo();
            var             user       = UserTool.GetCurrUser(currUser);

            if (user == null)
            {
                returnInfo.SetFailureMsg("您还未登录,请先登录系统");

                return(returnInfo);
            }

            if (workflowHandle == null)
            {
                returnInfo.SetFailureMsg("找不到处理信息");

                return(returnInfo);
            }

            if (workflowHandle.HandlerId != user.Id)
            {
                returnInfo.SetFailureMsg("Sorry,您不是此流程的处理者,无权限审核");

                return(returnInfo);
            }

            if (workflowHandle.HandleStatus == HandleStatusEnum.EFFICACYED)
            {
                returnInfo.SetFailureMsg("Sorry,您的处理信息已无效");

                return(returnInfo);
            }
            if (workflowHandle.HandleStatus == HandleStatusEnum.SENDED || workflowHandle.HandleStatus == HandleStatusEnum.RETURNED)
            {
                returnInfo.SetFailureMsg("Sorry,您的处理信息已处理,无需重复处理");

                return(returnInfo);
            }

            return(returnInfo);
        }
Ejemplo n.º 31
0
        /// <summary>
        /// 页面载入
        /// </summary>
        protected void Page_Load(object sender, EventArgs e)
        {
            UserAccount = UserTool.GetAccount(Session); // 获取登录的用户名
            UserType    = UserTool.UserType(Session);   // 获取当前登录的用户类型信息

            //if((!Page.IsPostBack)) ScTool.RecordUserAgent(Request);    // 记录客户端信息

            //if (!Page.IsPostBack)  // 首次载入时
            {
                String LogName = this.GetType().Name;   // 当前页面名称
                log   = new LogTool(LogName);           // 记录至log中
                param = getParam();                     // 获取参数信息

                if (!param.Equals(""))
                {
                    log.WriteLine(param);
                }
            }

            Load(sender, e);
        }
 public ActionResult Edit(UserTool userTool)
 {
     return View(userTool);
 }