AppointmentController

打印 上一主题 下一主题

主题 668|帖子 668|积分 2004

目录

1、 AppointmentController

1.1、 预约安排

1.1.1、 //ViewBag:获取动态视图数据字典

1.1.2、 //无法获取session 重定向到登录界面 重新登录

1.2、 生成预约单号



  • AppointmentController 
using QXQPS.Models;
using QXQPS.Vo;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace QXQPS.Areas.MechanicsManagment.Controllers
{
    public class AppointmentController : Controller
    {
        // GET: MechanicsManagment/Appointment
        Models.QXQPEntities myModels = new Models.QXQPEntities();


    • 预约安排

        public ActionResult Appointment()//预约安排
        {
            try
            {
                ViewBag.UserName = Session["UserName"].ToString().Trim();



      • //ViewBag:获取动态视图数据字典


                return View();
            }
            catch (Exception)
            {




      •                 //无法获取session 重定向到登录界面 重新登录


                return Redirect("/Home/Login");
            }
        }


    • 生成预约单号

        public ActionResult PredateNum()//生成预约单号
        {
            string PredateNum = "";
            var date = DateTime.Now.ToString("yyyyMMdd");
            var datetime = DateTime.Now.ToString("yyyyMMddHHmmss");
            try
            {
                var list = myModels.PW_Predate.Where(m => m.PredateNum.Contains(date)).OrderBy(m=>m.PredateNum).ToList();
                if (list.Count != 0)
                {
                    int num = Convert.ToInt32(list.Last().PredateNum.Trim().Substring(15)) + 1;
                    if (num < 10)
                    {
                        PredateNum = "BJ" + datetime + "000" + num;
                    }
                    else if (num > 9 && num < 100)
                    {
                        PredateNum = "BJ" + datetime + "00" + num;
                    }
                    else if (num > 99 && num < 1000)
                    {
                        PredateNum = "BJ" + datetime + "0" + num;
                    }
                }
                else {
                    PredateNum = "BJ" + datetime + "0001";
                }
            }
            catch (Exception)
            {
                return Json(PredateNum, JsonRequestBehavior.AllowGet);
            }
            return Json(PredateNum, JsonRequestBehavior.AllowGet);
        }

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

民工心事

金牌会员
这个人很懒什么都没写!

标签云

快速回复 返回顶部 返回列表