コード例 #1
0
 private void UpdateThroughUserInput()
 {
     using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(Helper.CnnVal("AssetDB")))
     {
         var equipment = new Equipment {
             equipmentId      = ID, equipmentName = Name, equipmentSystem = BarCode, equipmentType = Type,
             building         = Building, floor = Level, room = Room, zone = Zone,
             docLink          = DocLink, docPhoto = DocPhotoLink,
             classification   = Classification, materialType = MaterialType, consequencePriority = ConsequencePriority, opeationStatus = OpeationStatus,
             manufacturer     = Manufacturer, year = MM.ToShortDateString(), degradationInfo = DegradationInfo, detail = Detail,
             inspectionStatus = Status, alarmType = AlarmType, collectedBy = CollectedBy, collectedOn = CollectedOn.ToShortDateString(),
             notes            = Notes, inspectionPhotoLink = InspectionPhotoLink, attachmentLink = AttachmentLink
         };
         Equipmentlist.Add(equipment);
         connection.Execute(
             "dbo.EquipmentList_Insert " +
             "@equipmentId, @equipmentName, @equipmentSystem, @equipmentType," +
             "@building,@floor,@room,@zone," +
             "@docLink,@docPhoto," +
             "@classification,@materialType," +
             "@consequencePriority,@opeationStatus," +
             "@manufacturer,@year,@degradationInfo,@detail," +
             "@inspectionStatus,@alarmType,@collectedBy," +
             "@collectedOn,@notes,@inspectionPhotoLink,@attachmentLink"
             , Equipmentlist);
     }
     MessageBox.Show("The data has been uploaded to the SQL Server!");
     Equipmentlist.Clear();
 }