示例#1
0
 public static IEnumerable GetAllMaintenance()
 {
     var db = new HardwareMaintenanceEntities();
     using (db)
     {
         MaintenanceModel p = new MaintenanceModel();
         IList<Maintenance> maintenance = p.maintenanceService.GetAll();
         return maintenance;
     }
 }
示例#2
0
        internal static String SaveData(FormCollection isi)
        {
            // Maintenance maintenance = new Maintenance();
            MaintenanceModel p = new MaintenanceModel();
            int itemId = Int32.Parse(isi["TxtItemId"]);
            int custId = Int32.Parse(isi["TxtCustomerId"]);
            int userId = Int32.Parse(isi["TxtUserId"]);
            int Case   = Int32.Parse(isi["TxtCase"]);;
            DateTime reqDate = Convert.ToDateTime(isi["TxtRequestDate"]);
            String Complaint = isi["TxtComplaint"];

            Maintenance MaintenanceNew = p.maintenanceService.CreateObject(itemId, custId, userId, reqDate,
                                                                            Complaint, Case, p.itemService,
                                                                            p.itemTypeService, p.userService,
                                                                            p.customerService);

            /*
            maintenance.ItemId = Int32.Parse(isi["TxtItemId"]);
            maintenance.UserId = Int32.Parse(isi["TxtUserId"]);

            maintenance.CustomerId = Int32.Parse(isi["TxtCustomerId"]);
            maintenance.RequestDate = Convert.ToDateTime(isi["TxtRequestDate"]);
            maintenance.Complaint = isi["TxtComplaint"];
            maintenance.Case = Int32.Parse(isi["TxtCase"]);
            maintenance.IsDiagnosed = false;
            maintenance.IsFinished = false;

            ItemType itemType = new ItemType();
            itemType = ItemTypes.GetItemType(Int32.Parse(isi["TxtItemId"]));
            maintenance.ItemTypeId = itemType.Id;

            */

            // Maintenance MaintenanceNew = p.maintenanceService.CreateObject(maintenance, p.itemService, p.itemTypeService, p.userService, p.customerService);
            String err = (MaintenanceNew.Errors.Any()) ? p.maintenanceService.GetValidator().PrintError(MaintenanceNew) : "";
            return err;
        }