Exemple #1
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            //1.验证用户权限
            if (!this.Master.A_Edit)
            {
                Response.Write("你没有权限访问此功能!");
                Response.End();
                return;
            }
            //2.取得用户变量
            string flowId     = this.ddlFlowName.SelectedItem.Value;
            string userList   = this.hidden_SponsorList.Value;
            int    remindType = Convert.ToInt32(this.ddlRemindType.SelectedItem.Value);
            string dateTime   = DateTime.Now.ToString();

            switch (remindType)
            {
            case 1:
                dateTime = this.txtTimer1.Text;
                break;

            case 2:
                dateTime = String.Format("{0:yyyy-MM-dd} {1}", DateTime.Now, this.txtTimer2.Text);
                break;

            case 3:
                dateTime = GetRemindTime(3).ToString();
                break;

            case 4:
                dateTime = GetRemindTime(4).ToString();
                break;

            case 5:
                dateTime = GetRemindTime(5).ToString();
                break;
            }
            //3.验证用户变量,包含Request.QueryString及Request.Form
            //4.业务处理过程
            //填写主要业务逻辑代码
            string cmdText = "SELECT RemindType FROM Fl_FlowTimer WHERE RemindType=" + remindType + " AND FlowId=" + flowId;

            if (XSql.IsHasRow(cmdText))
            {
                ULCode.Debug.Alert("此提醒类型已经添加,不能重复添加", "Flow_Timer.aspx?id=" + flowId);
                Response.End();
            }
            string sql = "INSERT INTO Fl_FlowTimer (FlowId,UserList,RemindType,RemindTime) VALUES (" + flowId + ",'" + userList + "'," + remindType + ",'" + dateTime + "')";
            int    row = XSql.Execute(sql);

            //6.登记日志
            if (row > 0)
            {
                WX.Main.AddLog(WX.LogType.Default, "添加定时设置成功!", null);
            }
            //7.返回处理结果或返回其它页面。
            if (row > 0)
            {
                ULCode.Debug.Alert("定时设置添加成功!", "Flow_Timer.aspx?id=" + flowId);
            }
            else
            {
                ULCode.Debug.Alert("提醒类型添加失败", "Flow_Timer.aspx?id=" + flowId);
            }
        }