基于Jquerymobile实现的支持PC、平板、手机移动设备的web应用程序(C#)

页面部分:

List部分:

@{
    Layout = null;
}
@using ePR.Models;
@using ePR;
@using BusinessObjectLayer.Entities;
@using DataAccessLayer;
@model ePR.Models.pRHeaderListModel

<!DOCTYPE html>

<html>
<head>

 
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="@Url.Content("~/Scripts/jquery.mobile-1.0.1/jquery.mobile-1.0.1.min.css")" rel="stylesheet" type="text/css" />
    
    <script src="@Url.Content("~/Scripts/jquery-1.6.4.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.mobile-1.0.1/jquery.mobile-1.0.1.min.js")" type="text/javascript"></script>


</head>
<body>
   
    <div data-role="page">
        <!-- /header -->
        <div data-role="header" data-theme="a">
         @*<a href="Approve/ApproveList?home=yes" data-icon="home" data-theme="a" class="ui-btn-left">Home</a>*@
            <a href="@Url.Action("ApproveList", "Approve", new { home = "home" })" data-icon="home" data-theme="a" class="ui-btn-left" data-ajax="false">Home</a>
      <h1>ePR System</h1>
     </div>
        <!--content-->
     <div data-role="content">
     <h6> *** The PR highlighted in purple means you are delegated to approve this request ***</h6>
        @{

            if (Model.pRHeaderInfo == null)
            {
                        <h4> *** No PR is pending for your approval ***</h4>        
            }
            else
            {
           
        
      
                <div data-role="collapsible-set">
                <div data-role="collapsible" data-collapsed="false" data-theme="c" data-content-theme="c">
                    <h6>PR List for Approval</h6>

                       <ul id="listView1" data-role="listview" data-inset="true" IsNumberedList="true">
                       
                        @foreach (InfoEntity inen in Model.pRHeaderInfo)
                        {
                            <li>
                                @*<a id="SelListItem"  href="@Url.Action("Approve", "Approve", new { prno = @inen.PR_NO })"  >*@
                                <a id="SelListItem"  href="@inen.PRUrl/Approve/Approve?prno=@inen.PR_NO"  >
                               
                                @*<a id="SelListItem"  href="@inen.PRUrl/mobile_web/Overview.aspx?PRNO=@inen.PR_NO"  >*@
                                    <div class="textareaDesc">
                                        <strong>@inen.PR_NO</strong> 
                                        <p>&nbsp</p>
                                        <p>Company: @inen.Comp_Code</p>
                                        <p>Department: @inen.Dept_Code</p>
                                        <p>Requester: @inen.Requester</p>
                                        <p>Remark: @inen.Remark_By_User</p>                                       
                                    </div>
                                </a>
                            </li>
                        }
                       
                       
                            </ul> 
                      
                       
                  </div>
              </div>
            }
           
      }
        </div>

    </div>

</body>
</html>

Detail部分:

@model ePR.Models.MobilepRDetailModel
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <title>MobileDetail</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link href="@Url.Content("~/Scripts/jquery.mobile-1.0.1/jquery.mobile-1.0.1.min.css")" rel="stylesheet" type="text/css" />
    
     <script src="@Url.Content("~/Scripts/jquery-1.6.4.min.js")" type="text/javascript"></script>
     <script src="@Url.Content("~/Scripts/jquery.mobile-1.0.1/jquery.mobile-1.0.1.min.js")" type="text/javascript"></script>
     
     <script src="@Url.Content("~/Scripts/Approve/MobileApprove.js")" type="text/javascript"></script>
</head>
<body>
<div id="DetailPage" data-role="page">
                <!-- Header -->
                <div data-role="header" data-theme="a">
                 <a href="@Url.Action("ApproveList", "Approve", new { home = "home" })" data-ajax="false" data-icon="home" data-theme="a" class="ui-btn-left">Home</a>
                    <h1>ePR System</h1>
                    <div data-role="navbar">
                        <ul>
                            <li>
                                <a href="@Url.Action("Approve", "Approve", new { home = "Overview" })" id="hrfOverview_Top" data-ajax="false">Overview</a>
                            </li>
                      <li>
                                <a href="@Url.Action("Approve", "Approve", new { home = "Detail" })" id="hrfOverview_Top" class="ui-btn-active" data-ajax="false">Detail</a>
                            </li>
                            <li>
                                <a href="@Url.Action("Approve", "Approve", new { home = "Approval" })" id="hrfOverview_Top" data-ajax="false">Approval</a>
                            </li>

                        </ul>
                    </div>
                </div>

                <!--Content-->
                <div data-role="content">
                    <ul data-role="listview">
                        <li data-role="list-divider">
                            <div class="ui-grid-a">
                                <div class="ui-block-a">@Model.selectPRNo</div>
                                <div class="ui-block-b"><div class="shiftLeft">(Login User: @Model.login_user.EnName)</div></div>
                            </div>
                        </li>
                        <li>
                            <div class="ui-grid-a">
                            <div class="ui-block-a"><strong>Requester:</strong></div>
                            <div class="ui-block-b"><span class="listContent">@Model.PRInfo.RequesterName</span></div>
                            </div>
                        </li>
                        <li>
                            <div class="ui-grid-a">
                            <div class="ui-block-a"><strong>Deliver To:</strong></div>
                            <div class="ui-block-b"><span class="listContent">@Model.PRInfo.DeliverToName</span></div>
                            </div>
                        </li>
                        <li>
                            <div class="ui-grid-a">
                            <div class="ui-block-a"><strong>Application Date:</strong></div>
                            <div class="ui-block-b"><span class="listContent">@Model.PRInfo.Add_Date</span></div>
                            </div>
                        </li>
                        <li>
                            <div class="ui-grid-a">
                            <div class="ui-block-a"><strong>Payment Company:</strong></div>
                            <div class="ui-block-b"><span class="listContent">@Model.PRInfo.PaymentComp</span></div>
                            </div>
                        </li>
                        <li>
                            <div class="ui-grid-a">
                            <div class="ui-block-a"><strong>Payment Department:</strong></div>
                            <div class="ui-block-b"><span class="listContent">@Model.PRInfo.PaymentDept</span></div>
                            </div>
                        </li>
                        <li>
                        <div class="ui-grid-a">
                            <div class="ui-block-a"><strong>Procurement Type:</strong></div>
                            <div class="ui-block-b"><span class="listContent">@Model.PRInfo.PRType</span></div>
                            </div>
                        </li>
                        <li>
                        <div class="ui-grid-a">
                            <div class="ui-block-a"><strong>Budget ID:</strong></div>
                            <div class="ui-block-b"><span class="listContent">@Model.PRInfo.Budget_ID</span></div>
                            </div>
                        </li>
                        <li>
                        <div class="ui-grid-a">
                            <div class="ui-block-a"><strong>Budget Description:</strong></div>
                            <div class="ui-block-b"><span class="listContent">@Model.PRInfo.Budget_Desc</span></div>
                            </div>
                        </li>
                        <li>
                        <div class="ui-grid-a">
                            <div class="ui-block-a"><strong>Project No:</strong></div>
                            <div class="ui-block-b"><span class="listContent">@Model.PRInfo.Project_NO</span></div>
                            </div>
                        </li>
                        <li>
                            <div class="ui-grid-a">
                            <div class="ui-block-a"><strong>Attachment list:</strong></div>
                            <div class="ui-block-b"><span class="listContent">
                                    @foreach (BusinessObjectLayer.Entities.UpfileEntity link in Model.Attachment)
                                    {
                                        <lable>@link.FileName</lable>
                                    }</span></div>
                            </div>
                        </li>
                        <li>
                            <div class="textareaDesc">
                                <strong>Remark:</strong><br /><br />
                                <p>@Model.PRInfo.Remark_By_User</p>
                            </div>
                        </li>
                    </ul> 
                </div>

                <!-- Footer -->
                <div data-role="footer">
                    <div data-role="navbar">
                        <ul>
                            <li>
                                <a href="@Url.Action("Approve", "Approve", new { home = "Overview" })" data-ajax="false">Overview</a>
                            </li>
                      <li>
                                <a href="@Url.Action("Approve", "Approve", new { home = "Detail" })"  class="ui-btn-active" data-ajax="false">Detail</a>
                            </li>
                            <li>
                                <a href="@Url.Action("Approve", "Approve", new { home = "Approval" })" data-ajax="false">Approval</a>
                            </li>
                   
                        </ul>
                    </div>
                </div>
       
                <h6 style="color:Purple">*** Due to the security concerns, the attachment cannot be opened/downloaded in mobile device at this stage ***</h6>
            </div>
</body>
</html>

后台:

 [HttpGet]
        public ActionResult Approve(string prno,string home)
        {

            if (Session["prno"] != null && prno == null) {
                prno = Session["prno"].ToString();
            }
            ViewBag.outputMessage = "";
            string pr_No = prno;
            LoginModel loginModel = new LoginModel();
            loginModel.UserName = Request.ServerVariables.Get("LOGON_USER").ToLower();
            CultureInfo usCulture = Thread.CurrentThread.CurrentUICulture;
            ViewBag.lang = usCulture.Name == "zh-TW" ? "zh-hk" : "en-US";

            bool IsMobileDevice = false;
            IsMobileDevice = Request.Browser.IsMobileDevice;
            //IsMobileDevice = true;//yan
            if (IsMobileDevice)
            {
                ViewBag.lang = "en-US";
            }
            if (!string.IsNullOrEmpty(loginModel.UserName.Trim())&&!string.IsNullOrEmpty(prno))
            {
                Session["prno"] = prno;
                //badge = "80006812";
                //badge = "80027397";
                string user_acc = loginModel.UserName.Split(‘\\‘)[1].ToString().Trim();
                LoginInfo = LoginInfoService.getLoginInfo(user_acc);
                if ((bool)LoginInfo[0])
                {
                    EmployeeEntity e = (EmployeeEntity)LoginInfo[1];
                    badge = e.badge;
                    if (!UserLoginTypeService.IsUnderMainten())
                    {
                        //if (!Request.Browser.IsMobileDevice)
                        //{
                            if (IApprovePRInfoService.CheckPRNO(prno))
                            {
                                object[][] isApproverOrIsProxy = UserLoginTypeService.IsApproverOrIsProxy(badge);
                                if ((bool)isApproverOrIsProxy[0][0] || IApprovePRInfoService.IsApproval(badge, prno))
                                {
                                    if (!(bool)isApproverOrIsProxy[1][0])
                                    {
                                        object[] authPRApprovePage=IApprovePRInfoService.AuthApprove(prno, badge);
                                        if (authPRApprovePage.Length != 0)
                                        {
                                            if ((bool)authPRApprovePage[0])
                                            {
                                                object[] PRdetail = IApprovePRInfoService.PRDetail(prno);
                                               
                                                DataSet ds = (DataSet)PRdetail[1];
                                                if (ds.Tables.Count!=0)//Convert.ToString(PRdetail[0]) == ""
                                                {
                                                    string selectPRNo = prno;

                                                    InfoEntity PRInfo = IApprovePRInfoService.GetPRHeader(ds, ViewBag.lang, prno);
                                                    pRDetailmodel = pRDetailManager.getPRDetailModel(
                                                        prno,
                                                        e,
                                                        PRInfo,
                                                        IApprovePRInfoService.GetPRItem(ds),
                                                        IApprovePRInfoService.getAttachList(prno, ""),
                                                        IApprovePRInfoService.getAppProgress(prno, ViewBag.lang),
                                                        IApprovePRInfoService.getProxy(prno, badge),
                                                        Manager.outputMessageService.outputProjectDetail((IApprovePRInfoService.ProjectDetail(PRInfo.Project_NO, badge))),
                                                        Manager.outputMessageService.outputViewBudget(IApprovePRInfoService.ViewBudget(PRInfo.Budget_ID, badge))
                                                        );
                                                    ViewBag.EstimateFlage = pRDetailmodel.PRInfo.EstimateFlage;
                                                    ViewBag.ShowProdSanSale = ApprovePRInfoService.ShowProdSanSale(PRInfo.Comp_Code);
                                                    //ViewBag.ShowProdSanSale = "OnlyENQ";
                                                    ViewBag.AllowSelectAll = pRDetailmodel.login_user.@class == "T" ? true : false;//S\M\T

                                                    Session["PRDetail"] = pRDetailmodel;//TEST
                                                }
                                                else
                                                    //ViewBag.outputMessage = PRdetail[0];
                                                    ViewBag.outputMessage = (string)PRdetail[0] == "" ? (ViewBag.lang == "en-US" ? "This PRNO does not exist" : "此請購單号不存在") : (string)PRdetail[0];

                                                    if (!IsMobileDevice)
                                                    {

                                                        return View(pRDetailmodel);//T
                                                    }
                                                    else
                                                    {
                                                        mobilepRDetail = MobilepRDetailModel.getMobilepRDetail(mobilepRDetail, pRDetailmodel);

                                                        if (home == "Detail")
                                                        {
                                                            return View("MobileDetail", mobilepRDetail);
                                                        }
                                                        if (home == "Approval")
                                                        {
                                                            return View("MobileApprove", mobilepRDetail);
                                                        }
                                                        if (home == "page")
                                                        {
                                                            return View("MobilePage", mobilepRDetail);
                                                        }
                                                        else
                                                        {

                                                            return View("MobileOverView", mobilepRDetail);
                                                        }
                                                    }
                                             
                                            }
                                            else
                                            {
                                                pRDetailmodel = new Models.pRDetailModel(SubmitApprovePRService.returnePRServiceMsg((string)authPRApprovePage[1], ViewBag.lang));
                                                pRDetailmodel.login_user = e;
                                                ViewBag.outputMessage = pRDetailmodel.outputMessage;
                                                if (!IsMobileDevice)
                                                {
                                                    return View(pRDetailmodel);//T
                                                }
                                                else
                                                {
                                                    mobilepRDetail = MobilepRDetailModel.getMobilepRDetail(mobilepRDetail, pRDetailmodel);
                                                    if (home == "Detail")
                                                    {
                                                        return View("MobileDetail", mobilepRDetail);
                                                    }
                                                    if (home == "Approval")
                                                    {
                                                        return View("MobileApprove", mobilepRDetail);
                                                    }
                                                    if(home=="page")
                                                    {
                                                        return View("MobilePage", mobilepRDetail);
                                                    }
                                                    else
                                                    {
                                                        return View("MobileOverView", mobilepRDetail);
                                                      
                                                    }
                                                }
                                            }
                                        }
                                        else {
                                            outputMessageService = new outputAuthApprovePRMessage();
                                            pRDetailmodel = new Models.pRDetailModel(outputMessageService.outputMessage());
                                            pRDetailmodel.login_user = e;
                                            ViewBag.outputMessage = pRDetailmodel.outputMessage;

                                            if (!IsMobileDevice)
                                            {
                                                return View(pRDetailmodel);//T
                                            }
                                            else
                                            {
                                                mobilepRDetail = MobilepRDetailModel.getMobilepRDetail(mobilepRDetail, pRDetailmodel);
                                                return View("MobileErrorPage", mobilepRDetail);
                                            }
                                        }
                                       

                                    }
                                    else
                                    {
                                        outputMessageService = new outputIsProxyMessage();
                                        pRDetailmodel = new Models.pRDetailModel(outputMessageService.outputMessage());
                                        ViewBag.Title = pRDetailmodel.outputMessage;
                                        if (!IsMobileDevice)
                                            return View("~/Views/GeneralUser/RightFailed.cshtml");
                                        return View("~/Views/Approve/MobileErrorPage.cshtml");
                                    }
                                }
                                else
                                {
                                    outputMessageService = new outputIsApproverMessage();
                                    pRDetailmodel = new Models.pRDetailModel(outputMessageService.outputMessage());
                                    ViewBag.Title = pRDetailmodel.outputMessage;
                                    if (!IsMobileDevice)
                                        return View("~/Views/GeneralUser/RightFailed.cshtml");
                                    return View("~/Views/Approve/MobileErrorPage.cshtml");
                                }
                            }
                            else {
                                outputMessageService = new outputCheckPRNoMessage();
                                pRDetailmodel = new Models.pRDetailModel(outputMessageService.outputMessage());
                                ViewBag.Title = pRDetailmodel.outputMessage;
                                if (!IsMobileDevice)
                                    return View("~/Views/GeneralUser/RightFailed.cshtml");
                                return View("~/Views/Approve/MobileErrorPage.cshtml");
                            }
                        //}
                        //else
                        //{
                        //    outputMessageService = new outputIsMobileDeviceMessage();
                        //    pRDetailmodel = new Models.pRDetailModel(outputMessageService.outputMessage());
                        //    ViewBag.Title = pRDetailmodel.outputMessage;
                        //    return View("~/Views/GeneralUser/RightFailed.cshtml");
                        //}
                    }
                    else
                    {
                        outputMessageService = new outputUnderMaintenMessage();
                        pRDetailmodel = new Models.pRDetailModel(outputMessageService.outputMessage());
                        ViewBag.Title = pRDetailmodel.outputMessage;
                        if (!IsMobileDevice)
                            return View("~/Views/GeneralUser/RightFailed.cshtml");
                        return View("~/Views/Approve/MobileErrorPage.cshtml");
                    }
                }
                else
                {
                    ViewBag.Title = "Approval authority failed";
                    if (!IsMobileDevice)
                        return View("~/Views/GeneralUser/RightFailed.cshtml");
                    return View("~/Views/Approve/MobileErrorPage.cshtml");

                }
            }
            else
            {
                ViewBag.Title = "_Layout";
                if (!IsMobileDevice)
                    return View("~/Views/Default/Default.cshtml");
                return View("~/Views/Approve/MobileDefault.cshtml");
                //return View("~/Views/Shared/_Layout.cshtml");
            }
        }

 

基于Jquerymobile实现的支持PC、平板、手机移动设备的web应用程序(C#)

上一篇:/vendor/lib64/libOpenCL.so在安卓应用中无访问权限的解决办法


下一篇:集合之ArrayList