просмотр таблицы в MVC - PullRequest
0 голосов
/ 15 марта 2020

Я новичок в мире MVC, и у меня проблема с поиском таблицы в mvc; помните, что моя компания использует службы WCF для связи с базой данных Oracle. У меня есть следующая модель:

public class Pharmacy
    {
       [Required]
        public int ID { get; set; }
        [Display(Name = "أسم الصيدلية ")]
        public string PHARMACY_NAME { get; set; }

        [Required(ErrorMessage = "مطلوب أدخال رقم الموظف المكون من أربع خانات")]
        [MaxLength(4), MinLength(4)]  
        [Display(Name = "رقم الموظف")]
        public string EMPLOYEE_NUMBER { get; set; }


        [Required(ErrorMessage = "Required.")]
        [Display(Name = " التاريخ")]
        public string ENTRY_DATE { get; set; }


        [Required(ErrorMessage = "Required.")]
        [Display(Name = "الوقت")]
        public string ENTRY_TIME { get; set; }


        [Required(ErrorMessage = "أختار المستفيد")]
        [Display(Name = "المستفيدون")]
        public int BENEFICIARIES { get; set; }



        [Display(Name = "ملاحظات")]
        public string Note { get; set; }


        [Required(ErrorMessage = "أدخل أسم الباركود")]
        [Display(Name = "الباركود")]
        public string itemCode { get; set; }


        [Required(ErrorMessage = "أدخل أسم العينة")]
        [Display(Name = "أسم العينة")]
        public string itemName { get; set; }


        [Required(ErrorMessage = "أدخل الكمية")]
        [Display(Name = "الكمية")]
        public int QTY { get; set; }


        [Required(ErrorMessage = "أدخل السعر")]
        [Display(Name = "السعر")]
        public double Price { get; set; }


        public DataTable dtItemsDetails { get; set; }
        public int PageCount { get; set; }
        public int PageNumber { get; set; }
        public List<Pharmacy> Pharmacies { get; set; }
    }

также у меня есть следующий контроллер:

[HttpGet]

        public ActionResult pharmacyDetials(Pharmacy model)
        {
            var masterID = Convert.ToInt32(Session["login"]);
            if (masterID == 0)
            {
                return RedirectToAction("Login");
            }
            else
            {

                IDECOServiceReference.IdecoAPIServiceClient idecoAPI = new IDECOServiceReference.IdecoAPIServiceClient();


                DataTable dtPharmacy = idecoAPI.GETPHARMACYEMPLOYEEMASTER("", 1);
                Models.Pharmacy objPharamcyMode = new Pharmacy();

                model.dtItemsDetails = dtPharmacy;

                return View("pharmacyDetials", model);
            }   
}

И следующий вид:

@model IDECOHealthInsurance.Models.Pharmacy
@using PagedList.Mvc;
@using PagedList;
@using (Ajax.BeginForm("pharmacyDetials", "Pharmacy", new AjaxOptions { HttpMethod = "Post", UpdateTargetId = "", InsertionMode = System.Web.Mvc.Ajax.InsertionMode.Replace, LoadingElementId = "Loading", OnBegin = "" }))
{
    <h4 style="direction:rtl; text-align:center">تفاصيل الصيدلية</h4>


    <div>
        <ul class="form-inline">
            <li>
                <input class="form-control mr-sm-2" type="search" placeholder="بحث عن طريق رقم الموظف" aria-label="Search">

            </li>
            <li>
                <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
            </li>
        </ul>

    </div>

    <div id="dvPatientNotice" class="MainGridContainer pb-5">


        @if (Model.dtItemsDetails != null)
        {

        <table dir="rtl" id="phdet" class="table" style="border:thin; text-align:right">
            <thead class="thead-dark">
                <tr style="text-size-adjust:auto;">

                    <th>
                        رقم الموظف
                    </th>
                    <th>
                        التاريخ
                    </th>
                    <th>
                        الوقت
                    </th>
                    <th>
                        المستفيدون
                    </th>
                    <th>
                        ملاحظات
                    </th>
                    <th>
                        الباركورد
                    </th>
                    <th>
                        أسم العينة
                    </th>
                    <th>
                        الكمية
                    </th>
                    <th>
                        السعر
                    </th>

                </tr>
            </thead>
            <tbody>

                @foreach (System.Data.DataRow row in Model.dtItemsDetails.Rows)
                {
                    <tr style="width:100%">

                        <td>
                            @row["EMPLOYEE_NUMBER"]
                        </td>
                        <td>
                            @row["ENTRY_DATE"]
                        </td>
                        <td>
                            @row["ENTRY_TIME"]
                        </td>
                        <td>
                            @row["BENEFICIARIES"]
                        </td>
                        <td>
                            @row["NOTE"]
                        </td>

                        <td>
                            @row["ITEM_CODE"]
                        </td>
                        <td>
                            @row["ITEM_NAME"]
                        </td>
                        <td>
                            @row["QTY"]
                        </td>
                        <td>
                            @row["PRICE"]
                        </td>
                    </tr>
                }




            </tbody>



        </table>

        }



    </div>


}

Может кто-нибудь предоставить мне объяснение того, как выполняется подкачка в mvc, службах wcf? весь пример, который я нашел в inte rnet, основан на платформе сущностей, которая бесполезна в случае использования.

...